Gentoo Development Guide

DEPEND.PHP.ECLASS

Section: portage (5)
Updated: Oct 2014
Index Return to Main Contents
 

NAME

depend.php.eclass - Functions to allow ebuilds to depend on php5 and check for specific features.  

DESCRIPTION

This eclass provides functions that allow ebuilds to depend on php5 and check for specific PHP features, SAPIs etc. Also provides dodoc-php wrapper to install documentation for PHP packages to php-specific location.  

FUNCTIONS

need_php5_cli
Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 with cli SAPI.
need_php5_httpd
Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 with either cgi or apache2 SAPI.
need_php5
Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP5 (with any SAPI).
need_php_cli
Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP (any version) with cli SAPI.
need_php_httpd
Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP (any version) with either cgi or apache2 SAPI.
need_php
Set this after setting DEPEND/RDEPEND in your ebuild if the ebuild requires PHP (any version with any SAPI).
need_php_by_category
Set this after setting DEPEND/RDEPEND in your ebuild to depend on PHP version determined by ${CATEGORY} - any PHP version or PHP5 for dev-php or dev-php5, respectively.
has_php
Call this function from your pkg_setup, src_compile, src_install etc. if you need to know which PHP version is being used and where the PHP binaries/data are installed.
require_php_sapi_from <list of SAPIs>
Call this function from pkg_setup if your package only works with specific SAPI(s) and specify a list of PHP SAPI USE flags that are required (one or more from cli, cgi, apache2) as arguments. Returns if any of the listed SAPIs have been installed, dies if none of them is available.

Unfortunately, if you want to be really sure that the required SAPI is provided by PHP, you will have to use this function or similar ones (like require_php_cli or require_php_cgi) in pkg_setup until we are able to depend on USE flags being enabled. The above described need_php[45]_cli and need_php[45]_httpd functions cannot guarantee these requirements. See Bug 2272 for details.

require_php_with_use <list of USE flags>
Call this function from pkg_setup if your package requires PHP compiled with specific USE flags. Returns if all of the listed USE flags are enabled. Dies if any of the listed USE flags are disabled.
PHPCHECKNODIE
You can set PHPCHECKNODIE to non-empty value in your ebuild to chain multiple require_php_with_(any)_use checks without making the ebuild die on every failure. This is useful in cases when certain PHP features are only required if specific USE flag(s) are enabled for that ebuild.
Example:

local flags="pcre session snmp sockets wddx"
use mysql && flags="${flags} mysql"
use postgres && flags="${flags} postgres"
if ! PHPCHECKNODIE="yes" require_php_with_use ${flags} \
|| ! PHPCHECKNODIE="yes" require_php_with_any_use gd gd-external ; then
die "Re-install ${PHP_PKG} with ${flags} and either gd or gd-external"
fi
require_php_with_any_use <list of USE flags>
Call this function from pkg_setup if your package requires PHP compiled with any of specified USE flags. Returns if any of the listed USE flags are enabled. Dies if all of the listed USE flags are disabled.
has_zts
Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled.
has_debug
Check if our PHP was built with debug support enabled.
has_concurrentmodphp
Check if our PHP was built with the concurrentmodphp support enabled.
require_pdo
Require a PHP built with PDO support (PHP5 only). This function is now redundant and DEPRECATED since pdo-external use flag and pecl-pdo-* ebuilds were removed. You should use require_php_with_use pdo instead now.
require_php_cli
Determines which installed PHP version has the CLI SAPI enabled. Useful for PEAR stuff, or anything which needs to run PHP script depending on the CLI SAPI.
require_php_cgi
Determines which installed PHP version has the CGI SAPI enabled. Useful for anything which needs to run PHP scripts depending on the CGI SAPI.
require_sqlite
Require a PHP built with SQLite support
require_gd
Require a PHP built with GD support
php_binary_extension
Executes some checks needed when installing a binary PHP extension.
dodoc-php <list of docs>
Alternative to dodoc function for use in our PHP eclasses and ebuilds. Stored here because depend.php gets always sourced everywhere in the PHP ebuilds and eclasses. It simply is dodoc with a changed path to the docs. NOTE: No support for docinto is provided!
dohtml-php <list of html docs>
Alternative to dohtml function for use in our PHP eclasses and ebuilds. Stored here because depend.php gets always sourced everywhere in the PHP ebuilds and eclasses. It simply is dohtml with a changed path to the docs. NOTE: No support for [-a|-A|-p|-x] options is provided!
 

AUTHORS

Author: Stuart Herbert <stuart@gentoo.org>
Author: Luca Longinotti <chtekk@gentoo.org>
Author: Jakub Moc <jakub@gentoo.org> (documentation)
 

MAINTAINERS

Gentoo PHP team <php-bugs@gentoo.org>
 

REPORTING BUGS

Please report bugs via http://bugs.gentoo.org/  

FILES

/usr/portage/eclass/depend.php.eclass  

SEE ALSO

ebuild(5)
http://sources.gentoo.org/eclass/depend.php.eclass?view=log


 

Index

NAME
DESCRIPTION
FUNCTIONS
AUTHORS
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:25:02 GMT, October 01, 2014