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
15 PKG_CONFIG_DEPENDS += \
16 CONFIG_VERSION_BUG_URL \
17 CONFIG_VERSION_NUMBER \
22 CONFIG_VERSION_MANUFACTURER \
23 CONFIG_VERSION_MANUFACTURER_URL \
24 CONFIG_VERSION_PRODUCT \
25 CONFIG_VERSION_SUPPORT_URL \
26 CONFIG_VERSION_HWREV \
28 qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
31 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
33 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
34 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
36 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_CODE))
37 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
39 VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
40 VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
42 VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
43 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/snapshots)
45 VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
46 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),LEDE)
47 VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
49 VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
50 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),LEDE)
52 VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL))
53 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://lede-project.org/)
55 VERSION_BUG_URL:=$(call qstrip_escape,$(CONFIG_VERSION_BUG_URL))
56 VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.lede-project.org/)
58 VERSION_SUPPORT_URL:=$(call qstrip_escape,$(CONFIG_VERSION_SUPPORT_URL))
59 VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),http://forum.lede-project.org/)
61 VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
62 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
64 VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV))
65 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
68 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
72 $(lastword $(subst :, ,$(1)))
75 VERSION_TAINT_SPECS := \
80 +BUSYBOX_CUSTOM:busybox \
81 +OVERRIDE_PKGS:override \
83 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
84 $(if $(findstring +,$(taint)), \
85 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
86 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
89 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
91 VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
92 -e 's,%V,$(VERSION_NUMBER),g' \
93 -e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
94 -e 's,%C,$(VERSION_CODE),g' \
95 -e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
96 -e 's,%N,$(VERSION_NICK),g' \
97 -e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
98 -e 's,%D,$(VERSION_DIST),g' \
99 -e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
100 -e 's,%R,$(REVISION),g' \
101 -e 's,%T,$(BOARD),g' \
102 -e 's,%S,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic),g' \
103 -e 's,%A,$(ARCH_PACKAGES),g' \
104 -e 's,%t,$(VERSION_TAINTS),g' \
105 -e 's,%M,$(VERSION_MANUFACTURER),g' \
106 -e 's,%m,$(VERSION_MANUFACTURER_URL),g' \
107 -e 's,%b,$(VERSION_BUG_URL),g' \
108 -e 's,%s,$(VERSION_SUPPORT_URL),g' \
109 -e 's,%P,$(VERSION_PRODUCT),g' \
110 -e 's,%h,$(VERSION_HWREV),g'
112 VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))