/[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.15 Revision 1.19
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.15 2006/05/13 15:39:11 chtekk Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.19 2007/05/12 14:22:12 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
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
48 PHPCONFIG="/usr/${libdir}/php4/bin/php-config" 48 PHPCONFIG="/usr/${libdir}/php4/bin/php-config"
49 PHPCLI="/usr/${libdir}/php4/bin/php" 49 PHPCLI="/usr/${libdir}/php4/bin/php"
50 PHPCGI="/usr/${libdir}/php4/bin/php-cgi" 50 PHPCGI="/usr/${libdir}/php4/bin/php-cgi"
51 PHP_PKG="`best_version =dev-lang/php-4*`" 51 PHP_PKG="`best_version =dev-lang/php-4*`"
52 PHPPREFIX="/usr/${libdir}/php4" 52 PHPPREFIX="/usr/${libdir}/php4"
53 EXT_DIR="`${PHPCONFIG} --extension-dir 2>/dev/null`"
53 54
54 einfo 55 einfo
55 einfo "Using ${PHP_PKG}" 56 einfo "Using ${PHP_PKG}"
56 einfo 57 einfo
57} 58}
85 PHPCONFIG="/usr/${libdir}/php5/bin/php-config" 86 PHPCONFIG="/usr/${libdir}/php5/bin/php-config"
86 PHPCLI="/usr/${libdir}/php5/bin/php" 87 PHPCLI="/usr/${libdir}/php5/bin/php"
87 PHPCGI="/usr/${libdir}/php5/bin/php-cgi" 88 PHPCGI="/usr/${libdir}/php5/bin/php-cgi"
88 PHP_PKG="`best_version =dev-lang/php-5*`" 89 PHP_PKG="`best_version =dev-lang/php-5*`"
89 PHPPREFIX="/usr/${libdir}/php5" 90 PHPPREFIX="/usr/${libdir}/php5"
91 EXT_DIR="`${PHPCONFIG} --extension-dir 2>/dev/null`"
90 92
91 einfo 93 einfo
92 einfo "Using ${PHP_PKG}" 94 einfo "Using ${PHP_PKG}"
93 einfo 95 einfo
94} 96}
113need_php_by_category() { 115need_php_by_category() {
114 case "${CATEGORY}" in 116 case "${CATEGORY}" in
115 dev-php) need_php ;; 117 dev-php) need_php ;;
116 dev-php4) need_php4 ;; 118 dev-php4) need_php4 ;;
117 dev-php5) need_php5 ;; 119 dev-php5) need_php5 ;;
118 *) 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"
119 esac 121 esac
120} 122}
121 123
122# 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
123# 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
146} 148}
147 149
148# 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
149# specific SAPIs 151# specific SAPIs
150# 152#
151# $1 ... a list of PHP SAPI USE flags (cli, cgi, apache, apache2) 153# $1 ... a list of PHP SAPI USE flags (cli, cgi, apache2)
152# 154#
153# Returns if any one of the listed SAPIs have been installed 155# Returns if any one of the listed SAPIs have been installed
154# Dies if none of the listed SAPIs have been installed 156# Dies if none of the listed SAPIs have been installed
155 157
156require_php_sapi_from() { 158require_php_sapi_from() {
287 fi 289 fi
288 290
289 return 1 291 return 1
290} 292}
291 293
292# Check if our PHP was built with Hardened-PHP enabled
293
294has_hardenedphp() {
295 has_php
296
297 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then
298 return 0
299 fi
300
301 return 1
302}
303
304# Check if our PHP was built with debug support enabled 294# Check if our PHP was built with debug support enabled
305 295
306has_debug() { 296has_debug() {
307 has_php 297 has_php
308 298
311 fi 301 fi
312 302
313 return 1 303 return 1
314} 304}
315 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
316# ======================================================================== 318# ========================================================================
317# require_*() functions 319# require_*() functions
318# 320#
319# These functions die() if PHP was built without the required features 321# These functions die() if PHP was built without the required features
320# ======================================================================== 322# ========================================================================
327 # Do we have PHP5 installed? 329 # Do we have PHP5 installed?
328 if [[ "${PHP_VERSION}" == "4" ]] ; then 330 if [[ "${PHP_VERSION}" == "4" ]] ; then
329 eerror 331 eerror
330 eerror "This package requires PDO." 332 eerror "This package requires PDO."
331 eerror "PDO is only available for PHP 5." 333 eerror "PDO is only available for PHP 5."
332 eerror "You must install =dev-lang/php-5.0* with" 334 eerror "You must install >=dev-lang/php-5.1 with"
333 eerror "the 'pdo-external' USE flag or you must"
334 eerror "install >=dev-lang/php-5.1 with either"
335 eerror "the 'pdo' or the 'pdo-external' USE flags" 335 eerror "either the 'pdo' or the 'pdo-external'"
336 eerror "turned on." 336 eerror "USE flags turned on."
337 eerror 337 eerror
338 die "PHP 5 not installed" 338 die "PHP 5 not installed"
339 fi 339 fi
340 340
341 # Was PHP5 compiled with internal PDO support? 341 # Was PHP5 compiled with internal PDO support?
351 # 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
352 if has_version 'dev-php5/pecl-pdo' ; then 352 if has_version 'dev-php5/pecl-pdo' ; then
353 return 353 return
354 fi 354 fi
355 355
356 # If we get here, then we have no PDO support 356 # If we get here, then we don't have PDO support
357 eerror 357 eerror
358 eerror "No PDO extension for PHP found." 358 eerror "No PDO extension for PHP found."
359 eerror "Please note that PDO only exists for PHP 5." 359 eerror "Please note that PDO only exists for PHP 5."
360 eerror "Please install a PDO extension for PHP 5," 360 eerror "Please install a PDO extension for PHP 5,"
361 eerror "you must install =dev-lang/php-5.0* with" 361 eerror "you must install >=dev-lang/php-5.1 with"
362 eerror "the 'pdo-external' USE flag or you must"
363 eerror "install >=dev-lang/php-5.1 with either"
364 eerror "the 'pdo' or the 'pdo-external' USE flags" 362 eerror "either the 'pdo' or the 'pdo-external'"
365 eerror "turned on." 363 eerror "USE flags turned on."
366 eerror 364 eerror
367 die "No PDO extension for PHP 5 found" 365 die "No PDO extension for PHP 5 found"
368} 366}
369 367
370# Determines which installed PHP version has the CLI SAPI enabled, 368# Determines which installed PHP version has the CLI SAPI enabled,
519 517
520 local PUSE_ENABLED="" 518 local PUSE_ENABLED=""
521 519
522 # Binary extensions do not support the change of PHP 520 # Binary extensions do not support the change of PHP
523 # API version, so they can't be installed when USE flags 521 # API version, so they can't be installed when USE flags
524 # are enabled wich change the PHP API version 522 # are enabled which change the PHP API version, they also
523 # don't provide correctly versioned symbols for our use
525 524
526 if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then 525 if has_debug ; then
527 eerror
528 eerror "You cannot install binary PHP extensions"
529 eerror "when the 'hardenedphp' USE flag is enabled!"
530 eerror "Please reemerge dev-lang/php with the"
531 eerror "'hardenedphp' USE flag turned off."
532 eerror
533 PUSE_ENABLED="1"
534 fi
535
536 if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then
537 eerror 526 eerror
538 eerror "You cannot install binary PHP extensions" 527 eerror "You cannot install binary PHP extensions"
539 eerror "when the 'debug' USE flag is enabled!" 528 eerror "when the 'debug' USE flag is enabled!"
540 eerror "Please reemerge dev-lang/php with the" 529 eerror "Please reemerge dev-lang/php with the"
541 eerror "'debug' USE flag turned off." 530 eerror "'debug' USE flag turned off."
542 eerror 531 eerror
543 PUSE_ENABLED="1" 532 PUSE_ENABLED="1"
544 fi 533 fi
545 534
535 if has_concurrentmodphp ; then
536 eerror
537 eerror "You cannot install binary PHP extensions when"
538 eerror "the 'concurrentmodphp' USE flag is enabled!"
539 eerror "Please reemerge dev-lang/php with the"
540 eerror "'concurrentmodphp' USE flag turned off."
541 eerror
542 PUSE_ENABLED="1"
543 fi
544
546 if [[ -n ${PUSE_ENABLED} ]] ; then 545 if [[ -n ${PUSE_ENABLED} ]] ; then
547 die "'hardenedphp' and/or 'debug' USE flags turned on" 546 die "'debug' and/or 'concurrentmodphp' USE flags turned on!"
548 fi 547 fi
549} 548}
550 549
551# Alternative to dodoc function for use in our PHP eclasses and 550# Alternative to dodoc function for use in our PHP eclasses and
552# ebuilds. 551# ebuilds.

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20