/[gentoo-x86]/eclass/depend.php.eclass
Gentoo

Diff of /eclass/depend.php.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.17 Revision 1.20
1# Copyright 1999-2005 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.17 2007/02/02 19:09:33 chtekk Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.20 2007/08/16 22:11:00 hoffie 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
9# 9#
10# Author: Stuart Herbert 10# Author: Stuart Herbert
11# <stuart@gentoo.org> 11# <stuart@gentoo.org>
12# 12#
13# Author: Luca Longinotti 13# Author: Luca Longinotti
14# <chtekk@gentoo.org> 14# <chtekk@gentoo.org>
15# 15#
16# Maintained by the PHP Herd <php-bugs@gentoo.org> 16# Maintained by the PHP Team <php-bugs@gentoo.org>
17# 17#
18# ======================================================================== 18# ========================================================================
19 19
20inherit eutils phpconfutils 20inherit eutils phpconfutils
21 21
115need_php_by_category() { 115need_php_by_category() {
116 case "${CATEGORY}" in 116 case "${CATEGORY}" in
117 dev-php) need_php ;; 117 dev-php) need_php ;;
118 dev-php4) need_php4 ;; 118 dev-php4) need_php4 ;;
119 dev-php5) need_php5 ;; 119 dev-php5) need_php5 ;;
120 *) die "I don't know which version of PHP packages in ${CATEGORY} require" 120 *) die "Version of PHP required by packages in category ${CATEGORY} unknown"
121 esac 121 esac
122} 122}
123 123
124# Call this function from your pkg_setup, src_compile and src_install methods 124# Call this function from your pkg_setup, src_compile and src_install methods
125# if you need to know where the PHP binaries are installed and their data 125# if you need to know where the PHP binaries are installed and their data
148} 148}
149 149
150# Call this function from pkg_setup if your package only works with 150# Call this function from pkg_setup if your package only works with
151# specific SAPIs 151# specific SAPIs
152# 152#
153# $1 ... a list of PHP SAPI USE flags (cli, cgi, apache, apache2) 153# $1 ... a list of PHP SAPI USE flags (cli, cgi, apache2)
154# 154#
155# Returns if any one of the listed SAPIs have been installed 155# Returns if any one of the listed SAPIs have been installed
156# Dies if none of the listed SAPIs have been installed 156# Dies if none of the listed SAPIs have been installed
157 157
158require_php_sapi_from() { 158require_php_sapi_from() {
289 fi 289 fi
290 290
291 return 1 291 return 1
292} 292}
293 293
294# Check if our PHP was built with Hardened-PHP enabled
295
296has_hardenedphp() {
297 has_php
298
299 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then
300 return 0
301 fi
302
303 return 1
304}
305
306# Check if our PHP was built with debug support enabled 294# Check if our PHP was built with debug support enabled
307 295
308has_debug() { 296has_debug() {
309 has_php 297 has_php
310 298
313 fi 301 fi
314 302
315 return 1 303 return 1
316} 304}
317 305
306# Check if our PHP was built with the concurrentmodphp support enabled
307
308has_concurrentmodphp() {
309 has_php
310
311 if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then
312 return 0
313 fi
314
315 return 1
316}
317
318# ======================================================================== 318# ========================================================================
319# require_*() functions 319# require_*() functions
320# 320#
321# These functions die() if PHP was built without the required features 321# These functions die() if PHP was built without the required features
322# ======================================================================== 322# ========================================================================
329 # Do we have PHP5 installed? 329 # Do we have PHP5 installed?
330 if [[ "${PHP_VERSION}" == "4" ]] ; then 330 if [[ "${PHP_VERSION}" == "4" ]] ; then
331 eerror 331 eerror
332 eerror "This package requires PDO." 332 eerror "This package requires PDO."
333 eerror "PDO is only available for PHP 5." 333 eerror "PDO is only available for PHP 5."
334 eerror "You must install =dev-lang/php-5.0* with" 334 eerror "You must install >=dev-lang/php-5.1 with"
335 eerror "the 'pdo-external' USE flag or you must"
336 eerror "install >=dev-lang/php-5.1 with either"
337 eerror "the 'pdo' or the 'pdo-external' USE flags" 335 eerror "either the 'pdo' or the 'pdo-external'"
338 eerror "turned on." 336 eerror "USE flags turned on."
339 eerror 337 eerror
340 die "PHP 5 not installed" 338 die "PHP 5 not installed"
341 fi 339 fi
342 340
343 # Was PHP5 compiled with internal PDO support? 341 # Was PHP5 compiled with internal PDO support?
353 # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support 351 # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support
354 if has_version 'dev-php5/pecl-pdo' ; then 352 if has_version 'dev-php5/pecl-pdo' ; then
355 return 353 return
356 fi 354 fi
357 355
358 # If we get here, then we have no PDO support 356 # If we get here, then we don't have PDO support
359 eerror 357 eerror
360 eerror "No PDO extension for PHP found." 358 eerror "No PDO extension for PHP found."
361 eerror "Please note that PDO only exists for PHP 5." 359 eerror "Please note that PDO only exists for PHP 5."
362 eerror "Please install a PDO extension for PHP 5," 360 eerror "Please install a PDO extension for PHP 5,"
363 eerror "you must install =dev-lang/php-5.0* with" 361 eerror "you must install >=dev-lang/php-5.1 with"
364 eerror "the 'pdo-external' USE flag or you must"
365 eerror "install >=dev-lang/php-5.1 with either"
366 eerror "the 'pdo' or the 'pdo-external' USE flags" 362 eerror "either the 'pdo' or the 'pdo-external'"
367 eerror "turned on." 363 eerror "USE flags turned on."
368 eerror 364 eerror
369 die "No PDO extension for PHP 5 found" 365 die "No PDO extension for PHP 5 found"
370} 366}
371 367
372# Determines which installed PHP version has the CLI SAPI enabled, 368# Determines which installed PHP version has the CLI SAPI enabled,
402 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then 398 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
403 die "Unable to find an installed dev-lang/php package" 399 die "Unable to find an installed dev-lang/php package"
404 fi 400 fi
405 401
406 if [[ -z ${PHP_VERSION} ]] ; then 402 if [[ -z ${PHP_VERSION} ]] ; then
407 die "No PHP CLI installed" 403 die "No PHP CLI installed. Re-emerge dev-lang/php with USE=cli."
408 fi 404 fi
409 405
410 # If we get here, then PHP_VERSION tells us which version of PHP we 406 # If we get here, then PHP_VERSION tells us which version of PHP we
411 # want to use 407 # want to use
412 uses_php${PHP_VERSION} 408 uses_php${PHP_VERSION}
445 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then 441 if [[ -z ${PHP_PACKAGE_FOUND} ]] ; then
446 die "Unable to find an installed dev-lang/php package" 442 die "Unable to find an installed dev-lang/php package"
447 fi 443 fi
448 444
449 if [[ -z ${PHP_VERSION} ]] ; then 445 if [[ -z ${PHP_VERSION} ]] ; then
450 die "No PHP CGI installed" 446 die "No PHP CGI installed. Re-emerge dev-lang/php with USE=cgi."
451 fi 447 fi
452 448
453 # If we get here, then PHP_VERSION tells us which version of PHP we 449 # If we get here, then PHP_VERSION tells us which version of PHP we
454 # want to use 450 # want to use
455 uses_php${PHP_VERSION} 451 uses_php${PHP_VERSION}
524 # Binary extensions do not support the change of PHP 520 # Binary extensions do not support the change of PHP
525 # API version, so they can't be installed when USE flags 521 # API version, so they can't be installed when USE flags
526 # are enabled which change the PHP API version, they also 522 # are enabled which change the PHP API version, they also
527 # don't provide correctly versioned symbols for our use 523 # don't provide correctly versioned symbols for our use
528 524
529 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then 525 if has_debug ; then
530 eerror
531 eerror "You cannot install binary PHP extensions"
532 eerror "when the 'hardenedphp' USE flag is enabled!"
533 eerror "Please reemerge dev-lang/php with the"
534 eerror "'hardenedphp' USE flag turned off."
535 eerror
536 PUSE_ENABLED="1"
537 fi
538
539 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
540 eerror 526 eerror
541 eerror "You cannot install binary PHP extensions" 527 eerror "You cannot install binary PHP extensions"
542 eerror "when the 'debug' USE flag is enabled!" 528 eerror "when the 'debug' USE flag is enabled!"
543 eerror "Please reemerge dev-lang/php with the" 529 eerror "Please reemerge dev-lang/php with the"
544 eerror "'debug' USE flag turned off." 530 eerror "'debug' USE flag turned off."
545 eerror 531 eerror
546 PUSE_ENABLED="1" 532 PUSE_ENABLED="1"
547 fi 533 fi
548 534
549 if built_with_use =${PHP_PKG} concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} concurrentmodphp ; then 535 if has_concurrentmodphp ; then
550 eerror 536 eerror
551 eerror "You cannot install binary PHP extensions when" 537 eerror "You cannot install binary PHP extensions when"
552 eerror "the 'concurrentmodphp' USE flag is enabled!" 538 eerror "the 'concurrentmodphp' USE flag is enabled!"
553 eerror "Please reemerge dev-lang/php with the" 539 eerror "Please reemerge dev-lang/php with the"
554 eerror "'concurrentmodphp' USE flag turned off." 540 eerror "'concurrentmodphp' USE flag turned off."
555 eerror 541 eerror
556 PUSE_ENABLED="1" 542 PUSE_ENABLED="1"
557 fi 543 fi
558 544
559 if [[ -n ${PUSE_ENABLED} ]] ; then 545 if [[ -n ${PUSE_ENABLED} ]] ; then
560 die "'hardenedphp' and/or 'debug' and/or 'concurrentmodphp' USE flags turned on!" 546 die "'debug' and/or 'concurrentmodphp' USE flags turned on!"
561 fi 547 fi
562} 548}
563 549
564# Alternative to dodoc function for use in our PHP eclasses and 550# Alternative to dodoc function for use in our PHP eclasses and
565# ebuilds. 551# ebuilds.

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20