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_HOME_URL \
15 CONFIG_VERSION_BUG_URL \
16 CONFIG_VERSION_NUMBER \
20 CONFIG_VERSION_MANUFACTURER \
21 CONFIG_VERSION_MANUFACTURER_URL \
22 CONFIG_VERSION_PRODUCT \
23 CONFIG_VERSION_SUPPORT_URL \
24 CONFIG_VERSION_HWREV \
26 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
28 VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
29 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
31 VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
32 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
34 VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
35 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots)
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))
41 VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
42 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt)
44 VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
45 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://openwrt.org/)
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/)
50 VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL))
51 VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),http://openwrt.org/)
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/)
56 VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
57 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
59 VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV))
60 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
63 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
67 $(lastword $(subst :, ,$(1)))
70 VERSION_TAINT_SPECS := \
75 +BUSYBOX_CUSTOM:busybox \
76 +OVERRIDE_PKGS:override \
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))) \
84 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
86 # escape commas, backslashes, squotes, and ampersands for sed
88 $(subst &,\&,$(subst $(comma),\$(comma),$(subst ','\'',$(subst \,\\,$(1)))))
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,%b,$(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'