/[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.5 Revision 1.7
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.5 2005/09/25 12:30:26 swegener Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.7 2005/11/20 01:35:05 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#
13# Author: Luca Longinotti
14# <chtekk@gentoo.org>
15#
16# Maintained by the PHP Herd <php-bugs@gentoo.org>
12# 17#
13# ======================================================================== 18# ========================================================================
14 19
15inherit eutils 20inherit eutils
16 21
131# 136#
132# this function will disappear when USE-based deps are supported by 137# this function will disappear when USE-based deps are supported by
133# Portage 138# Portage
134# 139#
135# $1 ... a list of SAPI USE flags (eg cli, cgi, apache2) 140# $1 ... a list of SAPI USE flags (eg cli, cgi, apache2)
136# 141#
137# returns if any one of the listed SAPIs has been installed 142# returns if any one of the listed SAPIs has been installed
138# dies if none of the listed SAPIs has been installed 143# dies if none of the listed SAPIs has been installed
139 144
140require_php_sapi_from() 145require_php_sapi_from()
141{ 146{
171# 176#
172# this function will disappear when USE-based deps are supported by 177# this function will disappear when USE-based deps are supported by
173# Portage 178# Portage
174# 179#
175# $1 ... a list of USE flags 180# $1 ... a list of USE flags
176# 181#
177# returns if all of the listed USE flags are set 182# returns if all of the listed USE flags are set
178# dies if any of the listed USE flags are not set 183# dies if any of the listed USE flags are not set
179 184
180require_php_with_use() 185require_php_with_use()
181{ 186{
218 return 223 return
219 fi 224 fi
220 225
221 if [[ -z ${PHP_VERSION} ]]; then 226 if [[ -z ${PHP_VERSION} ]]; then
222 # detect which PHP version installed 227 # detect which PHP version installed
228 if has_version '=dev-lang/php-4*' ; then
229 PHP_VERSION=4
223 if has_version '=dev-lang/php-5*' ; then 230 elif has_version '=dev-lang/php-5*' ; then
224 PHP_VERSION=5 231 PHP_VERSION=5
225 elif has_version '=dev-lang/php-4*' ; then
226 PHP_VERSION=4
227 else 232 else
228 die "Unable to find an installed dev-lang/php package" 233 die "Unable to find an installed dev-lang/php package"
229 fi 234 fi
230 fi 235 fi
231 236
335 if [[ -n ${PHP_PKG} ]]; then 340 if [[ -n ${PHP_PKG} ]]; then
336 return 341 return
337 fi 342 fi
338 343
339 # detect which PHP version installed 344 # detect which PHP version installed
345 if has_version '=dev-lang/php-4*' ; then
346 pkg="`best_version '=dev-lang/php-4*'`"
347 if built_with_use =${pkg} cli ; then
348 PHP_VERSION=4
349 fi
340 if has_version '=dev-lang/php-5*' ; then 350 elif has_version '=dev-lang/php-5*' ; then
341 pkg="`best_version '=dev-lang/php-5*'`" 351 pkg="`best_version '=dev-lang/php-5*'`"
342 if built_with_use =${pkg} cli ; then 352 if built_with_use =${pkg} cli ; then
343 PHP_VERSION=5 353 PHP_VERSION=5
344 fi 354 fi
345 elif has_version '=dev-lang/php-4*' ; then
346 pkg="`best_version '=dev-lang/php-4*'`"
347 if built_with_use =${pkg} cli ; then
348 PHP_VERSION=4
349 fi
350 else 355 else
351 die "Unable to find an installed dev-lang/php package" 356 die "Unable to find an installed dev-lang/php package"
352 fi 357 fi
353 358
354 if [[ -z ${PHP_VERSION} ]]; then 359 if [[ -z ${PHP_VERSION} ]]; then
373 if [[ -n ${PHP_PKG} ]]; then 378 if [[ -n ${PHP_PKG} ]]; then
374 return 379 return
375 fi 380 fi
376 381
377 # detect which PHP version installed 382 # detect which PHP version installed
383 if has_version '=dev-lang/php-4*' ; then
384 pkg="`best_version '=dev-lang/php-4*'`"
385 if built_with_use =${pkg} cgi ; then
386 PHP_VERSION=4
387 fi
378 if has_version '=dev-lang/php-5*' ; then 388 elif has_version '=dev-lang/php-5*' ; then
379 pkg="`best_version '=dev-lang/php-5*'`" 389 pkg="`best_version '=dev-lang/php-5*'`"
380 if built_with_use =${pkg} cgi ; then 390 if built_with_use =${pkg} cgi ; then
381 PHP_VERSION=5 391 PHP_VERSION=5
382 fi
383 elif has_version '=dev-lang/php-4*' ; then
384 pkg="`best_version '=dev-lang/php-4*'`"
385 if built_with_use =${pkg} cgi ; then
386 PHP_VERSION=4
387 fi 392 fi
388 else 393 else
389 die "Unable to find an installed dev-lang/php package" 394 die "Unable to find an installed dev-lang/php package"
390 fi 395 fi
391 396
427 eerror "this is done best by simply adding the" 432 eerror "this is done best by simply adding the"
428 eerror "'sqlite' USE flag when emerging dev-lang/php." 433 eerror "'sqlite' USE flag when emerging dev-lang/php."
429 eerror 434 eerror
430 die "No sqlite extension for PHP found" 435 die "No sqlite extension for PHP found"
431} 436}
437
438# require a PHP built with GD support
432 439
433require_gd() 440require_gd()
434{ 441{
435 has_php 442 has_php
436 443
455 eerror "the 'gd' or the 'gd-external' USE flags" 462 eerror "the 'gd' or the 'gd-external' USE flags"
456 eerror "turned on." 463 eerror "turned on."
457 eerror 464 eerror
458 die "No GD support found for PHP" 465 die "No GD support found for PHP"
459} 466}
467
468# ========================================================================
469# Misc functions
470#
471# These functions provide miscellaneous checks and functionality.
472# ========================================================================
473
474# executes some checks needed when installing a binary PHP extension
475
476php_binary_extension() {
477 has_php
478
479 # binary extensions do not support the change of PHP
480 # API version, so they can't be installed when USE flags
481 # are enabled wich change the PHP API version
482
483 if built_with_use =${PHP_PKG} hardenedphp ; then
484 eerror
485 eerror "You cannot install binary PHP extensions"
486 eerror "when the 'hardenedphp' USE flag is enabled!"
487 eerror "Please reemerge dev-lang/php with the"
488 eerror "'hardenedphp' USE flag turned off."
489 eerror
490 die "'hardenedphp' USE flag turned on"
491 fi
492
493 if built_with_use =${PHP_PKG} debug ; then
494 eerror
495 eerror "You cannot install binary PHP extensions"
496 eerror "when the 'debug' USE flag is enabled!"
497 eerror "Please reemerge dev-lang/php with the"
498 eerror "'debug' USE flag turned off."
499 eerror
500 die "'debug' USE flag turned on"
501 fi
502}
503
504# alternative to dodoc for use in our php eclasses and ebuilds
505# stored here because depend.php gets always sourced everywhere
506# in the PHP ebuilds and eclasses
507# it simply is dodoc with a changed path to the docs
508# no support for docinto is given!
509
510dodoc-php()
511{
512if [ $# -lt 1 ] ; then
513 echo "$0: at least one argument needed" 1>&2
514 exit 1
515fi
516
517phpdocdir="${D}/usr/share/doc/${CATEGORY}/${PF}/"
518
519if [ ! -d "${phpdocdir}" ] ; then
520 install -d "${phpdocdir}"
521fi
522
523for x in "$@" ; do
524 if [ -s "${x}" ] ; then
525 install -m0644 "${x}" "${phpdocdir}"
526 gzip -f -9 "${phpdocdir}/${x##*/}"
527 elif [ ! -e "${x}" ] ; then
528 echo "dodoc-php: ${x} does not exist" 1>&2
529 fi
530done
531}

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20