| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 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.12 2006/03/24 23:05:47 chtekk Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.13 2006/04/20 12:15:35 chtekk Exp $ |
| 4 | # |
4 | # |
| 5 | # ======================================================================== |
5 | # ======================================================================== |
| 6 | # |
6 | # |
| 7 | # depend.php.eclass |
7 | # depend.php.eclass |
| 8 | # functions to allow ebuilds to depend on php4 and/or php5 |
8 | # functions to allow ebuilds to depend on php4 and/or php5 |
| … | |
… | |
| 160 | local x |
160 | local x |
| 161 | |
161 | |
| 162 | einfo "Checking for compatible SAPI(s)" |
162 | einfo "Checking for compatible SAPI(s)" |
| 163 | |
163 | |
| 164 | for x in $@ ; do |
164 | for x in $@ ; do |
| 165 | if built_with_use =${PHP_PKG} ${x} ; then |
165 | if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then |
| 166 | einfo " Discovered compatible SAPI ${x}" |
166 | einfo " Discovered compatible SAPI ${x}" |
| 167 | has_sapi="1" |
167 | has_sapi="1" |
| 168 | fi |
168 | fi |
| 169 | done |
169 | done |
| 170 | |
170 | |
| … | |
… | |
| 264 | # Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled |
264 | # Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled |
| 265 | |
265 | |
| 266 | has_zts() { |
266 | has_zts() { |
| 267 | has_php |
267 | has_php |
| 268 | |
268 | |
| 269 | if built_with_use =${PHP_PKG} apache2 threads ; then |
269 | if built_with_use =${PHP_PKG} apache2 threads || phpconfutils_built_with_use =${PHP_PKG} apache2 threads ; then |
| 270 | return 0 |
270 | return 0 |
| 271 | fi |
271 | fi |
| 272 | |
272 | |
| 273 | return 1 |
273 | return 1 |
| 274 | } |
274 | } |
| … | |
… | |
| 276 | # Check if our PHP was built with Hardened-PHP enabled |
276 | # Check if our PHP was built with Hardened-PHP enabled |
| 277 | |
277 | |
| 278 | has_hardenedphp() { |
278 | has_hardenedphp() { |
| 279 | has_php |
279 | has_php |
| 280 | |
280 | |
| 281 | if built_with_use =${PHP_PKG} hardenedphp ; then |
281 | if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then |
| 282 | return 0 |
282 | return 0 |
| 283 | fi |
283 | fi |
| 284 | |
284 | |
| 285 | return 1 |
285 | return 1 |
| 286 | } |
286 | } |
| … | |
… | |
| 288 | # Check if our PHP was built with debug support enabled |
288 | # Check if our PHP was built with debug support enabled |
| 289 | |
289 | |
| 290 | has_debug() { |
290 | has_debug() { |
| 291 | has_php |
291 | has_php |
| 292 | |
292 | |
| 293 | if built_with_use =${PHP_PKG} debug ; then |
293 | if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then |
| 294 | return 0 |
294 | return 0 |
| 295 | fi |
295 | fi |
| 296 | |
296 | |
| 297 | return 1 |
297 | return 1 |
| 298 | } |
298 | } |
| … | |
… | |
| 321 | eerror |
321 | eerror |
| 322 | die "PHP 5 not installed" |
322 | die "PHP 5 not installed" |
| 323 | fi |
323 | fi |
| 324 | |
324 | |
| 325 | # Was PHP5 compiled with internal PDO support? |
325 | # Was PHP5 compiled with internal PDO support? |
| 326 | if built_with_use =${PHP_PKG} pdo ; then |
326 | if built_with_use =${PHP_PKG} pdo || phpconfutils_built_with_use =${PHP_PKG} pdo ; then |
| 327 | return |
327 | return |
| 328 | fi |
328 | fi |
| 329 | |
329 | |
| 330 | # Ok, maybe PDO was built as an external extension? |
330 | # Ok, maybe PDO was built as an external extension? |
| 331 | if built_with_use =${PHP_PKG} pdo-external && has_version 'dev-php5/pecl-pdo' ; then |
331 | if ( built_with_use =${PHP_PKG} pdo-external || phpconfutils_built_with_use =${PHP_PKG} pdo-external ) && has_version 'dev-php5/pecl-pdo' ; then |
| 332 | return |
332 | return |
| 333 | fi |
333 | fi |
| 334 | |
334 | |
| 335 | # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support |
335 | # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support |
| 336 | if has_version 'dev-php5/pecl-pdo' ; then |
336 | if has_version 'dev-php5/pecl-pdo' ; then |
| … | |
… | |
| 366 | |
366 | |
| 367 | # Detect which PHP version we have installed |
367 | # Detect which PHP version we have installed |
| 368 | if has_version '=dev-lang/php-4*' ; then |
368 | if has_version '=dev-lang/php-4*' ; then |
| 369 | PHP_PACKAGE_FOUND="1" |
369 | PHP_PACKAGE_FOUND="1" |
| 370 | pkg="`best_version '=dev-lang/php-4*'`" |
370 | pkg="`best_version '=dev-lang/php-4*'`" |
| 371 | if built_with_use =${pkg} cli ; then |
371 | if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then |
| 372 | PHP_VERSION="4" |
372 | PHP_VERSION="4" |
| 373 | fi |
373 | fi |
| 374 | fi |
374 | fi |
| 375 | |
375 | |
| 376 | if has_version '=dev-lang/php-5*' ; then |
376 | if has_version '=dev-lang/php-5*' ; then |
| 377 | PHP_PACKAGE_FOUND="1" |
377 | PHP_PACKAGE_FOUND="1" |
| 378 | pkg="`best_version '=dev-lang/php-5*'`" |
378 | pkg="`best_version '=dev-lang/php-5*'`" |
| 379 | if built_with_use =${pkg} cli ; then |
379 | if built_with_use =${pkg} cli || phpconfutils_built_with_use =${pkg} cli ; then |
| 380 | PHP_VERSION="5" |
380 | PHP_VERSION="5" |
| 381 | fi |
381 | fi |
| 382 | fi |
382 | fi |
| 383 | |
383 | |
| 384 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
384 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
| … | |
… | |
| 409 | |
409 | |
| 410 | # Detect which PHP version we have installed |
410 | # Detect which PHP version we have installed |
| 411 | if has_version '=dev-lang/php-4*' ; then |
411 | if has_version '=dev-lang/php-4*' ; then |
| 412 | PHP_PACKAGE_FOUND="1" |
412 | PHP_PACKAGE_FOUND="1" |
| 413 | pkg="`best_version '=dev-lang/php-4*'`" |
413 | pkg="`best_version '=dev-lang/php-4*'`" |
| 414 | if built_with_use =${pkg} cgi ; then |
414 | if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then |
| 415 | PHP_VERSION="4" |
415 | PHP_VERSION="4" |
| 416 | fi |
416 | fi |
| 417 | fi |
417 | fi |
| 418 | |
418 | |
| 419 | if has_version '=dev-lang/php-5*' ; then |
419 | if has_version '=dev-lang/php-5*' ; then |
| 420 | PHP_PACKAGE_FOUND="1" |
420 | PHP_PACKAGE_FOUND="1" |
| 421 | pkg="`best_version '=dev-lang/php-5*'`" |
421 | pkg="`best_version '=dev-lang/php-5*'`" |
| 422 | if built_with_use =${pkg} cgi ; then |
422 | if built_with_use =${pkg} cgi || phpconfutils_built_with_use =${pkg} cgi ; then |
| 423 | PHP_VERSION="5" |
423 | PHP_VERSION="5" |
| 424 | fi |
424 | fi |
| 425 | fi |
425 | fi |
| 426 | |
426 | |
| 427 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
427 | if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then |
| … | |
… | |
| 505 | |
505 | |
| 506 | # Binary extensions do not support the change of PHP |
506 | # Binary extensions do not support the change of PHP |
| 507 | # API version, so they can't be installed when USE flags |
507 | # API version, so they can't be installed when USE flags |
| 508 | # are enabled wich change the PHP API version |
508 | # are enabled wich change the PHP API version |
| 509 | |
509 | |
| 510 | if built_with_use =${PHP_PKG} hardenedphp ; then |
510 | if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then |
| 511 | eerror |
511 | eerror |
| 512 | eerror "You cannot install binary PHP extensions" |
512 | eerror "You cannot install binary PHP extensions" |
| 513 | eerror "when the 'hardenedphp' USE flag is enabled!" |
513 | eerror "when the 'hardenedphp' USE flag is enabled!" |
| 514 | eerror "Please reemerge dev-lang/php with the" |
514 | eerror "Please reemerge dev-lang/php with the" |
| 515 | eerror "'hardenedphp' USE flag turned off." |
515 | eerror "'hardenedphp' USE flag turned off." |
| 516 | eerror |
516 | eerror |
| 517 | PUSE_ENABLED="1" |
517 | PUSE_ENABLED="1" |
| 518 | fi |
518 | fi |
| 519 | |
519 | |
| 520 | if built_with_use =${PHP_PKG} debug ; then |
520 | if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then |
| 521 | eerror |
521 | eerror |
| 522 | eerror "You cannot install binary PHP extensions" |
522 | eerror "You cannot install binary PHP extensions" |
| 523 | eerror "when the 'debug' USE flag is enabled!" |
523 | eerror "when the 'debug' USE flag is enabled!" |
| 524 | eerror "Please reemerge dev-lang/php with the" |
524 | eerror "Please reemerge dev-lang/php with the" |
| 525 | eerror "'debug' USE flag turned off." |
525 | eerror "'debug' USE flag turned off." |