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

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

  ViewVC Help
Powered by ViewVC 1.1.20