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
14 PKG_CONFIG_DEPENDS += \
15 CONFIG_VERSION_NUMBER \
19 CONFIG_VERSION_MANUFACTURER \
20 CONFIG_VERSION_MANUFACTURER_URL \
21 CONFIG_VERSION_PRODUCT \
22 CONFIG_VERSION_HWREV \
24 qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
27 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
29 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
30 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),$(REVISION))
32 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
33 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),HEAD)
35 VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
36 VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
38 VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
39 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/snapshots)
41 VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
42 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),LEDE)
43 VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
45 VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
46 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),LEDE)
48 VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL))
49 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://www.lede-project.org/)
51 VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
52 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
54 VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV))
55 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
58 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
62 $(lastword $(subst :, ,$(1)))
65 VERSION_TAINT_SPECS := \
70 +BUSYBOX_CUSTOM:busybox \
71 +OVERRIDE_PKGS:override \
73 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
74 $(if $(findstring +,$(taint)), \
75 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
76 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
79 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
81 VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
82 -e 's,%V,$(VERSION_NUMBER),g' \
83 -e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
84 -e 's,%C,$(VERSION_CODE),g' \
85 -e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
86 -e 's,%N,$(VERSION_NICK),g' \
87 -e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
88 -e 's,%D,$(VERSION_DIST),g' \
89 -e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
90 -e 's,%R,$(REVISION),g' \
91 -e 's,%T,$(BOARD),g' \
92 -e 's,%S,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic),g' \
93 -e 's,%A,$(ARCH_PACKAGES),g' \
94 -e 's,%t,$(VERSION_TAINTS),g' \
95 -e 's,%M,$(VERSION_MANUFACTURER),g' \
96 -e 's,%m,$(VERSION_MANUFACTURER_URL),g' \
97 -e 's,%P,$(VERSION_PRODUCT),g' \
98 -e 's,%h,$(VERSION_HWREV),g'
100 VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))