/[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.9
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.9 2006/01/21 09:02:44 sebastian 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
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 PHP_PACKAGE_FOUND=1
385 pkg="`best_version '=dev-lang/php-4*'`"
386 if built_with_use =${pkg} cgi ; then
387 PHP_VERSION=4
388 fi
389 fi
390
378 if has_version '=dev-lang/php-5*' ; then 391 if has_version '=dev-lang/php-5*' ; then
392 PHP_PACKAGE_FOUND=1
379 pkg="`best_version '=dev-lang/php-5*'`" 393 pkg="`best_version '=dev-lang/php-5*'`"
380 if built_with_use =${pkg} cgi ; then 394 if built_with_use =${pkg} cgi ; then
381 PHP_VERSION=5 395 PHP_VERSION=5
382 fi 396 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 397 fi
388 else 398
399 if [[ -z ${PHP_PACKAGE_FOUND} ]]; then
389 die "Unable to find an installed dev-lang/php package" 400 die "Unable to find an installed dev-lang/php package"
390 fi 401 fi
391 402
392 if [[ -z ${PHP_VERSION} ]]; then 403 if [[ -z ${PHP_VERSION} ]]; then
393 die "No PHP CGI installed" 404 die "No PHP CGI installed"
427 eerror "this is done best by simply adding the" 438 eerror "this is done best by simply adding the"
428 eerror "'sqlite' USE flag when emerging dev-lang/php." 439 eerror "'sqlite' USE flag when emerging dev-lang/php."
429 eerror 440 eerror
430 die "No sqlite extension for PHP found" 441 die "No sqlite extension for PHP found"
431} 442}
443
444# require a PHP built with GD support
432 445
433require_gd() 446require_gd()
434{ 447{
435 has_php 448 has_php
436 449
455 eerror "the 'gd' or the 'gd-external' USE flags" 468 eerror "the 'gd' or the 'gd-external' USE flags"
456 eerror "turned on." 469 eerror "turned on."
457 eerror 470 eerror
458 die "No GD support found for PHP" 471 die "No GD support found for PHP"
459} 472}
473
474# ========================================================================
475# Misc functions
476#
477# These functions provide miscellaneous checks and functionality.
478# ========================================================================
479
480# executes some checks needed when installing a binary PHP extension
481
482php_binary_extension() {
483 has_php
484
485 # binary extensions do not support the change of PHP
486 # API version, so they can't be installed when USE flags
487 # are enabled wich change the PHP API version
488
489 if built_with_use =${PHP_PKG} hardenedphp ; then
490 eerror
491 eerror "You cannot install binary PHP extensions"
492 eerror "when the 'hardenedphp' USE flag is enabled!"
493 eerror "Please reemerge dev-lang/php with the"
494 eerror "'hardenedphp' USE flag turned off."
495 eerror
496 die "'hardenedphp' USE flag turned on"
497 fi
498
499 if built_with_use =${PHP_PKG} debug ; then
500 eerror
501 eerror "You cannot install binary PHP extensions"
502 eerror "when the 'debug' USE flag is enabled!"
503 eerror "Please reemerge dev-lang/php with the"
504 eerror "'debug' USE flag turned off."
505 eerror
506 die "'debug' USE flag turned on"
507 fi
508}
509
510# alternative to dodoc for use in our php eclasses and ebuilds
511# stored here because depend.php gets always sourced everywhere
512# in the PHP ebuilds and eclasses
513# it simply is dodoc with a changed path to the docs
514# no support for docinto is given!
515
516dodoc-php()
517{
518if [ $# -lt 1 ] ; then
519 echo "$0: at least one argument needed" 1>&2
520 exit 1
521fi
522
523phpdocdir="${D}/usr/share/doc/${CATEGORY}/${PF}/"
524
525if [ ! -d "${phpdocdir}" ] ; then
526 install -d "${phpdocdir}"
527fi
528
529for x in "$@" ; do
530 if [ -s "${x}" ] ; then
531 install -m0644 "${x}" "${phpdocdir}"
532 gzip -f -9 "${phpdocdir}/${x##*/}"
533 elif [ ! -e "${x}" ] ; then
534 echo "dodoc-php: ${x} does not exist" 1>&2
535 fi
536done
537}

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

  ViewVC Help
Powered by ViewVC 1.1.20