version.mk 4.07 KB
Newer Older
1
#
2
# Copyright (C) 2012-2015 OpenWrt.org
3
# Copyright (C) 2016 LEDE Project
4
5
6
7
8
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

9
10
# Substituted by SDK, do not remove
# 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
20
	CONFIG_VERSION_DIST \
	CONFIG_VERSION_MANUFACTURER \
21
	CONFIG_VERSION_MANUFACTURER_URL \
22
	CONFIG_VERSION_PRODUCT \
23
	CONFIG_VERSION_SUPPORT_URL \
24
	CONFIG_VERSION_HWREV \
25

26
27
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))

28
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
29
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),19.07.0-rc2)
30

31
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
32
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r10775-db8345d8e4)
33

34
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
35
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/19.07.0-rc2)
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),https://openwrt.org/)
46

47
VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
48
VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://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),https://openwrt.org/)
52

53
VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
54
VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),https://forum.openwrt.org/)
55

56
VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
57
58
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)
61
62
63
64
65
66
67
68
69
70

define taint2sym
$(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
endef

define taint2name
$(lastword $(subst :, ,$(1)))
endef

VERSION_TAINT_SPECS := \
71
	-ALL_KMODS:no-all \
72
	-IPV6:no-ipv6 \
73
	+USE_GLIBC:glibc \
74
75
	+USE_MKLIBS:mklibs \
	+BUSYBOX_CUSTOM:busybox \
76
	+OVERRIDE_PKGS:override \
77
78
79
80
81
82
83
84
85

VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
	$(if $(findstring +,$(taint)), \
		$(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
		$(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
	)))

PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))

86
87
88
89
90
91
# escape commas, backslashes, squotes, and ampersands for sed
define sed_escape
$(subst &,\&,$(subst $(comma),\$(comma),$(subst ','\'',$(subst \,\\,$(1)))))
endef
#'

92
VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	-e 's,%V,$(call sed_escape,$(VERSION_NUMBER)),g' \
	-e 's,%v,\L$(call sed_escape,$(subst $(space),_,$(VERSION_NUMBER))),g' \
	-e 's,%C,$(call sed_escape,$(VERSION_CODE)),g' \
	-e 's,%c,\L$(call sed_escape,$(subst $(space),_,$(VERSION_CODE))),g' \
	-e 's,%D,$(call sed_escape,$(VERSION_DIST)),g' \
	-e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
	-e 's,%R,$(call sed_escape,$(REVISION)),g' \
	-e 's,%T,$(call sed_escape,$(BOARD)),g' \
	-e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
	-e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
	-e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
	-e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
	-e 's,%m,$(call sed_escape,$(VERSION_MANUFACTURER_URL)),g' \
	-e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
107
	-e 's,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \
108
109
110
111
	-e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
	-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
	-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'