feeds.mk 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #
  2. # Copyright (C) 2014 OpenWrt.org
  3. # Copyright (C) 2016 LEDE Project
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. -include $(TMP_DIR)/.packagesubdirs
  9. FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*))
  10. FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n))
  11. FEEDS_ENABLED:=$(foreach feed,$(FEEDS_AVAILABLE),$(if $(CONFIG_FEED_$(feed)),$(feed)))
  12. FEEDS_DISABLED:=$(filter-out $(FEEDS_ENABLED),$(FEEDS_AVAILABLE))
  13. PACKAGE_SUBDIRS=$(PACKAGE_DIR)
  14. ifneq ($(CONFIG_PER_FEED_REPO),)
  15. PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base
  16. ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
  17. PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
  18. else
  19. PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_ENABLED),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
  20. endif
  21. endif
  22. opkg_package_files = $(wildcard \
  23. $(foreach dir,$(PACKAGE_SUBDIRS), \
  24. $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
  25. # 1: package name
  26. define FeedPackageDir
  27. $(strip $(if $(CONFIG_PER_FEED_REPO), \
  28. $(if $(Package/$(1)/subdir), \
  29. $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir)), \
  30. $(PACKAGE_DIR)), \
  31. $(PACKAGE_DIR)))
  32. endef
  33. # 1: destination file
  34. define FeedSourcesAppend
  35. ( \
  36. echo "src/gz %d_core %U/targets/%S/packages"; \
  37. $(strip $(if $(CONFIG_PER_FEED_REPO), \
  38. $(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %d_$(feed) %U/packages/%A/$(feed)";) \
  39. $(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
  40. $(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %d_$(feed) %U/packages/%A/$(feed)";)))) \
  41. ) >> $(1)
  42. endef