/[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.24
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.24 2008/02/11 20:47:35 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 174 # If PHP_PKG is already set, then we have remembered our PHP settings
175 # from last time 175 # from last time
176 if [[ -n ${PHP_PKG} ]] ; then 176 if [[ -n ${PHP_PKG} ]] ; then
203# of them is available. 203# of them is available.
204# 204#
205# Unfortunately, if you want to be really sure that the required SAPI is 205# 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 206# 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 207# 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 208# depend on USE flags being enabled. The above described need_php[45]_cli
209# and need_php[45]_httpd functions cannot guarantee these requirements. 209# and need_php[45]_httpd functions cannot guarantee these requirements.
210# See Bug 2272 for details. 210# See Bug 2272 for details.
211require_php_sapi_from() { 211require_php_sapi_from() {
212 has_php 212 has_php
213 213
245 245
246# @VARIABLE: PHPCHECKNODIE 246# @VARIABLE: PHPCHECKNODIE
247# @DESCRIPTION: 247# @DESCRIPTION:
248# You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple 248# 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. 249# 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 250# This is useful in cases when certain PHP features are only required if specific
251# USE flag(s) are enabled for that ebuild. 251# USE flag(s) are enabled for that ebuild.
252# @CODE 252# @CODE
253# Example: 253# Example:
254# 254#
255# local flags="pcre session snmp sockets wddx" 255# local flags="pcre session snmp sockets wddx"
621 621
622# @FUNCTION: dodoc-php 622# @FUNCTION: dodoc-php
623# @USAGE: <list of docs> 623# @USAGE: <list of docs>
624# @DESCRIPTION: 624# @DESCRIPTION:
625# Alternative to dodoc function for use in our PHP eclasses and ebuilds. 625# 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 626# 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. 627# ebuilds and eclasses. It simply is dodoc with a changed path to the docs.
628# NOTE: No support for docinto is provided! 628# NOTE: No support for docinto is provided!
629dodoc-php() { 629dodoc-php() {
630if [[ $# -lt 1 ]] ; then 630if [[ $# -lt 1 ]] ; then
631 echo "$0: at least one argument needed" 1>&2 631 echo "$0: at least one argument needed" 1>&2
632 exit 1 632 exit 1
633fi 633fi
634 634
635phpdocdir="${D}/usr/share/doc/${CATEGORY}/${PF}/" 635phpdocdir="/usr/share/doc/${CATEGORY}/${PF}/"
636
637if [[ ! -d "${phpdocdir}" ]] ; then
638 install -d "${phpdocdir}"
639fi
640 636
641for x in $@ ; do 637for x in $@ ; do
642 if [[ -s "${x}" ]] ; then 638 if [[ -s "${x}" ]] ; then
643 install -m0644 "${x}" "${phpdocdir}" 639 insinto "${phpdocdir}"
640 doins "${x}"
644 gzip -f -9 "${phpdocdir}/${x##*/}" 641 gzip -f -9 "${D}/${phpdocdir}/${x##*/}"
645 elif [[ ! -e "${x}" ]] ; then 642 elif [[ ! -e "${x}" ]] ; then
646 echo "dodoc-php: ${x} does not exist" 1>&2 643 echo "dodoc-php: ${x} does not exist" 1>&2
647 fi 644 fi
648done 645done
649} 646}
647
648# @FUNCTION: dohtml-php
649# @USAGE: <list of html docs>
650# @DESCRIPTION:
651# Alternative to dohtml function for use in our PHP eclasses and ebuilds.
652# Stored here because depend.php gets always sourced everywhere in the PHP
653# ebuilds and eclasses. It simply is dohtml with a changed path to the docs.
654# NOTE: No support for [-a|-A|-p|-x] options is provided!
655dohtml-php() {
656if [[ $# -lt 1 ]] ; then
657 echo "$0: at least one argument needed" 1>&2
658 exit 1
659fi
660
661phphtmldir="/usr/share/doc/${CATEGORY}/${PF}/html"
662
663for x in $@ ; do
664 if [[ -s "${x}" ]] ; then
665 insinto "${phphtmldir}"
666 doins "${x}"
667 elif [[ ! -e "${x}" ]] ; then
668 echo "dohtml-php: ${x} does not exist" 1>&2
669 fi
670done
671}

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

  ViewVC Help
Powered by ViewVC 1.1.20