mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 18:19:02 +00:00
build: rework the package/install step - collect package install lists during package/compile, then install all packages at once
SVN-Revision: 33631
This commit is contained in:
parent
5c91b34ed7
commit
44cd20b802
8
Makefile
8
Makefile
@ -40,11 +40,9 @@ else
|
|||||||
|
|
||||||
$(toolchain/stamp-install): $(tools/stamp-install)
|
$(toolchain/stamp-install): $(tools/stamp-install)
|
||||||
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
|
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
|
||||||
$(package/stamp-cleanup): $(target/stamp-compile)
|
$(package/stamp-compile): $(target/stamp-compile)
|
||||||
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
|
|
||||||
$(package/stamp-install): $(package/stamp-compile)
|
$(package/stamp-install): $(package/stamp-compile)
|
||||||
$(package/stamp-rootfs-prepare): $(package/stamp-install)
|
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
|
||||||
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare)
|
|
||||||
|
|
||||||
printdb:
|
printdb:
|
||||||
@true
|
@true
|
||||||
@ -86,7 +84,7 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
|
prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
|
||||||
world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
|
world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
|
||||||
$(_SINGLE)$(SUBMAKE) -r package/index
|
$(_SINGLE)$(SUBMAKE) -r package/index
|
||||||
|
|
||||||
# update all feeds, re-create index files, install symlinks
|
# update all feeds, re-create index files, install symlinks
|
||||||
|
@ -5,22 +5,6 @@
|
|||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
|
|
||||||
# where to build (and put) .ipk packages
|
|
||||||
OPKG:= \
|
|
||||||
IPKG_TMP=$(TMP_DIR)/ipkg \
|
|
||||||
IPKG_INSTROOT=$(TARGET_DIR) \
|
|
||||||
IPKG_CONF_DIR=$(STAGING_DIR)/etc \
|
|
||||||
IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
|
|
||||||
$(STAGING_DIR_HOST)/bin/opkg \
|
|
||||||
--offline-root $(TARGET_DIR) \
|
|
||||||
--force-depends \
|
|
||||||
--force-overwrite \
|
|
||||||
--force-postinstall \
|
|
||||||
--force-maintainer \
|
|
||||||
--add-dest root:/ \
|
|
||||||
--add-arch all:100 \
|
|
||||||
--add-arch $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD)):200
|
|
||||||
|
|
||||||
# invoke ipkg-build with some default options
|
# invoke ipkg-build with some default options
|
||||||
IPKG_BUILD:= \
|
IPKG_BUILD:= \
|
||||||
ipkg-build -c -o 0 -g 0
|
ipkg-build -c -o 0 -g 0
|
||||||
@ -89,7 +73,6 @@ ifeq ($(DUMP),)
|
|||||||
define BuildTarget/ipkg
|
define BuildTarget/ipkg
|
||||||
IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
|
IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
|
||||||
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
||||||
INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
|
|
||||||
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
||||||
|
|
||||||
ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT))
|
ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT))
|
||||||
@ -99,7 +82,15 @@ ifeq ($(DUMP),)
|
|||||||
compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
|
compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
|
||||||
|
|
||||||
ifeq ($(CONFIG_PACKAGE_$(1)),y)
|
ifeq ($(CONFIG_PACKAGE_$(1)),y)
|
||||||
install: $$(INFO_$(1))
|
.PHONY: $(PKG_INFO_DIR)/$(PKG_DIR_NAME).install.$(1)
|
||||||
|
compile: $(PKG_INFO_DIR)/$(PKG_DIR_NAME).install.$(1)
|
||||||
|
$(PKG_INFO_DIR)/$(PKG_DIR_NAME).install.$(1):
|
||||||
|
@if [ -f $(PKG_INFO_DIR)/$(PKG_DIR_NAME).install.clean ]; then \
|
||||||
|
rm -f \
|
||||||
|
$(PKG_INFO_DIR)/$(PKG_DIR_NAME).install \
|
||||||
|
$(PKG_INFO_DIR)/$(PKG_DIR_NAME).install.clean; \
|
||||||
|
fi; \
|
||||||
|
echo "$(1)" >> $(PKG_INFO_DIR)/$(PKG_DIR_NAME).install
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
compile: $(1)-disabled
|
compile: $(1)-disabled
|
||||||
@ -188,11 +179,6 @@ ifeq ($(DUMP),)
|
|||||||
$(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
|
$(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
|
||||||
@[ -f $$(IPKG_$(1)) ]
|
@[ -f $$(IPKG_$(1)) ]
|
||||||
|
|
||||||
$$(INFO_$(1)): $$(IPKG_$(1))
|
|
||||||
@[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
|
|
||||||
$(OPKG) install $$(IPKG_$(1))
|
|
||||||
$(if $(filter-out essential,$(PKG_FLAGS)),for flag in $(filter-out essential,$(PKG_FLAGS)); do $(OPKG) flag $$$$flag $(1); done,$(OPKG) flag ok $(1))
|
|
||||||
|
|
||||||
$(1)-clean:
|
$(1)-clean:
|
||||||
rm -f $(PACKAGE_DIR)/$(1)_*
|
rm -f $(PACKAGE_DIR)/$(1)_*
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
|||||||
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
||||||
PKG_MD5SUM ?= unknown
|
PKG_MD5SUM ?= unknown
|
||||||
PKG_BUILD_PARALLEL ?=
|
PKG_BUILD_PARALLEL ?=
|
||||||
PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
|
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
|
||||||
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
|
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
|
||||||
@ -52,6 +51,8 @@ ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
|
|||||||
QUILT:=1
|
QUILT:=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
PKG_DIR_NAME:=$(lastword $(subst /,$(space),$(CURDIR)))
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/download.mk
|
include $(INCLUDE_DIR)/download.mk
|
||||||
include $(INCLUDE_DIR)/quilt.mk
|
include $(INCLUDE_DIR)/quilt.mk
|
||||||
include $(INCLUDE_DIR)/package-defaults.mk
|
include $(INCLUDE_DIR)/package-defaults.mk
|
||||||
@ -250,6 +251,11 @@ Build/DistCheck=$(call Build/DistCheck/Default,)
|
|||||||
|
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
|
|
||||||
|
.PHONY: prepare-package-install
|
||||||
|
prepare-package-install:
|
||||||
|
@touch $(PKG_INFO_DIR)/$(PKG_DIR_NAME).install.clean
|
||||||
|
@echo "$(filter-out essential,$(PKG_FLAGS))" > $(PKG_INFO_DIR)/$(PKG_DIR_NAME).install.flags
|
||||||
|
|
||||||
$(PACKAGE_DIR):
|
$(PACKAGE_DIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
@ -257,8 +263,8 @@ dumpinfo:
|
|||||||
download:
|
download:
|
||||||
prepare:
|
prepare:
|
||||||
configure:
|
configure:
|
||||||
compile:
|
compile: prepare-package-install
|
||||||
install:
|
install: compile
|
||||||
clean-staging: FORCE
|
clean-staging: FORCE
|
||||||
rm -f $(STAMP_INSTALLED)
|
rm -f $(STAMP_INSTALLED)
|
||||||
@-(\
|
@-(\
|
||||||
|
@ -9,23 +9,16 @@ curdir:=package
|
|||||||
|
|
||||||
-include $(TMP_DIR)/.packagedeps
|
-include $(TMP_DIR)/.packagedeps
|
||||||
$(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
|
$(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
|
||||||
|
$(curdir)/builddirs-install:=.
|
||||||
ifeq ($(SDK),1)
|
ifeq ($(SDK),1)
|
||||||
$(curdir)/builddirs-install:=.
|
|
||||||
else
|
else
|
||||||
$(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
|
$(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
|
||||||
$(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
|
$(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
|
||||||
$(curdir)/builddirs-install:=. $(filter-out base-files,$(sort $(package-y))) $(filter base-files,$(package-y))
|
|
||||||
endif
|
endif
|
||||||
ifneq ($(IGNORE_ERRORS),)
|
ifneq ($(IGNORE_ERRORS),)
|
||||||
$(curdir)/builddirs-ignore-compile:= $(if $(filter n m y, $(IGNORE_ERRORS)),$(foreach m,$(IGNORE_ERRORS),$(package-$(subst n,,$(m)))),$(package-m) $(package-))
|
$(curdir)/builddirs-ignore-compile:= $(if $(filter n m y, $(IGNORE_ERRORS)),$(foreach m,$(IGNORE_ERRORS),$(package-$(subst n,,$(m)))),$(package-m) $(package-))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(curdir)/install:=$(curdir)/install-cleanup
|
|
||||||
|
|
||||||
$(curdir)/cleanup: $(TMP_DIR)/.build
|
|
||||||
- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
|
|
||||||
rm -rf $(TARGET_DIR) $(STAGING_DIR_ROOT)
|
|
||||||
|
|
||||||
ifdef CONFIG_USE_MKLIBS
|
ifdef CONFIG_USE_MKLIBS
|
||||||
define mklibs
|
define mklibs
|
||||||
rm -rf $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-out
|
rm -rf $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-out
|
||||||
@ -61,7 +54,36 @@ ifdef CONFIG_USE_MKLIBS
|
|||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(curdir)/rootfs-prepare: $(TMP_DIR)/.build
|
# where to build (and put) .ipk packages
|
||||||
|
OPKG:= \
|
||||||
|
IPKG_TMP=$(TMP_DIR)/ipkg \
|
||||||
|
IPKG_INSTROOT=$(TARGET_DIR) \
|
||||||
|
IPKG_CONF_DIR=$(STAGING_DIR)/etc \
|
||||||
|
IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
|
||||||
|
$(STAGING_DIR_HOST)/bin/opkg \
|
||||||
|
--offline-root $(TARGET_DIR) \
|
||||||
|
--force-depends \
|
||||||
|
--force-overwrite \
|
||||||
|
--force-postinstall \
|
||||||
|
--force-maintainer \
|
||||||
|
--add-dest root:/ \
|
||||||
|
--add-arch all:100 \
|
||||||
|
--add-arch $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD)):200
|
||||||
|
|
||||||
|
PACKAGE_INSTALL:=$(sort $(foreach pkg,$(package-y),$(lastword $(subst /,$(space),$(pkg)))))
|
||||||
|
PACKAGE_INSTALL_FILES:=$(patsubst %,$(PKG_INFO_DIR)/%.install,$(PACKAGE_INSTALL))
|
||||||
|
|
||||||
|
$(curdir)/install: $(TMP_DIR)/.build
|
||||||
|
- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
|
||||||
|
rm -rf $(TARGET_DIR) $(STAGING_DIR_ROOT)
|
||||||
|
[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
|
||||||
|
$(OPKG) install `cat $(PACKAGE_INSTALL_FILES) | sed -e 's,^\(.*\)$$,$(PACKAGE_DIR)/\1_*.ipk,'`
|
||||||
|
@for pkg in $(PACKAGE_INSTALL); do \
|
||||||
|
[ -s $(PKG_INFO_DIR)/$${pkg}.install.flags ] || continue; \
|
||||||
|
for flag in `cat $(PKG_INFO_DIR)/$${pkg}.install.flags`; do \
|
||||||
|
$(OPKG) flag $$flag `cat $(PKG_INFO_DIR)/$${pkg}.install`; \
|
||||||
|
done; \
|
||||||
|
done || true
|
||||||
@-$(MAKE) package/preconfig
|
@-$(MAKE) package/preconfig
|
||||||
@if [ -d $(TOPDIR)/files ]; then \
|
@if [ -d $(TOPDIR)/files ]; then \
|
||||||
( cd $(TOPDIR)/files; find -type f ) | \
|
( cd $(TOPDIR)/files; find -type f ) | \
|
||||||
@ -94,12 +116,12 @@ $(curdir)/index: FORCE
|
|||||||
gzip -9c Packages > Packages.gz \
|
gzip -9c Packages > Packages.gz \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$(curdir)/preconfig:
|
||||||
|
|
||||||
$(curdir)/flags-install:= -j1
|
$(curdir)/flags-install:= -j1
|
||||||
|
|
||||||
$(eval $(call stampfile,$(curdir),package,prereq,.config))
|
$(eval $(call stampfile,$(curdir),package,prereq,.config))
|
||||||
$(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
|
|
||||||
$(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
|
$(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
|
||||||
$(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
|
$(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
|
||||||
$(eval $(call stampfile,$(curdir),package,rootfs-prepare,$(TMP_DIR)/.build))
|
|
||||||
|
|
||||||
$(eval $(call subdir,$(curdir)))
|
$(eval $(call subdir,$(curdir)))
|
||||||
|
1
rules.mk
1
rules.mk
@ -105,6 +105,7 @@ TARGET_ROOTFS_DIR?=$(if $(call qstrip,$(CONFIG_TARGET_ROOTFS_DIR)),$(call qstrip
|
|||||||
TARGET_DIR:=$(TARGET_ROOTFS_DIR)/root-$(BOARD)
|
TARGET_DIR:=$(TARGET_ROOTFS_DIR)/root-$(BOARD)
|
||||||
STAGING_DIR_ROOT:=$(STAGING_DIR)/root-$(BOARD)
|
STAGING_DIR_ROOT:=$(STAGING_DIR)/root-$(BOARD)
|
||||||
BUILD_LOG_DIR:=$(TOPDIR)/logs
|
BUILD_LOG_DIR:=$(TOPDIR)/logs
|
||||||
|
PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
|
||||||
|
|
||||||
TARGET_PATH:=$(STAGING_DIR_HOST)/bin:$(subst $(space),:,$(filter-out .,$(filter-out ./,$(subst :,$(space),$(PATH)))))
|
TARGET_PATH:=$(STAGING_DIR_HOST)/bin:$(subst $(space),:,$(filter-out .,$(filter-out ./,$(subst :,$(space),$(PATH)))))
|
||||||
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3)
|
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3)
|
||||||
|
Loading…
Reference in New Issue
Block a user