| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0-only | 
|  | 2 | # | 
|  | 3 | # Copyright (C) 2014 OpenWrt.org | 
|  | 4 | # Copyright (C) 2016 LEDE Project | 
|  | 5 |  | 
|  | 6 | -include $(TMP_DIR)/.packageauxvars | 
|  | 7 |  | 
|  | 8 | FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*)) | 
|  | 9 | FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2>/dev/null)) | 
|  | 10 |  | 
|  | 11 | PACKAGE_SUBDIRS=$(PACKAGE_DIR) | 
|  | 12 | ifneq ($(CONFIG_PER_FEED_REPO),) | 
|  | 13 | PACKAGE_SUBDIRS += $(PACKAGE_DIR)/base | 
|  | 14 | PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(PACKAGE_DIR)/$(FEED)) | 
|  | 15 | endif | 
|  | 16 |  | 
|  | 17 | opkg_package_files = $(wildcard \ | 
|  | 18 | $(foreach dir,$(PACKAGE_SUBDIRS), \ | 
|  | 19 | $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk))) | 
|  | 20 |  | 
|  | 21 | apk_package_files = $(wildcard \ | 
|  | 22 | $(foreach dir,$(PACKAGE_SUBDIRS), \ | 
|  | 23 | $(foreach pkg,$(1), $(dir)/$(pkg)_*.apk))) | 
|  | 24 |  | 
|  | 25 | # 1: package name | 
|  | 26 | define FeedPackageDir | 
|  | 27 | $(strip $(if $(CONFIG_PER_FEED_REPO), \ | 
|  | 28 | $(if $(Package/$(1)/subdir), \ | 
|  | 29 | $(abspath $(PACKAGE_DIR)/$(Package/$(1)/subdir)), \ | 
|  | 30 | $(PACKAGE_DIR)), \ | 
|  | 31 | $(PACKAGE_DIR))) | 
|  | 32 | endef | 
|  | 33 |  | 
|  | 34 | # 1: destination file | 
|  | 35 | define FeedSourcesAppendOPKG | 
|  | 36 | ( \ | 
|  | 37 | echo 'src/gz %d_core %U/targets/%S/packages'; \ | 
|  | 38 | $(strip $(if $(CONFIG_PER_FEED_REPO), \ | 
|  | 39 | echo 'src/gz %d_base %U/packages/%A/base'; \ | 
|  | 40 | $(if $(CONFIG_BUILDBOT), \ | 
|  | 41 | echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \ | 
|  | 42 | $(foreach feed,$(FEEDS_AVAILABLE), \ | 
|  | 43 | $(if $(CONFIG_FEED_$(feed)), \ | 
|  | 44 | echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \ | 
|  | 45 | ) >> $(1) | 
|  | 46 | endef | 
|  | 47 |  | 
|  | 48 | # 1: destination file | 
|  | 49 | define FeedSourcesAppendAPK | 
|  | 50 | ( \ | 
|  | 51 | echo '%U/targets/%S/packages/packages.adb'; \ | 
|  | 52 | $(strip $(if $(CONFIG_PER_FEED_REPO), \ | 
|  | 53 | echo '%U/packages/%A/base/packages.adb'; \ | 
|  | 54 | $(if $(CONFIG_BUILDBOT), \ | 
|  | 55 | echo '%U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)/packages.adb';) \ | 
|  | 56 | $(foreach feed,$(FEEDS_AVAILABLE), \ | 
|  | 57 | $(if $(CONFIG_FEED_$(feed)), \ | 
|  | 58 | echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )%U/packages/%A/$(feed)/packages.adb';)))) \ | 
|  | 59 | ) >> $(1) | 
|  | 60 | endef | 
|  | 61 |  | 
|  | 62 | # 1: package name | 
|  | 63 | define GetABISuffix | 
|  | 64 | $(if $(ABIV_$(1)),$(ABIV_$(1)),$(call FormatABISuffix,$(1),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v))))) | 
|  | 65 | endef | 
|  | 66 |  | 
|  | 67 | # 1: package name | 
|  | 68 | # 2: abi version | 
|  | 69 | define FormatABISuffix | 
|  | 70 | $(if $(filter-out kmod-%,$(1)),$(if $(2),$(if $(filter %0 %1 %2 %3 %4 %5 %6 %7 %8 %9,$(1)),-)$(2))) | 
|  | 71 | endef |