| @@ -1,246 +1,246 @@ | | | @@ -1,246 +1,246 @@ |
1 | # $NetBSD: phpversion.mk,v 1.209 2018/03/02 02:13:44 taca Exp $ | | 1 | # $NetBSD: phpversion.mk,v 1.210 2018/03/29 16:19:38 taca Exp $ |
2 | # | | 2 | # |
3 | # This file selects a PHP version, based on the user's preferences and | | 3 | # This file selects a PHP version, based on the user's preferences and |
4 | # the installed packages. It does not add a dependency on the PHP | | 4 | # the installed packages. It does not add a dependency on the PHP |
5 | # package. | | 5 | # package. |
6 | # | | 6 | # |
7 | # === User-settable variables === | | 7 | # === User-settable variables === |
8 | # | | 8 | # |
9 | # PHP_VERSION_DEFAULT | | 9 | # PHP_VERSION_DEFAULT |
10 | # The PHP version to choose when more than one is acceptable to | | 10 | # The PHP version to choose when more than one is acceptable to |
11 | # the package. | | 11 | # the package. |
12 | # | | 12 | # |
13 | # Possible: 56 70 71 72 | | 13 | # Possible: 56 70 71 72 |
14 | # Default: 71 | | 14 | # Default: 71 |
15 | # | | 15 | # |
16 | # === Infrastructure variables === | | 16 | # === Infrastructure variables === |
17 | # | | 17 | # |
18 | # PHP_VERSION_REQD | | 18 | # PHP_VERSION_REQD |
19 | # PHP version to use. This variable should not be set in | | 19 | # PHP version to use. This variable should not be set in |
20 | # packages. Normally it is used by bulk build tools. | | 20 | # packages. Normally it is used by bulk build tools. |
21 | # | | 21 | # |
22 | # Possible: ${PHP_VERSIONS_ACCEPTED} | | 22 | # Possible: ${PHP_VERSIONS_ACCEPTED} |
23 | # Default: ${PHP_VERSION_DEFAULT} | | 23 | # Default: ${PHP_VERSION_DEFAULT} |
24 | # | | 24 | # |
25 | # === Package-settable variables === | | 25 | # === Package-settable variables === |
26 | # | | 26 | # |
27 | # PHP_VERSIONS_ACCEPTED | | 27 | # PHP_VERSIONS_ACCEPTED |
28 | # The PHP versions that are accepted by the package. | | 28 | # The PHP versions that are accepted by the package. |
29 | # | | 29 | # |
30 | # Possible: 56 70 71 72 | | 30 | # Possible: 56 70 71 72 |
31 | # Default: 56 | | 31 | # Default: 71 |
32 | # | | 32 | # |
33 | # PHP_VERSIONS_INCOMPATIBLE | | 33 | # PHP_VERSIONS_INCOMPATIBLE |
34 | # The PHP versions that are not supported by the package. | | 34 | # The PHP versions that are not supported by the package. |
35 | # | | 35 | # |
36 | # Possible: 56 70 71 72 | | 36 | # Possible: 56 70 71 72 |
37 | # Default: (empty) | | 37 | # Default: (empty) |
38 | # | | 38 | # |
39 | # PHP_CHECK_INSTALLED | | 39 | # PHP_CHECK_INSTALLED |
40 | # Check installed version of PHP. Should be used by lang/php56, | | 40 | # Check installed version of PHP. Should be used by lang/php56, |
41 | # lang/php70, or lang/php71 only. | | 41 | # lang/php70, or lang/php71 only. |
42 | # | | 42 | # |
43 | # Possible: Yes No | | 43 | # Possible: Yes No |
44 | # Default: Yes | | 44 | # Default: Yes |
45 | # | | 45 | # |
46 | # === Variables defined by this file === | | 46 | # === Variables defined by this file === |
47 | # | | 47 | # |
48 | # PKG_PHP_VERSION | | 48 | # PKG_PHP_VERSION |
49 | # The selected PHP version. | | 49 | # The selected PHP version. |
50 | # | | 50 | # |
51 | # Possible: 56 70 71 72 | | 51 | # Possible: 56 70 71 72 |
52 | # Default: ${PHP_VERSION_DEFAULT} | | 52 | # Default: ${PHP_VERSION_DEFAULT} |
53 | # | | 53 | # |
54 | # PHP_BASE_VERS | | 54 | # PHP_BASE_VERS |
55 | # The selected PHP's full version depends on PKG_PHP_VERSION | | 55 | # The selected PHP's full version depends on PKG_PHP_VERSION |
56 | # | | 56 | # |
57 | # PKG_PHP_MAJOR_VERS | | 57 | # PKG_PHP_MAJOR_VERS |
58 | # The selected PHP's major version. | | 58 | # The selected PHP's major version. |
59 | # | | 59 | # |
60 | # Possible: 5 7 | | 60 | # Possible: 5 7 |
61 | # Default: 5 | | 61 | # Default: 7 |
62 | # | | 62 | # |
63 | # PKG_PHP | | 63 | # PKG_PHP |
64 | # The same as ${PKG_PHP_VERSION}, prefixed with "php-". | | 64 | # The same as ${PKG_PHP_VERSION}, prefixed with "php-". |
65 | # | | 65 | # |
66 | # PHPPKGSRCDIR | | 66 | # PHPPKGSRCDIR |
67 | # The directory of the PHP implementation, relative to the | | 67 | # The directory of the PHP implementation, relative to the |
68 | # package directory. | | 68 | # package directory. |
69 | # | | 69 | # |
70 | # Example: ../../lang/php56 | | 70 | # Example: ../../lang/php56 |
71 | # | | 71 | # |
72 | # PHP_PKG_PREFIX | | 72 | # PHP_PKG_PREFIX |
73 | # The prefix that is prepended to the package name. | | 73 | # The prefix that is prepended to the package name. |
74 | # | | 74 | # |
75 | # Example: php56 php70 php71 php72 | | 75 | # Example: php56 php70 php71 php72 |
76 | # | | 76 | # |
77 | # PHP_EXTENSION_DIR | | 77 | # PHP_EXTENSION_DIR |
78 | # Relative path to ${PREFIX} for PHP's extensions. It is derived from | | 78 | # Relative path to ${PREFIX} for PHP's extensions. It is derived from |
79 | # initial release of major version. | | 79 | # initial release of major version. |
80 | # | | 80 | # |
81 | # Example: lib/php/20140828 | | 81 | # Example: lib/php/20140828 |
82 | # | | 82 | # |
83 | # Keywords: php | | 83 | # Keywords: php |
84 | # | | 84 | # |
85 | | | 85 | |
86 | .if !defined(PHPVERSION_MK) | | 86 | .if !defined(PHPVERSION_MK) |
87 | PHPVERSION_MK= defined | | 87 | PHPVERSION_MK= defined |
88 | | | 88 | |
89 | # Define each PHP's version. | | 89 | # Define each PHP's version. |
90 | PHP56_VERSION= 5.6.34 | | 90 | PHP56_VERSION= 5.6.34 |
91 | PHP70_VERSION= 7.0.28 | | 91 | PHP70_VERSION= 7.0.28 |
92 | PHP71_VERSION= 7.1.15 | | 92 | PHP71_VERSION= 7.1.16 |
93 | PHP72_VERSION= 7.2.3 | | 93 | PHP72_VERSION= 7.2.3 |
94 | | | 94 | |
95 | # Define initial release of major version. | | 95 | # Define initial release of major version. |
96 | PHP56_RELDATE= 20140828 | | 96 | PHP56_RELDATE= 20140828 |
97 | PHP70_RELDATE= 20151203 | | 97 | PHP70_RELDATE= 20151203 |
98 | PHP71_RELDATE= 20160303 | | 98 | PHP71_RELDATE= 20160303 |
99 | PHP72_RELDATE= 20170718 | | 99 | PHP72_RELDATE= 20170718 |
100 | | | 100 | |
101 | _VARGROUPS+= php | | 101 | _VARGROUPS+= php |
102 | _USER_VARS.php= PHP_VERSION_DEFAULT | | 102 | _USER_VARS.php= PHP_VERSION_DEFAULT |
103 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD | | 103 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD |
104 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ | | 104 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ |
105 | PKG_PHP_MAJOR_VERS | | 105 | PKG_PHP_MAJOR_VERS |
106 | | | 106 | |
107 | .include "../../mk/bsd.prefs.mk" | | 107 | .include "../../mk/bsd.prefs.mk" |
108 | | | 108 | |
109 | PHP_VERSION_DEFAULT?= 71 | | 109 | PHP_VERSION_DEFAULT?= 71 |
110 | PHP_VERSIONS_ACCEPTED?= 56 70 71 72 | | 110 | PHP_VERSIONS_ACCEPTED?= 56 70 71 72 |
111 | .for pv in ${PHP_VERSIONS_ACCEPTED} | | 111 | .for pv in ${PHP_VERSIONS_ACCEPTED} |
112 | . if empty(PHP_VERSIONS_INCOMPATIBLE:M${pv}) | | 112 | . if empty(PHP_VERSIONS_INCOMPATIBLE:M${pv}) |
113 | _PHP_VERSIONS_ACCEPTED+= ${pv} | | 113 | _PHP_VERSIONS_ACCEPTED+= ${pv} |
114 | . endif | | 114 | . endif |
115 | .endfor | | 115 | .endfor |
116 | | | 116 | |
117 | # transform the list into individual variables | | 117 | # transform the list into individual variables |
118 | .for pv in ${_PHP_VERSIONS_ACCEPTED} | | 118 | .for pv in ${_PHP_VERSIONS_ACCEPTED} |
119 | _PHP_VERSION_${pv}_OK= yes | | 119 | _PHP_VERSION_${pv}_OK= yes |
120 | .endfor | | 120 | .endfor |
121 | | | 121 | |
122 | # check what is installed | | 122 | # check what is installed |
123 | .if exists(${LOCALBASE}/lib/php/${PHP72_RELDATE}) | | 123 | .if exists(${LOCALBASE}/lib/php/${PHP72_RELDATE}) |
124 | _PHP_VERSION_72_INSTALLED= yes | | 124 | _PHP_VERSION_72_INSTALLED= yes |
125 | _PHP_INSTALLED= yes | | 125 | _PHP_INSTALLED= yes |
126 | .elif exists(${LOCALBASE}/lib/php/${PHP71_RELDATE}) | | 126 | .elif exists(${LOCALBASE}/lib/php/${PHP71_RELDATE}) |
127 | _PHP_VERSION_71_INSTALLED= yes | | 127 | _PHP_VERSION_71_INSTALLED= yes |
128 | _PHP_INSTALLED= yes | | 128 | _PHP_INSTALLED= yes |
129 | .elif exists(${LOCALBASE}/lib/php/${PHP70_RELDATE}) | | 129 | .elif exists(${LOCALBASE}/lib/php/${PHP70_RELDATE}) |
130 | _PHP_VERSION_70_INSTALLED= yes | | 130 | _PHP_VERSION_70_INSTALLED= yes |
131 | _PHP_INSTALLED= yes | | 131 | _PHP_INSTALLED= yes |
132 | .elif exists(${LOCALBASE}/lib/php/${PHP56_RELDATE}) | | 132 | .elif exists(${LOCALBASE}/lib/php/${PHP56_RELDATE}) |
133 | _PHP_VERSION_56_INSTALLED= yes | | 133 | _PHP_VERSION_56_INSTALLED= yes |
134 | _PHP_INSTALLED= yes | | 134 | _PHP_INSTALLED= yes |
135 | .endif | | 135 | .endif |
136 | | | 136 | |
137 | # if a version is explicitely required, take it | | 137 | # if a version is explicitely required, take it |
138 | .if defined(PHP_VERSION_REQD) | | 138 | .if defined(PHP_VERSION_REQD) |
139 | _PHP_VERSION= ${PHP_VERSION_REQD} | | 139 | _PHP_VERSION= ${PHP_VERSION_REQD} |
140 | .endif | | 140 | .endif |
141 | # if the default is already installed, it is first choice | | 141 | # if the default is already installed, it is first choice |
142 | .if !defined(_PHP_VERSION) | | 142 | .if !defined(_PHP_VERSION) |
143 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 143 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
144 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) | | 144 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) |
145 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 145 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
146 | .endif | | 146 | .endif |
147 | .endif | | 147 | .endif |
148 | .endif | | 148 | .endif |
149 | # prefer an already installed version, in order of "accepted" | | 149 | # prefer an already installed version, in order of "accepted" |
150 | .if !defined(_PHP_VERSION) | | 150 | .if !defined(_PHP_VERSION) |
151 | .for pv in ${_PHP_VERSIONS_ACCEPTED} | | 151 | .for pv in ${_PHP_VERSIONS_ACCEPTED} |
152 | .if defined(_PHP_VERSION_${pv}_INSTALLED) | | 152 | .if defined(_PHP_VERSION_${pv}_INSTALLED) |
153 | _PHP_VERSION?= ${pv} | | 153 | _PHP_VERSION?= ${pv} |
154 | .else | | 154 | .else |
155 | # keep information as last resort - see below | | 155 | # keep information as last resort - see below |
156 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} | | 156 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} |
157 | .endif | | 157 | .endif |
158 | .endfor | | 158 | .endfor |
159 | .endif | | 159 | .endif |
160 | # if the default is OK for the addon pkg, take this | | 160 | # if the default is OK for the addon pkg, take this |
161 | .if !defined(_PHP_VERSION) | | 161 | .if !defined(_PHP_VERSION) |
162 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 162 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
163 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 163 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
164 | .endif | | 164 | .endif |
165 | .endif | | 165 | .endif |
166 | # take the first one accepted by the package | | 166 | # take the first one accepted by the package |
167 | .if !defined(_PHP_VERSION) | | 167 | .if !defined(_PHP_VERSION) |
168 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} | | 168 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} |
169 | .endif | | 169 | .endif |
170 | | | 170 | |
171 | # | | 171 | # |
172 | # Variable assignment for multi-PHP packages | | 172 | # Variable assignment for multi-PHP packages |
173 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} | | 173 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} |
174 | | | 174 | |
175 | # export some of internal variables | | 175 | # export some of internal variables |
176 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} | | 176 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} |
177 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} | | 177 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} |
178 | | | 178 | |
179 | # Major version | | 179 | # Major version |
180 | PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/} | | 180 | PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/} |
181 | | | 181 | |
182 | PHP_CHECK_INSTALLED?= Yes | | 182 | PHP_CHECK_INSTALLED?= Yes |
183 | | | 183 | |
184 | # if installed PHP isn't compatible with required PHP, bail out | | 184 | # if installed PHP isn't compatible with required PHP, bail out |
185 | .if empty(PHP_CHECK_INSTALLED:M[nN][oO]) | | 185 | .if empty(PHP_CHECK_INSTALLED:M[nN][oO]) |
186 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) | | 186 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) |
187 | PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" | | 187 | PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" |
188 | .endif | | 188 | .endif |
189 | .endif | | 189 | .endif |
190 | | | 190 | |
191 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 191 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
192 | PKG_PHP=${PKG_PHP} | | 192 | PKG_PHP=${PKG_PHP} |
193 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 193 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
194 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ | | 194 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ |
195 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} | | 195 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} |
196 | | | 196 | |
197 | # force the selected PHP version for recursive builds | | 197 | # force the selected PHP version for recursive builds |
198 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} | | 198 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} |
199 | | | 199 | |
200 | # | | 200 | # |
201 | # set variables for the version we decided to use: | | 201 | # set variables for the version we decided to use: |
202 | # | | 202 | # |
203 | .if ${_PHP_VERSION} == "56" | | 203 | .if ${_PHP_VERSION} == "56" |
204 | PHPPKGSRCDIR= ../../lang/php56 | | 204 | PHPPKGSRCDIR= ../../lang/php56 |
205 | PHP_VERSION= ${PHP56_VERSION} | | 205 | PHP_VERSION= ${PHP56_VERSION} |
206 | PHP_INITIAL_TEENY= 3 | | 206 | PHP_INITIAL_TEENY= 3 |
207 | PHP_PKG_PREFIX= php56 | | 207 | PHP_PKG_PREFIX= php56 |
208 | PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE} | | 208 | PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE} |
209 | .elif ${_PHP_VERSION} == "70" | | 209 | .elif ${_PHP_VERSION} == "70" |
210 | PHPPKGSRCDIR= ../../lang/php70 | | 210 | PHPPKGSRCDIR= ../../lang/php70 |
211 | PHP_VERSION= ${PHP70_VERSION} | | 211 | PHP_VERSION= ${PHP70_VERSION} |
212 | PHP_INITIAL_TEENY= 0 | | 212 | PHP_INITIAL_TEENY= 0 |
213 | PHP_PKG_PREFIX= php70 | | 213 | PHP_PKG_PREFIX= php70 |
214 | PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE} | | 214 | PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE} |
215 | .elif ${_PHP_VERSION} == "71" | | 215 | .elif ${_PHP_VERSION} == "71" |
216 | PHPPKGSRCDIR= ../../lang/php71 | | 216 | PHPPKGSRCDIR= ../../lang/php71 |
217 | PHP_VERSION= ${PHP71_VERSION} | | 217 | PHP_VERSION= ${PHP71_VERSION} |
218 | PHP_INITIAL_TEENY= 0 | | 218 | PHP_INITIAL_TEENY= 0 |
219 | PHP_PKG_PREFIX= php71 | | 219 | PHP_PKG_PREFIX= php71 |
220 | PHP_EXTENSION_DIR= lib/php/${PHP71_RELDATE} | | 220 | PHP_EXTENSION_DIR= lib/php/${PHP71_RELDATE} |
221 | .elif ${_PHP_VERSION} == "72" | | 221 | .elif ${_PHP_VERSION} == "72" |
222 | PHPPKGSRCDIR= ../../lang/php72 | | 222 | PHPPKGSRCDIR= ../../lang/php72 |
223 | PHP_VERSION= ${PHP72_VERSION} | | 223 | PHP_VERSION= ${PHP72_VERSION} |
224 | PHP_INITIAL_TEENY= 0 | | 224 | PHP_INITIAL_TEENY= 0 |
225 | PHP_PKG_PREFIX= php72 | | 225 | PHP_PKG_PREFIX= php72 |
226 | PHP_EXTENSION_DIR= lib/php/${PHP72_RELDATE} | | 226 | PHP_EXTENSION_DIR= lib/php/${PHP72_RELDATE} |
227 | .else | | 227 | .else |
228 | # force an error | | 228 | # force an error |
229 | PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package" | | 229 | PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package" |
230 | .endif | | 230 | .endif |
231 | | | 231 | |
232 | _PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/} | | 232 | _PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/} |
233 | _PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/} | | 233 | _PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/} |
234 | | | 234 | |
235 | PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY} | | 235 | PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY} |
236 | | | 236 | |
237 | # | | 237 | # |
238 | # check installed version aginst required: | | 238 | # check installed version aginst required: |
239 | # | | 239 | # |
240 | .if !empty(PHP_CHECK_INSTALLED:M[nN][oO]) | | 240 | .if !empty(PHP_CHECK_INSTALLED:M[nN][oO]) |
241 | .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} | | 241 | .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} |
242 | PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." | | 242 | PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." |
243 | .endif | | 243 | .endif |
244 | .endif | | 244 | .endif |
245 | | | 245 | |
246 | .endif # PHPVERSION_MK | | 246 | .endif # PHPVERSION_MK |