2008-07-29 03:36:11 +00:00
|
|
|
#
|
2010-03-05 20:28:52 +00:00
|
|
|
# Copyright (C) 2006-2010 OpenWrt.org
|
2006-07-21 09:15:06 +00:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
|
2007-07-30 18:22:01 +00:00
|
|
|
curdir:=package
|
|
|
|
|
2018-03-06 08:38:29 +00:00
|
|
|
include $(INCLUDE_DIR)/feeds.mk
|
2016-07-21 16:49:54 +00:00
|
|
|
include $(INCLUDE_DIR)/rootfs.mk
|
2014-08-05 11:24:24 +00:00
|
|
|
|
2007-07-30 18:22:01 +00:00
|
|
|
-include $(TMP_DIR)/.packagedeps
|
2020-10-15 08:17:45 +00:00
|
|
|
package-y += kernel/linux
|
2017-01-18 14:37:57 +00:00
|
|
|
$(curdir)/autoremove:=1
|
2007-07-30 18:22:01 +00:00
|
|
|
$(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
|
2014-03-13 12:12:58 +00:00
|
|
|
$(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
|
|
|
|
$(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
|
2016-12-16 15:08:44 +00:00
|
|
|
ifdef CHECK_ALL
|
|
|
|
$(curdir)/builddirs-check:=$($(curdir)/builddirs)
|
|
|
|
$(curdir)/builddirs-download:=$($(curdir)/builddirs)
|
|
|
|
endif
|
2008-05-07 16:45:00 +00:00
|
|
|
ifneq ($(IGNORE_ERRORS),)
|
2013-07-18 16:44:44 +00: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)
|
2016-03-04 11:20:11 +00:00
|
|
|
package-ignore-subdirs := $(sort $(foreach m,$(package-ignore-errors),$(package-$(m)-filter)))
|
|
|
|
$(curdir)/builddirs-ignore-download := $(package-ignore-subdirs)
|
|
|
|
$(curdir)/builddirs-ignore-compile := $(package-ignore-subdirs)
|
|
|
|
$(curdir)/builddirs-ignore-host-download := $(package-ignore-subdirs)
|
|
|
|
$(curdir)/builddirs-ignore-host-compile := $(package-ignore-subdirs)
|
2008-05-07 16:45:00 +00:00
|
|
|
endif
|
2007-07-30 18:22:01 +00:00
|
|
|
|
2012-12-13 13:07:01 +00:00
|
|
|
PACKAGE_INSTALL_FILES:= \
|
|
|
|
$(foreach pkg,$(sort $(package-y)), \
|
|
|
|
$(foreach variant, \
|
2014-03-12 19:53:13 +00:00
|
|
|
$(if $(strip $(package/$(pkg)/variants)), \
|
2012-12-13 13:07:01 +00: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-06 16:01:06 +00:00
|
|
|
|
2012-10-15 13:19:45 +00:00
|
|
|
$(curdir)/cleanup: $(TMP_DIR)/.build
|
|
|
|
rm -rf $(STAGING_DIR_ROOT)
|
|
|
|
|
2016-08-01 09:12:15 +00:00
|
|
|
$(curdir)/merge:
|
|
|
|
rm -rf $(PACKAGE_DIR_ALL)
|
|
|
|
mkdir -p $(PACKAGE_DIR_ALL)
|
2024-05-14 10:36:59 +00:00
|
|
|
ifneq ($(CONFIG_USE_APK),)
|
|
|
|
-$(foreach pdir,$(PACKAGE_SUBDIRS),$(if $(wildcard $(pdir)/*.apk),ln -s $(pdir)/*.apk $(PACKAGE_DIR_ALL);))
|
|
|
|
else
|
2016-08-01 09:12:15 +00:00
|
|
|
-$(foreach pdir,$(PACKAGE_SUBDIRS),$(if $(wildcard $(pdir)/*.ipk),ln -s $(pdir)/*.ipk $(PACKAGE_DIR_ALL);))
|
2024-05-14 10:36:59 +00:00
|
|
|
endif
|
2016-08-01 09:12:15 +00:00
|
|
|
|
2024-05-22 14:19:45 +00:00
|
|
|
$(BUILD_KEY_APK_SEC):
|
|
|
|
$(STAGING_DIR_HOST)/bin/openssl ecparam -name prime256v1 -genkey -noout -out $(BUILD_KEY_APK_SEC)
|
|
|
|
|
|
|
|
$(BUILD_KEY_APK_PUB): $(BUILD_KEY_APK_SEC)
|
|
|
|
$(STAGING_DIR_HOST)/bin/openssl ec -in $(BUILD_KEY_APK_SEC) -pubout > $(BUILD_KEY_APK_PUB)
|
|
|
|
|
2016-08-01 09:12:15 +00:00
|
|
|
$(curdir)/merge-index: $(curdir)/merge
|
2024-05-14 10:36:59 +00:00
|
|
|
ifneq ($(CONFIG_USE_APK),)
|
|
|
|
(cd $(PACKAGE_DIR_ALL) && $(STAGING_DIR_HOST)/bin/apk mkndx \
|
|
|
|
--root $(TOPDIR) \
|
|
|
|
--keys-dir $(TOPDIR) \
|
|
|
|
--sign $(BUILD_KEY_APK_SEC) \
|
|
|
|
--output packages.adb \
|
|
|
|
*.apk; \
|
|
|
|
)
|
|
|
|
else
|
2016-08-01 09:12:15 +00:00
|
|
|
(cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; )
|
2024-05-14 10:36:59 +00:00
|
|
|
endif
|
2016-08-01 09:12:15 +00:00
|
|
|
|
2017-02-21 19:43:35 +00:00
|
|
|
ifndef SDK
|
2024-03-04 22:45:15 +00:00
|
|
|
$(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR)
|
2024-05-14 10:36:59 +00:00
|
|
|
ifneq ($(CONFIG_USE_APK),)
|
2024-05-23 10:24:11 +00:00
|
|
|
$(curdir)//compile += $(curdir)/system/apk/host/compile $(BUILD_KEY_APK_SEC) $(BUILD_KEY_APK_PUB)
|
2024-05-14 10:36:59 +00:00
|
|
|
else
|
2017-02-21 19:43:35 +00:00
|
|
|
$(curdir)/compile: $(curdir)/system/opkg/host/compile
|
|
|
|
endif
|
2024-08-08 15:31:18 +00:00
|
|
|
else
|
|
|
|
ifneq ($(CONFIG_USE_APK),)
|
2024-10-28 21:33:48 +00:00
|
|
|
$(curdir)//compile += $(BUILD_KEY_APK_SEC) $(BUILD_KEY_APK_PUB)
|
2024-08-08 15:31:18 +00:00
|
|
|
endif
|
2024-05-14 10:36:59 +00:00
|
|
|
endif
|
2017-02-20 11:37:58 +00:00
|
|
|
|
2024-05-14 10:36:59 +00:00
|
|
|
$(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(curdir)/merge-index
|
2012-10-06 16:01:06 +00:00
|
|
|
- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
|
2016-09-25 07:30:55 +00:00
|
|
|
rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
|
2017-03-05 08:17:17 +00:00
|
|
|
mkdir -p $(TARGET_DIR)/tmp
|
2024-05-14 10:36:59 +00:00
|
|
|
ifneq ($(CONFIG_USE_APK),)
|
|
|
|
$(file >$(TMP_DIR)/apk_install_list,\
|
|
|
|
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
|
2024-11-01 11:33:49 +00:00
|
|
|
$(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \
|
2024-11-15 11:27:44 +00:00
|
|
|
--repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb \
|
2024-10-24 18:25:06 +00:00
|
|
|
$$(cat $(TMP_DIR)/apk_install_list)
|
2024-05-14 10:36:59 +00:00
|
|
|
else
|
2021-04-09 23:32:44 +00:00
|
|
|
$(file >$(TMP_DIR)/opkg_install_list,\
|
|
|
|
$(call opkg_package_files,\
|
|
|
|
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))))
|
|
|
|
$(call opkg,$(TARGET_DIR)) install $$(cat $(TMP_DIR)/opkg_install_list)
|
2012-11-07 16:15:22 +00:00
|
|
|
@for file in $(PACKAGE_INSTALL_FILES); do \
|
|
|
|
[ -s $$file.flags ] || continue; \
|
|
|
|
for flag in `cat $$file.flags`; do \
|
2016-07-22 10:10:17 +00:00
|
|
|
$(call opkg,$(TARGET_DIR)) flag $$flag `cat $$file`; \
|
2012-10-06 16:01:06 +00:00
|
|
|
done; \
|
|
|
|
done || true
|
2024-05-14 10:36:59 +00:00
|
|
|
endif
|
2016-09-25 07:30:55 +00:00
|
|
|
|
|
|
|
$(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG)
|
|
|
|
|
2018-03-06 20:06:30 +00:00
|
|
|
$(call prepare_rootfs,$(TARGET_DIR),$(TOPDIR)/files)
|
2007-08-01 08:21:15 +00:00
|
|
|
|
|
|
|
$(curdir)/index: FORCE
|
2013-10-02 16:38:28 +00:00
|
|
|
@echo Generating package index...
|
2024-05-14 10:36:59 +00:00
|
|
|
ifneq ($(CONFIG_USE_APK),)
|
|
|
|
@for d in $(PACKAGE_SUBDIRS); do \
|
|
|
|
mkdir -p $$d; \
|
|
|
|
cd $$d || continue; \
|
|
|
|
ls *.apk >/dev/null 2>&1 || continue; \
|
|
|
|
$(STAGING_DIR_HOST)/bin/apk mkndx \
|
|
|
|
--root $(TOPDIR) \
|
|
|
|
--keys-dir $(TOPDIR) \
|
|
|
|
--sign $(BUILD_KEY_APK_SEC) \
|
|
|
|
--output packages.adb \
|
2024-11-06 15:32:03 +00:00
|
|
|
$$(ls *.apk | grep -v 'base-files-\|kernel-\|libc-'); \
|
2024-11-12 17:10:02 +00:00
|
|
|
echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \
|
|
|
|
$(STAGING_DIR_HOST)/bin/apk adbdump packages.adb | \
|
|
|
|
awk '/- name: / {pkg = $$NF} ; / version: / {printf "\"%s\": \"%s\", ", pkg, $$NF}' | \
|
|
|
|
sed 's/, $$//' >> index.json; \
|
|
|
|
echo '}}' >> index.json; \
|
2024-05-14 10:36:59 +00:00
|
|
|
done
|
|
|
|
else
|
2014-08-05 11:24:24 +00:00
|
|
|
@for d in $(PACKAGE_SUBDIRS); do ( \
|
2016-04-06 19:55:44 +00:00
|
|
|
mkdir -p $$d; \
|
|
|
|
cd $$d || continue; \
|
2016-12-24 12:32:26 +00:00
|
|
|
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
|
2020-08-15 20:57:03 +00:00
|
|
|
grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require|SourceDateEpoch)' Packages.manifest > Packages; \
|
2019-08-07 05:15:07 +00:00
|
|
|
case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \
|
|
|
|
$(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
|
|
|
|
{ echo ""; echo ""; } >> Packages;; \
|
|
|
|
esac; \
|
2023-05-09 19:39:58 +00:00
|
|
|
echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \
|
|
|
|
sed -n -e 's/^Package: \(.*\)$$/"\1":/p' -e 's/^Version: \(.*\)$$/"\1",/p' Packages | tr '\n' ' ' >> index.json; \
|
|
|
|
echo '}}' >> index.json; \
|
|
|
|
sed -i 's/, }}/}}/' index.json; \
|
2019-08-07 05:15:07 +00:00
|
|
|
gzip -9nc Packages > Packages.gz; \
|
2014-08-05 11:24:24 +00:00
|
|
|
); done
|
2015-04-06 19:39:51 +00:00
|
|
|
ifdef CONFIG_SIGNED_PACKAGES
|
|
|
|
@echo Signing package index...
|
|
|
|
@for d in $(PACKAGE_SUBDIRS); do ( \
|
2016-04-06 19:55:44 +00:00
|
|
|
[ -d $$d ] && \
|
|
|
|
cd $$d || continue; \
|
2015-04-06 19:39:51 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
|
|
|
|
); done
|
|
|
|
endif
|
2023-10-24 08:27:13 +00:00
|
|
|
ifdef CONFIG_JSON_CYCLONEDX_SBOM
|
|
|
|
@echo Creating CycloneDX package SBOMs...
|
|
|
|
@for d in $(PACKAGE_SUBDIRS); do ( \
|
|
|
|
[ -d $$d ] && \
|
|
|
|
cd $$d || continue; \
|
|
|
|
$(SCRIPT_DIR)/package-metadata.pl pkgcyclonedxsbom Packages.manifest > Packages.bom.cdx.json || true; \
|
|
|
|
); done
|
|
|
|
endif
|
2024-05-14 10:36:59 +00:00
|
|
|
endif
|
2006-07-30 17:09:22 +00:00
|
|
|
|
2007-07-30 21:14:08 +00:00
|
|
|
$(curdir)/flags-install:= -j1
|
|
|
|
|
2007-08-30 22:43:25 +00:00
|
|
|
$(eval $(call stampfile,$(curdir),package,prereq,.config))
|
2017-01-22 12:47:24 +00:00
|
|
|
$(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
|
2010-07-28 02:18:16 +00:00
|
|
|
$(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
|
|
|
|
$(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
|
2016-12-14 14:36:39 +00:00
|
|
|
$(eval $(call stampfile,$(curdir),package,check,$(TMP_DIR)/.build))
|
2007-07-30 21:14:08 +00:00
|
|
|
|
2007-07-30 18:22:01 +00:00
|
|
|
$(eval $(call subdir,$(curdir)))
|