| @@ -1,224 +1,224 @@ | | | @@ -1,224 +1,224 @@ |
1 | # $NetBSD: phpversion.mk,v 1.141 2016/06/24 15:27:57 taca Exp $ | | 1 | # $NetBSD: phpversion.mk,v 1.142 2016/07/24 02:15:15 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: 55 56 70 | | 13 | # Possible: 55 56 70 |
14 | # Default: 55 | | 14 | # Default: 55 |
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: 55 56 70 | | 30 | # Possible: 55 56 70 |
31 | # Default: 55 56 | | 31 | # Default: 55 56 |
32 | # | | 32 | # |
33 | # PHP_CHECK_INSTALLED | | 33 | # PHP_CHECK_INSTALLED |
34 | # Check installed version of PHP. Should be used by lang/php55, | | 34 | # Check installed version of PHP. Should be used by lang/php55, |
35 | # lang/php56 and lang/php70 only. | | 35 | # lang/php56 and lang/php70 only. |
36 | # | | 36 | # |
37 | # Possible: Yes No | | 37 | # Possible: Yes No |
38 | # Default: Yes | | 38 | # Default: Yes |
39 | # | | 39 | # |
40 | # === Variables defined by this file === | | 40 | # === Variables defined by this file === |
41 | # | | 41 | # |
42 | # PKG_PHP_VERSION | | 42 | # PKG_PHP_VERSION |
43 | # The selected PHP version. | | 43 | # The selected PHP version. |
44 | # | | 44 | # |
45 | # Possible: 55 56 70 | | 45 | # Possible: 55 56 70 |
46 | # Default: ${PHP_VERSION_DEFAULT} | | 46 | # Default: ${PHP_VERSION_DEFAULT} |
47 | # | | 47 | # |
48 | # PHP_BASE_VERS | | 48 | # PHP_BASE_VERS |
49 | # The selected PHP's full version depends on PKG_PHP_VERSION | | 49 | # The selected PHP's full version depends on PKG_PHP_VERSION |
50 | # | | 50 | # |
51 | # PKG_PHP_MAJOR_VERS | | 51 | # PKG_PHP_MAJOR_VERS |
52 | # The selected PHP's major version. | | 52 | # The selected PHP's major version. |
53 | # | | 53 | # |
54 | # Possible: 5 7 | | 54 | # Possible: 5 7 |
55 | # Default: 5 | | 55 | # Default: 5 |
56 | # | | 56 | # |
57 | # PKG_PHP | | 57 | # PKG_PHP |
58 | # The same as ${PKG_PHP_VERSION}, prefixed with "php-". | | 58 | # The same as ${PKG_PHP_VERSION}, prefixed with "php-". |
59 | # | | 59 | # |
60 | # PHPPKGSRCDIR | | 60 | # PHPPKGSRCDIR |
61 | # The directory of the PHP implementation, relative to the | | 61 | # The directory of the PHP implementation, relative to the |
62 | # package directory. | | 62 | # package directory. |
63 | # | | 63 | # |
64 | # Example: ../../lang/php55 | | 64 | # Example: ../../lang/php55 |
65 | # | | 65 | # |
66 | # PHP_PKG_PREFIX | | 66 | # PHP_PKG_PREFIX |
67 | # The prefix that is prepended to the package name. | | 67 | # The prefix that is prepended to the package name. |
68 | # | | 68 | # |
69 | # Example: php55 php56 php70 | | 69 | # Example: php55 php56 php70 |
70 | # | | 70 | # |
71 | # PHP_EXTENSION_DIR | | 71 | # PHP_EXTENSION_DIR |
72 | # Relative path to ${PREFIX} for PHP's extensions. It is derived from | | 72 | # Relative path to ${PREFIX} for PHP's extensions. It is derived from |
73 | # initial release of major version. | | 73 | # initial release of major version. |
74 | # | | 74 | # |
75 | # Example: lib/php/20090630 | | 75 | # Example: lib/php/20090630 |
76 | # | | 76 | # |
77 | # Keywords: php | | 77 | # Keywords: php |
78 | # | | 78 | # |
79 | | | 79 | |
80 | .if !defined(PHPVERSION_MK) | | 80 | .if !defined(PHPVERSION_MK) |
81 | PHPVERSION_MK= defined | | 81 | PHPVERSION_MK= defined |
82 | | | 82 | |
83 | # Define each PHP's version. | | 83 | # Define each PHP's version. |
84 | PHP55_VERSION= 5.5.37 | | 84 | PHP55_VERSION= 5.5.38 |
85 | PHP56_VERSION= 5.6.23 | | 85 | PHP56_VERSION= 5.6.23 |
86 | PHP70_VERSION= 7.0.8 | | 86 | PHP70_VERSION= 7.0.8 |
87 | | | 87 | |
88 | # Define initial release of major version. | | 88 | # Define initial release of major version. |
89 | PHP55_RELDATE= 20130620 | | 89 | PHP55_RELDATE= 20130620 |
90 | PHP56_RELDATE= 20140828 | | 90 | PHP56_RELDATE= 20140828 |
91 | PHP70_RELDATE= 20151203 | | 91 | PHP70_RELDATE= 20151203 |
92 | | | 92 | |
93 | _VARGROUPS+= php | | 93 | _VARGROUPS+= php |
94 | _USER_VARS.php= PHP_VERSION_DEFAULT | | 94 | _USER_VARS.php= PHP_VERSION_DEFAULT |
95 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD | | 95 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD |
96 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ | | 96 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ |
97 | PKG_PHP_MAJOR_VERS | | 97 | PKG_PHP_MAJOR_VERS |
98 | | | 98 | |
99 | .include "../../mk/bsd.prefs.mk" | | 99 | .include "../../mk/bsd.prefs.mk" |
100 | | | 100 | |
101 | PHP_VERSION_DEFAULT?= 55 | | 101 | PHP_VERSION_DEFAULT?= 55 |
102 | PHP_VERSIONS_ACCEPTED?= 55 56 70 | | 102 | PHP_VERSIONS_ACCEPTED?= 55 56 70 |
103 | | | 103 | |
104 | # transform the list into individual variables | | 104 | # transform the list into individual variables |
105 | .for pv in ${PHP_VERSIONS_ACCEPTED} | | 105 | .for pv in ${PHP_VERSIONS_ACCEPTED} |
106 | _PHP_VERSION_${pv}_OK= yes | | 106 | _PHP_VERSION_${pv}_OK= yes |
107 | .endfor | | 107 | .endfor |
108 | | | 108 | |
109 | # check what is installed | | 109 | # check what is installed |
110 | .if exists(${LOCALBASE}/lib/php/20151203) | | 110 | .if exists(${LOCALBASE}/lib/php/20151203) |
111 | _PHP_VERSION_70_INSTALLED= yes | | 111 | _PHP_VERSION_70_INSTALLED= yes |
112 | _PHP_INSTALLED= yes | | 112 | _PHP_INSTALLED= yes |
113 | .elif exists(${LOCALBASE}/lib/php/20140828) | | 113 | .elif exists(${LOCALBASE}/lib/php/20140828) |
114 | _PHP_VERSION_56_INSTALLED= yes | | 114 | _PHP_VERSION_56_INSTALLED= yes |
115 | _PHP_INSTALLED= yes | | 115 | _PHP_INSTALLED= yes |
116 | .elif exists(${LOCALBASE}/lib/php/20130620) | | 116 | .elif exists(${LOCALBASE}/lib/php/20130620) |
117 | _PHP_VERSION_55_INSTALLED= yes | | 117 | _PHP_VERSION_55_INSTALLED= yes |
118 | _PHP_INSTALLED= yes | | 118 | _PHP_INSTALLED= yes |
119 | .endif | | 119 | .endif |
120 | | | 120 | |
121 | # if a version is explicitely required, take it | | 121 | # if a version is explicitely required, take it |
122 | .if defined(PHP_VERSION_REQD) | | 122 | .if defined(PHP_VERSION_REQD) |
123 | _PHP_VERSION= ${PHP_VERSION_REQD} | | 123 | _PHP_VERSION= ${PHP_VERSION_REQD} |
124 | .endif | | 124 | .endif |
125 | # if the default is already installed, it is first choice | | 125 | # if the default is already installed, it is first choice |
126 | .if !defined(_PHP_VERSION) | | 126 | .if !defined(_PHP_VERSION) |
127 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 127 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
128 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) | | 128 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) |
129 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 129 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
130 | .endif | | 130 | .endif |
131 | .endif | | 131 | .endif |
132 | .endif | | 132 | .endif |
133 | # prefer an already installed version, in order of "accepted" | | 133 | # prefer an already installed version, in order of "accepted" |
134 | .if !defined(_PHP_VERSION) | | 134 | .if !defined(_PHP_VERSION) |
135 | .for pv in ${PHP_VERSIONS_ACCEPTED} | | 135 | .for pv in ${PHP_VERSIONS_ACCEPTED} |
136 | .if defined(_PHP_VERSION_${pv}_INSTALLED) | | 136 | .if defined(_PHP_VERSION_${pv}_INSTALLED) |
137 | _PHP_VERSION?= ${pv} | | 137 | _PHP_VERSION?= ${pv} |
138 | .else | | 138 | .else |
139 | # keep information as last resort - see below | | 139 | # keep information as last resort - see below |
140 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} | | 140 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} |
141 | .endif | | 141 | .endif |
142 | .endfor | | 142 | .endfor |
143 | .endif | | 143 | .endif |
144 | # if the default is OK for the addon pkg, take this | | 144 | # if the default is OK for the addon pkg, take this |
145 | .if !defined(_PHP_VERSION) | | 145 | .if !defined(_PHP_VERSION) |
146 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 146 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
147 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 147 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
148 | .endif | | 148 | .endif |
149 | .endif | | 149 | .endif |
150 | # take the first one accepted by the package | | 150 | # take the first one accepted by the package |
151 | .if !defined(_PHP_VERSION) | | 151 | .if !defined(_PHP_VERSION) |
152 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} | | 152 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} |
153 | .endif | | 153 | .endif |
154 | | | 154 | |
155 | # | | 155 | # |
156 | # Variable assignment for multi-PHP packages | | 156 | # Variable assignment for multi-PHP packages |
157 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} | | 157 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} |
158 | | | 158 | |
159 | # export some of internal variables | | 159 | # export some of internal variables |
160 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} | | 160 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} |
161 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} | | 161 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} |
162 | | | 162 | |
163 | # Major version | | 163 | # Major version |
164 | PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/} | | 164 | PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/} |
165 | | | 165 | |
166 | PHP_CHECK_INSTALLED?= Yes | | 166 | PHP_CHECK_INSTALLED?= Yes |
167 | | | 167 | |
168 | # if installed PHP isn't compatible with required PHP, bail out | | 168 | # if installed PHP isn't compatible with required PHP, bail out |
169 | .if empty(PHP_CHECK_INSTALLED:M[nN][oO]) | | 169 | .if empty(PHP_CHECK_INSTALLED:M[nN][oO]) |
170 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) | | 170 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) |
171 | PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" | | 171 | PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" |
172 | .endif | | 172 | .endif |
173 | .endif | | 173 | .endif |
174 | | | 174 | |
175 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 175 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
176 | PKG_PHP=${PKG_PHP} | | 176 | PKG_PHP=${PKG_PHP} |
177 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 177 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
178 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ | | 178 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ |
179 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} | | 179 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} |
180 | | | 180 | |
181 | # force the selected PHP version for recursive builds | | 181 | # force the selected PHP version for recursive builds |
182 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} | | 182 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} |
183 | | | 183 | |
184 | # | | 184 | # |
185 | # set variables for the version we decided to use: | | 185 | # set variables for the version we decided to use: |
186 | # | | 186 | # |
187 | .if ${_PHP_VERSION} == "55" | | 187 | .if ${_PHP_VERSION} == "55" |
188 | PHPPKGSRCDIR= ../../lang/php55 | | 188 | PHPPKGSRCDIR= ../../lang/php55 |
189 | PHP_VERSION= ${PHP55_VERSION} | | 189 | PHP_VERSION= ${PHP55_VERSION} |
190 | PHP_INITIAL_TEENY= 1 | | 190 | PHP_INITIAL_TEENY= 1 |
191 | PHP_PKG_PREFIX= php55 | | 191 | PHP_PKG_PREFIX= php55 |
192 | PHP_EXTENSION_DIR= lib/php/${PHP55_RELDATE} | | 192 | PHP_EXTENSION_DIR= lib/php/${PHP55_RELDATE} |
193 | .elif ${_PHP_VERSION} == "56" | | 193 | .elif ${_PHP_VERSION} == "56" |
194 | PHPPKGSRCDIR= ../../lang/php56 | | 194 | PHPPKGSRCDIR= ../../lang/php56 |
195 | PHP_VERSION= ${PHP56_VERSION} | | 195 | PHP_VERSION= ${PHP56_VERSION} |
196 | PHP_INITIAL_TEENY= 3 | | 196 | PHP_INITIAL_TEENY= 3 |
197 | PHP_PKG_PREFIX= php56 | | 197 | PHP_PKG_PREFIX= php56 |
198 | PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE} | | 198 | PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE} |
199 | .elif ${_PHP_VERSION} == "70" | | 199 | .elif ${_PHP_VERSION} == "70" |
200 | PHPPKGSRCDIR= ../../lang/php70 | | 200 | PHPPKGSRCDIR= ../../lang/php70 |
201 | PHP_VERSION= ${PHP70_VERSION} | | 201 | PHP_VERSION= ${PHP70_VERSION} |
202 | PHP_INITIAL_TEENY= 0 | | 202 | PHP_INITIAL_TEENY= 0 |
203 | PHP_PKG_PREFIX= php70 | | 203 | PHP_PKG_PREFIX= php70 |
204 | PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE} | | 204 | PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE} |
205 | .else | | 205 | .else |
206 | # force an error | | 206 | # force an error |
207 | PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package" | | 207 | PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package" |
208 | .endif | | 208 | .endif |
209 | | | 209 | |
210 | _PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/} | | 210 | _PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/} |
211 | _PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/} | | 211 | _PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/} |
212 | | | 212 | |
213 | PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY} | | 213 | PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY} |
214 | | | 214 | |
215 | # | | 215 | # |
216 | # check installed version aginst required: | | 216 | # check installed version aginst required: |
217 | # | | 217 | # |
218 | .if !empty(PHP_CHECK_INSTALLED:M[nN][oO]) | | 218 | .if !empty(PHP_CHECK_INSTALLED:M[nN][oO]) |
219 | .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} | | 219 | .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} |
220 | PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." | | 220 | PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." |
221 | .endif | | 221 | .endif |
222 | .endif | | 222 | .endif |
223 | | | 223 | |
224 | .endif # PHPVERSION_MK | | 224 | .endif # PHPVERSION_MK |