2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
10 include $(INCLUDE_DIR)/rootfs.mk
12 -include $(TMP_DIR)/.packagedeps
13 $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
14 $(curdir)/builddirs-install:=.
15 $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
16 $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
17 ifneq ($(IGNORE_ERRORS),)
18 package-y-filter := $(package-y)
19 package-m-filter := $(filter-out $(package-y),$(package-m))
20 package-n-filter := $(filter-out $(package-y) $(package-m),$(package-))
21 package-ignore-errors := $(filter n m y,$(IGNORE_ERRORS))
22 package-ignore-errors := $(if $(package-ignore-errors),$(package-ignore-errors),n m)
23 package-ignore-subdirs := $(sort $(foreach m,$(package-ignore-errors),$(package-$(m)-filter)))
24 $(curdir)/builddirs-ignore-download := $(package-ignore-subdirs)
25 $(curdir)/builddirs-ignore-compile := $(package-ignore-subdirs)
26 $(curdir)/builddirs-ignore-host-download := $(package-ignore-subdirs)
27 $(curdir)/builddirs-ignore-host-compile := $(package-ignore-subdirs)
30 PACKAGE_INSTALL_FILES:= \
31 $(foreach pkg,$(sort $(package-y)), \
33 $(if $(strip $(package/$(pkg)/variants)), \
34 $(package/$(pkg)/variants), \
35 $(if $(package/$(pkg)/default-variant), \
36 $(package/$(pkg)/default-variant), \
40 $(PKG_INFO_DIR)/$(lastword $(subst /,$(space),$(pkg))).$(variant).install \
44 $(curdir)/cleanup: $(TMP_DIR)/.build
45 rm -rf $(STAGING_DIR_ROOT)
47 $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install
48 - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
50 [ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
51 @echo $(wildcard $(foreach dir,$(PACKAGE_SUBDIRS),$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(dir)/$(pkg)_*.ipk))) | $(OPKG) install
52 @for file in $(PACKAGE_INSTALL_FILES); do \
53 [ -s $$file.flags ] || continue; \
54 for flag in `cat $$file.flags`; do \
55 $(OPKG) flag $$flag < $$file; \
58 @-$(MAKE) package/preconfig
63 ifndef CONFIG_OPKGSMIME_PASSPHRASE
64 ifneq ($(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)),)
66 PASSARG="file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE))"
70 $(curdir)/index: FORCE
71 @echo Generating package index...
72 @for d in $(PACKAGE_SUBDIRS); do ( \
75 $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
76 gzip -9nc Packages > Packages.gz; \
78 ifdef CONFIG_SIGNED_PACKAGES
79 @echo Signing package index...
80 @for d in $(PACKAGE_SUBDIRS); do ( \
83 $(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
86 ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_KEY)),)
87 @echo Signing key has not been configured
89 ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_CERT)),)
90 @echo Certificate has not been configured
92 @echo Signing package index...
93 @for d in $(PACKAGE_SUBDIRS); do ( \
96 openssl smime -binary -in Packages.gz \
97 -out Packages.sig -outform PEM -sign \
98 -signer $(CONFIG_OPKGSMIME_CERT) \
99 -inkey $(CONFIG_OPKGSMIME_KEY) \
100 $(PASSOPT) $(PASSARG); \
108 $(curdir)/flags-install:= -j1
110 $(eval $(call stampfile,$(curdir),package,prereq,.config))
111 $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
112 $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
113 $(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
115 $(eval $(call subdir,$(curdir)))