/[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.22 Revision 1.25
1# Copyright 1999-2007 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.22 2007/12/24 12:29:36 armin76 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.25 2008/02/26 16:26:08 armin76 Exp $
4 4
5# Author: Stuart Herbert <stuart@gentoo.org> 5# Author: Stuart Herbert <stuart@gentoo.org>
6# Author: Luca Longinotti <chtekk@gentoo.org> 6# Author: Luca Longinotti <chtekk@gentoo.org>
7# Author: Jakub Moc <jakub@gentoo.org> (documentation) 7# Author: Jakub Moc <jakub@gentoo.org> (documentation)
8 8
9# @ECLASS: depend.php.eclass 9# @ECLASS: depend.php.eclass
10# @MAINTAINER: 10# @MAINTAINER:
11# Gentoo PHP team <php-bugs@gentoo.org> 11# Gentoo PHP team <php-bugs@gentoo.org>
12# @BLURB: Functions to allow ebuilds to depend on php[45] and check for specific features. 12# @BLURB: Functions to allow ebuilds to depend on php[45] and check for specific features.
13# @DESCRIPTION: 13# @DESCRIPTION:
14# This eclass provides functions that allow ebuilds to depend on php[45] and check 14# This eclass provides functions that allow ebuilds to depend on php[45] and check
15# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install 15# for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install
16# documentation for PHP packages to php-specific location. 16# documentation for PHP packages to php-specific location.
17 17
18 18
19inherit eutils phpconfutils 19inherit eutils phpconfutils
166 166
167 167
168# @FUNCTION: has_php 168# @FUNCTION: has_php
169# @DESCRIPTION: 169# @DESCRIPTION:
170# Call this function from your pkg_setup, src_compile, src_install etc. if you 170# Call this function from your pkg_setup, src_compile, src_install etc. if you
171# need to know which PHP version is being used and where the PHP binaries/data 171# need to know which PHP version is being used and where the PHP binaries/data
172# are installed. 172# are installed.
173has_php() { 173has_php() {
174 # If PHP_PKG is already set, then we have remembered our PHP settings
175 # from last time
176 if [[ -n ${PHP_PKG} ]] ; then
177 return
178 fi
179
180 if [[ -z ${PHP_VERSION} ]] ; then
181 # Detect which PHP version we have installed 174 # Detect which PHP version we have installed
182 if has_version '=dev-lang/php-5*' ; then 175 if has_version '=dev-lang/php-5*' ; then
183 PHP_VERSION="5" 176 PHP_VERSION="5"
184 elif has_version '=dev-lang/php-4*' ; then 177 elif has_version '=dev-lang/php-4*' ; then
185 PHP_VERSION="4" 178 PHP_VERSION="4"
186 else 179 else
187 die "Unable to find an installed dev-lang/php package" 180 die "Unable to find an installed dev-lang/php package"
188 fi
189 fi 181 fi
190 182
191 # If we get here, then PHP_VERSION tells us which version of PHP we 183 # If we get here, then PHP_VERSION tells us which version of PHP we
192 # want to use 184 # want to use
193 uses_php${PHP_VERSION} 185 uses_php${PHP_VERSION}
203# of them is available. 195# of them is available.
204# 196#
205# Unfortunately, if you want to be really sure that the required SAPI is 197# Unfortunately, if you want to be really sure that the required SAPI is
206# provided by PHP, you will have to use this function or similar ones (like 198# provided by PHP, you will have to use this function or similar ones (like
207# require_php_cli or require_php_cgi) in pkg_setup until we are able to 199# require_php_cli or require_php_cgi) in pkg_setup until we are able to
208# depend on USE flags being enabled. The above described need_php[45]_cli 200# depend on USE flags being enabled. The above described need_php[45]_cli
209# and need_php[45]_httpd functions cannot guarantee these requirements. 201# and need_php[45]_httpd functions cannot guarantee these requirements.
210# See Bug 2272 for details. 202# See Bug 2272 for details.
211require_php_sapi_from() { 203require_php_sapi_from() {
212 has_php 204 has_php
213 205
245 237
246# @VARIABLE: PHPCHECKNODIE 238# @VARIABLE: PHPCHECKNODIE
247# @DESCRIPTION: 239# @DESCRIPTION:
248# You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple 240# You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple
249# require_php_with_(any)_use checks without making the ebuild die on every failure. 241# require_php_with_(any)_use checks without making the ebuild die on every failure.
250# This is useful in cases when certain PHP features are only required if specific 242# This is useful in cases when certain PHP features are only required if specific
251# USE flag(s) are enabled for that ebuild. 243# USE flag(s) are enabled for that ebuild.
252# @CODE 244# @CODE
253# Example: 245# Example:
254# 246#
255# local flags="pcre session snmp sockets wddx" 247# local flags="pcre session snmp sockets wddx"
621 613
622# @FUNCTION: dodoc-php 614# @FUNCTION: dodoc-php
623# @USAGE: <list of docs> 615# @USAGE: <list of docs>
624# @DESCRIPTION: 616# @DESCRIPTION:
625# Alternative to dodoc function for use in our PHP eclasses and ebuilds. 617# Alternative to dodoc function for use in our PHP eclasses and ebuilds.
626# Stored here because depend.php gets always sourced everywhere in the PHP 618# Stored here because depend.php gets always sourced everywhere in the PHP
627# ebuilds and eclasses. It simply is dodoc with a changed path to the docs. 619# ebuilds and eclasses. It simply is dodoc with a changed path to the docs.
628# NOTE: No support for docinto is provided! 620# NOTE: No support for docinto is provided!
629dodoc-php() { 621dodoc-php() {
630if [[ $# -lt 1 ]] ; then 622if [[ $# -lt 1 ]] ; then
631 echo "$0: at least one argument needed" 1>&2 623 echo "$0: at least one argument needed" 1>&2
632 exit 1 624 exit 1
633fi 625fi
634 626
635phpdocdir="${D}/usr/share/doc/${CATEGORY}/${PF}/" 627phpdocdir="/usr/share/doc/${CATEGORY}/${PF}/"
636
637if [[ ! -d "${phpdocdir}" ]] ; then
638 install -d "${phpdocdir}"
639fi
640 628
641for x in $@ ; do 629for x in $@ ; do
642 if [[ -s "${x}" ]] ; then 630 if [[ -s "${x}" ]] ; then
643 install -m0644 "${x}" "${phpdocdir}" 631 insinto "${phpdocdir}"
632 doins "${x}"
644 gzip -f -9 "${phpdocdir}/${x##*/}" 633 gzip -f -9 "${D}/${phpdocdir}/${x##*/}"
645 elif [[ ! -e "${x}" ]] ; then 634 elif [[ ! -e "${x}" ]] ; then
646 echo "dodoc-php: ${x} does not exist" 1>&2 635 echo "dodoc-php: ${x} does not exist" 1>&2
647 fi 636 fi
648done 637done
649} 638}
639
640# @FUNCTION: dohtml-php
641# @USAGE: <list of html docs>
642# @DESCRIPTION:
643# Alternative to dohtml function for use in our PHP eclasses and ebuilds.
644# Stored here because depend.php gets always sourced everywhere in the PHP
645# ebuilds and eclasses. It simply is dohtml with a changed path to the docs.
646# NOTE: No support for [-a|-A|-p|-x] options is provided!
647dohtml-php() {
648if [[ $# -lt 1 ]] ; then
649 echo "$0: at least one argument needed" 1>&2
650 exit 1
651fi
652
653phphtmldir="/usr/share/doc/${CATEGORY}/${PF}/html"
654
655for x in $@ ; do
656 if [[ -s "${x}" ]] ; then
657 insinto "${phphtmldir}"
658 doins "${x}"
659 elif [[ ! -e "${x}" ]] ; then
660 echo "dohtml-php: ${x} does not exist" 1>&2
661 fi
662done
663}

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20