diff options
author | Stuart Herbert <stuart@gentoo.org> | 2005-09-04 10:54:53 +0000 |
---|---|---|
committer | Stuart Herbert <stuart@gentoo.org> | 2005-09-04 10:54:53 +0000 |
commit | 4a760c17b6f5a24f59cd5135c7fe300554a402bf (patch) | |
tree | 546e864e785cf1db264bafe9c08ea56f9aff133b /eclass | |
parent | Don't install COPYING file. (diff) | |
download | gentoo-2-4a760c17b6f5a24f59cd5135c7fe300554a402bf.tar.gz gentoo-2-4a760c17b6f5a24f59cd5135c7fe300554a402bf.tar.bz2 gentoo-2-4a760c17b6f5a24f59cd5135c7fe300554a402bf.zip |
New & updated eclasses for new PHP packages
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/confutils.eclass | 115 | ||||
-rw-r--r-- | eclass/depend.apache.eclass | 92 | ||||
-rw-r--r-- | eclass/depend.php.eclass | 352 | ||||
-rw-r--r-- | eclass/php-common-r1.eclass | 174 | ||||
-rw-r--r-- | eclass/php-ext-base-r1.eclass | 119 | ||||
-rw-r--r-- | eclass/php-ext-pecl-r1.eclass | 46 | ||||
-rw-r--r-- | eclass/php-ext-source-r1.eclass | 50 | ||||
-rw-r--r-- | eclass/php-lib-r1.eclass | 53 | ||||
-rw-r--r-- | eclass/php-pear.eclass | 24 | ||||
-rw-r--r-- | eclass/php4_4-sapi.eclass | 561 | ||||
-rw-r--r-- | eclass/php5_0-sapi.eclass | 557 | ||||
-rw-r--r-- | eclass/php5_1-sapi.eclass | 591 |
12 files changed, 2692 insertions, 42 deletions
diff --git a/eclass/confutils.eclass b/eclass/confutils.eclass index c230b5e86b2e..fa3ac312da59 100644 --- a/eclass/confutils.eclass +++ b/eclass/confutils.eclass @@ -1,6 +1,6 @@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.17 2005/07/11 15:08:06 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/confutils.eclass,v 1.18 2005/09/04 10:54:53 stuart Exp $ # # eclass/confutils.eclass # Utility functions to help with configuring a package @@ -12,7 +12,9 @@ # # ======================================================================== -IUSE="sharedext" +if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]]; then + IUSE="sharedext" +fi # ======================================================================== @@ -28,7 +30,7 @@ IUSE="sharedext" # this eclass first confutils_init () { - if useq sharedext ; then + if [[ ${EBUILD_SUPPORTS_SHAREDEXT} == 1 ]] && useq sharedext ; then shared="=shared" else shared= @@ -36,6 +38,53 @@ confutils_init () { } # ======================================================================== +# confutils_require_any () +# +# Use this function to ensure one or more of the specified USE flags have +# been enabled +# +# $1 - message to output everytime a flag is found +# $2 - message to output everytime a flag is not found +# $3 .. - flags to check +# + +confutils_require_any() { + success_msg="$1" + shift + fail_msg="$1" + shift + + required_flags="$@" + success=0 + + while [[ -n $1 ]]; do + if useq $1 ; then + einfo "$success_msg $1" + success=1 + else + ewarn "$fail_msg $1" + fi + shift + done + + # did we find what we are looking for? + if [[ $success == 1 ]]; then + return + fi + + # if we get here, then none of the required USE flags are switched on + + echo + eerror "You *must* enable one or more of the following USE flags:" + eerror " $required_flags" + eerror + eerror "You can do this by enabling these flags in /etc/portage/package.use:" + eerror " =$CATEGORY/$PN-$PVR $required_flags" + eerror + die "Missing USE flags" +} + +# ======================================================================== # confutils_use_conflict () # # Use this function to automatically complain to the user if conflicting @@ -379,3 +428,61 @@ confutils_warn_about_missing_deps () sleep 5 fi } + +# ======================================================================== +# enable_extension_enable_built_with () +# +# This function is like use_enable(), except that it knows about +# enabling modules as shared libraries, and it supports passing +# additional data with the switch +# +# $1 - pkg name +# $2 - USE flag +# $3 - extension name +# $4 - additional setting for configure +# $5 - alternative message + +enable_extension_enable_built_with () { + local msg=$3 + [[ -n $5 ]] && msg="$5" + + local param + [[ -n $4 ]] && msg="=$4" + + if built_with_use $1 $2 ; then + my_conf="${my_conf} --enable-$3${param}" + einfo " Enabling $msg" + else + my_conf="${my_conf} --disable-$3" + einfo " Disabling $msg" + fi +} + +# ======================================================================== +# enable_extension_with_built_with () +# +# This function is like use_enable(), except that it knows about +# enabling modules as shared libraries, and it supports passing +# additional data with the switch +# +# $1 - pkg name +# $2 - USE flag +# $3 - extension name +# $4 - additional setting for configure +# $5 - alternative message + +enable_extension_with_built_with () { + local msg=$3 + [[ -n $5 ]] && msg="$5" + + local param + [[ -n $4 ]] && param="=$4" + + if built_with_use $1 $2 ; then + my_conf="${my_conf} --with-$3${param}" + einfo " Enabling $msg" + else + my_conf="${my_conf} --disable-$3" + einfo " Disabling $msg" + fi +} diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass index 2bc094463f4f..00f16945bcfc 100644 --- a/eclass/depend.apache.eclass +++ b/eclass/depend.apache.eclass @@ -1,6 +1,6 @@ -# Copyright 2004-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.19 2005/08/02 23:26:14 vericgar Exp $ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.20 2005/09/04 10:54:53 stuart Exp $ ###### ## Apache Common Variables @@ -63,7 +63,7 @@ APACHE1_MODULES_CONFDIR="${APACHE1_CONFDIR}/modules.d" APACHE2_MODULES_CONFDIR="${APACHE2_CONFDIR}/modules.d" #### -## APACHE1_VHOSTDIR, APACHE2_VHOSTDIR +## APACHE1_MODULES_VHOSTDIR, APACHE2_MODULES_VHOSTDIR ## ## Paths where virtual host configuration files are kept #### @@ -91,14 +91,55 @@ APACHE2_MODULESDIR="${APACHE2_BASEDIR}/modules" APACHE1_DEPEND="=net-www/apache-1*" APACHE2_DEPEND=">=net-www/apache-2.0.54-r10" - #### ## APACHE_DEPEND ## ## Dependency magic based on useflags to use the right DEPEND #### -APACHE_DEPEND="apache2? ( ${APACHE2_DEPEND} ) !apache2? ( ${APACHE1_DEPEND} )" +NEED_APACHE_DEPEND="apache2? ( ${APACHE2_DEPEND} ) !apache2? ( ${APACHE1_DEPEND} )" +WANT_APACHE_DEPEND="apache2? ( ${APACHE2_DEPEND} ) !apache2? ( apache? ( ${APACHE1_DEPEND} ) )" + +#### +# uses_apache1() +# +# sets up all of the environment variables required by an apache1 module +#### + +uses_apache1() { + APACHE_VERSION='1' + APXS="$APXS1" + USE_APACHE2= + APACHECTL="${APACHECTL1}" + APACHE_BASEDIR="${APACHE1_BASEDIR}" + APACHE_CONFDIR="${APACHE1_CONFDIR}" + APACHE_MODULES_CONFDIR="${APACHE1_MODULES_CONFDIR}" + APACHE_VHOSTSDIR="${APACHE1_VHOSTSDIR}" + APACHE_MODULESDIR="${APACHE1_MODULESDIR}" +} + +#### +# uses_apache2() +# +# sets up all of the environment variables required by an apache2 module +#### + +uses_apache2() { + APACHE_VERSION='2' + USE_APACHE2=2 + APXS="$APXS2" + APACHECTL="${APACHECTL2}" + APACHE_BASEDIR="${APACHE2_BASEDIR}" + APACHE_CONFDIR="${APACHE2_CONFDIR}" + APACHE_MODULES_CONFDIR="${APACHE2_MODULES_CONFDIR}" + APACHE_VHOSTSDIR="${APACHE2_VHOSTSDIR}" + APACHE_MODULESDIR="${APACHE2_MODULESDIR}" +} + +doesnt_use_apache() { + APACHE_VERSION='0' + USE_APACHE= +} #### ## need_apache1 @@ -143,27 +184,26 @@ need_apache() { debug-print-function need_apache IUSE="${IUSE} apache2" - DEPEND="${DEPEND} ${APACHE_DEPEND}" - RDEPEND="${RDEPEND} ${APACHE_DEPEND}" + DEPEND="${DEPEND} ${NEED_APACHE_DEPEND}" + RDEPEND="${RDEPEND} ${NEED_APACHE_DEPEND}" if useq apache2; then - APACHE_VERSION='2' - USE_APACHE2=2 - APXS="$APXS2" - APACHECTL="${APACHECTL2}" - APACHE_BASEDIR="${APACHE2_BASEDIR}" - APACHE_CONFDIR="${APACHE2_CONFDIR}" - APACHE_MODULES_CONFDIR="${APACHE2_MODULES_CONFDIR}" - APACHE_VHOSTSDIR="${APACHE2_VHOSTSDIR}" - APACHE_MODULESDIR="${APACHE2_MODULESDIR}" + uses_apache2 + else + uses_apache1 + fi +} + +want_apache() { + debug-print-function want_apache + + IUSE="${IUSE} apache apache2" + DEPEND="${DEPEND} ${WANT_APACHE_DEPEND}" + RDEPEND="${DEPEND} ${WANT_APACHE_DEPEND}" + if useq apache2 ; then + uses_apache2 + elif useq apache ; then + uses_apache1 else - APACHE_VERSION='1' - APXS="$APXS1" - USE_APACHE2= - APACHECTL="${APACHECTL1}" - APACHE_BASEDIR="${APACHE1_BASEDIR}" - APACHE_CONFDIR="${APACHE1_CONFDIR}" - APACHE_MODULES_CONFDIR="${APACHE1_MODULES_CONFDIR}" - APACHE_VHOSTSDIR="${APACHE1_VHOSTSDIR}" - APACHE_MODULESDIR="${APACHE1_MODULESDIR}" + doesnt_use_apache fi } diff --git a/eclass/depend.php.eclass b/eclass/depend.php.eclass new file mode 100644 index 000000000000..ce1ba82ba2d0 --- /dev/null +++ b/eclass/depend.php.eclass @@ -0,0 +1,352 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# ======================================================================== +# +# depend.php.eclass +# functions to allow ebuilds to depend on php4 and/or php5 +# +# Author: Stuart Herbert +# (stuart@gentoo.org) +# +# ======================================================================== + +inherit eutils + +need_php4_cli() +{ + DEPEND="${DEPEND} =virtual/php-4*" + RDEPEND="${RDEPEND} =virtual/php-4*" + PHP_VERSION=4 +} + +need_php4_httpd() +{ + DEPEND="${DEPEND} =virtual/httpd-php-4*" + RDEPEND="${RDEPEND} =virtual/httpd-php-4*" + PHP_VERSION=4 +} + +need_php4() +{ + DEPEND="${DEPEND} =dev-lang/php-4*" + RDEPEND="${RDEPEND} =dev-lang/php-4*" + PHP_VERSION=4 + PHP_SHARED_CAT="php4" +} + +# common settings go in here +uses_php4() +{ + # cache this + libdir=$(get_libdir) + + PHPIZE="/usr/${libdir}/php4/bin/phpize" + PHPCONFIG="/usr/${libdir}/php4/bin/php-config" + PHPCLI="/usr/${libdir}/php4/bin/php" + PHPCGI="/usr/${libdir}/php4/bin/php-cgi" + PHP_PKG="`best_version =dev-lang/php-4*`" + PHPPREFIX="/usr/${libdir}/php4" + + einfo + einfo "Using ${PHP_PKG}" + einfo +} + +need_php5_cli() +{ + DEPEND="${DEPEND} =virtual/php-5*" + RDEPEND="${RDEPEND} =virtual/php-5*" + PHP_VERSION=5 +} + +need_php5_httpd() +{ + DEPEND="${DEPEND} =virtual/httpd-php-5*" + RDEPEND="${RDEPEND} =virtual/httpd-php-5*" + PHP_VERSION=5 +} + +need_php5() +{ + DEPEND="${DEPEND} =dev-lang/php-5*" + RDEPEND="${RDEPEND} =dev-lang/php-5*" + PHP_VERSION=5 + PHP_SHARED_CAT="php5" +} + +# common settings go in here +uses_php5() +{ + # cache this + libdir=$(get_libdir) + + PHPIZE="/usr/${libdir}/php5/bin/phpize" + PHPCONFIG="/usr/${libdir}/php5/bin/php-config" + PHPCLI="/usr/${libdir}/php5/bin/php" + PHPCGI="/usr/${libdir}/php5/bin/php-cgi" + PHP_PKG="`best_version =dev-lang/php-5*`" + PHPPREFIX="/usr/${libdir}/php5" + + einfo + einfo "Using ${PHP_PKG}" + einfo +} + +need_php() +{ + DEPEND="${DEPEND} dev-lang/php" + RDEPEND="${RDEPEND} dev-lang/php" + PHP_SHARED_CAT="php" +} + +need_php_by_category() +{ + case "${CATEGORY}" in + dev-php) need_php ;; + dev-php4) need_php4 ;; + dev-php5) need_php5 ;; + *) die "I don't know which version of PHP packages in ${CATEGORY} require" + esac +} + +# call this function from pkg_setup if your PHP extension only works with +# specific SAPIs +# +# this function will disappear when USE-based deps are supported by +# Portage +# +# $1 ... a list of SAPI USE flags (eg cli, cgi, apache2) +# +# returns if any one of the listed SAPIs has been installed +# dies if none of the listed SAPIs has been installed + +require_php_sapi_from() { + has_php + + local has_sapi=0 + local x + + einfo "Checking for compatible SAPI(s)" + + for x in $@ ; do + if built_with_use =${PHP_PKG} ${x} ; then + einfo " Discovered compatible SAPI ${x}" + has_sapi=1 + fi + done + + if [[ ${has_sapi} == 1 ]]; then + return + fi + + eerror + eerror "${PHP_PKG} needs to be re-installed with one of the following" + eerror "USE flags enabled:" + eerror + eerror " $@" + eerror + die "Re-install ${PHP_PKG}" +} + +# call this function from pkg_setup if your package requires PHP compiled +# with specific USE flags +# +# this function will disappear when USE-based deps are supported by +# Portage +# +# $1 ... a list of USE flags +# +# returns if all of the listed USE flags are set +# dies if any of the listed USE flags are not set + +require_php_with_use() { + has_php + + local missing_use= + local x + + einfo "Checking for required PHP feature(s):" + + for x in $@ ; do + if ! built_with_use =${PHP_PKG} ${x} ; then + einfo " Discovered missing USE flag ${x}" + missing_use="${missing_use} ${x}" + fi + done + + if [[ -z ${missing_use} ]]; then + return + fi + + eerror + eerror "${PHP_PKG} needs to be re-installed with all of the following" + eerror "USE flags enabled:" + eerror + eerror " $@" + eerror + die "Re-install ${PHP_PKG}" +} + +# call this function from your src_compile & src_install methods +# if you need to know where the PHP binaries are installed + +has_php() +{ + # if PHP_PKG is set, then we have remembered our PHP settings + # from last time + if [[ -n ${PHP_PKG} ]]; then + return + fi + + if [[ -z ${PHP_VERSION} ]]; then + # detect which PHP version installed + if has_version '=dev-lang/php-5*' ; then + PHP_VERSION=5 + elif has_version '=dev-lang/php-4*' ; then + PHP_VERSION=4 + else + die "Unable to find an installed dev-lang/php package" + fi + fi + + # if we get here, then PHP_VERSION tells us which version of PHP we + # want to use + + uses_php${PHP_VERSION} +} + +# ======================================================================== +# has_*() functions +# +# these functions return 0 if the condition is satisfied, or 1 otherwise +# ======================================================================== + +has_zts() +{ + has_php + + if built_with_use =${PHP_PKG} apache2 threads ; then + return 0 + fi + + return 1 +} + +# ======================================================================== +# require_*() functions +# +# These functions die() if PHP was built without the required USE flag(s) +# ======================================================================== + +require_pdo() +{ + has_php + + # do we have php5.1 installed? + + if [[ ${PHP_VERSION} == 4 ]] ; then + eerror + eerror "This package requires PDO. PDO is only available for PHP 5." + eerror "Please install dev-lang/php-5*" + eerror + die "PHP 5 not installed" + fi + + # was php5 compiled w/ pdo support? + + if built_with_use =${PHP_PKG} pdo ; then + return + fi + + # ok, maybe PDO was built as an external extension? + + if built_with_use =${PHP_PKG} pdo-external && has_version dev-php5/pecl-pdo ; then + return + fi + + # it suffices that pecl-pdo was installed to have PDO support + + if has_version dev-php5/pecl-pdo ; then + return + fi + + # if we get here, then we have no PDO support :( + + eerror + eerror "No PDO extension for PHP found." + eerror "Please note that PDO only exists for PHP 5." + eerror "Please install a PDO extension for PHP 5," + eerror "you must install dev-lang/php-5.0* with" + eerror "the 'pdo-external' USE flag or you must" + eerror "install dev-lang/php-5.1* with either" + eerror "the 'pdo' or the 'pdo-external' USE flags" + eerror "turned on." + eerror + die "No PDO extension found for PHP" +} + +# determines which installed PHP version has the CLI sapi +# useful for PEAR eclass, or anything which needs to run PHP +# scripts + +require_php_cli() +{ + # if PHP_PKG is set, then we have remembered our PHP settings + # from last time + if [[ -n ${PHP_PKG} ]]; then + return + fi + + # detect which PHP version installed + if has_version '=dev-lang/php-5*' ; then + pkg="`best_version '=dev-lang/php-5*'`" + if built_with_use =${pkg} cli ; then + PHP_VERSION=5 + fi + elif has_version '=dev-lang/php-4*' ; then + pkg="`best_version '=dev-lang/php-4*'`" + if built_with_use =${pkg} cli ; then + PHP_VERSION=4 + fi + else + die "Unable to find an installed dev-lang/php package" + fi + + if [[ -z ${PHP_VERSION} ]]; then + die "No PHP CLI installed" + fi + + # if we get here, then PHP_VERSION tells us which version of PHP we + # want to use + uses_php${PHP_VERSION} +} + +# require a PHP built with sqlite support + +require_sqlite() +{ + has_php + + # has our PHP been built w/ sqlite? + if built_with_use =${PHP_PKG} sqlite ; then + return + fi + + # do we have pecl-sqlite installed for PHP4? + if [[ ${PHP_VERSION} == 4 ]] ; then + if has_version dev-php4/pecl-sqlite ; then + return + fi + fi + + # if we get here, then we don't have any php/sqlite support installed + eerror + eerror "No sqlite extension for PHP found." + eerror "Please install an sqlite extension for PHP," + eerror "this is done best by simply adding the" + eerror "'sqlite' USE flag when emerging dev-lang/php." + eerror + die "No sqlite extension for PHP found" +} diff --git a/eclass/php-common-r1.eclass b/eclass/php-common-r1.eclass new file mode 100644 index 000000000000..ddc67edc1972 --- /dev/null +++ b/eclass/php-common-r1.eclass @@ -0,0 +1,174 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-common-r1.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ + +# ######################################################################## +# +# eclass/php-common-r1.eclass +# Contains common functions which are shared between the +# PHP4 and PHP5 packages +# +# USE THIS ECLASS FOR THE "CONSOLIDATED" PACKAGES +# +# Based on robbat2's work on the php4 sapi eclass +# Based on stuart's work on the php5 sapi eclass +# +# Maintainer: +# php-bugs@gentoo.org +# +# ######################################################################## + +# ######################################################################## +# CFLAG SANITY +# ######################################################################## + +php_check_cflags() { + # filter the following from C[XX]FLAGS regardless, as apache won't be + # supporting LFS until 2.2 is released and in the tree. Fixes bug #24373. + filter-flags "-D_FILE_OFFSET_BITS=64" + filter-flags "-D_FILE_OFFSET_BITS=32" + filter-flags "-D_LARGEFILE_SOURCE=1" + filter-flags "-D_LARGEFILE_SOURCE" + + #fixes bug #14067 + # changed order to run it in reverse for bug #32022 and #12021 + replace-flags "-march=k6-3" "-march=i586" + replace-flags "-march=k6-2" "-march=i586" + replace-flags "-march=k6" "-march=i586" +} + +# ######################################################################## +# IMAP SUPPORT +# ######################################################################## + +php_check_imap() { + if ! useq imap ; then + return + fi + + if useq ssl ; then + if ! built_with_use virtual/imap-c-client ssl ; then + eerror + eerror "IMAP+SSL requested, but your IMAP libraries are built without SSL!" + eerror + die "Please recompile IMAP libraries w/ SSL support enabled" + fi + fi +} + +# ######################################################################## +# JAVA EXTENSION SUPPORT +# +# The bundled java extension is unique to PHP4 at the time of writing, but +# there is now the PHP-Java-Bridge that works under both PHP4 and PHP5. +# ######################################################################## + +php_uses_java() { + if ! useq java ; then + return 1 + fi + + if useq alpha || useq amd64 ; then + return 1 + fi + + return 0 +} + +php_check_java() { + if ! php_uses_java ; then + return + fi + + JDKHOME="`java-config --jdk-home`" + NOJDKERROR="You need to use java-config to set your JVM to a JDK!" + if [ -z "${JDKHOME}" ] || [ ! -d "${JDKHOME}" ]; then + eerror "${NOJDKERROR}" + die "${NOJDKERROR}" + fi + + # stuart@gentoo.org - 2003/05/18 + # Kaffe JVM is not a drop-in replacement for the Sun JDK at this time + + if echo ${JDKHOME} | grep kaffe > /dev/null 2>&1 ; then + eerror + eerror "PHP will not build using the Kaffe Java Virtual Machine." + eerror "Please change your JVM to either Blackdown or Sun's." + eerror + eerror "To build PHP without Java support, please re-run this emerge" + eerror "and place the line:" + eerror " USE='-java'" + eerror "in front of your emerge command; e.g." + eerror " USE='-java' emerge mod_php" + eerror + eerror "or edit your USE flags in /etc/make.conf" + die "Kaffe JVM not supported" + fi + + JDKVER=$(java-config --java-version 2>&1 | awk '/^java version/ { print $3 +}' | xargs ) + einfo "Active JDK version: ${JDKVER}" + case ${JDKVER} in + 1.4.*) ;; + 1.5.*) ewarn "Java 1.5 is NOT supported at this time, and might not work." ;; + *) eerror "A Java 1.4 JDK is required for Java support in PHP." ; die ;; + esac +} + +php_install_java() { + if ! php_uses_java ; then + return + fi + + # we put these into /usr/lib so that they cannot conflict with + # other versions of PHP (e.g. PHP 4 & PHP 5) + insinto ${PHPEXTDIR} + einfo "Installing JAR for PHP" + doins ext/java/php_java.jar + + einfo "Installing Java test page" + newins ext/java/except.php java-test.php + + JAVA_LIBRARY="`grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;'| sort | uniq `" + sed -e "s|;java.library .*$|java.library = ${JAVA_LIBRARY}|g" -i ${phpinisrc} + sed -e "s|;java.class.path .*$|java.class.path = ${PHPEXTDIR}/php_java.jar|g" -i ${phpinisrc} + sed -e "s|;java.library.path .*$|java.library.path = ${PHPEXTDIR}|g" -i ${phpinisrc} + sed -e "s|;extension=php_java.dll.*$|extension = java.so|g" -i ${phpinisrc} + + einfo "Installing Java extension for PHP" + doins modules/java.so + + dosym ${PHPEXTDIR}/java.so ${PHPEXTDIR}/libphp_java.so +} + +# ######################################################################## +# MTA SUPPORT +# ######################################################################## + +php_check_mta() { + [ -x "${ROOT}/usr/sbin/sendmail" ] || die "You need a virtual/mta that provides /usr/sbin/sendmail!" +} + +# ######################################################################## +# ORACLE SUPPORT +# ######################################################################## + +php_check_oracle() { + if useq oci8 && [ -z "${ORACLE_HOME}" ]; then + eerror + eerror "You must have the ORACLE_HOME variable in your environment!" + eerror + die "Oracle configuration incorrect; user error" + fi + + if useq oci8 || useq oracle7 ; then + if has_version 'dev-db/oracle-instantclient-basic' ; then + ewarn "Please ensure you have a full install of the Oracle client." + ewarn "dev-db/oracle-instantclient* is NOT sufficient." + fi + fi +} + +# ######################################################################## +# END OF ECLASS +# ######################################################################## diff --git a/eclass/php-ext-base-r1.eclass b/eclass/php-ext-base-r1.eclass new file mode 100644 index 000000000000..fd2c80ab69cc --- /dev/null +++ b/eclass/php-ext-base-r1.eclass @@ -0,0 +1,119 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-base-r1.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# Author: Tal Peer <coredumb@gentoo.org> +# Author: Stuart Herbert <stuart@gentoo.org> +# +# The php-ext-base eclass provides a unified interface for adding standalone +# PHP extensions ('modules') to the php.ini files on your system. +# +# Combined with php-ext-source, we have a standardised solution for supporting +# PHP extensions + +inherit depend.php + +EXPORT_FUNCTIONS src_install + +# ---begin ebuild configurable settings + +# The extension name, this must be set, otherwise we die. +[ -z "${PHP_EXT_NAME}" ] && die "No module name specified for the php-ext eclass." + +# Wether the extensions is a Zend Engine extension +#(defaults to "no" and if you don't know what is it, you don't need it.) +[ -z "${PHP_EXT_ZENDEXT}" ] && PHP_EXT_ZENDEXT="no" + +# Wether or not to add a line in the php.ini for the extension +# (defaults to "yes" and shouldn't be changed in most cases) +[ -z "${PHP_EXT_INI}" ] && PHP_EXT_INI="yes" + +# find out where to install extensions +EXT_DIR="`${PHPCONFIG} --extension-dir 2>/dev/null`" + +# ---end ebuild configurable settings + +DEPEND="${DEPEND} + >=sys-devel/m4-1.4 + >=sys-devel/libtool-1.4.3" + +php-ext-base-r1_buildinilist() { + # work out the list of .ini files to edit/add to + if [ -z "${PHPSAPILIST}" ]; then + PHPSAPILIST="apache1 apache2 cli cgi" + fi + + PHPINIFILELIST= + + for x in ${PHPSAPILIST} ; do + if [ -f /etc/php/${x}-php${PHP_VERSION}/php.ini ]; then + PHPINIFILELIST="${PHPINIFILELIST} etc/php/${x}-php${PHP_VERSION}/ext/${PHP_EXT_NAME}.ini" + fi + done +} + +php-ext-base-r1_src_install() { + has_php + addpredict /usr/share/snmp/mibs/.index + php-ext-base-r1_buildinilist + if [ "${PHP_EXT_INI}" = "yes" ] ; then + php-ext-base-r1_addextension "${PHP_EXT_NAME}.so" + fi + # add support for installing php files into a version dependant directory + PHP_EXT_SHARED_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_EXT_NAME}" +} + +php-ext-base-r1_addextension() { + if [ "${PHP_EXT_ZENDEXT}" = "yes" ] ; then + if built_with_use =${PHP_PKG} apache2 threads ; then + ext_type="zend_extension_ts" + ext_file="${EXT_DIR}/$1" + else + ext_type="zend_extension" + ext_file="${EXT_DIR}/$1" + fi + else + # we do *not* add the full path for the extension! + ext_type="extension" + ext_file="$1" + fi + + php-ext-base-r1_addtoinifiles "${ext_type}" "${ext_file}" "Extension added" +} + +# $1 - setting name +# $2 - setting value +# $3 - file to add to +# $4 - sanitised text to output + +php-ext-base-r1_addtoinifile() { + if [[ ! -d `dirname $3` ]]; then + mkdir -p `dirname $3` + fi + + # are we adding the name of a section? + if [[ ${1:0:1} == "[" ]] ; then + echo "$1" >> $3 + my_added="$1" + else + echo "$1=$2" >> $3 + my_added="$1=$2" + fi + + if [ -z "$4" ]; then + einfo "Added '$my_added' to /$3" + else + einfo "$4 to /$3" + fi + + # yes, this is inefficient - but it works every time ;-) + + insinto /`dirname $3` + doins $3 +} + +php-ext-base-r1_addtoinifiles() { + for x in ${PHPINIFILELIST} ; do + php-ext-base-r1_addtoinifile "$1" "$2" "$x" "$3" + done +} diff --git a/eclass/php-ext-pecl-r1.eclass b/eclass/php-ext-pecl-r1.eclass new file mode 100644 index 000000000000..371f47f938ca --- /dev/null +++ b/eclass/php-ext-pecl-r1.eclass @@ -0,0 +1,46 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-pecl-r1.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# Author: Tal Peer <coredumb@gentoo.org> +# +# This eclass should be used by all dev-php/PECL-* ebuilds, as a uniform way of installing PECL extensions. +# For more information about PECL, see: http://pecl.php.net + +[ -z "${PHP_EXT_PECL_PKG}" ] && PHP_EXT_PECL_PKG=${PN/pecl-/} +PECL_PKG=${PHP_EXT_PECL_PKG} +PECL_PKG_V=${PECL_PKG}-${PV} + +[ -z "${PHP_EXT_NAME}" ] && PHP_EXT_NAME=${PECL_PKG} + +inherit php-ext-source-r1 + +EXPORT_FUNCTIONS src_compile src_install + +# ---begin ebuild configurable settings + +# Needs to be set if the filename is other than the package name +if [ -n "${PHP_EXT_PECL_FILENAME}" ]; then + FILENAME="${PHP_EXT_PECL_FILENAME}-${PV}.tgz" +else + FILENAME="${PECL_PKG_V}.tgz" +fi + +# ---end ebuild configurable settings + +SRC_URI="http://pecl.php.net/get/${FILENAME}" +HOMEPAGE="http://pecl.php.net/${PECL_PKG}" +S=${WORKDIR}/${PECL_PKG_V} + +php-ext-pecl-r1_src_compile() { + has_php + php-ext-source-r1_src_compile +} + +php-ext-pecl-r1_src_install() { + has_php + php-ext-source-r1_src_install + + # Those two are always present + dodoc ${WORKDIR}/package.xml CREDITS +} diff --git a/eclass/php-ext-source-r1.eclass b/eclass/php-ext-source-r1.eclass new file mode 100644 index 000000000000..7a019174a9c4 --- /dev/null +++ b/eclass/php-ext-source-r1.eclass @@ -0,0 +1,50 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r1.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# Author: Tal Peer <coredumb@gentoo.org> +# Author: Stuart Herbert <stuart@gentoo.org> +# +# The php-ext-source eclass provides a unified interface for compiling and +# installing standalone PHP extensions ('modules') from source code +# +# To use this eclass, you must add the following to your ebuild: +# +# inherit php-ext-source-r1 + +inherit php-ext-base-r1 + +EXPORT_FUNCTIONS src_compile src_install + +# ---begin ebuild configurable settings + +# Wether or not to add a line in the php.ini for the extension +# (defaults to "yes" and shouldn't be changed in most cases) +[ -z "${PHP_EXT_INI}" ] && PHP_EXT_INI="yes" + +# ---end ebuild configurable settings + +DEPEND="${DEPEND} + >=sys-devel/m4-1.4 + >=sys-devel/libtool-1.4.3" + +php-ext-source-r1_src_compile() { + # pull in the PHP settings + has_php + my_conf="${my_conf} --prefix=${PHPPREFIX} --with-php-config=${PHPCONFIG}" + addpredict /usr/share/snmp/mibs/.index + #phpize creates configure out of config.m4 + export WANT_AUTOMAKE=1.6 + ${PHPIZE} + ./configure ${my_conf} || die "Unable to configure code to compile" + emake || die "Unable to make code" +} + +php-ext-source-r1_src_install() { + has_php + addpredict /usr/share/snmp/mibs/.index + chmod +x build/shtool + insinto ${EXT_DIR} + doins modules/${PHP_EXT_NAME}.so + php-ext-base-r1_src_install +} diff --git a/eclass/php-lib-r1.eclass b/eclass/php-lib-r1.eclass new file mode 100644 index 000000000000..905a4eab120a --- /dev/null +++ b/eclass/php-lib-r1.eclass @@ -0,0 +1,53 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php-lib-r1.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# Author: Stuart Herbert <stuart@gentoo.org> +# +# The php-lib eclass provides a unified interface for adding new +# PHP libraries. PHP libraries are PHP scripts designed for reuse inside +# other PHP scripts. +# +# This eclass doesn't do a lot (yet) + +inherit depend.php + +RESTRICT="${RESTRICT} nostrip" + +EXPORT_FUNCTIONS src_install + +# ---begin ebuild configurable settings + +# provide default extension name if necessary +[ -z "${PHP_LIB_NAME}" ] && PHP_LIB_NAME="${PN}" +# ---end ebuild configurable settings + +DEPEND="${DEPEND} dev-lang/php" + +# you have to pass in a list of the PHP files to install +# +# $1 - directory in ${S} to insert from +# $2 ... list of files to install + +php-lib_src_install() { + has_php + + # install to the correct phpX folder, if not specified + # fall back to /usr/share/php + if [ -z "${PHP_SHARED_CAT}" ] ; then + PHP_LIB_DIR="/usr/share/${PHP_SHARED_CAT}/${PHP_LIB_NAME}" + else + PHP_LIB_DIR="/usr/share/php/${PHP_LIB_NAME}" + fi + + local x + + S_DIR="$1" + shift + + for x in $@ ; do + SUBDIR="`dirname ${x}`" + insinto ${PHP_LIB_DIR}/${SUBDIR} + doins ${S_DIR}/${x} + done +} diff --git a/eclass/php-pear.eclass b/eclass/php-pear.eclass index f41a6ee8d348..d0e287707b4f 100644 --- a/eclass/php-pear.eclass +++ b/eclass/php-pear.eclass @@ -1,6 +1,6 @@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear.eclass,v 1.11 2005/07/06 20:23:20 agriffis Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear.eclass,v 1.12 2005/09/04 10:54:53 stuart Exp $ # # Author: Tal Peer <coredumb@gentoo.org> # @@ -14,35 +14,35 @@ EXPORT_FUNCTIONS src_install # Set this is the the package name on PEAR is different than the one in # portage (generally shouldn't be the case). -[ -z "$PHP_PEAR_PKG_NAME" ] && PHP_PEAR_PKG_NAME=${PN/PEAR-/} +[ -z "${PHP_PEAR_PKG_NAME}" ] && PHP_PEAR_PKG_NAME=${PN/PEAR-/} -# We must depend on the virtual as well as the base package as we need it to do +# We must depend on the base package as we need it to do # install tasks (it provides the pear binary). -DEPEND="$DEPEND virtual/php dev-php/php" -RDEPEND="$RDEPEND $DEPEND" +DEPEND="${DEPEND} dev-lang/php" +RDEPEND="${RDEPEND} ${DEPEND}" fix_PEAR_PV() { - tmp=$PV + tmp=${PV} tmp=${tmp/_/} tmp=${tmp/rc/RC} tmp=${tmp/beta/b} - PEAR_PV=$tmp + PEAR_PV=${tmp} } PEAR_PV="" fix_PEAR_PV PEAR_PN=${PHP_PEAR_PKG_NAME}-${PEAR_PV} -[ -z "$SRC_URI" ] && SRC_URI="http://pear.php.net/get/${PEAR_PN}.tgz" -[ -z "$HOMEPAGE" ] && HOMEPAGE="http://pear.php.net/${PHP_PEAR_PKG_NAME}" +[ -z "${SRC_URI}" ] && SRC_URI="http://pear.php.net/get/${PEAR_PN}.tgz" +[ -z "${HOMEPAGE}" ] && HOMEPAGE="http://pear.php.net/${PHP_PEAR_PKG_NAME}" S="${WORKDIR}/${PEAR_PN}" -php-pear_src_install () { +php-pear_src_install() { # SNMP is nuts sometimes addpredict /usr/share/snmp/mibs/.index addpredict /var/lib/net-snmp/ cd ${S} mv ${WORKDIR}/package.xml ${S} - pear install --nodeps -R ${D} ${S}/package.xml || die + pear install --nodeps --installroot=${D} ${S}/package.xml || die "Unable to install PEAR package" } diff --git a/eclass/php4_4-sapi.eclass b/eclass/php4_4-sapi.eclass new file mode 100644 index 000000000000..139f130670cf --- /dev/null +++ b/eclass/php4_4-sapi.eclass @@ -0,0 +1,561 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php4_4-sapi.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# ######################################################################## +# +# eclass/php4_4-sapi.eclass +# Eclass for building different php4 SAPI instances +# +# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES +# +# Based on robbat2's work on the php4 sapi eclass +# +# Author(s) Stuart Herbert +# <stuart@gentoo.org> +# +# CHTEKK +# <chtekk@longitekk.org> +# +# ======================================================================== + +CONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase msql oci8 oracle7 ovrimos pfpro sapdb solid sybase sybase-ct" +EBUILD_SUPPORTS_SHAREDEXT=1 + +inherit flag-o-matic eutils confutils libtool php-common-r1 + +# set MY_PHP_P in the ebuild + +# we only set these variables if we're building a copy of php which can be +# installed as a package in its own right +# +# copies of php which are compiled into other packages (e.g. php support +# for the thttpd web server) don't need these variables + +if [ "${PHP_PACKAGE}" = 1 ]; then + HOMEPAGE="http://www.php.net/" + LICENSE="PHP-3" + SRC_URI="http://www.php.net/distributions/${MY_PHP_P}.tar.bz2" + S="${WORKDIR}/${MY_PHP_P}" +fi + +IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb crypt ctype curl curlwrappers db2 dba dbase dbm dbmaker dbx debug doc empress empress-bcs esoob exif fastbuild frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hardenedphp hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java java-external jpeg kerberos ldap libedit mcal mcve memlimit mhash ming msql mssql mysql ncurses nls oci8 odbc oracle7 overload ovrimos pcntl pcre pear pfpro png posix postgres readline recode sapdb sasl session sharedext sharedmem snmp sockets solid spell sqlite ssl sybase sybase-ct sysvipc threads tiff tokenizer truetype wddx xml xml2 xmlrpc xpm xsl yaz zip zlib" + +# these USE flags should have the correct dependencies +DEPEND="${DEPEND} + !dev-php/php + !dev-php/php-cgi + !dev-php/mod_php + berkdb? ( =sys-libs/db-4* ) + bzip2? ( app-arch/bzip2 ) + cdb? ( dev-db/cdb ) + crypt? ( >=dev-libs/libmcrypt-2.4 ) + curl? ( >=net-misc/curl-7.10.5 ) + fdftk? ( app-text/fdftk ) + firebird? ( dev-db/firebird ) + gd-external? ( media-libs/gd ) + gdbm? ( >=sys-libs/gdbm-1.8.0 ) + gmp? ( dev-libs/gmp ) + imap? ( virtual/imap-c-client ) + iodbc? ( dev-db/libiodbc ) + !alpha? ( !amd64? ( java? ( =virtual/jdk-1.4* dev-java/java-config ) ) ) + jpeg? ( >=media-libs/jpeg-6b ) + kerberos? ( virtual/krb5 ) + ldap? ( >=net-nds/openldap-1.2.11 ) + libedit? ( dev-libs/libedit ) + mcal? ( dev-libs/libmcal !=dev-libs/libmcal-0.7-r2 ) + mcve? ( net-libs/libmonetra ) + mhash? ( app-crypt/mhash ) + ming? ( media-libs/ming ) + mssql? ( dev-db/freetds ) + mysql? ( dev-db/mysql ) + ncurses? ( sys-libs/ncurses ) + nls? ( sys-devel/gettext ) + odbc? ( >=dev-db/unixODBC-1.8.13 ) + png? ( media-libs/libpng ) + postgres? ( >=dev-db/postgresql-7.1 ) + readline? ( sys-libs/readline ) + recode? ( app-text/recode ) + sharedmem? ( dev-libs/mm ) + snmp? ( >=net-analyzer/net-snmp-5.2 ) + spell? ( >=app-text/aspell-0.60 ) + ssl? ( >=dev-libs/openssl-0.9.7 ) + sybase? ( dev-db/freetds ) + tiff? ( media-libs/tiff ) + truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 ) + wddx? ( dev-libs/expat ) + xpm? ( virtual/x11 ) + xml? ( dev-libs/expat ) + xml2? ( dev-libs/libxml2 ) + xsl? ( app-text/sablotron dev-libs/expat ) + zlib? ( sys-libs/zlib ) + virtual/mta" + +# libswf conflicts with ming and should not +# be installed with the new PHP ebuilds +DEPEND="${DEPEND} !media-libs/libswf" + +# 9libs causes a configure error +DEPEND="${DEPEND} !dev-libs/9libs" + +# simplistic for now +RDEPEND="${RDEPEND} ${DEPEND}" + +# Additional features +# +# They are in PDEPEND because we need PHP installed first! +PDEPEND="${PDEPEND} + doc? ( app-doc/php-docs ) + java-external? ( dev-php4/php-java-bridge ) + pear? ( >=dev-php/PEAR-PEAR-1.3.6 ) + sqlite? ( dev-php4/pecl-sqlite ) + yaz? ( dev-php4/pecl-yaz ) + zip? ( dev-php4/pecl-zip )" + +# ======================================================================== +# php.ini Support +# ======================================================================== + +PHP_INI_FILE="php.ini" + +# ======================================================================== +# Hardened-PHP Support +# ======================================================================== +# +# I've done it like this so that we can support different versions of +# the patch for different versions of PHP + +case "${PV}" in + 4.4.0) HARDENEDPHP_PATCH="hardening-patch-${PV}-0.4.1.patch.gz" ;; +esac + +[ -n "${HARDENEDPHP_PATCH}" ] && SRC_URI="${SRC_URI} hardenedphp? ( http://www.hardened-php.net/${HARDENEDPHP_PATCH} )" + +# ======================================================================== + +EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst + +# ======================================================================== +# INTERNAL FUNCTIONS +# ======================================================================== + +php4_4-sapi_check_awkward_uses() { + # ------------------------------------ + # Rules for things unexpectedly broken + # go below here + # + # These rules override the "normal" + # rules listed later on + # ------------------------------------ + + # No special rules at the moment + + # ------------------------------------ + # Normal rules go below here + # ------------------------------------ + + # A variety of extensions need DBA + confutils_use_depend_all "berkdb" "dba" + confutils_use_depend_all "cdb" "dba" + confutils_use_depend_all "dbm" "dba" + confutils_use_depend_all "flatfile" "dba" + confutils_use_depend_all "gdbm" "dba" + confutils_use_depend_all "inifile" "dba" + + # DBX checks + confutils_use_depend_any "dbx" "frontbase" "mssql" "odbc" "postgres" "sybase-ct" "oci8" + + # DOM XML support + confutils_use_depend_all "xml2" "zlib" + + # EXIF only gets built if we support a file format that uses it + confutils_use_depend_any "exif" "jpeg" "tiff" + + # support for the GD graphics library + confutils_use_conflict "gd" "gd-external" + confutils_use_depend_any "truetype" "gd" "gd-external" + confutils_use_depend_any "jpeg" "gd" "gd-external" + confutils_use_depend_any "png" "gd" "gd-external" + confutils_use_depend_any "tiff" "gd" "gd-external" + confutils_use_depend_any "xpm" "gd" "gd-external" + confutils_use_depend_all "png" "zlib" + + # Hardened-PHP doesn't work well with Apache; needs further investigation + confutils_use_conflict "hardenedphp" "apache" "apache2" + + # IMAP support + php_check_imap + + # Java support + php_check_java + + # Java-external support + confutils_use_conflict "java-external" "java" + confutils_use_depend_all "java-external" "session" + + # Mail support + php_check_mta + + # Oracle support + php_check_oracle + + # LDAP-sasl support + confutils_use_depend_all "sasl" "ldap" + + # MCVE needs OpenSSL + confutils_use_depend_all "mcve" "ssl" + + # ODBC support + confutils_use_depend_all "adabas" "odbc" + confutils_use_depend_all "birdstep" "odbc" + confutils_use_depend_all "dbmaker" "odbc" + confutils_use_depend_all "empress" "odbc" + confutils_use_depend_all "empress-bcs" "odbc" "empress" + confutils_use_depend_all "esoob" "odbc" + confutils_use_depend_all "db2" "odbc" + confutils_use_depend_all "iodbc" "odbc" + confutils_use_depend_all "sapdb" "odbc" + confutils_use_depend_all "solid" "odbc" + + # PEAR support + confutils_use_depend_all "pear" "cli" "pcre" "xml" + + # Readline and libedit do the same thing; you can't have both + confutils_use_conflict "readline" "libedit" + + # Recode is not liked + confutils_use_conflict "recode" "mysql" "imap" "nis" + + # the MM extension isn't thread-safe + confutils_use_conflict "sharedmem" "threads" + + confutils_warn_about_missing_deps +} + +# ======================================================================== +# EXPORTED FUNCTIONS +# ======================================================================== + +php4_4-sapi_pkg_setup() { + # let's do all the USE flag testing before we do anything else + # this way saves a lot of time + + php4_4-sapi_check_awkward_uses +} + +php4_4-sapi_src_unpack() { + if [ "${PHP_PACKAGE}" == 1 ]; then + unpack ${A} + fi + + cd ${PHP_S} + + # Patch PHP to show Gentoo as the server platform + sed -i "s/PHP_UNAME=\`uname -a\`/PHP_UNAME=\`uname -s -n -r -v\`/g" configure + # Patch for PostgreSQL support + sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i configure + + # stop php from activating the apache config, as we will do that ourselves + for i in configure sapi/apache/config.m4 sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 ; do + sed -i.orig -e 's,-i -a -n php,-i -n php,g' ${i} + sed -i.orig -e 's,-i -A -n php,-i -n php,g' ${i} + done + + # hardenedphp support + use hardenedphp && [ -n "${HARDENEDPHP_PATCH}" ] && epatch ${DISTDIR}/${HARDENEDPHP_PATCH} + + # imap support + use imap && epatch ${FILESDIR}/4.4.0/php4-imap-symlink.diff + + # iodbc support + use iodbc && epatch ${FILESDIR}/4.4.0/php4-iodbc-config.diff + use iodbc && epatch ${FILESDIR}/4.4.0/php4-with-iodbc.diff + + # fix configure scripts to recognize uClibc + uclibctoolize + + # Just in case ;-) + chmod 755 configure + + # fastbuild support + use fastbuild && epatch ${FILESDIR}/4.4.0/fastbuild.patch + + # rebuild configure to make sure it's up to date + einfo "Rebuilding configure script" + WANT_AUTOCONF=2.5 autoconf -W no-cross || die "Unable to regenerate configure script" + + # fix DBA support + sed -e 's!for LIB in dbm c gdbm!for LIB in dbm c gdbm gdbm_compat!' -i configure +} + +set_php_ini_dir() { + PHP_INI_DIR="/etc/php/${PHPSAPI}-php4" + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" +} + +php4_4-sapi_src_compile() { + destdir=/usr/$(get_libdir)/php4 + set_php_ini_dir + + cd ${PHP_S} + confutils_init + + my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR} --without-pear" + + # extension USE flag shared support? + enable_extension_enable "bcmath" "bcmath" 1 + enable_extension_with "bz2" "bzip2" 1 + enable_extension_enable "calendar" "calendar" 1 + enable_extension_disable "ctype" "ctype" 0 + enable_extension_with "curl" "curl" 1 + enable_extension_with "curlwrappers" "curlwrappers" 1 + enable_extension_enable "dbase" "dbase" 1 + enable_extension_with "dom" "xml2" 0 + enable_extension_enable "exif" "exif" 1 + enable_extension_with "fbsql" "frontbase" 1 + enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" + enable_extension_enable "filepro" "filepro" 1 + enable_extension_enable "ftp" "ftp" 1 + enable_extension_with "gettext" "nls" 1 + enable_extension_with "gmp" "gmp" 1 + enable_extension_with "hwapi" "hyperwave-api" 1 + enable_extension_with "iconv" "iconv" 1 + enable_extension_with "informix" "informix" 1 + enable_extension_disable "ipv6" "ipv6" 0 + # ircg extension not supported on Gentoo at this time + enable_extension_with "jpeg-dir" "jpeg" 0 "/usr" + enable_extension_with "kerberos" "kerberos" 0 "/usr" + enable_extension_enable "mbstring" "nls" 1 + enable_extension_with "mcal" "mcal" 1 "/usr" + enable_extension_with "mcrypt" "crypt" 1 + enable_extension_with "mcve" "mcve" 1 + enable_extension_enable "memory-limit" "memlimit" 0 + enable_extension_with "mhash" "mhash" 1 + enable_extension_with "ming" "ming" 1 + enable_extension_with "msql" "msql" 1 + enable_extension_with "mssql" "mssql" 1 + enable_extension_with "ncurses" "ncurses" 1 + enable_extension_with "oci8" "oci8" 1 + enable_extension_with "oracle" "oracle7" 1 + enable_extension_with "openssl" "ssl" 1 + enable_extension_with "openssl-dir" "ssl" 0 "/usr" + enable_extension_disable "overload" "overload" 0 + enable_extension_with "ovrimos" "ovrimos" 1 + enable_extension_enable "pcntl" "pcntl" 1 + enable_extension_without "pcre-regex" "pcre" 0 + enable_extension_with "pfpro" "pfpro" 1 + enable_extension_with "pgsql" "postgres" 1 + enable_extension_disable "posix" "posix" 1 + enable_extension_with "pspell" "spell" 1 + enable_extension_with "recode" "recode" 1 + enable_extension_enable "shmop" "sharedmem" 0 + enable_extension_with "snmp" "snmp" 1 + enable_extension_enable "sockets" "sockets" 1 + enable_extension_with "sybase" "sybase" 1 + enable_extension_with "sybase-ct" "sybase-ct" 1 + enable_extension_enable "sysvmsg" "sysvipc" 1 + enable_extension_enable "sysvsem" "sysvipc" 1 + enable_extension_enable "sysvshm" "sysvipc" 1 + enable_extension_disable "tokenizer" "tokenizer" 1 + enable_extension_enable "wddx" "wddx" 1 + enable_extension_disable "xml" "xml" 0 + enable_extension_with "xmlrpc" "xmlrpc" 1 + enable_extension_with "zlib" "zlib" 1 + enable_extension_enable "debug" "debug" 0 + + # DBA support + enable_extension_enable "dba" "dba" 1 + + if useq dba ; then + enable_extension_with "cdb" "cdb" 1 + enable_extension_with "db4" "berkdb" 1 + enable_extension_with "dbm" "dbm" 1 + enable_extension_with "flatfile" "flatfile" 1 + enable_extension_with "gdbm" "gdbm" 1 + enable_extension_with "inifile" "inifile" 1 + fi + + # DBX support + if useq dbx ; then + enable_extension_enable "dbx" "dbx" 1 + fi + + # support for the GD graphics library + if useq gd-external ; then + enable_extension_with "freetype-dir" "truetype" 0 "/usr" + enable_extension_with "t1lib" "truetype" 0 "/usr" + enable_extension_enable "gd-jis-conv" "nls" 0 + enable_extension_enable "gd-native-ttf" "truetype" 0 + enable_extension_with "gd" "gd-external" 1 "/usr" + else + enable_extension_with "freetype-dir" "truetype" 0 "/usr" + enable_extension_with "t1lib" "truetype" 0 "/usr" + enable_extension_enable "gd-jis-conv" "nls" 0 + enable_extension_enable "gd-native-ttf" "truetype" 0 + enable_extension_with "png-dir" "png" 0 "/usr" + enable_extension_with "tiff-dir" "tiff" 0 "/usr" + enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6" + # enable gd last, so configure can pick up the previous settings + enable_extension_with "gd" "gd" 0 + fi + + # Java support + if useq java ; then + enable_extension_with "java" "java" 0 "`java-config --jdk-home`" + fi + + # IMAP support + if useq imap ; then + enable_extension_with "imap" "imap" 1 + enable_extension_with "imap-ssl" "ssl" 0 + fi + + # Interbase support + if useq firebird || useq interbase ; then + my_conf="${my_conf} --with-interbase" + fi + + # LDAP support + if useq ldap ; then + enable_extension_with "ldap" "ldap" 1 + enable_extension_with "ldap-sasl" "sasl" 0 + fi + + # MySQL support + # In PHP4 MySQL is enabled by default, so if no 'mysql' USE flag is set, + # we must turn it off. + if ! useq mysql ; then + enable_extension_without "mysql" "mysql" 1 "/usr" + fi + if useq mysql ; then + enable_extension_with "mysql" "mysql" 1 "/usr" + enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + fi + + # ODBC support + if useq odbc ; then + enable_extension_with "unixODBC" "odbc" 1 "/usr" + + enable_extension_with "adabas" "adabas" 1 + enable_extension_with "birdstep" "birdstep" 1 + enable_extension_with "dbmaker" "dbmaker" 1 + enable_extension_with "empress" "empress" 1 + if useq empress ; then + enable_extension_with "empress-bcs" "empress-bcs" 0 + fi + enable_extension_with "esoob" "esoob" 1 + enable_extension_with "ibm-db2" "db2" 1 + enable_extension_with "iodbc" "iodbc" 1 "/usr" + enable_extension_with "sapdb" "sapdb" 1 + enable_extension_with "solid" "solid" 1 + fi + + # readline/libedit support + # you can use readline or libedit, but you can't use both + enable_extension_with "readline" "readline" 0 + enable_extension_with "libedit" "libedit" 1 + + # Sablotron/XSLT support + enable_extension_enable "xslt" "xsl" 1 + enable_extension_with "xslt-sablot" "xsl" 1 + if useq xml2 ; then + enable_extension_with "dom-xslt" "xsl" 0 "/usr" + enable_extension_with "dom-exslt" "xsl" 0 "/usr" + fi + + # session support + if ! useq session ; then + enable_extension_disable "session" "session" 1 + else + enable_extension_with "mm" "sharedmem" 0 + fi + + # fix ELF-related problems + if has_pic ; then + einfo "Enabling PIC support" + my_conf="${my_conf} --with-pic" + fi + + # apache2 & threads support + if useq apache2 && useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # catch cflag problems + php_check_cflags + + # multilib support + if [[ $(get_libdir) != lib ]] ; then + my_conf="--with-libdir=$(get_libdir) ${my_conf}" + fi + + # all done + + # we don't use econf, because we need to override all of its settings + ./configure --prefix=${destdir} --sysconfdir=/etc --cache-file=./config.cache ${my_conf} || die "configure failed" + emake || die "make failed" +} + +php4_4-sapi_src_install() { + destdir=/usr/$(get_libdir)/php4 + + cd ${PHP_S} + addpredict /usr/share/snmp/mibs/.index + + PHP_INSTALLTARGETS="install-build install-headers install-programs" + useq sharedext && PHP_INSTALLTARGETS="${PHP_INSTALLTARGETS} install-modules" + make INSTALL_ROOT=${D} ${PHP_INSTALLTARGETS} || die "install failed" + + # get the extension dir + PHPEXTDIR="`${D}/${destdir}/bin/php-config --extension-dir`" + + # don't forget the php.ini file + local phpinisrc=php.ini-dist + einfo "Setting extension_dir in php.ini" + sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc} + + # A patch for PHP for security. PHP-CLI interface is exempt, as it cannot be + # fed bad data from outside. + einfo "Securing fopen wrappers" + sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i ${phpinisrc} + + # Set the include path to point to where we want to find PEAR packages + einfo "Setting correct include_path" + sed -e 's|^;include_path .*|include_path = ".:/usr/share/php:/usr/share/php4"|' -i ${phpinisrc} + + # Java install needs to insert the correct lines into phpinisrc + php_install_java + + # Install any extensions built as shared objects + if useq sharedext; then + for x in `ls ${D}/${PHPEXTDIR}/*.so | sort | sed -e "s|.*java.*||g"`; do + echo "extension=`basename ${x}`" >> ${phpinisrc} + done; + fi + + # create the directory where we'll put php4-only php scripts + keepdir /usr/share/php4 +} + +php4_4-sapi_install_ini() { + # work out where we are installing the ini file + set_php_ini_dir + local phpinisrc=php.ini-dist + + dodir ${PHP_INI_DIR} + insinto ${PHP_INI_DIR} + newins ${phpinisrc} ${PHP_INI_FILE} + + dodir ${PHP_EXT_INI_DIR} +} + +php4_4-sapi_pkg_postinst() { + ewarn "If you have additional third party PHP extensions (such as" + ewarn "dev-php4/phpdbg) you may need to recompile them now." + + if useq curl; then + ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions." + ewarn "This can be a security risk!" + fi +} diff --git a/eclass/php5_0-sapi.eclass b/eclass/php5_0-sapi.eclass new file mode 100644 index 000000000000..181aa4fda8a0 --- /dev/null +++ b/eclass/php5_0-sapi.eclass @@ -0,0 +1,557 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_0-sapi.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# ######################################################################## +# +# eclass/php5_0-sapi.eclass +# Eclass for building different php5.0 SAPI instances +# +# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES +# +# Based on robbat2's work on the php4 sapi eclass +# +# Author(s) Stuart Herbert +# <stuart@gentoo.org> +# +# CHTEKK +# <chtekk@longitekk.org> +# +# ======================================================================== + +CONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase msql oci8 oracle7 ovrimos pfpro sapdb solid sybase sybase-ct" +EBUILD_SUPPORTS_SHAREDEXT=1 + +inherit flag-o-matic eutils confutils libtool php-common-r1 + +# set MY_PHP_P in the ebuild + +# we only set these variables if we're building a copy of php which can be +# installed as a package in its own right +# +# copies of php which are compiled into other packages (e.g. php support +# for the thttpd web server) don't need these variables + +if [ "${PHP_PACKAGE}" = 1 ]; then + HOMEPAGE="http://www.php.net/" + LICENSE="PHP-3" + SRC_URI="http://www.php.net/distributions/${MY_PHP_P}.tar.bz2" + S="${WORKDIR}/${MY_PHP_P}" +fi + +IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb crypt ctype curl curlwrappers db2 dba dbase dbm dbmaker debug doc empress empress-bcs esoob exif frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hardenedphp hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-external jpeg kerberos ldap libedit mcve memlimit mhash ming msql mssql mysql mysqli ncurses nls oci8 odbc oracle7 ovrimos pcntl pcre pdo-external pear pfpro png posix postgres qdbm readline recode sapdb sasl session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl sybase sybase-ct sysvipc threads tidy tiff tokenizer truetype wddx xml2 xmlrpc xpm xsl yaz zip zlib" + +# these USE flags should have the correct dependencies +DEPEND="${DEPEND} + !dev-php/php + !dev-php/php-cgi + !dev-php/mod_php + berkdb? ( =sys-libs/db-4* ) + bzip2? ( app-arch/bzip2 ) + cdb? ( dev-db/cdb ) + crypt? ( >=dev-libs/libmcrypt-2.4 ) + curl? ( >=net-misc/curl-7.10.5 ) + fdftk? ( app-text/fdftk ) + firebird? ( dev-db/firebird ) + gd-external? ( media-libs/gd ) + gdbm? ( >=sys-libs/gdbm-1.8.0 ) + gmp? ( dev-libs/gmp ) + imap? ( virtual/imap-c-client ) + iodbc? ( dev-db/libiodbc ) + jpeg? ( >=media-libs/jpeg-6b ) + kerberos? ( virtual/krb5 ) + ldap? ( >=net-nds/openldap-1.2.11 ) + libedit? ( dev-libs/libedit ) + mcve? ( net-libs/libmonetra ) + mhash? ( app-crypt/mhash ) + ming? ( media-libs/ming ) + mssql? ( dev-db/freetds ) + mysql? ( dev-db/mysql ) + mysqli? ( >=dev-db/mysql-4.1 ) + ncurses? ( sys-libs/ncurses ) + nls? ( sys-devel/gettext ) + odbc? ( >=dev-db/unixODBC-1.8.13 ) + postgres? ( >=dev-db/postgresql-7.1 ) + png? ( media-libs/libpng ) + qdbm? ( dev-db/qdbm ) + readline? ( sys-libs/readline ) + recode? ( app-text/recode ) + sharedmem? ( dev-libs/mm ) + simplexml? ( >=dev-libs/libxml2-2.6.8 ) + snmp? ( >=net-analyzer/net-snmp-5.2 ) + soap? ( >=dev-libs/libxml2-2.6.8 ) + spell? ( >=app-text/aspell-0.60 ) + ssl? ( >=dev-libs/openssl-0.9.7 ) + sybase? ( dev-db/freetds ) + tidy? ( app-text/htmltidy ) + tiff? ( media-libs/tiff ) + truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 ) + wddx? ( dev-libs/expat ) + xml2? ( >=dev-libs/libxml2-2.6.8 ) + xpm? ( virtual/x11 ) + xsl? ( dev-libs/libxslt ) + zlib? ( sys-libs/zlib ) + virtual/mta" + +# libswf conflicts with ming and should not +# be installed with the new PHP ebuilds +DEPEND="${DEPEND} !media-libs/libswf" + +# simplistic for now +RDEPEND="${RDEPEND} ${DEPEND}" + +# Additional features +# +# They are in PDEPEND because we need PHP installed first! +PDEPEND="${PDEPEND} + doc? ( app-doc/php-docs ) + java-external? ( dev-php5/php-java-bridge ) + pdo-external? ( dev-php5/pecl-pdo ) + pear? ( >=dev-php/PEAR-PEAR-1.3.6 ) + yaz? ( dev-php5/pecl-yaz ) + zip? ( dev-php5/pecl-zip )" + +# ======================================================================== +# php.ini Support +# ======================================================================== + +PHP_INI_FILE="php.ini" + +# ======================================================================== +# Hardened-PHP Support +# ======================================================================== +# +# I've done it like this so that we can support different versions of +# the patch for different versions of PHP + +case "${PV}" in + 5.0.4) HARDENEDPHP_PATCH="hardening-patch-${PV}-0.4.1.patch.gz" ;; +esac + +[ -n "${HARDENEDPHP_PATCH}" ] && SRC_URI="${SRC_URI} hardenedphp? ( http://www.hardened-php.net/${HARDENEDPHP_PATCH} )" + +# ======================================================================== + +EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst + +# ======================================================================== +# INTERNAL FUNCTIONS +# ======================================================================== + +php5_0-sapi_check_awkward_uses() { + # ------------------------------------ + # Rules for things unexpectedly broken + # go below here + # + # These rules override the "normal" + # rules listed later on + # ------------------------------------ + + # No special rules at the moment + + # ------------------------------------ + # Normal rules go below here + # ------------------------------------ + + # A variety of extensions need DBA + confutils_use_depend_all "berkdb" "dba" + confutils_use_depend_all "cdb" "dba" + confutils_use_depend_all "dbm" "dba" + confutils_use_depend_all "flatfile" "dba" + confutils_use_depend_all "gdbm" "dba" + confutils_use_depend_all "inifile" "dba" + confutils_use_depend_all "qdbm" "dba" + + # EXIF only gets built if we support a file format that uses it + confutils_use_depend_any "exif" "jpeg" "tiff" + + # support for the GD graphics library + confutils_use_conflict "gd" "gd-external" + confutils_use_depend_any "truetype" "gd" "gd-external" + confutils_use_depend_any "jpeg" "gd" "gd-external" + confutils_use_depend_any "png" "gd" "gd-external" + confutils_use_depend_any "tiff" "gd" "gd-external" + confutils_use_depend_any "xpm" "gd" "gd-external" + confutils_use_depend_all "png" "zlib" + + # Hardened-PHP doesn't work well with Apache; needs further investigation + confutils_use_conflict "hardenedphp" "apache" "apache2" + + # IMAP support + php_check_imap + + # Java-external support + confutils_use_depend_all "java-external" "session" + + # Mail support + php_check_mta + + # Oracle support + php_check_oracle + + # LDAP-sasl support + confutils_use_depend_all "sasl" "ldap" + + # MCVE needs OpenSSL + confutils_use_depend_all "mcve" "ssl" + + # ODBC support + confutils_use_depend_all "adabas" "odbc" + confutils_use_depend_all "birdstep" "odbc" + confutils_use_depend_all "dbmaker" "odbc" + confutils_use_depend_all "empress" "odbc" + confutils_use_depend_all "empress-bcs" "odbc" "empress" + confutils_use_depend_all "esoob" "odbc" + confutils_use_depend_all "db2" "odbc" + confutils_use_depend_all "iodbc" "odbc" + confutils_use_depend_all "sapdb" "odbc" + confutils_use_depend_all "solid" "odbc" + + # PEAR support + confutils_use_depend_all "pear" "cli" "pcre" "xml2" + + # QDBM doesn't play nicely with GDBM or DBM + confutils_use_conflict "qdbm" "gdbm" "dbm" + + # Readline and libedit do the same thing; you can't have both + confutils_use_conflict "readline" "libedit" + + # Recode is not liked + confutils_use_conflict "recode" "mysql" "imap" "nis" + + # the MM extension isn't thread-safe + confutils_use_conflict "sharedmem" "threads" + + confutils_warn_about_missing_deps +} + +# ======================================================================== +# EXPORTED FUNCTIONS +# ======================================================================== + +php5_0-sapi_pkg_setup() { + # let's do all the USE flag testing before we do anything else + # this way saves a lot of time + + php5_0-sapi_check_awkward_uses +} + +php5_0-sapi_src_unpack() { + if [ "${PHP_PACKAGE}" == 1 ]; then + unpack ${A} + fi + + cd ${PHP_S} + + # Patch PHP to show Gentoo as the server platform + sed -i "s/PHP_UNAME=\`uname -a\`/PHP_UNAME=\`uname -s -n -r -v\`/g" configure + # Patch for PostgreSQL support + sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i configure + + # Patch for session persistence bug + epatch ${FILESDIR}/5.1.0/php5_soap_persistence_session.diff + + # stop php from activating the apache config, as we will do that ourselves + for i in configure sapi/apache/config.m4 sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 ; do + sed -i.orig -e 's,-i -a -n php5,-i -n php5,g' ${i} + sed -i.orig -e 's,-i -A -n php5,-i -n php5,g' ${i} + done + + # hardenedphp support + use hardenedphp && [ -n "${HARDENEDPHP_PATCH}" ] && epatch ${DISTDIR}/${HARDENEDPHP_PATCH} + + # imap support + use imap && epatch ${FILESDIR}/5.0.0/php5-imap-symlink.diff + + # iodbc support + use iodbc && epatch ${FILESDIR}/5.0.0/php5-iodbc-config.diff + use iodbc && epatch ${FILESDIR}/5.1.0/php5-with-iodbc.diff + + # fix configure scripts to recognize uClibc + uclibctoolize + + # Just in case ;-) + chmod 755 configure + + # fix problems compiling with apache2 + if useq apache2 && ! useq threads ; then + epatch ${FILESDIR}/5.1.0/php5-prefork.patch || die "Unable to patch for prefork support" + fi + + # rebuild configure to make sure it's up to date + einfo "Rebuilding configure script" + WANT_AUTOCONF=2.5 autoconf -W no-cross || die "Unable to regenerate configure script" + + # fix DBA support + sed -e 's!for LIB in dbm c gdbm!for LIB in dbm c gdbm gdbm_compat!' -i configure +} + +set_php_ini_dir() { + PHP_INI_DIR="/etc/php/${PHPSAPI}-php5" + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" +} + +php5_0-sapi_src_compile() { + destdir=/usr/$(get_libdir)/php5 + set_php_ini_dir + + cd ${PHP_S} + confutils_init + + my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR} --without-pear" + + # extension USE flag shared support? + enable_extension_enable "bcmath" "bcmath" 1 + enable_extension_with "bz2" "bzip2" 1 + enable_extension_enable "calendar" "calendar" 1 + enable_extension_disable "ctype" "ctype" 0 + enable_extension_with "curl" "curl" 1 + enable_extension_with "curlwrappers" "curlwrappers" 1 + enable_extension_enable "dbase" "dbase" 1 + enable_extension_disable "dom" "xml2" 0 + enable_extension_enable "exif" "exif" 1 + enable_extension_with "fbsql" "frontbase" 1 + enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" + enable_extension_enable "filepro" "filepro" 1 + enable_extension_enable "ftp" "ftp" 1 + enable_extension_with "gettext" "nls" 1 + enable_extension_with "gmp" "gmp" 1 + enable_extension_with "hwapi" "hyperwave-api" 1 + enable_extension_with "iconv" "iconv" 1 + enable_extension_with "informix" "informix" 1 + enable_extension_disable "ipv6" "ipv6" 0 + # ircg extension not supported on Gentoo at this time + enable_extension_with "jpeg-dir" "jpeg" 0 "/usr" + enable_extension_with "kerberos" "kerberos" 0 "/usr" + enable_extension_disable "libxml" "xml2" 0 + enable_extension_enable "mbstring" "nls" 1 + enable_extension_with "mcrypt" "crypt" 1 + enable_extension_with "mcve" "mcve" 1 + enable_extension_enable "memory-limit" "memlimit" 0 + enable_extension_with "mhash" "mhash" 1 + enable_extension_with "ming" "ming" 1 + enable_extension_with "msql" "msql" 1 + enable_extension_with "mssql" "mssql" 1 + enable_extension_with "ncurses" "ncurses" 1 + enable_extension_with "oci8" "oci8" 1 + enable_extension_with "oracle" "oracle7" 1 + enable_extension_with "openssl" "ssl" 1 + enable_extension_with "openssl-dir" "ssl" 0 "/usr" + enable_extension_with "ovrimos" "ovrimos" 1 + enable_extension_enable "pcntl" "pcntl" 1 + enable_extension_without "pcre-regex" "pcre" 0 + enable_extension_with "pfpro" "pfpro" 1 + enable_extension_with "pgsql" "postgres" 1 + enable_extension_disable "posix" "posix" 1 + enable_extension_with "pspell" "spell" 1 + enable_extension_with "recode" "recode" 1 + enable_extension_disable "simplexml" "simplexml" 1 + enable_extension_enable "shmop" "sharedmem" 0 + enable_extension_with "snmp" "snmp" 1 + enable_extension_enable "soap" "soap" 1 + enable_extension_enable "sockets" "sockets" 1 + enable_extension_disable "spl" "spl" 1 + enable_extension_with "sybase" "sybase" 1 + enable_extension_with "sybase-ct" "sybase-ct" 1 + enable_extension_enable "sysvmsg" "sysvipc" 1 + enable_extension_enable "sysvsem" "sysvipc" 1 + enable_extension_enable "sysvshm" "sysvipc" 1 + enable_extension_with "tidy" "tidy" 1 + enable_extension_disable "tokenizer" "tokenizer" 1 + enable_extension_enable "wddx" "wddx" 1 + enable_extension_disable "xml" "xml2" 0 + enable_extension_with "xmlrpc" "xmlrpc" 1 + enable_extension_with "xsl" "xsl" 1 + enable_extension_with "zlib" "zlib" 1 + enable_extension_enable "debug" "debug" 0 + + # DBA support + enable_extension_enable "dba" "dba" 1 + + if useq dba ; then + enable_extension_with "cdb" "cdb" 1 + enable_extension_with "db4" "berkdb" 1 + enable_extension_with "dbm" "dbm" 1 + enable_extension_with "flatfile" "flatfile" 1 + enable_extension_with "gdbm" "gdbm" 1 + enable_extension_with "inifile" "inifile" 1 + enable_extension_with "qdbm" "qdbm" 1 + fi + + # support for the GD graphics library + if useq gd-external ; then + enable_extension_with "freetype-dir" "truetype" 0 "/usr" + enable_extension_with "t1lib" "truetype" 0 "/usr" + enable_extension_enable "gd-jis-conv" "nls" 0 + enable_extension_enable "gd-native-ttf" "truetype" 0 + enable_extension_with "gd" "gd-external" 1 "/usr" + else + enable_extension_with "freetype-dir" "truetype" 0 "/usr" + enable_extension_with "t1lib" "truetype" 0 "/usr" + enable_extension_enable "gd-jis-conv" "nls" 0 + enable_extension_enable "gd-native-ttf" "truetype" 0 + enable_extension_with "png-dir" "png" 0 "/usr" + enable_extension_with "tiff-dir" "tiff" 0 "/usr" + enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6" + # enable gd last, so configure can pick up the previous settings + enable_extension_with "gd" "gd" 0 + fi + + # IMAP support + if useq imap ; then + enable_extension_with "imap" "imap" 1 + enable_extension_with "imap-ssl" "ssl" 0 + fi + + # Interbase support + if useq firebird || useq interbase ; then + my_conf="${my_conf} --with-interbase" + fi + + # LDAP support + if useq ldap ; then + enable_extension_with "ldap" "ldap" 1 + enable_extension_with "ldap-sasl" "sasl" 0 + fi + + # MySQL support + if useq mysql ; then + enable_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" + enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + fi + + # MySQLi support + enable_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" + + # ODBC support + if useq odbc ; then + enable_extension_with "unixODBC" "odbc" 1 "/usr" + + enable_extension_with "adabas" "adabas" 1 + enable_extension_with "birdstep" "birdstep" 1 + enable_extension_with "dbmaker" "dbmaker" 1 + enable_extension_with "empress" "empress" 1 + if useq empress ; then + enable_extension_with "empress-bcs" "empress-bcs" 0 + fi + enable_extension_with "esoob" "esoob" 1 + enable_extension_with "ibm-db2" "db2" 1 + enable_extension_with "iodbc" "iodbc" 1 "/usr" + enable_extension_with "sapdb" "sapdb" 1 + enable_extension_with "solid" "solid" 1 + fi + + # readline/libedit support + # you can use readline or libedit, but you can't use both + enable_extension_with "readline" "readline" 0 + enable_extension_with "libedit" "libedit" 1 + + # session support + if ! useq session ; then + enable_extension_disable "session" "session" 1 + else + enable_extension_with "mm" "sharedmem" 0 + fi + + # sqlite support + if ! useq sqlite ; then + enable_extension_without "sqlite" "sqlite" 0 + else + enable_extension_enable "sqlite-utf8" "nls" 0 + fi + + # fix ELF-related problems + if has_pic ; then + einfo "Enabling PIC support" + my_conf="${my_conf} --with-pic" + fi + + # apache2 & threads support + if useq apache2 && useq threads ; then + my_conf="${my_conf} --enable-maintainer-zts --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # catch cflag problems + php_check_cflags + + # multilib support + if [[ $(get_libdir) != lib ]] ; then + my_conf="--with-libdir=$(get_libdir) ${my_conf}" + fi + + # all done + + # we don't use econf, because we need to override all of its settings + ./configure --prefix=${destdir} --sysconfdir=/etc --cache-file=./config.cache ${my_conf} || die "configure failed" + emake || die "make failed" +} + +php5_0-sapi_src_install() { + destdir=/usr/$(get_libdir)/php5 + + cd ${PHP_S} + addpredict /usr/share/snmp/mibs/.index + + PHP_INSTALLTARGETS="install-build install-headers install-programs" + useq sharedext && PHP_INSTALLTARGETS="${PHP_INSTALLTARGETS} install-modules" + make INSTALL_ROOT=${D} ${PHP_INSTALLTARGETS} || die "install failed" + + # install missing header files + if useq nls ; then + dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + for x in mbfilter.h mbfl_consts.h mbfl_encoding.h mbfl_language.h mbfl_string.h mbfl_convert.h mbfl_ident.h mbfl_memory_device.h mbfl_allocators.h mbfl_defs.h mbfl_filter_output.h mbfilter_pass.h mbfilter_wchar.h mbfilter_8bit.h ; do + doins ext/mbstring/libmbfl/mbfl/${x} + done + fi + + # get the extension dir + PHPEXTDIR="`${D}/${destdir}/bin/php-config --extension-dir`" + + # don't forget the php.ini file + local phpinisrc=php.ini-dist + einfo "Setting extension_dir in php.ini" + sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc} + + # A patch for PHP for security. PHP-CLI interface is exempt, as it cannot be + # fed bad data from outside. + einfo "Securing fopen wrappers" + sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i ${phpinisrc} + + # Set the include path to point to where we want to find PEAR packages + einfo "Setting correct include_path" + sed -e 's|^;include_path .*|include_path = ".:/usr/share/php:/usr/share/php5"|' -i ${phpinisrc} + + # Install any extensions built as shared objects + if useq sharedext; then + for x in `ls ${D}/${PHPEXTDIR}/*.so | sort`; do + echo "extension=`basename ${x}`" >> ${phpinisrc} + done; + fi + + # create the directory where we'll put php5-only php scripts + keepdir /usr/share/php5 +} + +php5_0-sapi_install_ini() { + # work out where we are installing the ini file + set_php_ini_dir + local phpinisrc=php.ini-dist + + dodir ${PHP_INI_DIR} + insinto ${PHP_INI_DIR} + newins ${phpinisrc} ${PHP_INI_FILE} + + dodir ${PHP_EXT_INI_DIR} +} + +php5_0-sapi_pkg_postinst() { + ewarn "If you have additional third party PHP extensions (such as" + ewarn "dev-php5/phpdbg) you may need to recompile them now." + + if useq curl; then + ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions." + ewarn "This can be a security risk!" + fi +} diff --git a/eclass/php5_1-sapi.eclass b/eclass/php5_1-sapi.eclass new file mode 100644 index 000000000000..effa5d43ad19 --- /dev/null +++ b/eclass/php5_1-sapi.eclass @@ -0,0 +1,591 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_1-sapi.eclass,v 1.1 2005/09/04 10:54:53 stuart Exp $ +# +# ######################################################################## +# +# eclass/php5_1-sapi.eclass +# Eclass for building different php5.1 SAPI instances +# +# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES +# +# Based on robbat2's work on the php4 sapi eclass +# +# Author(s) Stuart Herbert +# <stuart@gentoo.org> +# +# CHTEKK +# <chtekk@longitekk.org> +# +# ======================================================================== + +CONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase msql oci8 oracle7 ovrimos pfpro sapdb solid sybase sybase-ct" +EBUILD_SUPPORTS_SHAREDEXT=1 + +inherit flag-o-matic eutils confutils libtool php-common-r1 + +# set MY_PHP_P in the ebuild + +# we only set these variables if we're building a copy of php which can be +# installed as a package in its own right +# +# copies of php which are compiled into other packages (e.g. php support +# for the thttpd web server) don't need these variables + +if [ "${PHP_PACKAGE}" = 1 ]; then + HOMEPAGE="http://www.php.net/" + LICENSE="PHP-3" + SRC_URI="http://www.php.net/distributions/${MY_PHP_P}.tar.bz2" + S="${WORKDIR}/${MY_PHP_P}" +fi + +IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb crypt ctype curl curlwrappers db2 dba dbase dbm dbmaker debug doc empress empress-bcs esoob exif fastbuild frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hardenedphp hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-external jpeg kerberos ldap libedit mcve memlimit mhash ming msql mssql mysql mysqli ncurses nls oci8 odbc oracle7 ovrimos pcntl pcre pdo pdo-external pear pfpro png posix postgres qdbm readline recode sapdb sasl session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl sybase sybase-ct sysvipc threads tidy tiff tokenizer truetype vm-goto vm-switch wddx xml2 xmlreader xmlrpc xpm xsl yaz zip zlib" + +# these USE flags should have the correct dependencies +DEPEND="${DEPEND} + !dev-php/php + !dev-php/php-cgi + !dev-php/mod_php + berkdb? ( =sys-libs/db-4* ) + bzip2? ( app-arch/bzip2 ) + cdb? ( dev-db/cdb ) + crypt? ( >=dev-libs/libmcrypt-2.4 ) + curl? ( >=net-misc/curl-7.10.5 ) + fdftk? ( app-text/fdftk ) + firebird? ( dev-db/firebird ) + gd-external? ( media-libs/gd ) + gdbm? ( >=sys-libs/gdbm-1.8.0 ) + gmp? ( dev-libs/gmp ) + imap? ( virtual/imap-c-client ) + iodbc? ( dev-db/libiodbc ) + jpeg? ( >=media-libs/jpeg-6b ) + kerberos? ( virtual/krb5 ) + ldap? ( >=net-nds/openldap-1.2.11 ) + libedit? ( dev-libs/libedit ) + mcve? ( net-libs/libmonetra ) + mhash? ( app-crypt/mhash ) + ming? ( media-libs/ming ) + mssql? ( dev-db/freetds ) + mysql? ( dev-db/mysql ) + mysqli? ( >=dev-db/mysql-4.1 ) + ncurses? ( sys-libs/ncurses ) + nls? ( sys-devel/gettext ) + odbc? ( >=dev-db/unixODBC-1.8.13 ) + postgres? ( >=dev-db/postgresql-7.1 ) + png? ( media-libs/libpng ) + qdbm? ( dev-db/qdbm ) + readline? ( sys-libs/readline ) + recode? ( app-text/recode ) + sharedmem? ( dev-libs/mm ) + simplexml? ( >=dev-libs/libxml2-2.6.8 ) + snmp? ( >=net-analyzer/net-snmp-5.2 ) + soap? ( >=dev-libs/libxml2-2.6.8 ) + spell? ( >=app-text/aspell-0.60 ) + ssl? ( >=dev-libs/openssl-0.9.7 ) + sybase? ( dev-db/freetds ) + tidy? ( app-text/htmltidy ) + tiff? ( media-libs/tiff ) + truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 ) + wddx? ( dev-libs/expat ) + xml2? ( >=dev-libs/libxml2-2.6.8 ) + xmlreader? ( >=dev-libs/libxml2-2.6.8 ) + xpm? ( virtual/x11 ) + xsl? ( dev-libs/libxslt ) + zlib? ( sys-libs/zlib ) + virtual/mta" + +# libswf conflicts with ming and should not +# be installed with the new PHP ebuilds +DEPEND="${DEPEND} !media-libs/libswf" + +# simplistic for now +RDEPEND="${RDEPEND} ${DEPEND}" + +# Additional features +# +# They are in PDEPEND because we need PHP installed first! +PDEPEND="${PDEPEND} + doc? ( app-doc/php-docs ) + java-external? ( dev-php5/php-java-bridge ) + pdo-external? ( dev-php5/pecl-pdo ) + pear? ( >=dev-php/PEAR-PEAR-1.3.6 ) + yaz? ( dev-php5/pecl-yaz ) + zip? ( dev-php5/pecl-zip )" + +# ======================================================================== +# php.ini Support +# ======================================================================== + +PHP_INI_FILE="php.ini" + +# ======================================================================== +# Hardened-PHP Support +# ======================================================================== +# +# I've done it like this so that we can support different versions of +# the patch for different versions of PHP + +#case "${PV}" in +# 5.1.0) ;; +#esac + +#[ -n "${HARDENEDPHP_PATCH}" ] && SRC_URI="${SRC_URI} hardenedphp? ( http://www.hardened-php.net/${HARDENEDPHP_PATCH} )" + +# ======================================================================== + +EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst + +# ======================================================================== +# INTERNAL FUNCTIONS +# ======================================================================== + +php5_1-sapi_check_awkward_uses() { + # ------------------------------------ + # Rules for things unexpectedly broken + # go below here + # + # These rules override the "normal" + # rules listed later on + # ------------------------------------ + + # No special rules at the moment + + # ------------------------------------ + # Normal rules go below here + # ------------------------------------ + + # A variety of extensions need DBA + confutils_use_depend_all "berkdb" "dba" + confutils_use_depend_all "cdb" "dba" + confutils_use_depend_all "dbm" "dba" + confutils_use_depend_all "flatfile" "dba" + confutils_use_depend_all "gdbm" "dba" + confutils_use_depend_all "inifile" "dba" + confutils_use_depend_all "qdbm" "dba" + + # EXIF only gets built if we support a file format that uses it + confutils_use_depend_any "exif" "jpeg" "tiff" + + # support for the GD graphics library + confutils_use_conflict "gd" "gd-external" + confutils_use_depend_any "truetype" "gd" "gd-external" + confutils_use_depend_any "jpeg" "gd" "gd-external" + confutils_use_depend_any "png" "gd" "gd-external" + confutils_use_depend_any "tiff" "gd" "gd-external" + confutils_use_depend_any "xpm" "gd" "gd-external" + confutils_use_depend_all "png" "zlib" + + # Hardened-PHP doesn't work well with Apache; needs further investigation + confutils_use_conflict "hardenedphp" "apache" "apache2" + + # IMAP support + php_check_imap + + # Java-external support + confutils_use_depend_all "java-external" "session" + + # Mail support + php_check_mta + + # Oracle support + php_check_oracle + + # LDAP-sasl support + confutils_use_depend_all "sasl" "ldap" + + # MCVE needs OpenSSL + confutils_use_depend_all "mcve" "ssl" + + # ODBC support + confutils_use_depend_all "adabas" "odbc" + confutils_use_depend_all "birdstep" "odbc" + confutils_use_depend_all "dbmaker" "odbc" + confutils_use_depend_all "empress" "odbc" + confutils_use_depend_all "empress-bcs" "odbc" "empress" + confutils_use_depend_all "esoob" "odbc" + confutils_use_depend_all "db2" "odbc" + confutils_use_depend_all "iodbc" "odbc" + confutils_use_depend_all "sapdb" "odbc" + confutils_use_depend_all "solid" "odbc" + + # PDO can be built using the bundled code or the external PECL + # packages (dev-php5/pecl-pdo), but not both + confutils_use_conflict "pdo" "pdo-external" + + # PEAR support + confutils_use_depend_all "pear" "cli" "pcre" "xml2" + + # QDBM doesn't play nicely with GDBM or DBM + confutils_use_conflict "qdbm" "gdbm" "dbm" + + # Readline and libedit do the same thing; you can't have both + confutils_use_conflict "readline" "libedit" + + # Recode is not liked + confutils_use_conflict "recode" "mysql" "imap" "nis" + + # the MM extension isn't thread-safe + confutils_use_conflict "sharedmem" "threads" + + # We can only have one Zend-VM option enabled at a time + confutils_use_conflict "vm-goto" "vm-switch" + + confutils_warn_about_missing_deps +} + +# ======================================================================== +# EXPORTED FUNCTIONS +# ======================================================================== + +php5_1-sapi_pkg_setup() { + # let's do all the USE flag testing before we do anything else + # this way saves a lot of time + + php5_1-sapi_check_awkward_uses +} + +php5_1-sapi_src_unpack() { + if [ "${PHP_PACKAGE}" == 1 ]; then + unpack ${A} + fi + + cd ${PHP_S} + + # Patch PHP to show Gentoo as the server platform + sed -i "s/PHP_UNAME=\`uname -a\`/PHP_UNAME=\`uname -s -n -r -v\`/g" configure + # Patch for PostgreSQL support + sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i configure + + # Patch for session persistence bug + epatch ${FILESDIR}/5.1.0/php5_soap_persistence_session.diff + + # stop php from activating the apache config, as we will do that ourselves + for i in configure sapi/apache/config.m4 sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 ; do + sed -i.orig -e 's,-i -a -n php5,-i -n php5,g' ${i} + sed -i.orig -e 's,-i -A -n php5,-i -n php5,g' ${i} + done + + # hardenedphp support + use hardenedphp && [ -n "${HARDENEDPHP_PATCH}" ] && epatch ${DISTDIR}/${HARDENEDPHP_PATCH} + + # imap support + use imap && epatch ${FILESDIR}/5.1.0/php5-imap-symlink.diff + + # iodbc support + use iodbc && epatch ${FILESDIR}/5.1.0/php5-iodbc-config.diff + use iodbc && epatch ${FILESDIR}/5.1.0/php5-with-iodbc.diff + + # fix configure scripts to recognize uClibc + uclibctoolize + + # Just in case ;-) + chmod 755 configure + + # fix problems compiling with apache2 + if useq apache2 && ! useq threads ; then + epatch ${FILESDIR}/5.1.0/php5-prefork.patch || die "Unable to patch for prefork support" + fi + + # fastbuild support + use fastbuild && epatch ${FILESDIR}/5.1.0/fastbuild.patch + + # rebuild configure to make sure it's up to date + einfo "Rebuilding configure script" + WANT_AUTOCONF=2.5 autoconf -W no-cross || die "Unable to regenerate configure script" + + # fix DBA support + sed -e 's!for LIB in dbm c gdbm!for LIB in dbm c gdbm gdbm_compat!' -i configure +} + +set_php_ini_dir() { + PHP_INI_DIR="/etc/php/${PHPSAPI}-php5" + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" +} + +php5_1-sapi_src_compile() { + destdir=/usr/$(get_libdir)/php5 + set_php_ini_dir + + cd ${PHP_S} + confutils_init + + my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR} --without-pear" + + # extension USE flag shared support? + enable_extension_enable "bcmath" "bcmath" 1 + enable_extension_with "bz2" "bzip2" 1 + enable_extension_enable "calendar" "calendar" 1 + enable_extension_disable "ctype" "ctype" 0 + enable_extension_with "curl" "curl" 1 + enable_extension_with "curlwrappers" "curlwrappers" 1 + enable_extension_enable "dbase" "dbase" 1 + enable_extension_disable "dom" "xml2" 0 + enable_extension_enable "exif" "exif" 1 + enable_extension_with "fbsql" "frontbase" 1 + enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" + enable_extension_enable "filepro" "filepro" 1 + enable_extension_enable "ftp" "ftp" 1 + enable_extension_with "gettext" "nls" 1 + enable_extension_with "gmp" "gmp" 1 + enable_extension_with "hwapi" "hyperwave-api" 1 + enable_extension_with "iconv" "iconv" 1 + enable_extension_with "informix" "informix" 1 + enable_extension_disable "ipv6" "ipv6" 0 + # ircg extension not supported on Gentoo at this time + enable_extension_with "jpeg-dir" "jpeg" 0 "/usr" + enable_extension_with "kerberos" "kerberos" 0 "/usr" + enable_extension_disable "libxml" "xml2" 0 + enable_extension_enable "mbstring" "nls" 1 + enable_extension_with "mcrypt" "crypt" 1 + enable_extension_with "mcve" "mcve" 1 + enable_extension_enable "memory-limit" "memlimit" 0 + enable_extension_with "mhash" "mhash" 1 + enable_extension_with "ming" "ming" 1 + enable_extension_with "msql" "msql" 1 + enable_extension_with "mssql" "mssql" 1 + enable_extension_with "ncurses" "ncurses" 1 + enable_extension_with "oci8" "oci8" 1 + enable_extension_with "oracle" "oracle7" 1 + enable_extension_with "openssl" "ssl" 1 + enable_extension_with "openssl-dir" "ssl" 0 "/usr" + enable_extension_with "ovrimos" "ovrimos" 1 + enable_extension_enable "pcntl" "pcntl" 1 + enable_extension_without "pcre-regex" "pcre" 0 + enable_extension_disable "pdo" "pdo" 1 + enable_extension_with "pfpro" "pfpro" 1 + enable_extension_with "pgsql" "postgres" 1 + enable_extension_disable "posix" "posix" 1 + enable_extension_with "pspell" "spell" 1 + enable_extension_with "recode" "recode" 1 + enable_extension_disable "simplexml" "simplexml" 1 + enable_extension_enable "shmop" "sharedmem" 0 + enable_extension_with "snmp" "snmp" 1 + enable_extension_enable "soap" "soap" 1 + enable_extension_enable "sockets" "sockets" 1 + enable_extension_disable "spl" "spl" 1 + enable_extension_with "sybase" "sybase" 1 + enable_extension_with "sybase-ct" "sybase-ct" 1 + enable_extension_enable "sysvmsg" "sysvipc" 1 + enable_extension_enable "sysvsem" "sysvipc" 1 + enable_extension_enable "sysvshm" "sysvipc" 1 + enable_extension_with "tidy" "tidy" 1 + enable_extension_disable "tokenizer" "tokenizer" 1 + enable_extension_enable "wddx" "wddx" 1 + enable_extension_disable "xml" "xml2" 0 + enable_extension_with "xmlreader" "xmlreader" 1 + enable_extension_with "xmlrpc" "xmlrpc" 1 + enable_extension_with "xsl" "xsl" 1 + enable_extension_with "zlib" "zlib" 1 + enable_extension_enable "debug" "debug" 0 + + # DBA support + enable_extension_enable "dba" "dba" 1 + + if useq dba ; then + enable_extension_with "cdb" "cdb" 1 + enable_extension_with "db4" "berkdb" 1 + enable_extension_with "dbm" "dbm" 1 + enable_extension_with "flatfile" "flatfile" 1 + enable_extension_with "gdbm" "gdbm" 1 + enable_extension_with "inifile" "inifile" 1 + enable_extension_with "qdbm" "qdbm" 1 + fi + + # support for the GD graphics library + if useq gd-external ; then + enable_extension_with "freetype-dir" "truetype" 0 "/usr" + enable_extension_with "t1lib" "truetype" 0 "/usr" + enable_extension_enable "gd-jis-conv" "nls" 0 + enable_extension_enable "gd-native-ttf" "truetype" 0 + enable_extension_with "gd" "gd-external" 1 "/usr" + else + enable_extension_with "freetype-dir" "truetype" 0 "/usr" + enable_extension_with "t1lib" "truetype" 0 "/usr" + enable_extension_enable "gd-jis-conv" "nls" 0 + enable_extension_enable "gd-native-ttf" "truetype" 0 + enable_extension_with "png-dir" "png" 0 "/usr" + enable_extension_with "tiff-dir" "tiff" 0 "/usr" + enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6" + # enable gd last, so configure can pick up the previous settings + enable_extension_with "gd" "gd" 0 + fi + + # IMAP support + if useq imap ; then + enable_extension_with "imap" "imap" 1 + enable_extension_with "imap-ssl" "ssl" 0 + fi + + # Interbase support + if useq firebird || useq interbase ; then + my_conf="${my_conf} --with-interbase" + fi + + # LDAP support + if useq ldap ; then + enable_extension_with "ldap" "ldap" 1 + enable_extension_with "ldap-sasl" "sasl" 0 + fi + + # MySQL support + if useq mysql ; then + enable_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" + enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + fi + + # MySQLi support + enable_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" + + # ODBC support + if useq odbc ; then + enable_extension_with "unixODBC" "odbc" 1 "/usr" + + enable_extension_with "adabas" "adabas" 1 + enable_extension_with "birdstep" "birdstep" 1 + enable_extension_with "dbmaker" "dbmaker" 1 + enable_extension_with "empress" "empress" 1 + if useq empress ; then + enable_extension_with "empress-bcs" "empress-bcs" 0 + fi + enable_extension_with "esoob" "esoob" 1 + enable_extension_with "ibm-db2" "db2" 1 + enable_extension_with "iodbc" "iodbc" 1 "/usr" + enable_extension_with "sapdb" "sapdb" 1 + enable_extension_with "solid" "solid" 1 + fi + + # PDO support + if useq pdo ; then + enable_extension_with "pdo-dblib" "mssql" 1 + enable_extension_with "pdo-firebird" "firebird" 1 + enable_extension_with "pdo-mysql" "mysql" 1 "/usr" + enable_extension_with "pdo-oci" "oci8" 1 + enable_extension_with "pdo-odbc" "odbc" 1 "unixODBC,/usr" + enable_extension_with "pdo-pgsql" "postgres" 1 + enable_extension_without "pdo-sqlite" "sqlite" 1 + fi + + # readline/libedit support + # you can use readline or libedit, but you can't use both + enable_extension_with "readline" "readline" 0 + enable_extension_with "libedit" "libedit" 1 + + # session support + if ! useq session ; then + enable_extension_disable "session" "session" 1 + else + enable_extension_with "mm" "sharedmem" 0 + fi + + # sqlite support + if ! useq sqlite ; then + enable_extension_without "sqlite" "sqlite" 0 + else + enable_extension_enable "sqlite-utf8" "nls" 0 + fi + + # Zend-GOTO-VM support + if useq vm-goto ; then + my_conf="${my_conf} --with-zend-vm=GOTO" + fi + + # Zend-SWITCH-VM support + if useq vm-switch ; then + my_conf="${my_conf} --with-zend-vm=SWITCH" + fi + + # fix ELF-related problems + if has_pic ; then + einfo "Enabling PIC support" + my_conf="${my_conf} --with-pic" + fi + + # apache2 & threads support + if useq apache2 && useq threads ; then + my_conf="${my_conf} --enable-maintainer-zts --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # catch cflag problems + php_check_cflags + + # multilib support + if [[ $(get_libdir) != lib ]] ; then + my_conf="--with-libdir=$(get_libdir) ${my_conf}" + fi + + # all done + + # we don't use econf, because we need to override all of its settings + ./configure --prefix=${destdir} --sysconfdir=/etc --cache-file=./config.cache ${my_conf} || die "configure failed" + emake || die "make failed" +} + +php5_1-sapi_src_install() { + destdir=/usr/$(get_libdir)/php5 + + cd ${PHP_S} + addpredict /usr/share/snmp/mibs/.index + + PHP_INSTALLTARGETS="install-build install-headers install-programs" + useq sharedext && PHP_INSTALLTARGETS="${PHP_INSTALLTARGETS} install-modules" + make INSTALL_ROOT=${D} ${PHP_INSTALLTARGETS} || die "install failed" + + # install missing header files + if useq nls ; then + dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + for x in mbfilter.h mbfl_consts.h mbfl_encoding.h mbfl_language.h mbfl_string.h mbfl_convert.h mbfl_ident.h mbfl_memory_device.h mbfl_allocators.h mbfl_defs.h mbfl_filter_output.h mbfilter_pass.h mbfilter_wchar.h mbfilter_8bit.h ; do + doins ext/mbstring/libmbfl/mbfl/${x} + done + fi + + # get the extension dir + PHPEXTDIR="`${D}/${destdir}/bin/php-config --extension-dir`" + + # don't forget the php.ini file + local phpinisrc=php.ini-dist + einfo "Setting extension_dir in php.ini" + sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc} + + # A patch for PHP for security. PHP-CLI interface is exempt, as it cannot be + # fed bad data from outside. + einfo "Securing fopen wrappers" + sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i ${phpinisrc} + + # Set the include path to point to where we want to find PEAR packages + einfo "Setting correct include_path" + sed -e 's|^;include_path .*|include_path = ".:/usr/share/php:/usr/share/php5"|' -i ${phpinisrc} + + # Install any extensions built as shared objects + if useq sharedext; then + for x in `ls ${D}/${PHPEXTDIR}/*.so | sort`; do + echo "extension=`basename ${x}`" >> ${phpinisrc} + done; + fi + + # create the directory where we'll put php5-only php scripts + keepdir /usr/share/php5 +} + +php5_1-sapi_install_ini() { + # work out where we are installing the ini file + set_php_ini_dir + local phpinisrc=php.ini-dist + + dodir ${PHP_INI_DIR} + insinto ${PHP_INI_DIR} + newins ${phpinisrc} ${PHP_INI_FILE} + + dodir ${PHP_EXT_INI_DIR} +} + +php5_1-sapi_pkg_postinst() { + ewarn "If you have additional third party PHP extensions (such as" + ewarn "dev-php5/phpdbg) you may need to recompile them now." + + if useq curl; then + ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions." + ewarn "This can be a security risk!" + fi +} |