| @@ -1,235 +1,235 @@ | | | @@ -1,235 +1,235 @@ |
1 | # $NetBSD: phpversion.mk,v 1.161 2016/10/16 11:58:42 taca Exp $ | | 1 | # $NetBSD: phpversion.mk,v 1.162 2016/11/05 14:30:30 jdolecek 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 | | 13 | # Possible: 56 70 71 |
14 | # Default: 56 | | 14 | # Default: 56 |
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 | | 30 | # Possible: 56 70 71 |
31 | # Default: 56 | | 31 | # Default: 56 |
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 | | 36 | # Possible: 56 70 71 |
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 | | 51 | # Possible: 56 70 71 |
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: 5 |
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 | | 75 | # Example: php56 php70 php71 |
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.27 | | 90 | PHP56_VERSION= 5.6.27 |
91 | PHP70_VERSION= 7.0.12 | | 91 | PHP70_VERSION= 7.0.12 |
92 | PHP71_VERSION= 7.1.0RC3 | | 92 | PHP71_VERSION= 7.1.0RC5 |
93 | | | 93 | |
94 | # Define initial release of major version. | | 94 | # Define initial release of major version. |
95 | PHP56_RELDATE= 20140828 | | 95 | PHP56_RELDATE= 20140828 |
96 | PHP70_RELDATE= 20151203 | | 96 | PHP70_RELDATE= 20151203 |
97 | PHP71_RELDATE= 20160303 | | 97 | PHP71_RELDATE= 20160303 |
98 | | | 98 | |
99 | _VARGROUPS+= php | | 99 | _VARGROUPS+= php |
100 | _USER_VARS.php= PHP_VERSION_DEFAULT | | 100 | _USER_VARS.php= PHP_VERSION_DEFAULT |
101 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD | | 101 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD |
102 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ | | 102 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ |
103 | PKG_PHP_MAJOR_VERS | | 103 | PKG_PHP_MAJOR_VERS |
104 | | | 104 | |
105 | .include "../../mk/bsd.prefs.mk" | | 105 | .include "../../mk/bsd.prefs.mk" |
106 | | | 106 | |
107 | PHP_VERSION_DEFAULT?= 56 | | 107 | PHP_VERSION_DEFAULT?= 56 |
108 | PHP_VERSIONS_ACCEPTED?= 56 70 71 | | 108 | PHP_VERSIONS_ACCEPTED?= 56 70 71 |
109 | .for pv in ${PHP_VERSIONS_ACCEPTED} | | 109 | .for pv in ${PHP_VERSIONS_ACCEPTED} |
110 | . if empty(PHP_VERSIONS_INCOMPATIBLE:M${pv}) | | 110 | . if empty(PHP_VERSIONS_INCOMPATIBLE:M${pv}) |
111 | _PHP_VERSIONS_ACCEPTED+= ${pv} | | 111 | _PHP_VERSIONS_ACCEPTED+= ${pv} |
112 | . endif | | 112 | . endif |
113 | .endfor | | 113 | .endfor |
114 | | | 114 | |
115 | # transform the list into individual variables | | 115 | # transform the list into individual variables |
116 | .for pv in ${_PHP_VERSIONS_ACCEPTED} | | 116 | .for pv in ${_PHP_VERSIONS_ACCEPTED} |
117 | _PHP_VERSION_${pv}_OK= yes | | 117 | _PHP_VERSION_${pv}_OK= yes |
118 | .endfor | | 118 | .endfor |
119 | | | 119 | |
120 | # check what is installed | | 120 | # check what is installed |
121 | .if exists(${LOCALBASE}/lib/php/${PHP71_RELDATE}) | | 121 | .if exists(${LOCALBASE}/lib/php/${PHP71_RELDATE}) |
122 | _PHP_VERSION_71_INSTALLED= yes | | 122 | _PHP_VERSION_71_INSTALLED= yes |
123 | _PHP_INSTALLED= yes | | 123 | _PHP_INSTALLED= yes |
124 | .elif exists(${LOCALBASE}/lib/php/${PHP70_RELDATE}) | | 124 | .elif exists(${LOCALBASE}/lib/php/${PHP70_RELDATE}) |
125 | _PHP_VERSION_70_INSTALLED= yes | | 125 | _PHP_VERSION_70_INSTALLED= yes |
126 | _PHP_INSTALLED= yes | | 126 | _PHP_INSTALLED= yes |
127 | .elif exists(${LOCALBASE}/lib/php/${PHP56_RELDATE}) | | 127 | .elif exists(${LOCALBASE}/lib/php/${PHP56_RELDATE}) |
128 | _PHP_VERSION_56_INSTALLED= yes | | 128 | _PHP_VERSION_56_INSTALLED= yes |
129 | _PHP_INSTALLED= yes | | 129 | _PHP_INSTALLED= yes |
130 | .endif | | 130 | .endif |
131 | | | 131 | |
132 | # if a version is explicitely required, take it | | 132 | # if a version is explicitely required, take it |
133 | .if defined(PHP_VERSION_REQD) | | 133 | .if defined(PHP_VERSION_REQD) |
134 | _PHP_VERSION= ${PHP_VERSION_REQD} | | 134 | _PHP_VERSION= ${PHP_VERSION_REQD} |
135 | .endif | | 135 | .endif |
136 | # if the default is already installed, it is first choice | | 136 | # if the default is already installed, it is first choice |
137 | .if !defined(_PHP_VERSION) | | 137 | .if !defined(_PHP_VERSION) |
138 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 138 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
139 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) | | 139 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) |
140 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 140 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
141 | .endif | | 141 | .endif |
142 | .endif | | 142 | .endif |
143 | .endif | | 143 | .endif |
144 | # prefer an already installed version, in order of "accepted" | | 144 | # prefer an already installed version, in order of "accepted" |
145 | .if !defined(_PHP_VERSION) | | 145 | .if !defined(_PHP_VERSION) |
146 | .for pv in ${_PHP_VERSIONS_ACCEPTED} | | 146 | .for pv in ${_PHP_VERSIONS_ACCEPTED} |
147 | .if defined(_PHP_VERSION_${pv}_INSTALLED) | | 147 | .if defined(_PHP_VERSION_${pv}_INSTALLED) |
148 | _PHP_VERSION?= ${pv} | | 148 | _PHP_VERSION?= ${pv} |
149 | .else | | 149 | .else |
150 | # keep information as last resort - see below | | 150 | # keep information as last resort - see below |
151 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} | | 151 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} |
152 | .endif | | 152 | .endif |
153 | .endfor | | 153 | .endfor |
154 | .endif | | 154 | .endif |
155 | # if the default is OK for the addon pkg, take this | | 155 | # if the default is OK for the addon pkg, take this |
156 | .if !defined(_PHP_VERSION) | | 156 | .if !defined(_PHP_VERSION) |
157 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 157 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
158 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 158 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
159 | .endif | | 159 | .endif |
160 | .endif | | 160 | .endif |
161 | # take the first one accepted by the package | | 161 | # take the first one accepted by the package |
162 | .if !defined(_PHP_VERSION) | | 162 | .if !defined(_PHP_VERSION) |
163 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} | | 163 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} |
164 | .endif | | 164 | .endif |
165 | | | 165 | |
166 | # | | 166 | # |
167 | # Variable assignment for multi-PHP packages | | 167 | # Variable assignment for multi-PHP packages |
168 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} | | 168 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} |
169 | | | 169 | |
170 | # export some of internal variables | | 170 | # export some of internal variables |
171 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} | | 171 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} |
172 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} | | 172 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} |
173 | | | 173 | |
174 | # Major version | | 174 | # Major version |
175 | PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/} | | 175 | PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/} |
176 | | | 176 | |
177 | PHP_CHECK_INSTALLED?= Yes | | 177 | PHP_CHECK_INSTALLED?= Yes |
178 | | | 178 | |
179 | # if installed PHP isn't compatible with required PHP, bail out | | 179 | # if installed PHP isn't compatible with required PHP, bail out |
180 | .if empty(PHP_CHECK_INSTALLED:M[nN][oO]) | | 180 | .if empty(PHP_CHECK_INSTALLED:M[nN][oO]) |
181 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) | | 181 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) |
182 | PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" | | 182 | PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" |
183 | .endif | | 183 | .endif |
184 | .endif | | 184 | .endif |
185 | | | 185 | |
186 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 186 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
187 | PKG_PHP=${PKG_PHP} | | 187 | PKG_PHP=${PKG_PHP} |
188 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 188 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
189 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ | | 189 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ |
190 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} | | 190 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} |
191 | | | 191 | |
192 | # force the selected PHP version for recursive builds | | 192 | # force the selected PHP version for recursive builds |
193 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} | | 193 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} |
194 | | | 194 | |
195 | # | | 195 | # |
196 | # set variables for the version we decided to use: | | 196 | # set variables for the version we decided to use: |
197 | # | | 197 | # |
198 | .if ${_PHP_VERSION} == "56" | | 198 | .if ${_PHP_VERSION} == "56" |
199 | PHPPKGSRCDIR= ../../lang/php56 | | 199 | PHPPKGSRCDIR= ../../lang/php56 |
200 | PHP_VERSION= ${PHP56_VERSION} | | 200 | PHP_VERSION= ${PHP56_VERSION} |
201 | PHP_INITIAL_TEENY= 3 | | 201 | PHP_INITIAL_TEENY= 3 |
202 | PHP_PKG_PREFIX= php56 | | 202 | PHP_PKG_PREFIX= php56 |
203 | PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE} | | 203 | PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE} |
204 | .elif ${_PHP_VERSION} == "70" | | 204 | .elif ${_PHP_VERSION} == "70" |
205 | PHPPKGSRCDIR= ../../lang/php70 | | 205 | PHPPKGSRCDIR= ../../lang/php70 |
206 | PHP_VERSION= ${PHP70_VERSION} | | 206 | PHP_VERSION= ${PHP70_VERSION} |
207 | PHP_INITIAL_TEENY= 0 | | 207 | PHP_INITIAL_TEENY= 0 |
208 | PHP_PKG_PREFIX= php70 | | 208 | PHP_PKG_PREFIX= php70 |
209 | PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE} | | 209 | PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE} |
210 | .elif ${_PHP_VERSION} == "71" | | 210 | .elif ${_PHP_VERSION} == "71" |
211 | PHPPKGSRCDIR= ../../lang/php71 | | 211 | PHPPKGSRCDIR= ../../lang/php71 |
212 | PHP_VERSION= ${PHP71_VERSION} | | 212 | PHP_VERSION= ${PHP71_VERSION} |
213 | PHP_INITIAL_TEENY= 0 | | 213 | PHP_INITIAL_TEENY= 0 |
214 | PHP_PKG_PREFIX= php71 | | 214 | PHP_PKG_PREFIX= php71 |
215 | PHP_EXTENSION_DIR= lib/php/${PHP71_RELDATE} | | 215 | PHP_EXTENSION_DIR= lib/php/${PHP71_RELDATE} |
216 | .else | | 216 | .else |
217 | # force an error | | 217 | # force an error |
218 | PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package" | | 218 | PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package" |
219 | .endif | | 219 | .endif |
220 | | | 220 | |
221 | _PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/} | | 221 | _PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/} |
222 | _PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/} | | 222 | _PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/} |
223 | | | 223 | |
224 | PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY} | | 224 | PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY} |
225 | | | 225 | |
226 | # | | 226 | # |
227 | # check installed version aginst required: | | 227 | # check installed version aginst required: |
228 | # | | 228 | # |
229 | .if !empty(PHP_CHECK_INSTALLED:M[nN][oO]) | | 229 | .if !empty(PHP_CHECK_INSTALLED:M[nN][oO]) |
230 | .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} | | 230 | .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} |
231 | PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." | | 231 | PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." |
232 | .endif | | 232 | .endif |
233 | .endif | | 233 | .endif |
234 | | | 234 | |
235 | .endif # PHPVERSION_MK | | 235 | .endif # PHPVERSION_MK |