version.mk 3.77 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
14
RELEASE:=Reboot

15
PKG_CONFIG_DEPENDS += \
16
	CONFIG_VERSION_BUG_URL \
17
	CONFIG_VERSION_NUMBER \
18
	CONFIG_VERSION_CODE \
19
20
	CONFIG_VERSION_NICK \
	CONFIG_VERSION_REPO \
21
22
	CONFIG_VERSION_DIST \
	CONFIG_VERSION_MANUFACTURER \
23
	CONFIG_VERSION_MANUFACTURER_URL \
24
	CONFIG_VERSION_PRODUCT \
25
	CONFIG_VERSION_SUPPORT_URL \
26
	CONFIG_VERSION_HWREV \
27

28
29
30
qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
#'

31
32
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))

33
VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
34
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),17.01.7)
35

36
VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_CODE))
37
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r4030-6028f00df0)
38

39
VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
40
41
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/releases/17.01.7)
44

45
VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
John Crispin's avatar
John Crispin committed
46
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),LEDE)
47
VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
48

49
VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
John Crispin's avatar
John Crispin committed
50
VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),LEDE)
51

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/)
54

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/)
57
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/)
60

61
VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
62
63
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)
66
67
68
69
70
71
72
73
74
75

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

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

VERSION_TAINT_SPECS := \
76
	-ALL_KMODS:no-all \
77
	-IPV6:no-ipv6 \
78
	+USE_GLIBC:glibc \
79
80
	+USE_MKLIBS:mklibs \
	+BUSYBOX_CUSTOM:busybox \
81
	+OVERRIDE_PKGS:override \
82
83
84
85
86
87
88
89
90

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)))

91
92
93
94
95
96
97
98
99
100
101
VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
	-e 's,%V,$(VERSION_NUMBER),g' \
	-e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
	-e 's,%C,$(VERSION_CODE),g' \
	-e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
	-e 's,%N,$(VERSION_NICK),g' \
	-e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
	-e 's,%D,$(VERSION_DIST),g' \
	-e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
	-e 's,%R,$(REVISION),g' \
	-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
108
	-e 's,%b,$(VERSION_BUG_URL),g' \
	-e 's,%s,$(VERSION_SUPPORT_URL),g' \
109
110
	-e 's,%P,$(VERSION_PRODUCT),g' \
	-e 's,%h,$(VERSION_HWREV),g'
111
112

VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))