2008-07-29 11:36:11 +08:00
|
|
|
#
|
2010-03-06 04:28:52 +08:00
|
|
|
# Copyright (C) 2006-2010 OpenWrt.org
|
2006-07-21 17:15:06 +08:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
|
2007-07-31 02:22:01 +08:00
|
|
|
curdir:=package
|
|
|
|
|
2014-08-05 19:24:24 +08:00
|
|
|
include $(INCLUDE_DIR)/feeds.mk
|
|
|
|
|
2007-07-31 02:22:01 +08:00
|
|
|
-include $(TMP_DIR)/.packagedeps
|
|
|
|
$(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
|
2012-10-07 00:01:06 +08:00
|
|
|
$(curdir)/builddirs-install:=.
|
2014-03-13 20:12:58 +08:00
|
|
|
$(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
|
|
|
|
$(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
|
2008-05-08 00:45:00 +08:00
|
|
|
ifneq ($(IGNORE_ERRORS),)
|
2013-07-19 00:44:44 +08:00
|
|
|
package-y-filter := $(package-y)
|
|
|
|
package-m-filter := $(filter-out $(package-y),$(package-m))
|
|
|
|
package-n-filter := $(filter-out $(package-y) $(package-m),$(package-))
|
|
|
|
package-ignore-errors := $(filter n m y,$(IGNORE_ERRORS))
|
|
|
|
package-ignore-errors := $(if $(package-ignore-errors),$(package-ignore-errors),n m)
|
2014-05-14 23:49:22 +08:00
|
|
|
$(curdir)/builddirs-ignore-download := $(foreach m,$(package-ignore-errors),$(package-$(m)-filter))
|
2013-07-19 00:44:44 +08:00
|
|
|
$(curdir)/builddirs-ignore-compile := $(foreach m,$(package-ignore-errors),$(package-$(m)-filter))
|
2008-05-08 00:45:00 +08:00
|
|
|
endif
|
2007-07-31 02:22:01 +08:00
|
|
|
|
2009-08-08 10:25:03 +08:00
|
|
|
ifdef CONFIG_USE_MKLIBS
|
|
|
|
define mklibs
|
|
|
|
rm -rf $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-out
|
|
|
|
# first find all programs and add them to the mklibs list
|
2014-06-02 20:44:13 +08:00
|
|
|
find $(STAGING_DIR_ROOT) -type f -perm /100 -exec \
|
2009-08-08 10:25:03 +08:00
|
|
|
file -r -N -F '' {} + | \
|
|
|
|
awk ' /executable.*dynamically/ { print $$1 }' > $(TMP_DIR)/mklibs-progs
|
|
|
|
# find all loadable objects that are not regular libraries and add them to the list as well
|
|
|
|
find $(STAGING_DIR_ROOT) -type f -name \*.so\* -exec \
|
|
|
|
file -r -N -F '' {} + | \
|
2013-08-27 01:31:27 +08:00
|
|
|
awk ' /shared object/ { print $$1 }' > $(TMP_DIR)/mklibs-libs
|
2009-08-08 10:25:03 +08:00
|
|
|
mkdir -p $(TMP_DIR)/mklibs-out
|
2012-06-11 01:07:46 +08:00
|
|
|
$(STAGING_DIR_HOST)/bin/mklibs -D \
|
2009-08-08 10:25:03 +08:00
|
|
|
-d $(TMP_DIR)/mklibs-out \
|
|
|
|
--sysroot $(STAGING_DIR_ROOT) \
|
2013-08-27 01:31:27 +08:00
|
|
|
`cat $(TMP_DIR)/mklibs-libs | sed 's:/*[^/]\+/*$$::' | uniq | sed 's:^$(STAGING_DIR_ROOT):-L :'` \
|
2009-08-08 10:25:03 +08:00
|
|
|
--ldlib $(patsubst $(STAGING_DIR_ROOT)/%,/%,$(firstword $(wildcard \
|
2015-06-25 18:14:22 +08:00
|
|
|
$(foreach name,ld-uClibc.so.* ld-linux.so.* ld-*.so ld-musl-*.so.*, \
|
2009-08-08 10:25:03 +08:00
|
|
|
$(STAGING_DIR_ROOT)/lib/$(name) \
|
|
|
|
)))) \
|
|
|
|
--target $(REAL_GNU_TARGET_NAME) \
|
2013-08-27 01:31:27 +08:00
|
|
|
`cat $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-libs` 2>&1
|
2009-08-08 10:25:03 +08:00
|
|
|
$(RSTRIP) $(TMP_DIR)/mklibs-out
|
|
|
|
for lib in `ls $(TMP_DIR)/mklibs-out/*.so.* 2>/dev/null`; do \
|
|
|
|
LIB="$${lib##*/}"; \
|
|
|
|
DEST="`ls "$(TARGET_DIR)/lib/$$LIB" "$(TARGET_DIR)/usr/lib/$$LIB" 2>/dev/null`"; \
|
|
|
|
[ -n "$$DEST" ] || continue; \
|
|
|
|
echo "Copying stripped library $$lib to $$DEST"; \
|
|
|
|
cp "$$lib" "$$DEST" || exit 1; \
|
|
|
|
done
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2012-10-07 00:01:06 +08:00
|
|
|
# where to build (and put) .ipk packages
|
|
|
|
OPKG:= \
|
2014-09-16 19:56:19 +08:00
|
|
|
IPKG_NO_SCRIPT=1 \
|
2012-10-07 00:01:06 +08:00
|
|
|
IPKG_TMP=$(TMP_DIR)/ipkg \
|
|
|
|
IPKG_INSTROOT=$(TARGET_DIR) \
|
|
|
|
IPKG_CONF_DIR=$(STAGING_DIR)/etc \
|
|
|
|
IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
|
2012-11-08 00:15:22 +08:00
|
|
|
$(XARGS) $(STAGING_DIR_HOST)/bin/opkg \
|
2012-10-07 00:01:06 +08:00
|
|
|
--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
|
|
|
|
|
2012-12-13 21:07:01 +08:00
|
|
|
PACKAGE_INSTALL_FILES:= \
|
|
|
|
$(foreach pkg,$(sort $(package-y)), \
|
|
|
|
$(foreach variant, \
|
2014-03-13 03:53:13 +08:00
|
|
|
$(if $(strip $(package/$(pkg)/variants)), \
|
2012-12-13 21:07:01 +08:00
|
|
|
$(package/$(pkg)/variants), \
|
|
|
|
$(if $(package/$(pkg)/default-variant), \
|
|
|
|
$(package/$(pkg)/default-variant), \
|
|
|
|
default \
|
|
|
|
) \
|
|
|
|
), \
|
|
|
|
$(PKG_INFO_DIR)/$(lastword $(subst /,$(space),$(pkg))).$(variant).install \
|
|
|
|
) \
|
|
|
|
)
|
2012-10-07 00:01:06 +08:00
|
|
|
|
2012-10-15 21:19:45 +08:00
|
|
|
$(curdir)/cleanup: $(TMP_DIR)/.build
|
|
|
|
rm -rf $(STAGING_DIR_ROOT)
|
|
|
|
|
2015-12-14 01:03:40 +08:00
|
|
|
$(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install
|
2012-10-07 00:01:06 +08:00
|
|
|
- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
|
2012-10-15 21:19:45 +08:00
|
|
|
rm -rf $(TARGET_DIR)
|
2012-10-07 00:01:06 +08:00
|
|
|
[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
|
2014-08-07 23:35:12 +08:00
|
|
|
@$(FIND) `sed -e 's|.*|$(PACKAGE_DIR)$(if $(CONFIG_PER_FEED_REPO),/*)/&_*.ipk|' $(PACKAGE_INSTALL_FILES)` | sort -u | $(OPKG) install
|
2012-11-08 00:15:22 +08:00
|
|
|
@for file in $(PACKAGE_INSTALL_FILES); do \
|
|
|
|
[ -s $$file.flags ] || continue; \
|
|
|
|
for flag in `cat $$file.flags`; do \
|
|
|
|
$(OPKG) flag $$flag < $$file; \
|
2012-10-07 00:01:06 +08:00
|
|
|
done; \
|
|
|
|
done || true
|
2007-09-22 01:01:46 +08:00
|
|
|
@-$(MAKE) package/preconfig
|
2006-12-01 22:01:31 +08:00
|
|
|
@if [ -d $(TOPDIR)/files ]; then \
|
2012-12-02 20:20:38 +08:00
|
|
|
$(call file_copy,$(TOPDIR)/files/.,$(TARGET_DIR)); \
|
2006-12-01 22:01:31 +08:00
|
|
|
fi
|
2007-08-07 08:04:25 +08:00
|
|
|
@mkdir -p $(TARGET_DIR)/etc/rc.d
|
2006-10-16 05:03:30 +08:00
|
|
|
@( \
|
2007-08-07 08:04:25 +08:00
|
|
|
cd $(TARGET_DIR); \
|
2014-09-16 19:56:19 +08:00
|
|
|
for script in ./usr/lib/opkg/info/*.postinst; do \
|
|
|
|
IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) $$script; \
|
2015-06-15 01:42:05 +08:00
|
|
|
done; \
|
|
|
|
for script in ./etc/init.d/*; do \
|
|
|
|
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
|
|
|
|
IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) ./etc/rc.common $$script enable; \
|
2007-03-16 11:02:31 +08:00
|
|
|
done || true \
|
2006-10-16 05:03:30 +08:00
|
|
|
)
|
2016-02-01 07:29:12 +08:00
|
|
|
$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(TARGET_DIR)/usr/lib/opkg/status)
|
2007-08-07 08:04:25 +08:00
|
|
|
@-find $(TARGET_DIR) -name CVS | $(XARGS) rm -rf
|
|
|
|
@-find $(TARGET_DIR) -name .svn | $(XARGS) rm -rf
|
|
|
|
@-find $(TARGET_DIR) -name '.#*' | $(XARGS) rm -f
|
2014-09-11 20:27:49 +08:00
|
|
|
rm -f $(TARGET_DIR)/usr/lib/opkg/info/*.postinst*
|
|
|
|
rm -f $(TARGET_DIR)/usr/lib/opkg/info/*.prerm*
|
2009-10-06 12:50:53 +08:00
|
|
|
$(if $(CONFIG_CLEAN_IPKG),rm -rf $(TARGET_DIR)/usr/lib/opkg)
|
2009-08-08 10:25:03 +08:00
|
|
|
$(call mklibs)
|
2007-08-01 16:21:15 +08:00
|
|
|
|
2013-10-02 20:12:10 +08:00
|
|
|
PASSOPT=""
|
|
|
|
PASSARG=""
|
|
|
|
ifndef CONFIG_OPKGSMIME_PASSPHRASE
|
|
|
|
ifneq ($(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)),)
|
|
|
|
PASSOPT="-passin"
|
|
|
|
PASSARG="file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE))"
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-08-05 19:24:24 +08:00
|
|
|
PACKAGE_SUBDIRS=.
|
|
|
|
ifneq ($(CONFIG_PER_FEED_REPO),)
|
2015-05-26 19:37:05 +08:00
|
|
|
ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
|
2016-01-24 23:36:05 +08:00
|
|
|
PACKAGE_SUBDIRS=base kernel $(FEEDS_AVAILABLE)
|
2015-05-26 19:37:05 +08:00
|
|
|
else
|
2016-01-24 23:36:05 +08:00
|
|
|
PACKAGE_SUBDIRS=base kernel $(FEEDS_ENABLED)
|
2015-05-26 19:37:05 +08:00
|
|
|
endif
|
2014-08-05 19:24:24 +08:00
|
|
|
endif
|
|
|
|
|
2007-08-01 16:21:15 +08:00
|
|
|
$(curdir)/index: FORCE
|
2013-10-03 00:38:28 +08:00
|
|
|
@echo Generating package index...
|
2014-08-05 19:24:24 +08:00
|
|
|
@for d in $(PACKAGE_SUBDIRS); do ( \
|
2015-05-26 17:09:07 +08:00
|
|
|
mkdir -p $(PACKAGE_DIR)/$$d; \
|
|
|
|
cd $(PACKAGE_DIR)/$$d || continue; \
|
2013-10-03 00:38:28 +08:00
|
|
|
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
|
2015-07-14 17:57:45 +08:00
|
|
|
gzip -9nc Packages > Packages.gz; \
|
2014-08-05 19:24:24 +08:00
|
|
|
); done
|
2015-04-07 03:39:51 +08:00
|
|
|
ifdef CONFIG_SIGNED_PACKAGES
|
|
|
|
@echo Signing package index...
|
|
|
|
@for d in $(PACKAGE_SUBDIRS); do ( \
|
|
|
|
[ -d $(PACKAGE_DIR)/$$d ] && \
|
|
|
|
cd $(PACKAGE_DIR)/$$d || continue; \
|
|
|
|
$(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
|
|
|
|
); done
|
|
|
|
else
|
2013-10-02 20:12:10 +08:00
|
|
|
ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_KEY)),)
|
|
|
|
@echo Signing key has not been configured
|
|
|
|
else
|
|
|
|
ifeq ($(call qstrip,$(CONFIG_OPKGSMIME_CERT)),)
|
|
|
|
@echo Certificate has not been configured
|
|
|
|
else
|
|
|
|
@echo Signing package index...
|
2014-08-05 19:24:24 +08:00
|
|
|
@for d in $(PACKAGE_SUBDIRS); do ( \
|
|
|
|
[ -d $(PACKAGE_DIR)/$$d ] && \
|
|
|
|
cd $(PACKAGE_DIR)/$$d || continue; \
|
2013-10-02 20:12:10 +08:00
|
|
|
openssl smime -binary -in Packages.gz \
|
|
|
|
-out Packages.sig -outform PEM -sign \
|
|
|
|
-signer $(CONFIG_OPKGSMIME_CERT) \
|
|
|
|
-inkey $(CONFIG_OPKGSMIME_KEY) \
|
2014-08-05 19:24:24 +08:00
|
|
|
$(PASSOPT) $(PASSARG); \
|
|
|
|
); done
|
2013-10-02 20:12:10 +08:00
|
|
|
endif
|
|
|
|
endif
|
2015-04-07 03:39:51 +08:00
|
|
|
endif
|
2006-07-31 01:09:22 +08:00
|
|
|
|
2012-10-07 00:01:06 +08:00
|
|
|
$(curdir)/preconfig:
|
|
|
|
|
2007-07-31 05:14:08 +08:00
|
|
|
$(curdir)/flags-install:= -j1
|
|
|
|
|
2007-08-31 06:43:25 +08:00
|
|
|
$(eval $(call stampfile,$(curdir),package,prereq,.config))
|
2012-10-15 21:19:45 +08:00
|
|
|
$(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
|
2010-07-28 10:18:16 +08:00
|
|
|
$(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
|
|
|
|
$(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
|
2007-07-31 05:14:08 +08:00
|
|
|
|
2007-07-31 02:22:01 +08:00
|
|
|
$(eval $(call subdir,$(curdir)))
|