ef7a09f4cd272ded4da736a37c516b77d8e1ada2
[openwrt/openwrt.git] / include / feeds.mk
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
9 -include $(TMP_DIR)/.packagesubdirs
10
11 FEEDS_AVAILABLE:=$(shell $(SCRIPT_DIR)/feeds list -n)
12 FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*))
13 FEEDS_ENABLED:=$(foreach feed,$(FEEDS_INSTALLED),$(if $(CONFIG_FEED_$(feed)),$(feed)))
14 FEEDS_DISABLED:=$(filter-out $(FEEDS_ENABLED),$(FEEDS_AVAILABLE))
15
16 PACKAGE_SUBDIRS=$(PACKAGE_DIR)
17 ifneq ($(CONFIG_PER_FEED_REPO),)
18 PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base
19 ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
20 PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
21 else
22 PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_ENABLED),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
23 endif
24 endif
25
26 PKG_CONFIG_DEPENDS += \
27 CONFIG_PER_FEED_REPO \
28 CONFIG_PER_FEED_REPO_ADD_DISABLED \
29 CONFIG_PER_FEED_REPO_ADD_COMMENTED \
30 $(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed))
31
32 # 1: package name
33 # 2: flags
34 # 3: section
35 define FeedPackageDir
36 $(strip $(if $(CONFIG_PER_FEED_REPO), \
37 $(if $(Package/$(1)/subdir), \
38 $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir)), \
39 $(PACKAGE_DIR)), \
40 $(PACKAGE_DIR)))
41 endef
42
43 # 1: destination file
44 define FeedSourcesAppend
45 ( \
46 $(strip $(if $(CONFIG_PER_FEED_REPO), \
47 $(foreach feed,base kernel $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/$(feed)";) \
48 $(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
49 $(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$(feed) %U/$(feed)";)) \
50 , \
51 echo "src/gz %n %U"; \
52 )) \
53 ) >> $(1)
54 endef