2 # Copyright (C) 2012-2015 OpenWrt.org
3 # Copyright (C) 2016 LEDE Project
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
9 # Substituted by SDK, do not remove
11 # SOURCE_DATE_EPOCH:=x
13 PKG_CONFIG_DEPENDS += \
14 CONFIG_VERSION_BUG_URL \
15 CONFIG_VERSION_NUMBER \
19 CONFIG_VERSION_MANUFACTURER \
20 CONFIG_VERSION_MANUFACTURER_URL \
21 CONFIG_VERSION_PRODUCT \
22 CONFIG_VERSION_SUPPORT_URL \
23 CONFIG_VERSION_HWREV \
25 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
27 VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
28 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
30 VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
31 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
33 VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
34 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/snapshots)
36 VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
37 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
38 VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
40 VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
41 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt)
43 VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
44 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://lede-project.org/)
46 VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
47 VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.lede-project.org/)
49 VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
50 VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),http://forum.lede-project.org/)
52 VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
53 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
55 VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV))
56 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
59 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
63 $(lastword $(subst :, ,$(1)))
66 VERSION_TAINT_SPECS := \
71 +BUSYBOX_CUSTOM:busybox \
72 +OVERRIDE_PKGS:override \
74 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
75 $(if $(findstring +,$(taint)), \
76 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
77 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
80 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
82 # escape commas, backslashes, squotes, and ampersands for sed
84 $(subst &,\&,$(subst $(comma),\$(comma),$(subst ','\'',$(subst \,\\,$(1)))))
88 VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
89 -e 's,%V,$(call sed_escape,$(VERSION_NUMBER)),g' \
90 -e 's,%v,\L$(call sed_escape,$(subst $(space),_,$(VERSION_NUMBER))),g' \
91 -e 's,%C,$(call sed_escape,$(VERSION_CODE)),g' \
92 -e 's,%c,\L$(call sed_escape,$(subst $(space),_,$(VERSION_CODE))),g' \
93 -e 's,%D,$(call sed_escape,$(VERSION_DIST)),g' \
94 -e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
95 -e 's,%R,$(call sed_escape,$(REVISION)),g' \
96 -e 's,%T,$(call sed_escape,$(BOARD)),g' \
97 -e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
98 -e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
99 -e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
100 -e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
101 -e 's,%m,$(call sed_escape,$(VERSION_MANUFACTURER_URL)),g' \
102 -e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
103 -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
104 -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
105 -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'