| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.18 2007/03/05 01:50:47 chtekk Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.21 2007/09/01 15:58:17 jokey Exp $ |
| 4 | |
4 | |
| 5 | # ======================================================================== |
5 | # Author: Stuart Herbert <stuart@gentoo.org> |
| 6 | # |
6 | # Author: Luca Longinotti <chtekk@gentoo.org> |
|
|
7 | # Author: Jakub Moc <jakub@gentoo.org> (documentation) |
|
|
8 | |
| 7 | # depend.php.eclass |
9 | # @ECLASS: depend.php.eclass |
| 8 | # Functions to allow ebuilds to depend on php4 and/or php5 |
10 | # @MAINTAINER: |
| 9 | # |
|
|
| 10 | # Author: Stuart Herbert |
|
|
| 11 | # <stuart@gentoo.org> |
|
|
| 12 | # |
|
|
| 13 | # Author: Luca Longinotti |
|
|
| 14 | # <chtekk@gentoo.org> |
|
|
| 15 | # |
|
|
| 16 | # Maintained by the PHP Team <php-bugs@gentoo.org> |
11 | # Gentoo PHP team <php-bugs@gentoo.org> |
| 17 | # |
12 | # @BLURB: Functions to allow ebuilds to depend on php[45] and check for specific features. |
| 18 | # ======================================================================== |
13 | # @DESCRIPTION: |
|
|
14 | # This eclass provides functions that allow ebuilds to depend on php[45] and check |
|
|
15 | # for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install |
|
|
16 | # documentation for PHP packages to php-specific location. |
|
|
17 | |
| 19 | |
18 | |
| 20 | inherit eutils phpconfutils |
19 | inherit eutils phpconfutils |
| 21 | |
20 | |
| 22 | # PHP4-only depend functions |
21 | # PHP4-only depend functions |
|
|
22 | |
|
|
23 | # @FUNCTION: need_php4_cli |
|
|
24 | # @DESCRIPTION: |
|
|
25 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4 |
|
|
26 | # with cli SAPI. |
| 23 | need_php4_cli() { |
27 | need_php4_cli() { |
| 24 | DEPEND="${DEPEND} =virtual/php-4*" |
28 | DEPEND="${DEPEND} =virtual/php-4*" |
| 25 | RDEPEND="${RDEPEND} =virtual/php-4*" |
29 | RDEPEND="${RDEPEND} =virtual/php-4*" |
| 26 | PHP_VERSION="4" |
30 | PHP_VERSION="4" |
| 27 | } |
31 | } |
| 28 | |
32 | |
|
|
33 | # @FUNCTION: need_php4_httpd |
|
|
34 | # @DESCRIPTION: |
|
|
35 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4 |
|
|
36 | # with either cgi or apache2 SAPI. |
| 29 | need_php4_httpd() { |
37 | need_php4_httpd() { |
| 30 | DEPEND="${DEPEND} =virtual/httpd-php-4*" |
38 | DEPEND="${DEPEND} =virtual/httpd-php-4*" |
| 31 | RDEPEND="${RDEPEND} =virtual/httpd-php-4*" |
39 | RDEPEND="${RDEPEND} =virtual/httpd-php-4*" |
| 32 | PHP_VERSION="4" |
40 | PHP_VERSION="4" |
| 33 | } |
41 | } |
| 34 | |
42 | |
|
|
43 | # @FUNCTION: need_php4 |
|
|
44 | # @DESCRIPTION: |
|
|
45 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP4 |
|
|
46 | # (with any SAPI). |
| 35 | need_php4() { |
47 | need_php4() { |
| 36 | DEPEND="${DEPEND} =dev-lang/php-4*" |
48 | DEPEND="${DEPEND} =dev-lang/php-4*" |
| 37 | RDEPEND="${RDEPEND} =dev-lang/php-4*" |
49 | RDEPEND="${RDEPEND} =dev-lang/php-4*" |
| 38 | PHP_VERSION="4" |
50 | PHP_VERSION="4" |
| 39 | PHP_SHARED_CAT="php4" |
51 | PHP_SHARED_CAT="php4" |
| … | |
… | |
| 56 | einfo "Using ${PHP_PKG}" |
68 | einfo "Using ${PHP_PKG}" |
| 57 | einfo |
69 | einfo |
| 58 | } |
70 | } |
| 59 | |
71 | |
| 60 | # PHP5-only depend functions |
72 | # PHP5-only depend functions |
|
|
73 | |
|
|
74 | # @FUNCTION: need_php5_cli |
|
|
75 | # @DESCRIPTION: |
|
|
76 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 |
|
|
77 | # with cli SAPI. |
| 61 | need_php5_cli() { |
78 | need_php5_cli() { |
| 62 | DEPEND="${DEPEND} =virtual/php-5*" |
79 | DEPEND="${DEPEND} =virtual/php-5*" |
| 63 | RDEPEND="${RDEPEND} =virtual/php-5*" |
80 | RDEPEND="${RDEPEND} =virtual/php-5*" |
| 64 | PHP_VERSION="5" |
81 | PHP_VERSION="5" |
| 65 | } |
82 | } |
| 66 | |
83 | |
|
|
84 | # @FUNCTION: need_php5_httpd |
|
|
85 | # @DESCRIPTION: |
|
|
86 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 |
|
|
87 | # with either cgi or apache2 SAPI. |
| 67 | need_php5_httpd() { |
88 | need_php5_httpd() { |
| 68 | DEPEND="${DEPEND} =virtual/httpd-php-5*" |
89 | DEPEND="${DEPEND} =virtual/httpd-php-5*" |
| 69 | RDEPEND="${RDEPEND} =virtual/httpd-php-5*" |
90 | RDEPEND="${RDEPEND} =virtual/httpd-php-5*" |
| 70 | PHP_VERSION="5" |
91 | PHP_VERSION="5" |
| 71 | } |
92 | } |
| 72 | |
93 | |
|
|
94 | # @FUNCTION: need_php5 |
|
|
95 | # @DESCRIPTION: |
|
|
96 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 |
|
|
97 | # (with any SAPI). |
| 73 | need_php5() { |
98 | need_php5() { |
| 74 | DEPEND="${DEPEND} =dev-lang/php-5*" |
99 | DEPEND="${DEPEND} =dev-lang/php-5*" |
| 75 | RDEPEND="${RDEPEND} =dev-lang/php-5*" |
100 | RDEPEND="${RDEPEND} =dev-lang/php-5*" |
| 76 | PHP_VERSION="5" |
101 | PHP_VERSION="5" |
| 77 | PHP_SHARED_CAT="php5" |
102 | PHP_SHARED_CAT="php5" |
| … | |
… | |
| 94 | einfo "Using ${PHP_PKG}" |
119 | einfo "Using ${PHP_PKG}" |
| 95 | einfo |
120 | einfo |
| 96 | } |
121 | } |
| 97 | |
122 | |
| 98 | # general PHP depend functions |
123 | # general PHP depend functions |
|
|
124 | |
|
|
125 | # @FUNCTION: need_php_cli |
|
|
126 | # @DESCRIPTION: |
|
|
127 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP |
|
|
128 | # (any version) with cli SAPI. |
| 99 | need_php_cli() { |
129 | need_php_cli() { |
| 100 | DEPEND="${DEPEND} virtual/php" |
130 | DEPEND="${DEPEND} virtual/php" |
| 101 | RDEPEND="${RDEPEND} virtual/php" |
131 | RDEPEND="${RDEPEND} virtual/php" |
| 102 | } |
132 | } |
| 103 | |
133 | |
|
|
134 | # @FUNCTION: need_php_httpd |
|
|
135 | # @DESCRIPTION: |
|
|
136 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP |
|
|
137 | # (any version) with either cgi or apache2 SAPI. |
| 104 | need_php_httpd() { |
138 | need_php_httpd() { |
| 105 | DEPEND="${DEPEND} virtual/httpd-php" |
139 | DEPEND="${DEPEND} virtual/httpd-php" |
| 106 | RDEPEND="${RDEPEND} virtual/httpd-php" |
140 | RDEPEND="${RDEPEND} virtual/httpd-php" |
| 107 | } |
141 | } |
| 108 | |
142 | |
|
|
143 | # @FUNCTION: need_php |
|
|
144 | # @DESCRIPTION: |
|
|
145 | # Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP |
|
|
146 | # (any version with any SAPI). |
| 109 | need_php() { |
147 | need_php() { |
| 110 | DEPEND="${DEPEND} dev-lang/php" |
148 | DEPEND="${DEPEND} dev-lang/php" |
| 111 | RDEPEND="${RDEPEND} dev-lang/php" |
149 | RDEPEND="${RDEPEND} dev-lang/php" |
| 112 | PHP_SHARED_CAT="php" |
150 | PHP_SHARED_CAT="php" |
| 113 | } |
151 | } |
| 114 | |
152 | |
|
|
153 | # @FUNCTION: need_php_by_category |
|
|
154 | # @DESCRIPTION: |
|
|
155 | # Set this after setting DEPEND/RDEPEND in your ebuild to depend on PHP version |
|
|
156 | # determined by ${CATEGORY} - any PHP version, PHP4 or PHP5 for dev-php, dev-php4 and |
|
|
157 | # dev-php5, respectively. |
| 115 | need_php_by_category() { |
158 | need_php_by_category() { |
| 116 | case "${CATEGORY}" in |
159 | case "${CATEGORY}" in |
| 117 | dev-php) need_php ;; |
160 | dev-php) need_php ;; |
| 118 | dev-php4) need_php4 ;; |
161 | dev-php4) need_php4 ;; |
| 119 | dev-php5) need_php5 ;; |
162 | dev-php5) need_php5 ;; |
| 120 | *) die "Version of PHP required by packages in category ${CATEGORY} unknown" |
163 | *) die "Version of PHP required by packages in category ${CATEGORY} unknown" |
| 121 | esac |
164 | esac |
| 122 | } |
165 | } |
| 123 | |
166 | |
|
|
167 | |
|
|
168 | # @FUNCTION: has_php |
|
|
169 | # @DESCRIPTION: |
| 124 | # Call this function from your pkg_setup, src_compile and src_install methods |
170 | # Call this function from your pkg_setup, src_compile, src_install etc. if you |
| 125 | # if you need to know where the PHP binaries are installed and their data |
171 | # need to know which PHP version is being used and where the PHP binaries/data |
| 126 | |
172 | # are installed. |
| 127 | has_php() { |
173 | has_php() { |
| 128 | # If PHP_PKG is already set, then we have remembered our PHP settings |
174 | # If PHP_PKG is already set, then we have remembered our PHP settings |
| 129 | # from last time |
175 | # from last time |
| 130 | if [[ -n ${PHP_PKG} ]] ; then |
176 | if [[ -n ${PHP_PKG} ]] ; then |
| 131 | return |
177 | return |
| … | |
… | |
| 145 | # If we get here, then PHP_VERSION tells us which version of PHP we |
191 | # If we get here, then PHP_VERSION tells us which version of PHP we |
| 146 | # want to use |
192 | # want to use |
| 147 | uses_php${PHP_VERSION} |
193 | uses_php${PHP_VERSION} |
| 148 | } |
194 | } |
| 149 | |
195 | |
|
|
196 | # @FUNCTION: require_php_sapi_from |
|
|
197 | # @USAGE: <list of SAPIs> |
|
|
198 | # @DESCRIPTION: |
| 150 | # Call this function from pkg_setup if your package only works with |
199 | # Call this function from pkg_setup if your package only works with |
| 151 | # specific SAPIs |
200 | # specific SAPI(s) and specify a list of PHP SAPI USE flags that are |
|
|
201 | # required (one or more from cli, cgi, apache2) as arguments. |
|
|
202 | # Returns if any of the listed SAPIs have been installed, dies if none |
|
|
203 | # of them is available. |
| 152 | # |
204 | # |
| 153 | # $1 ... a list of PHP SAPI USE flags (cli, cgi, apache, apache2) |
205 | # Unfortunately, if you want to be really sure that the required SAPI is |
| 154 | # |
206 | # provided by PHP, you will have to use this function or similar ones (like |
| 155 | # Returns if any one of the listed SAPIs have been installed |
207 | # require_php_cli or require_php_cgi) in pkg_setup until we are able to |
| 156 | # Dies if none of the listed SAPIs have been installed |
208 | # depend on USE flags being enabled. The above described need_php[45]_cli |
| 157 | |
209 | # and need_php[45]_httpd functions cannot guarantee these requirements. |
|
|
210 | # See Bug 2272 for details. |
| 158 | require_php_sapi_from() { |
211 | require_php_sapi_from() { |
| 159 | has_php |
212 | has_php |
| 160 | |
213 | |
| 161 | local has_sapi="0" |
214 | local has_sapi="0" |
| 162 | local x |
215 | local x |
| … | |
… | |
| 181 | eerror " $@" |
234 | eerror " $@" |
| 182 | eerror |
235 | eerror |
| 183 | die "No compatible PHP SAPIs found" |
236 | die "No compatible PHP SAPIs found" |
| 184 | } |
237 | } |
| 185 | |
238 | |
|
|
239 | # @FUNCTION: require_php_with_use |
|
|
240 | # @USAGE: <list of USE flags> |
|
|
241 | # @DESCRIPTION: |
| 186 | # Call this function from pkg_setup if your package requires PHP compiled |
242 | # Call this function from pkg_setup if your package requires PHP compiled |
| 187 | # with specific USE flags |
243 | # with specific USE flags. Returns if all of the listed USE flags are enabled. |
|
|
244 | # Dies if any of the listed USE flags are disabled. |
|
|
245 | |
|
|
246 | # @VARIABLE: PHPCHECKNODIE |
|
|
247 | # @DESCRIPTION: |
|
|
248 | # You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple |
|
|
249 | # require_php_with_(any)_use checks without making the ebuild die on every failure. |
|
|
250 | # This is useful in cases when certain PHP features are only required if specific |
|
|
251 | # USE flag(s) are enabled for that ebuild. |
|
|
252 | # @CODE |
|
|
253 | # Example: |
| 188 | # |
254 | # |
| 189 | # $1 ... a list of USE flags |
255 | # local flags="pcre session snmp sockets wddx" |
| 190 | # |
256 | # use mysql && flags="${flags} mysql" |
| 191 | # Returns if all of the listed USE flags are enabled |
257 | # use postgres && flags="${flags} postgres" |
| 192 | # Dies if any of the listed USE flags are disabled |
258 | # if ! PHPCHECKNODIE="yes" require_php_with_use ${flags} \ |
| 193 | |
259 | # || ! PHPCHECKNODIE="yes" require_php_with_any_use gd gd-external ; then |
|
|
260 | # die "Re-install ${PHP_PKG} with ${flags} and either gd or gd-external" |
|
|
261 | # fi |
|
|
262 | # @CODE |
| 194 | require_php_with_use() { |
263 | require_php_with_use() { |
| 195 | has_php |
264 | has_php |
| 196 | |
265 | |
| 197 | local missing_use="" |
266 | local missing_use="" |
| 198 | local x |
267 | local x |
| … | |
… | |
| 225 | else |
294 | else |
| 226 | return 1 |
295 | return 1 |
| 227 | fi |
296 | fi |
| 228 | } |
297 | } |
| 229 | |
298 | |
|
|
299 | # @FUNCTION: require_php_with_any_use |
|
|
300 | # @USAGE: <list of USE flags> |
|
|
301 | # @DESCRIPTION: |
| 230 | # Call this function from pkg_setup if your package requires PHP compiled |
302 | # Call this function from pkg_setup if your package requires PHP compiled with |
| 231 | # with any of specified USE flags |
|
|
| 232 | # |
|
|
| 233 | # $1 ... a list of USE flags |
|
|
| 234 | # |
|
|
| 235 | # Returns if any of the listed USE flags are enabled |
303 | # any of specified USE flags. Returns if any of the listed USE flags are enabled. |
| 236 | # Dies if all of the listed USE flags are disabled |
304 | # Dies if all of the listed USE flags are disabled. |
| 237 | |
|
|
| 238 | require_php_with_any_use() { |
305 | require_php_with_any_use() { |
| 239 | has_php |
306 | has_php |
| 240 | |
307 | |
| 241 | local missing_use="" |
308 | local missing_use="" |
| 242 | local x |
309 | local x |
| … | |
… | |
| 277 | # has_*() functions |
344 | # has_*() functions |
| 278 | # |
345 | # |
| 279 | # These functions return 0 if the condition is satisfied, 1 otherwise |
346 | # These functions return 0 if the condition is satisfied, 1 otherwise |
| 280 | # ======================================================================== |
347 | # ======================================================================== |
| 281 | |
348 | |
|
|
349 | # @FUNCTION: has_zts |
|
|
350 | # @DESCRIPTION: |
| 282 | # Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled |
351 | # Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled. |
| 283 | |
352 | # @RETURN: 0 if true, 1 otherwise |
| 284 | has_zts() { |
353 | has_zts() { |
| 285 | has_php |
354 | has_php |
| 286 | |
355 | |
| 287 | if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then |
356 | if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then |
| 288 | return 0 |
357 | return 0 |
| 289 | fi |
358 | fi |
| 290 | |
359 | |
| 291 | return 1 |
360 | return 1 |
| 292 | } |
361 | } |
| 293 | |
362 | |
|
|
363 | # @FUNCTION: has_debug |
|
|
364 | # @DESCRIPTION: |
| 294 | # Check if our PHP was built with debug support enabled |
365 | # Check if our PHP was built with debug support enabled. |
| 295 | |
366 | # @RETURN: 0 if true, 1 otherwise |
| 296 | has_debug() { |
367 | has_debug() { |
| 297 | has_php |
368 | has_php |
| 298 | |
369 | |
| 299 | if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then |
370 | if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then |
| 300 | return 0 |
371 | return 0 |
| 301 | fi |
372 | fi |
| 302 | |
373 | |
| 303 | return 1 |
374 | return 1 |
| 304 | } |
375 | } |
| 305 | |
376 | |
|
|
377 | # @FUNCTION: has_concurrentmodphp |
|
|
378 | # @DESCRIPTION: |
| 306 | # Check if our PHP was built with the concurrentmodphp support enabled |
379 | # Check if our PHP was built with the concurrentmodphp support enabled. |
| 307 | |
380 | # @RETURN: 0 if true, 1 otherwise |
| 308 | has_concurrentmodphp() { |
381 | has_concurrentmodphp() { |
| 309 | has_php |
382 | has_php |
| 310 | |
383 | |
| 311 | if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then |
384 | if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then |
| 312 | return 0 |
385 | return 0 |
| … | |
… | |
| 319 | # require_*() functions |
392 | # require_*() functions |
| 320 | # |
393 | # |
| 321 | # These functions die() if PHP was built without the required features |
394 | # These functions die() if PHP was built without the required features |
| 322 | # ======================================================================== |
395 | # ======================================================================== |
| 323 | |
396 | |
|
|
397 | # @FUNCTION: require_pdo |
|
|
398 | # @DESCRIPTION: |
| 324 | # Require a PHP built with PDO support (PHP5 only) |
399 | # Require a PHP built with PDO support (PHP5 only). |
| 325 | |
400 | # @RETURN: die if feature is missing |
| 326 | require_pdo() { |
401 | require_pdo() { |
| 327 | has_php |
402 | has_php |
| 328 | |
403 | |
| 329 | # Do we have PHP5 installed? |
404 | # Do we have PHP5 installed? |
| 330 | if [[ "${PHP_VERSION}" == "4" ]] ; then |
405 | if [[ "${PHP_VERSION}" == "4" ]] ; then |
| … | |
… | |
| 363 | eerror "USE flags turned on." |
438 | eerror "USE flags turned on." |
| 364 | eerror |
439 | eerror |
| 365 | die "No PDO extension for PHP 5 found" |
440 | die "No PDO extension for PHP 5 found" |
| 366 | } |
441 | } |
| 367 | |
442 | |
|
|
443 | # @FUNCTION: require_php_cli |
|
|
444 | # @DESCRIPTION: |
| 368 | # Determines which installed PHP version has the CLI SAPI enabled, |
445 | # Determines which installed PHP version has the CLI SAPI enabled. |
| 369 | # useful for PEAR stuff, or anything which needs to run PHP |
446 | # Useful for PEAR stuff, or anything which needs to run PHP script |
| 370 | # scripts depending on the CLI SAPI |
447 | # depending on the CLI SAPI. |
| 371 | |
448 | # @RETURN: die if feature is missing |
| 372 | require_php_cli() { |
449 | require_php_cli() { |
| 373 | # If PHP_PKG is set, then we have remembered our PHP settings |
450 | # If PHP_PKG is set, then we have remembered our PHP settings |
| 374 | # from last time |
451 | # from last time |
| 375 | if [[ -n ${PHP_PKG} ]] ; then |
452 | if [[ -n ${PHP_PKG} ]] ; then |
| 376 | return |
453 | return |
| … | |
… | |
| 398 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
475 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
| 399 | die "Unable to find an installed dev-lang/php package" |
476 | die "Unable to find an installed dev-lang/php package" |
| 400 | fi |
477 | fi |
| 401 | |
478 | |
| 402 | if [[ -z ${PHP_VERSION} ]] ; then |
479 | if [[ -z ${PHP_VERSION} ]] ; then |
| 403 | die "No PHP CLI installed" |
480 | die "No PHP CLI installed. Re-emerge dev-lang/php with USE=cli." |
| 404 | fi |
481 | fi |
| 405 | |
482 | |
| 406 | # If we get here, then PHP_VERSION tells us which version of PHP we |
483 | # If we get here, then PHP_VERSION tells us which version of PHP we |
| 407 | # want to use |
484 | # want to use |
| 408 | uses_php${PHP_VERSION} |
485 | uses_php${PHP_VERSION} |
| 409 | } |
486 | } |
| 410 | |
487 | |
|
|
488 | # @FUNCTION: require_php_cgi |
|
|
489 | # @DESCRIPTION: |
| 411 | # Determines which installed PHP version has the CGI SAPI enabled, |
490 | # Determines which installed PHP version has the CGI SAPI enabled. |
| 412 | # useful for anything which needs to run PHP scripts |
491 | # Useful for anything which needs to run PHP scripts depending on the CGI SAPI. |
| 413 | # depending on the CGI SAPI |
492 | # @RETURN: die if feature is missing |
| 414 | |
|
|
| 415 | require_php_cgi() { |
493 | require_php_cgi() { |
| 416 | # If PHP_PKG is set, then we have remembered our PHP settings |
494 | # If PHP_PKG is set, then we have remembered our PHP settings |
| 417 | # from last time |
495 | # from last time |
| 418 | if [[ -n ${PHP_PKG} ]] ; then |
496 | if [[ -n ${PHP_PKG} ]] ; then |
| 419 | return |
497 | return |
| … | |
… | |
| 441 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
519 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
| 442 | die "Unable to find an installed dev-lang/php package" |
520 | die "Unable to find an installed dev-lang/php package" |
| 443 | fi |
521 | fi |
| 444 | |
522 | |
| 445 | if [[ -z ${PHP_VERSION} ]] ; then |
523 | if [[ -z ${PHP_VERSION} ]] ; then |
| 446 | die "No PHP CGI installed" |
524 | die "No PHP CGI installed. Re-emerge dev-lang/php with USE=cgi." |
| 447 | fi |
525 | fi |
| 448 | |
526 | |
| 449 | # If we get here, then PHP_VERSION tells us which version of PHP we |
527 | # If we get here, then PHP_VERSION tells us which version of PHP we |
| 450 | # want to use |
528 | # want to use |
| 451 | uses_php${PHP_VERSION} |
529 | uses_php${PHP_VERSION} |
| 452 | } |
530 | } |
| 453 | |
531 | |
|
|
532 | # @FUNCTION: require_sqlite |
|
|
533 | # @DESCRIPTION: |
| 454 | # Require a PHP built with SQLite support |
534 | # Require a PHP built with SQLite support |
| 455 | |
535 | # @RETURN: die if feature is missing |
| 456 | require_sqlite() { |
536 | require_sqlite() { |
| 457 | has_php |
537 | has_php |
| 458 | |
538 | |
| 459 | # Has our PHP been built with SQLite support? |
539 | # Has our PHP been built with SQLite support? |
| 460 | if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then |
540 | if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then |
| … | |
… | |
| 476 | eerror "'sqlite' USE flag when emerging dev-lang/php." |
556 | eerror "'sqlite' USE flag when emerging dev-lang/php." |
| 477 | eerror |
557 | eerror |
| 478 | die "No SQLite extension for PHP found" |
558 | die "No SQLite extension for PHP found" |
| 479 | } |
559 | } |
| 480 | |
560 | |
|
|
561 | # @FUNCTION: require_gd |
|
|
562 | # @DESCRIPTION: |
| 481 | # Require a PHP built with GD support |
563 | # Require a PHP built with GD support |
| 482 | |
564 | # @RETURN: die if feature is missing |
| 483 | require_gd() { |
565 | require_gd() { |
| 484 | has_php |
566 | has_php |
| 485 | |
567 | |
| 486 | # Do we have the internal GD support installed? |
568 | # Do we have the internal GD support installed? |
| 487 | if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then |
569 | if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then |
| … | |
… | |
| 508 | # Misc functions |
590 | # Misc functions |
| 509 | # |
591 | # |
| 510 | # These functions provide miscellaneous checks and functionality. |
592 | # These functions provide miscellaneous checks and functionality. |
| 511 | # ======================================================================== |
593 | # ======================================================================== |
| 512 | |
594 | |
|
|
595 | # @FUNCTION: php_binary_extension |
|
|
596 | # @DESCRIPTION: |
| 513 | # Executes some checks needed when installing a binary PHP extension |
597 | # Executes some checks needed when installing a binary PHP extension. |
| 514 | |
|
|
| 515 | php_binary_extension() { |
598 | php_binary_extension() { |
| 516 | has_php |
599 | has_php |
| 517 | |
600 | |
| 518 | local PUSE_ENABLED="" |
601 | local PUSE_ENABLED="" |
| 519 | |
602 | |
| … | |
… | |
| 545 | if [[ -n ${PUSE_ENABLED} ]] ; then |
628 | if [[ -n ${PUSE_ENABLED} ]] ; then |
| 546 | die "'debug' and/or 'concurrentmodphp' USE flags turned on!" |
629 | die "'debug' and/or 'concurrentmodphp' USE flags turned on!" |
| 547 | fi |
630 | fi |
| 548 | } |
631 | } |
| 549 | |
632 | |
|
|
633 | # @FUNCTION: dodoc-php |
|
|
634 | # @USAGE: <list of docs> |
|
|
635 | # @DESCRIPTION: |
| 550 | # Alternative to dodoc function for use in our PHP eclasses and |
636 | # Alternative to dodoc function for use in our PHP eclasses and ebuilds. |
| 551 | # ebuilds. |
|
|
| 552 | # Stored here because depend.php gets always sourced everywhere |
637 | # Stored here because depend.php gets always sourced everywhere in the PHP |
| 553 | # in the PHP ebuilds and eclasses. |
|
|
| 554 | # It simply is dodoc with a changed path to the docs. |
638 | # ebuilds and eclasses. It simply is dodoc with a changed path to the docs. |
| 555 | # NOTE: no support for docinto is given! |
639 | # NOTE: No support for docinto is provided! |
| 556 | |
|
|
| 557 | dodoc-php() { |
640 | dodoc-php() { |
| 558 | if [[ $# -lt 1 ]] ; then |
641 | if [[ $# -lt 1 ]] ; then |
| 559 | echo "$0: at least one argument needed" 1>&2 |
642 | echo "$0: at least one argument needed" 1>&2 |
| 560 | exit 1 |
643 | exit 1 |
| 561 | fi |
644 | fi |