| @@ -1,182 +1,182 @@ | | | @@ -1,182 +1,182 @@ |
1 | # $NetBSD: phpversion.mk,v 1.32 2013/04/12 17:01:46 taca Exp $ | | 1 | # $NetBSD: phpversion.mk,v 1.33 2013/06/03 15:23:14 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: 53 54 | | 13 | # Possible: 53 54 |
14 | # Default: 54 | | 14 | # Default: 54 |
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: 53 54 | | 30 | # Possible: 53 54 |
31 | # Default: 54 53 | | 31 | # Default: 54 53 |
32 | # | | 32 | # |
33 | # === Variables defined by this file === | | 33 | # === Variables defined by this file === |
34 | # | | 34 | # |
35 | # PKG_PHP_VERSION | | 35 | # PKG_PHP_VERSION |
36 | # The selected PHP version. | | 36 | # The selected PHP version. |
37 | # | | 37 | # |
38 | # Possible: 53 54 | | 38 | # Possible: 53 54 |
39 | # Default: ${PHP_VERSION_DEFAULT} | | 39 | # Default: ${PHP_VERSION_DEFAULT} |
40 | # | | 40 | # |
41 | # PHP_BASE_VERS | | 41 | # PHP_BASE_VERS |
42 | # The selected PHP's full version depends on PKG_PHP_VERSION | | 42 | # The selected PHP's full version depends on PKG_PHP_VERSION |
43 | # | | 43 | # |
44 | # PKG_PHP_MAJOR_VERS | | 44 | # PKG_PHP_MAJOR_VERS |
45 | # The selected PHP's major version. | | 45 | # The selected PHP's major version. |
46 | # | | 46 | # |
47 | # Possible: 5 | | 47 | # Possible: 5 |
48 | # Default: 5 | | 48 | # Default: 5 |
49 | # | | 49 | # |
50 | # PKG_PHP | | 50 | # PKG_PHP |
51 | # The same as ${PKG_PHP_VERSION}, prefixed with "php-". | | 51 | # The same as ${PKG_PHP_VERSION}, prefixed with "php-". |
52 | # | | 52 | # |
53 | # PHPPKGSRCDIR | | 53 | # PHPPKGSRCDIR |
54 | # The directory of the PHP implementation, relative to the | | 54 | # The directory of the PHP implementation, relative to the |
55 | # package directory. | | 55 | # package directory. |
56 | # | | 56 | # |
57 | # Example: ../../lang/php54 | | 57 | # Example: ../../lang/php54 |
58 | # | | 58 | # |
59 | # PHP_PKG_PREFIX | | 59 | # PHP_PKG_PREFIX |
60 | # The prefix that is prepended to the package name. | | 60 | # The prefix that is prepended to the package name. |
61 | # | | 61 | # |
62 | # Example: php53, php54 | | 62 | # Example: php53, php54 |
63 | # | | 63 | # |
64 | # Keywords: php | | 64 | # Keywords: php |
65 | # | | 65 | # |
66 | | | 66 | |
67 | .if !defined(PHPVERSION_MK) | | 67 | .if !defined(PHPVERSION_MK) |
68 | PHPVERSION_MK= defined | | 68 | PHPVERSION_MK= defined |
69 | | | 69 | |
70 | _VARGROUPS+= php | | 70 | _VARGROUPS+= php |
71 | _USER_VARS.php= PHP_VERSION_DEFAULT | | 71 | _USER_VARS.php= PHP_VERSION_DEFAULT |
72 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD | | 72 | _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD |
73 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ | | 73 | _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \ |
74 | PKG_PHP_MAJOR_VERS | | 74 | PKG_PHP_MAJOR_VERS |
75 | | | 75 | |
76 | .include "../../mk/bsd.prefs.mk" | | 76 | .include "../../mk/bsd.prefs.mk" |
77 | | | 77 | |
78 | PHP53_VERSION= 5.3.24 | | 78 | PHP53_VERSION= 5.3.25 |
79 | PHP54_VERSION= 5.4.14 | | 79 | PHP54_VERSION= 5.4.15 |
80 | | | 80 | |
81 | PHP_VERSION_DEFAULT?= 54 | | 81 | PHP_VERSION_DEFAULT?= 54 |
82 | PHP_VERSIONS_ACCEPTED?= 54 53 | | 82 | PHP_VERSIONS_ACCEPTED?= 54 53 |
83 | | | 83 | |
84 | # transform the list into individual variables | | 84 | # transform the list into individual variables |
85 | .for pv in ${PHP_VERSIONS_ACCEPTED} | | 85 | .for pv in ${PHP_VERSIONS_ACCEPTED} |
86 | _PHP_VERSION_${pv}_OK= yes | | 86 | _PHP_VERSION_${pv}_OK= yes |
87 | .endfor | | 87 | .endfor |
88 | | | 88 | |
89 | # check what is installed | | 89 | # check what is installed |
90 | .if exists(${LOCALBASE}/lib/php/20120301) | | 90 | .if exists(${LOCALBASE}/lib/php/20120301) |
91 | _PHP_VERSION_54_INSTALLED= yes | | 91 | _PHP_VERSION_54_INSTALLED= yes |
92 | _PHP_INSTALLED= yes | | 92 | _PHP_INSTALLED= yes |
93 | .elif exists(${LOCALBASE}/lib/php/20090626) || exists(${LOCALBASE}/include/php/Zend/zend_gc.h) | | 93 | .elif exists(${LOCALBASE}/lib/php/20090626) || exists(${LOCALBASE}/include/php/Zend/zend_gc.h) |
94 | _PHP_VERSION_53_INSTALLED= yes | | 94 | _PHP_VERSION_53_INSTALLED= yes |
95 | _PHP_INSTALLED= yes | | 95 | _PHP_INSTALLED= yes |
96 | .endif | | 96 | .endif |
97 | | | 97 | |
98 | # if a version is explicitely required, take it | | 98 | # if a version is explicitely required, take it |
99 | .if defined(PHP_VERSION_REQD) | | 99 | .if defined(PHP_VERSION_REQD) |
100 | _PHP_VERSION= ${PHP_VERSION_REQD} | | 100 | _PHP_VERSION= ${PHP_VERSION_REQD} |
101 | .endif | | 101 | .endif |
102 | # if the default is already installed, it is first choice | | 102 | # if the default is already installed, it is first choice |
103 | .if !defined(_PHP_VERSION) | | 103 | .if !defined(_PHP_VERSION) |
104 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 104 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
105 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) | | 105 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) |
106 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 106 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
107 | .endif | | 107 | .endif |
108 | .endif | | 108 | .endif |
109 | .endif | | 109 | .endif |
110 | # prefer an already installed version, in order of "accepted" | | 110 | # prefer an already installed version, in order of "accepted" |
111 | .if !defined(_PHP_VERSION) | | 111 | .if !defined(_PHP_VERSION) |
112 | .for pv in ${PHP_VERSIONS_ACCEPTED} | | 112 | .for pv in ${PHP_VERSIONS_ACCEPTED} |
113 | .if defined(_PHP_VERSION_${pv}_INSTALLED) | | 113 | .if defined(_PHP_VERSION_${pv}_INSTALLED) |
114 | _PHP_VERSION?= ${pv} | | 114 | _PHP_VERSION?= ${pv} |
115 | .else | | 115 | .else |
116 | # keep information as last resort - see below | | 116 | # keep information as last resort - see below |
117 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} | | 117 | _PHP_VERSION_FIRSTACCEPTED?= ${pv} |
118 | .endif | | 118 | .endif |
119 | .endfor | | 119 | .endfor |
120 | .endif | | 120 | .endif |
121 | # if the default is OK for the addon pkg, take this | | 121 | # if the default is OK for the addon pkg, take this |
122 | .if !defined(_PHP_VERSION) | | 122 | .if !defined(_PHP_VERSION) |
123 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) | | 123 | .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) |
124 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} | | 124 | _PHP_VERSION= ${PHP_VERSION_DEFAULT} |
125 | .endif | | 125 | .endif |
126 | .endif | | 126 | .endif |
127 | # take the first one accepted by the package | | 127 | # take the first one accepted by the package |
128 | .if !defined(_PHP_VERSION) | | 128 | .if !defined(_PHP_VERSION) |
129 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} | | 129 | _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} |
130 | .endif | | 130 | .endif |
131 | | | 131 | |
132 | # | | 132 | # |
133 | # Variable assignment for multi-PHP packages | | 133 | # Variable assignment for multi-PHP packages |
134 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} | | 134 | MULTI+= PHP_VERSION_REQD=${_PHP_VERSION} |
135 | | | 135 | |
136 | # export some of internal variables | | 136 | # export some of internal variables |
137 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} | | 137 | PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//} |
138 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} | | 138 | PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/} |
139 | | | 139 | |
140 | # currently we have only PHP 5.x packages. | | 140 | # currently we have only PHP 5.x packages. |
141 | PKG_PHP_MAJOR_VERS:= 5 | | 141 | PKG_PHP_MAJOR_VERS:= 5 |
142 | | | 142 | |
143 | # if installed PHP isn't compatible with required PHP, bail out | | 143 | # if installed PHP isn't compatible with required PHP, bail out |
144 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) | | 144 | .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED) |
145 | PKG_SKIP_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" | | 145 | PKG_SKIP_REASON+= "Package accepts ${PKG_PHP}, but different version is installed" |
146 | .endif | | 146 | .endif |
147 | | | 147 | |
148 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 148 | MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
149 | PKG_PHP=${PKG_PHP} | | 149 | PKG_PHP=${PKG_PHP} |
150 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ | | 150 | PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ |
151 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ | | 151 | PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \ |
152 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} | | 152 | PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR} |
153 | | | 153 | |
154 | # force the selected PHP version for recursive builds | | 154 | # force the selected PHP version for recursive builds |
155 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} | | 155 | PHP_VERSION_REQD:= ${PKG_PHP_VERSION} |
156 | | | 156 | |
157 | # | | 157 | # |
158 | # set variables for the version we decided to use: | | 158 | # set variables for the version we decided to use: |
159 | # | | 159 | # |
160 | .if ${_PHP_VERSION} == "53" | | 160 | .if ${_PHP_VERSION} == "53" |
161 | PHPPKGSRCDIR= ../../lang/php53 | | 161 | PHPPKGSRCDIR= ../../lang/php53 |
162 | PHP_BASE_VERS= ${PHP53_VERSION} | | 162 | PHP_BASE_VERS= ${PHP53_VERSION} |
163 | PHP_PKG_PREFIX= php53 | | 163 | PHP_PKG_PREFIX= php53 |
164 | .elif ${_PHP_VERSION} == "54" | | 164 | .elif ${_PHP_VERSION} == "54" |
165 | PHPPKGSRCDIR= ../../lang/php54 | | 165 | PHPPKGSRCDIR= ../../lang/php54 |
166 | PHP_BASE_VERS= ${PHP54_VERSION} | | 166 | PHP_BASE_VERS= ${PHP54_VERSION} |
167 | PHP_PKG_PREFIX= php54 | | 167 | PHP_PKG_PREFIX= php54 |
168 | .else | | 168 | .else |
169 | # force an error | | 169 | # force an error |
170 | PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package" | | 170 | PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package" |
171 | .endif | | 171 | .endif |
172 | | | 172 | |
173 | # | | 173 | # |
174 | # check installed version aginst required: | | 174 | # check installed version aginst required: |
175 | # | | 175 | # |
176 | .if defined(_PHP_VERSION_INSTALLED) | | 176 | .if defined(_PHP_VERSION_INSTALLED) |
177 | .if ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} | | 177 | .if ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED} |
178 | PKG_SKIP_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." | | 178 | PKG_SKIP_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed." |
179 | .endif | | 179 | .endif |
180 | .endif | | 180 | .endif |
181 | | | 181 | |
182 | .endif # PHPVERSION_MK | | 182 | .endif # PHPVERSION_MK |