Revert "iproute2: use tc package variant to limit other package sizes"
[openwrt/openwrt.git] / include / version.mk
1 #
2 # Copyright (C) 2012-2015 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 # Substituted by SDK, do not remove
10 # REVISION:=x
11 # SOURCE_DATE_EPOCH:=x
12
13 PKG_CONFIG_DEPENDS += \
14 CONFIG_VERSION_HOME_URL \
15 CONFIG_VERSION_BUG_URL \
16 CONFIG_VERSION_NUMBER \
17 CONFIG_VERSION_CODE \
18 CONFIG_VERSION_REPO \
19 CONFIG_VERSION_DIST \
20 CONFIG_VERSION_MANUFACTURER \
21 CONFIG_VERSION_MANUFACTURER_URL \
22 CONFIG_VERSION_PRODUCT \
23 CONFIG_VERSION_SUPPORT_URL \
24 CONFIG_VERSION_HWREV \
25
26 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
27
28 VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
29 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
30
31 VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
32 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
33
34 VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
35 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots)
36
37 VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
38 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
39 VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
40
41 VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
42 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt)
43
44 VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
45 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://openwrt.org/)
46
47 VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
48 VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.openwrt.org/)
49
50 VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL))
51 VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),http://openwrt.org/)
52
53 VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
54 VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),http://forum.lede-project.org/)
55
56 VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
57 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
58
59 VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV))
60 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
61
62 define taint2sym
63 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
64 endef
65
66 define taint2name
67 $(lastword $(subst :, ,$(1)))
68 endef
69
70 VERSION_TAINT_SPECS := \
71 -ALL_KMODS:no-all \
72 -IPV6:no-ipv6 \
73 +USE_GLIBC:glibc \
74 +USE_MKLIBS:mklibs \
75 +BUSYBOX_CUSTOM:busybox \
76 +OVERRIDE_PKGS:override \
77
78 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
79 $(if $(findstring +,$(taint)), \
80 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
81 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
82 )))
83
84 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
85
86 # escape commas, backslashes, squotes, and ampersands for sed
87 define sed_escape
88 $(subst &,\&,$(subst $(comma),\$(comma),$(subst ','\'',$(subst \,\\,$(1)))))
89 endef
90 #'
91
92 VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
93 -e 's,%V,$(call sed_escape,$(VERSION_NUMBER)),g' \
94 -e 's,%v,\L$(call sed_escape,$(subst $(space),_,$(VERSION_NUMBER))),g' \
95 -e 's,%C,$(call sed_escape,$(VERSION_CODE)),g' \
96 -e 's,%c,\L$(call sed_escape,$(subst $(space),_,$(VERSION_CODE))),g' \
97 -e 's,%D,$(call sed_escape,$(VERSION_DIST)),g' \
98 -e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
99 -e 's,%R,$(call sed_escape,$(REVISION)),g' \
100 -e 's,%T,$(call sed_escape,$(BOARD)),g' \
101 -e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
102 -e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
103 -e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
104 -e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
105 -e 's,%m,$(call sed_escape,$(VERSION_MANUFACTURER_URL)),g' \
106 -e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
107 -e 's,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \
108 -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
109 -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
110 -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'
111