1
0

feeds.mk 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2014 OpenWrt.org
  4. # Copyright (C) 2016 LEDE Project
  5. -include $(TMP_DIR)/.packageauxvars
  6. FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*))
  7. FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2>/dev/null))
  8. PACKAGE_SUBDIRS=$(PACKAGE_DIR)
  9. ifneq ($(CONFIG_PER_FEED_REPO),)
  10. PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base
  11. PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
  12. endif
  13. opkg_package_files = $(wildcard \
  14. $(foreach dir,$(PACKAGE_SUBDIRS), \
  15. $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
  16. # 1: package name
  17. define FeedPackageDir
  18. $(strip $(if $(CONFIG_PER_FEED_REPO), \
  19. $(if $(Package/$(1)/subdir), \
  20. $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir)), \
  21. $(PACKAGE_DIR)), \
  22. $(PACKAGE_DIR)))
  23. endef
  24. # 1: destination file
  25. define FeedSourcesAppend
  26. ( \
  27. echo 'src/gz %d_core %U/targets/%S/packages'; \
  28. $(strip $(if $(CONFIG_PER_FEED_REPO), \
  29. echo 'src/gz %d_base %U/packages/%A/base'; \
  30. $(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \
  31. echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \
  32. $(foreach feed,$(FEEDS_AVAILABLE), \
  33. $(if $(CONFIG_FEED_$(feed)), \
  34. echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \
  35. ) >> $(1)
  36. endef
  37. # 1: package name
  38. define GetABISuffix
  39. $(if $(ABIV_$(1)),$(ABIV_$(1)),$(call FormatABISuffix,$(1),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v)))))
  40. endef
  41. # 1: package name
  42. # 2: abi version
  43. define FormatABISuffix
  44. $(if $(filter-out kmod-%,$(1)),$(if $(2),$(if $(filter %0 %1 %2 %3 %4 %5 %6 %7 %8 %9,$(1)),-)$(2)))
  45. endef