/[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.1.1.1 Revision 1.5
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.1.1.1 2005/11/30 09:59:31 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.5 2005/09/25 12:30:26 swegener 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>
17# 12#
18# ======================================================================== 13# ========================================================================
19 14
20inherit eutils 15inherit eutils
21 16
136# 131#
137# this function will disappear when USE-based deps are supported by 132# this function will disappear when USE-based deps are supported by
138# Portage 133# Portage
139# 134#
140# $1 ... a list of SAPI USE flags (eg cli, cgi, apache2) 135# $1 ... a list of SAPI USE flags (eg cli, cgi, apache2)
141# 136#
142# returns if any one of the listed SAPIs has been installed 137# returns if any one of the listed SAPIs has been installed
143# dies if none of the listed SAPIs has been installed 138# dies if none of the listed SAPIs has been installed
144 139
145require_php_sapi_from() 140require_php_sapi_from()
146{ 141{
176# 171#
177# this function will disappear when USE-based deps are supported by 172# this function will disappear when USE-based deps are supported by
178# Portage 173# Portage
179# 174#
180# $1 ... a list of USE flags 175# $1 ... a list of USE flags
181# 176#
182# returns if all of the listed USE flags are set 177# returns if all of the listed USE flags are set
183# dies if any of the listed USE flags are not set 178# dies if any of the listed USE flags are not set
184 179
185require_php_with_use() 180require_php_with_use()
186{ 181{
223 return 218 return
224 fi 219 fi
225 220
226 if [[ -z ${PHP_VERSION} ]]; then 221 if [[ -z ${PHP_VERSION} ]]; then
227 # detect which PHP version installed 222 # detect which PHP version installed
223 if has_version '=dev-lang/php-5*' ; then
224 PHP_VERSION=5
228 if has_version '=dev-lang/php-4*' ; then 225 elif has_version '=dev-lang/php-4*' ; then
229 PHP_VERSION=4 226 PHP_VERSION=4
230 elif has_version '=dev-lang/php-5*' ; then
231 PHP_VERSION=5
232 else 227 else
233 die "Unable to find an installed dev-lang/php package" 228 die "Unable to find an installed dev-lang/php package"
234 fi 229 fi
235 fi 230 fi
236 231
340 if [[ -n ${PHP_PKG} ]]; then 335 if [[ -n ${PHP_PKG} ]]; then
341 return 336 return
342 fi 337 fi
343 338
344 # detect which PHP version installed 339 # detect which PHP version installed
340 if has_version '=dev-lang/php-5*' ; then
341 pkg="`best_version '=dev-lang/php-5*'`"
342 if built_with_use =${pkg} cli ; then
343 PHP_VERSION=5
344 fi
345 if has_version '=dev-lang/php-4*' ; then 345 elif has_version '=dev-lang/php-4*' ; then
346 pkg="`best_version '=dev-lang/php-4*'`" 346 pkg="`best_version '=dev-lang/php-4*'`"
347 if built_with_use =${pkg} cli ; then 347 if built_with_use =${pkg} cli ; then
348 PHP_VERSION=4 348 PHP_VERSION=4
349 fi 349 fi
350 elif has_version '=dev-lang/php-5*' ; then
351 pkg="`best_version '=dev-lang/php-5*'`"
352 if built_with_use =${pkg} cli ; then
353 PHP_VERSION=5
354 fi
355 else 350 else
356 die "Unable to find an installed dev-lang/php package" 351 die "Unable to find an installed dev-lang/php package"
357 fi 352 fi
358 353
359 if [[ -z ${PHP_VERSION} ]]; then 354 if [[ -z ${PHP_VERSION} ]]; then
378 if [[ -n ${PHP_PKG} ]]; then 373 if [[ -n ${PHP_PKG} ]]; then
379 return 374 return
380 fi 375 fi
381 376
382 # detect which PHP version installed 377 # detect which PHP version installed
378 if has_version '=dev-lang/php-5*' ; then
379 pkg="`best_version '=dev-lang/php-5*'`"
380 if built_with_use =${pkg} cgi ; then
381 PHP_VERSION=5
382 fi
383 if has_version '=dev-lang/php-4*' ; then 383 elif has_version '=dev-lang/php-4*' ; then
384 pkg="`best_version '=dev-lang/php-4*'`" 384 pkg="`best_version '=dev-lang/php-4*'`"
385 if built_with_use =${pkg} cgi ; then 385 if built_with_use =${pkg} cgi ; then
386 PHP_VERSION=4 386 PHP_VERSION=4
387 fi
388 elif has_version '=dev-lang/php-5*' ; then
389 pkg="`best_version '=dev-lang/php-5*'`"
390 if built_with_use =${pkg} cgi ; then
391 PHP_VERSION=5
392 fi 387 fi
393 else 388 else
394 die "Unable to find an installed dev-lang/php package" 389 die "Unable to find an installed dev-lang/php package"
395 fi 390 fi
396 391
432 eerror "this is done best by simply adding the" 427 eerror "this is done best by simply adding the"
433 eerror "'sqlite' USE flag when emerging dev-lang/php." 428 eerror "'sqlite' USE flag when emerging dev-lang/php."
434 eerror 429 eerror
435 die "No sqlite extension for PHP found" 430 die "No sqlite extension for PHP found"
436} 431}
437
438# require a PHP built with GD support
439 432
440require_gd() 433require_gd()
441{ 434{
442 has_php 435 has_php
443 436
462 eerror "the 'gd' or the 'gd-external' USE flags" 455 eerror "the 'gd' or the 'gd-external' USE flags"
463 eerror "turned on." 456 eerror "turned on."
464 eerror 457 eerror
465 die "No GD support found for PHP" 458 die "No GD support found for PHP"
466} 459}
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.1.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20