From 94fed447c2fbec3ccb7ecba38a7431b9e9b48de5 Mon Sep 17 00:00:00 2001 From: Luca Longinotti Date: Mon, 5 Mar 2007 01:50:47 +0000 Subject: [PATCH] New updated PHP eclasses, fix lots of bugs, introduce PHP 5.2 support. --- eclass/depend.php.eclass | 58 +-- eclass/php-common-r1.eclass | 128 ++++-- eclass/php-ext-base-r1.eclass | 97 +++-- eclass/php-ext-pecl-r1.eclass | 30 +- eclass/php-ext-source-r1.eclass | 79 ++-- eclass/php-ezc.eclass | 28 +- eclass/php-lib-r1.eclass | 22 +- eclass/php-pear-lib-r1.eclass | 34 +- eclass/php-pear-r1.eclass | 55 ++- eclass/php4_4-sapi.eclass | 150 ++++--- eclass/php5_0-sapi.eclass | 150 +++---- eclass/php5_1-sapi.eclass | 213 ++++++---- eclass/php5_2-sapi.eclass | 721 ++++++++++++++++++++++++++++++++ 13 files changed, 1290 insertions(+), 475 deletions(-) create mode 100644 eclass/php5_2-sapi.eclass diff --git a/eclass/depend.php.eclass b/eclass/depend.php.eclass index cff0b1aaa58a..c6eee63ea469 100644 --- a/eclass/depend.php.eclass +++ b/eclass/depend.php.eclass @@ -1,11 +1,11 @@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.17 2007/02/02 19:09:33 chtekk Exp $ -# +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.18 2007/03/05 01:50:47 chtekk Exp $ + # ======================================================================== # # depend.php.eclass -# functions to allow ebuilds to depend on php4 and/or php5 +# Functions to allow ebuilds to depend on php4 and/or php5 # # Author: Stuart Herbert # @@ -13,7 +13,7 @@ # Author: Luca Longinotti # # -# Maintained by the PHP Herd +# Maintained by the PHP Team # # ======================================================================== @@ -117,7 +117,7 @@ need_php_by_category() { 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" + *) die "Version of PHP required by packages in category ${CATEGORY} unknown" esac } @@ -291,24 +291,24 @@ has_zts() { return 1 } -# Check if our PHP was built with Hardened-PHP enabled +# Check if our PHP was built with debug support enabled -has_hardenedphp() { +has_debug() { has_php - if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then + if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then return 0 fi return 1 } -# Check if our PHP was built with debug support enabled +# Check if our PHP was built with the concurrentmodphp support enabled -has_debug() { +has_concurrentmodphp() { has_php - if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then + if built_with_use =${PHP_PKG} apache2 concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} apache2 concurrentmodphp ; then return 0 fi @@ -331,11 +331,9 @@ require_pdo() { eerror eerror "This package requires PDO." eerror "PDO is only available 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 "You must install >=dev-lang/php-5.1 with" + eerror "either the 'pdo' or the 'pdo-external'" + eerror "USE flags turned on." eerror die "PHP 5 not installed" fi @@ -355,16 +353,14 @@ require_pdo() { return fi - # If we get here, then we have no PDO support + # If we get here, then we don't have 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 "you must install >=dev-lang/php-5.1 with" + eerror "either the 'pdo' or the 'pdo-external'" + eerror "USE flags turned on." eerror die "No PDO extension for PHP 5 found" } @@ -526,17 +522,7 @@ php_binary_extension() { # are enabled which change the PHP API version, they also # don't provide correctly versioned symbols for our use - if built_with_use =${PHP_PKG} hardenedphp || phpconfutils_built_with_use =${PHP_PKG} hardenedphp ; then - eerror - eerror "You cannot install binary PHP extensions" - eerror "when the 'hardenedphp' USE flag is enabled!" - eerror "Please reemerge dev-lang/php with the" - eerror "'hardenedphp' USE flag turned off." - eerror - PUSE_ENABLED="1" - fi - - if built_with_use =${PHP_PKG} debug || phpconfutils_built_with_use =${PHP_PKG} debug ; then + if has_debug ; then eerror eerror "You cannot install binary PHP extensions" eerror "when the 'debug' USE flag is enabled!" @@ -546,7 +532,7 @@ php_binary_extension() { PUSE_ENABLED="1" fi - if built_with_use =${PHP_PKG} concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} concurrentmodphp ; then + if has_concurrentmodphp ; then eerror eerror "You cannot install binary PHP extensions when" eerror "the 'concurrentmodphp' USE flag is enabled!" @@ -557,7 +543,7 @@ php_binary_extension() { fi if [[ -n ${PUSE_ENABLED} ]] ; then - die "'hardenedphp' and/or 'debug' and/or 'concurrentmodphp' USE flags turned on!" + die "'debug' and/or 'concurrentmodphp' USE flags turned on!" fi } diff --git a/eclass/php-common-r1.eclass b/eclass/php-common-r1.eclass index 6d7794c0b35d..a323163db934 100644 --- a/eclass/php-common-r1.eclass +++ b/eclass/php-common-r1.eclass @@ -1,25 +1,25 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 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.8 2006/07/14 16:02:36 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-common-r1.eclass,v 1.9 2007/03/05 01:50:47 chtekk Exp $ -# ######################################################################## +# ======================================================================== # -# eclass/php-common-r1.eclass -# Contains common functions which are shared between the -# PHP4 and PHP5 packages +# php-common-r1.eclass +# Contains common functions which are shared between the +# PHP4 and PHP5 packages # -# USE THIS ECLASS FOR THE "CONSOLIDATED" 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 +# Based on robbat2's work on the php4 sapi eclass +# Based on stuart's work on the php5 sapi eclass # -# Maintained by the PHP Herd +# Maintained by the PHP Team # -# ######################################################################## +# ======================================================================== -# ######################################################################## +# ======================================================================== # CFLAG SANITY -# ######################################################################## +# ======================================================================== php_check_cflags() { # Filter the following from C[XX]FLAGS regardless, as apache won't be @@ -36,16 +36,16 @@ php_check_cflags() { replace-flags "-march=k6" "-march=i586" } -# ######################################################################## +# ======================================================================== # IMAP SUPPORT -# ######################################################################## +# ======================================================================== php_check_imap() { - if ! useq "imap" && ! phpconfutils_usecheck "imap" ; then + if ! use "imap" && ! phpconfutils_usecheck "imap" ; then return fi - if useq "ssl" || phpconfutils_usecheck "ssl" ; then + if use "ssl" || phpconfutils_usecheck "ssl" ; then if ! built_with_use virtual/imap-c-client ssl ; then eerror eerror "IMAP with SSL requested, but your IMAP C-Client libraries are built without SSL!" @@ -62,15 +62,15 @@ php_check_imap() { 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. -# ######################################################################## +# The bundled java extension is unique to PHP4, but there is +# now the PHP-Java-Bridge that works under both PHP4 and PHP5. +# ======================================================================== php_check_java() { - if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then return fi @@ -108,7 +108,7 @@ php_check_java() { } php_install_java() { - if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then return fi @@ -130,7 +130,7 @@ php_install_java() { } php_install_java_inifile() { - if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + if ! use "java-internal" && ! phpconfutils_usecheck "java-internal" ; then return fi @@ -144,9 +144,9 @@ php_install_java_inifile() { dosym "${PHP_EXT_INI_DIR}/java.ini" "${PHP_EXT_INI_DIR_ACTIVE}/java.ini" } -# ######################################################################## +# ======================================================================== # MTA SUPPORT -# ######################################################################## +# ======================================================================== php_check_mta() { if ! [[ -x "${ROOT}/usr/sbin/sendmail" ]] ; then @@ -160,12 +160,12 @@ php_check_mta() { fi } -# ######################################################################## +# ======================================================================== # ORACLE SUPPORT -# ######################################################################## +# ======================================================================== php_check_oracle_all() { - if useq "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then + if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then eerror eerror "You must have the ORACLE_HOME variable set in your environment to" eerror "compile the Oracle extension." @@ -173,7 +173,7 @@ php_check_oracle_all() { die "Oracle configuration incorrect; user error" fi - if useq "oci8" || useq "oracle7" ; then + if use "oci8" || use "oracle7" ; then if has_version 'dev-db/oracle-instantclient-basic' ; then ewarn ewarn "Please ensure you have a full install of the Oracle client." @@ -186,7 +186,7 @@ php_check_oracle_all() { } php_check_oracle_8() { - if useq "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then + if use "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then eerror eerror "You must have the ORACLE_HOME variable set in your environment to" eerror "compile the Oracle extension." @@ -194,7 +194,7 @@ php_check_oracle_8() { die "Oracle configuration incorrect; user error" fi - if useq "oci8" ; then + if use "oci8" ; then if has_version 'dev-db/oracle-instantclient-basic' ; then ewarn ewarn "Please ensure you have a full install of the Oracle client." @@ -206,13 +206,13 @@ php_check_oracle_8() { fi } -# ######################################################################## +# ======================================================================== # POSTGRESQL SUPPORT -# ######################################################################## +# ======================================================================== php_check_pgsql() { - if useq "postgres" \ - && useq "apache2" && useq "threads" \ + if use "postgres" \ + && use "apache2" && use "threads" \ && has_version ">=dev-db/libpq-8.1.3-r1" \ && ! built_with_use ">=dev-db/libpq-8.1.3-r1" "threads" ; then eerror @@ -223,6 +223,56 @@ php_check_pgsql() { fi } -# ######################################################################## -# END OF ECLASS -# ######################################################################## +# ======================================================================== +# MYSQL CHARSET DETECTION SUPPORT ## Thanks to hoffie +# ======================================================================== + +php_get_mycnf_charset() { + local sapi="${1}" + local section="" + local client_charset="" + local sapi_charset="" + + # remove comments and pipe the output to our while loop + while read line ; do + line=$(echo "${line}" | sed 's:[;#][^\n]*::g') + + # skip empty lines + if [[ "${line}" == "" ]] ; then + continue + fi + + # capture sections + tmp=$(echo "${line}" | sed 's:\[\([-a-z0-9\_]*\)\]:\1:') + if [[ "${line}" != "${tmp}" ]] ; then + section=${tmp} + else + # we don't need to check lines which are not in a section we are interested about + if [[ "${section}" != "client" && "${section}" != "php-${sapi}" ]] ; then + continue + fi + + # match default-character-set= lines + tmp=$(echo "${line}" | sed 's|^[[:space:]\ ]*default-character-set[[:space:]\ ]*=[[:space:]\ ]*\"\?\([a-z0-9\-]*\)\"\?|\1|') + if [[ "${line}" == "${tmp}" ]] ; then + # nothing changed, irrelevant line + continue + fi + if [[ "${section}" == "client" ]] ; then + client_charset="${tmp}" + else + if [[ "${section}" == "php-${sapi}" ]] ; then + sapi_charset="${tmp}" + fi + fi + fi + done < "${ROOT}/etc/mysql/my.cnf" + # if a sapi-specific section with a default-character-set= value was found we use it, otherwise we use the client charset (which may be empty) + if [[ -n "${sapi_charset}" ]] ; then + echo "${sapi_charset}" + elif [[ -n "${client_charset}" ]] ; then + echo "${client_charset}" + else + echo "empty" + fi +} diff --git a/eclass/php-ext-base-r1.eclass b/eclass/php-ext-base-r1.eclass index c0bb1221784d..52ac269da525 100644 --- a/eclass/php-ext-base-r1.eclass +++ b/eclass/php-ext-base-r1.eclass @@ -1,10 +1,11 @@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2007 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.5 2007/02/02 19:09:33 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-base-r1.eclass,v 1.6 2007/03/05 01:50:47 chtekk Exp $ # # Author: Tal Peer # Author: Stuart Herbert -# Maintained by the PHP Herd +# Author: Luca Longinotti +# Maintained by the PHP Team # # The php-ext-base-r1 eclass provides a unified interface for adding standalone # PHP extensions ('modules') to the php.ini files on your system. @@ -16,72 +17,78 @@ 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-base-r1 eclass" -# 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 +# Wether or not to add a line to php.ini for the extension # (defaults to "yes" and shouldn't be changed in most cases) -[ -z "${PHP_EXT_INI}" ] && PHP_EXT_INI="yes" +[[ -z "${PHP_EXT_INI}" ]] && PHP_EXT_INI="yes" -# ---end ebuild configurable settings - -DEPEND="${DEPEND} - >=sys-devel/m4-1.4.3 - >=sys-devel/libtool-1.5.18 - >=sys-devel/automake-1.9.6 - sys-devel/automake-wrapper - >=sys-devel/autoconf-2.59 - sys-devel/autoconf-wrapper" +# Wether the extension is a ZendEngine extension or not +# (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" php-ext-base-r1_buildinilist() { - # work out the list of .ini files to edit/add to - if [ -z "${PHPSAPILIST}" ]; then + # Work out the list of .ini files to edit/add to + if [[ -z "${PHPSAPILIST}" ]] ; then PHPSAPILIST="apache1 apache2 cli cgi" fi - PHPINIFILELIST= + PHPINIFILELIST="" for x in ${PHPSAPILIST} ; do - if [ -f /etc/php/${x}-php${PHP_VERSION}/php.ini ]; then + 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() { + # Pull in the PHP settings has_php addpredict /usr/share/snmp/mibs/.index + + # Build the list of .ini files to edit/add to php-ext-base-r1_buildinilist - if [ "${PHP_EXT_INI}" = "yes" ] ; then + + # Add the needed lines to the .ini files + if [[ "${PHP_EXT_INI}" = "yes" ]] ; then php-ext-base-r1_addextension "${PHP_EXT_NAME}.so" fi + + # Symlink the .ini files from ext/ to ext-active/ for inifile in ${PHPINIFILELIST} ; do - inidir=${inifile/${PHP_EXT_NAME}.ini/} - inidir=${inidir/ext/ext-active} + inidir="${inifile/${PHP_EXT_NAME}.ini/}" + inidir="${inidir/ext/ext-active}" dodir "/${inidir}" dosym "/${inifile}" "/${inifile/ext/ext-active}" done - # add support for installing php files into a version dependant directory + + # 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 [[ "${PHP_EXT_ZENDEXT}" = "yes" ]] ; then + # We need the full path for ZendEngine extensions + # and we need to check for debugging enabled! if has_zts ; then - ext_type="zend_extension_ts" + if has_debug ; then + ext_type="zend_extension_debug_ts" + else + ext_type="zend_extension_ts" + fi ext_file="${EXT_DIR}/$1" else - ext_type="zend_extension" + if has_debug ; then + ext_type="zend_extension_debug" + else + ext_type="zend_extension" + fi ext_file="${EXT_DIR}/$1" fi else - # we do *not* add the full path for the extension! + # We don't need the full path for normal extensions! ext_type="extension" ext_file="$1" fi @@ -89,35 +96,33 @@ php-ext-base-r1_addextension() { 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 +# $1 - Setting name +# $2 - Setting value +# $3 - File to add to +# $4 - Sanitized text to output php-ext-base-r1_addtoinifile() { - if [[ ! -d `dirname $3` ]]; then + if [[ ! -d `dirname $3` ]] ; then mkdir -p `dirname $3` fi - # are we adding the name of a section? + # Are we adding the name of a section? if [[ ${1:0:1} == "[" ]] ; then - echo "$1" >> $3 + echo "$1" >> "$3" my_added="$1" else - echo "$1=$2" >> $3 + echo "$1=$2" >> "$3" my_added="$1=$2" fi - if [ -z "$4" ]; then + 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 + doins "$3" } php-ext-base-r1_addtoinifiles() { diff --git a/eclass/php-ext-pecl-r1.eclass b/eclass/php-ext-pecl-r1.eclass index 075c2e909736..58c652c71381 100644 --- a/eclass/php-ext-pecl-r1.eclass +++ b/eclass/php-ext-pecl-r1.eclass @@ -1,35 +1,33 @@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2007 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.4 2006/09/05 07:42:00 sebastian Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-pecl-r1.eclass,v 1.5 2007/03/05 01:50:47 chtekk Exp $ # # Author: Tal Peer -# Maintained by the PHP Herd +# Author: Luca Longinotti +# Maintained by the PHP Team # # This eclass should be used by all dev-php[4,5]/pecl-* ebuilds, as a uniform way of installing PECL extensions. -# For more information about PECL, see: http://pecl.php.net +# 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} -MY_PV=${PV/_/} -PECL_PKG_V=${PECL_PKG}-${MY_PV} +[[ -z "${PHP_EXT_PECL_PKG}" ]] && PHP_EXT_PECL_PKG="${PN/pecl-/}" -[ -z "${PHP_EXT_NAME}" ] && PHP_EXT_NAME=${PECL_PKG} +PECL_PKG="${PHP_EXT_PECL_PKG}" +MY_PV="${PV/_/}" +PECL_PKG_V="${PECL_PKG}-${MY_PV}" -inherit php-ext-source-r1 +[[ -z "${PHP_EXT_NAME}" ]] && PHP_EXT_NAME="${PECL_PKG}" -EXPORT_FUNCTIONS src_compile src_install +inherit php-ext-source-r1 depend.php -# ---begin ebuild configurable settings +EXPORT_FUNCTIONS src_compile src_install -# Needs to be set if the filename is other than the package name -if [ -n "${PHP_EXT_PECL_FILENAME}" ]; then +# Needs to be set if the filename differs from the package name +if [[ -n "${PHP_EXT_PECL_FILENAME}" ]] ; then FILENAME="${PHP_EXT_PECL_FILENAME}-${MY_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}" diff --git a/eclass/php-ext-source-r1.eclass b/eclass/php-ext-source-r1.eclass index b9cc9b3d4f33..547583e4d450 100644 --- a/eclass/php-ext-source-r1.eclass +++ b/eclass/php-ext-source-r1.eclass @@ -1,10 +1,11 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 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.5 2006/07/14 16:02:36 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ext-source-r1.eclass,v 1.6 2007/03/05 01:50:47 chtekk Exp $ # # Author: Tal Peer # Author: Stuart Herbert -# Maintained by the PHP Herd +# Author: Luca Longinotti +# Maintained by the PHP Team # # The php-ext-source-r1 eclass provides a unified interface for compiling and # installing standalone PHP extensions ('modules') from source code. @@ -13,78 +14,68 @@ # # inherit php-ext-source-r1 -inherit php-ext-base-r1 flag-o-matic +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" -EXPORT_FUNCTIONS src_compile src_install - -# ---begin ebuild configurable settings +inherit php-ext-base-r1 flag-o-matic autotools depend.php -# 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" +EXPORT_FUNCTIONS src_compile src_install -# ---end 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-source-r1 eclass" DEPEND=">=sys-devel/m4-1.4.3 - >=sys-devel/libtool-1.5.18 - >=sys-devel/automake-1.9.6 - sys-devel/automake-wrapper - >=sys-devel/autoconf-2.59 - sys-devel/autoconf-wrapper" + >=sys-devel/libtool-1.5.18" +RDEPEND="" php-ext-source-r1_src_compile() { # Pull in the PHP settings has_php - cd "${S}" - my_conf="${my_conf} --prefix=${PHPPREFIX} --with-php-config=${PHPCONFIG}" addpredict /usr/share/snmp/mibs/.index + # Set the correct config options + my_conf="--prefix=${PHPPREFIX} --with-php-config=${PHPCONFIG} ${my_conf}" + # Create configure out of config.m4 ${PHPIZE} - # Set needed automake/autoconf versions - export WANT_AUTOMAKE=1.9 WANT_AUTOCONF=2.5 - # Concurrent PHP Apache2 modules support - if built_with_use =${PHP_PKG} apache2 || phpconfutils_built_with_use =${PHP_PKG} apache2 ; then - if built_with_use =${PHP_PKG} concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} concurrentmodphp ; then - append-ldflags "-Wl,--version-script=${ROOT}/var/lib/php-pkg/${PHP_PKG}/php${PHP_VERSION}-ldvs" - fi + if has_concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${ROOT}/var/lib/php-pkg/${PHP_PKG}/php${PHP_VERSION}-ldvs" fi - # First compile run: the default - ./configure ${my_conf} || die "Unable to configure code to compile" + # First compile run: the default one + econf ${my_conf} || die "Unable to configure code to compile" emake || die "Unable to make code" mv -f "modules/${PHP_EXT_NAME}.so" "${WORKDIR}/${PHP_EXT_NAME}-default.so" || die "Unable to move extension" # Concurrent PHP Apache2 modules support - if built_with_use =${PHP_PKG} apache2 || phpconfutils_built_with_use =${PHP_PKG} apache2 ; then - if built_with_use =${PHP_PKG} concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} concurrentmodphp ; then - # First let's clean up - make distclean || die "Unable to clean build environment" - - # Second compile run: the versioned one - append-ldflags "-Wl,--allow-shlib-undefined -L/usr/$(get_libdir)/apache2/modules/ -lphp${PHP_VERSION}" - ./configure ${my_conf} || die "Unable to configure code to compile" - emake || die "Unable to make code" - mv -f "modules/${PHP_EXT_NAME}.so" "${WORKDIR}/${PHP_EXT_NAME}-versioned.so" || die "Unable to move extension" - fi + if has_concurrentmodphp ; then + # First let's clean up + make distclean || die "Unable to clean build environment" + + # Second compile run: the versioned one + econf ${my_conf} || die "Unable to configure versioned code to compile" + sed -e "s|-Wl,--version-script=${ROOT}/var/lib/php-pkg/${PHP_PKG}/php${PHP_VERSION}-ldvs|-Wl,--version-script=${ROOT}/var/lib/php-pkg/${PHP_PKG}/php${PHP_VERSION}-ldvs -Wl,--allow-shlib-undefined -L/usr/$(get_libdir)/apache2/modules/ -lphp${PHP_VERSION}|g" -i Makefile + append-ldflags "-Wl,--allow-shlib-undefined -L/usr/$(get_libdir)/apache2/modules/ -lphp${PHP_VERSION}" + emake || die "Unable to make versioned code" + mv -f "modules/${PHP_EXT_NAME}.so" "${WORKDIR}/${PHP_EXT_NAME}-versioned.so" || die "Unable to move versioned extension" fi } php-ext-source-r1_src_install() { + # Pull in the PHP settings has_php + addpredict /usr/share/snmp/mibs/.index # Let's put the default module away insinto "${EXT_DIR}" newins "${WORKDIR}/${PHP_EXT_NAME}-default.so" "${PHP_EXT_NAME}.so" - # And now the versioned one - if built_with_use =${PHP_PKG} apache2 || phpconfutils_built_with_use =${PHP_PKG} apache2 ; then - if built_with_use =${PHP_PKG} concurrentmodphp || phpconfutils_built_with_use =${PHP_PKG} concurrentmodphp ; then - insinto "${EXT_DIR}-versioned" - newins "${WORKDIR}/${PHP_EXT_NAME}-versioned.so" "${PHP_EXT_NAME}.so" - fi + # And now the versioned one, if it exists + if has_concurrentmodphp ; then + insinto "${EXT_DIR}-versioned" + newins "${WORKDIR}/${PHP_EXT_NAME}-versioned.so" "${PHP_EXT_NAME}.so" fi php-ext-base-r1_src_install diff --git a/eclass/php-ezc.eclass b/eclass/php-ezc.eclass index f827a3cfa3aa..33d0c7285371 100644 --- a/eclass/php-ezc.eclass +++ b/eclass/php-ezc.eclass @@ -1,36 +1,34 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/php-ezc.eclass,v 1.1 2006/01/23 14:36:29 sebastian Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-ezc.eclass,v 1.2 2007/03/05 01:50:47 chtekk Exp $ # -# Maintained by the PHP Herd +# Maintained by the PHP Team # # The php-ezc eclass provides means for an easy installation -# for the eZ components, see http://ez.no/products/ez_components. +# of the eZ components, see http://ez.no/products/ez_components inherit php-pear-r1 -EZC_PKG_NAME=${PN/ezc-/} +EZC_PKG_NAME="${PN/ezc-/}" fix_EZC_PV() { - tmp=${PV} - tmp=${tmp/_/} - tmp=${tmp/rc/RC} - tmp=${tmp/beta/b} - EZC_PV=${tmp} + tmp="${PV}" + tmp="${tmp/_/}" + tmp="${tmp/rc/RC}" + tmp="${tmp/beta/b}" + EZC_PV="${tmp}" } EZC_PV="" fix_EZC_PV -EZC_PN=${EZC_PKG_NAME}-${EZC_PV} +EZC_PN="${EZC_PKG_NAME}-${EZC_PV}" S="${WORKDIR}/${EZC_PN}" -DEPEND="${DEPEND} - >=dev-lang/php-5.1.1 +DEPEND=">=dev-lang/php-5.1.2 >=dev-php/PEAR-PEAR-1.4.6" -RDEPEND="${RDEPEND} - ${DEPEND} +RDEPEND="${DEPEND} dev-php5/ezc-Base" SRC_URI="http://components.ez.no/get/${EZC_PN}.tgz" diff --git a/eclass/php-lib-r1.eclass b/eclass/php-lib-r1.eclass index 67a6e6631031..4596dc4992c8 100644 --- a/eclass/php-lib-r1.eclass +++ b/eclass/php-lib-r1.eclass @@ -1,9 +1,10 @@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2007 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.4 2005/11/20 01:35:05 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-lib-r1.eclass,v 1.5 2007/03/05 01:50:47 chtekk Exp $ # # Author: Stuart Herbert -# Maintained by the PHP Herd +# Author: Luca Longinotti +# Maintained by the PHP Team # # The php-lib-r1 eclass provides a unified interface for adding new # PHP libraries. PHP libraries are PHP scripts designed for reuse inside @@ -11,18 +12,13 @@ inherit depend.php -RESTRICT="${RESTRICT} nostrip" - EXPORT_FUNCTIONS src_install -# ---begin ebuild configurable settings +DEPEND="dev-lang/php" +RDEPEND="${DEPEND}" # provide default extension name if necessary -[ -z "${PHP_LIB_NAME}" ] && PHP_LIB_NAME="${PN}" -# ---end ebuild configurable settings - -DEPEND="${DEPEND} dev-lang/php" -RDEPEND="${RDEPEND} ${DEPEND}" +[[ -z "${PHP_LIB_NAME}" ]] && PHP_LIB_NAME="${PN}" # you have to pass in a list of the PHP files to install # @@ -34,7 +30,7 @@ php-lib-r1_src_install() { # install to the correct phpX folder, if not specified # fall back to /usr/share/php - if [ -n "${PHP_SHARED_CAT}" ] ; then + if [[ -n "${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}" @@ -47,7 +43,7 @@ php-lib-r1_src_install() { for x in $@ ; do SUBDIR="`dirname ${x}`" - insinto ${PHP_LIB_DIR}/${SUBDIR} + insinto "${PHP_LIB_DIR}/${SUBDIR}" doins "${S_DIR}/${x}" done } diff --git a/eclass/php-pear-lib-r1.eclass b/eclass/php-pear-lib-r1.eclass index 019a564136f6..7716af2950b7 100644 --- a/eclass/php-pear-lib-r1.eclass +++ b/eclass/php-pear-lib-r1.eclass @@ -1,24 +1,20 @@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear-lib-r1.eclass,v 1.9 2006/03/10 10:47:49 sebastian Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear-lib-r1.eclass,v 1.10 2007/03/05 01:50:47 chtekk Exp $ # # Author: Luca Longinotti -# Maintained by the PHP Herd -# -# Based on Tal Peer's work on php-pear.eclass. +# Maintained by the PHP Team # # The php-pear-lib-r1 eclass provides means for an easy installation of PEAR # based libraries, such as Creole, Jargon, Phing etc., while retaining -# the functionality to put the libraries into version-dependant dirs. +# the functionality to put the libraries into version-dependant directories. inherit depend.php EXPORT_FUNCTIONS src_install -# We must depend on the base package as we need it to let -# PEAR work, as well as PEAR itself. -DEPEND="${DEPEND} dev-lang/php >=dev-php/PEAR-PEAR-1.3.6" -RDEPEND="${RDEPEND} ${DEPEND}" +DEPEND="dev-lang/php >=dev-php/PEAR-PEAR-1.4.6" +RDEPEND="${DEPEND}" php-pear-lib-r1_src_install() { has_php @@ -36,23 +32,19 @@ php-pear-lib-r1_src_install() { fi ;; dev-php4) PHP_BIN="/usr/lib/php4/bin/php" ;; dev-php5) PHP_BIN="/usr/lib/php5/bin/php" ;; - *) die "I don't know which version of PHP packages in ${CATEGORY} require" + *) die "Version of PHP required by packages in category ${CATEGORY} unknown" esac cd "${S}" - mv "${WORKDIR}/package.xml" "${S}" + mv -f "${WORKDIR}/package.xml" "${S}" - if has_version '=dev-php/PEAR-PEAR-1.3*' ; then - pear -d php_bin="${PHP_BIN}" install --nodeps --installroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" + if has_version '>=dev-php/PEAR-PEAR-1.4.8' ; then + pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" else - if has_version '>=dev-php/PEAR-PEAR-1.4.8' ; then - pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" - else - pear -d php_bin="${PHP_BIN}" install --nodeps --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" - fi + pear -d php_bin="${PHP_BIN}" install --nodeps --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" fi - rm -rf "${D}/usr/share/php/.channels" \ + rm -Rf "${D}/usr/share/php/.channels" \ "${D}/usr/share/php/.depdblock" \ "${D}/usr/share/php/.depdb" \ "${D}/usr/share/php/.filemap" \ @@ -62,7 +54,7 @@ php-pear-lib-r1_src_install() { # install to the correct phpX folder, if not specified # /usr/share/php will be kept, also sedding to substitute # the path, many files can specify it wrongly - if [ -n "${PHP_SHARED_CAT}" ] && [ "${PHP_SHARED_CAT}" != "php" ] ; then + if [[ -n "${PHP_SHARED_CAT}" ]] && [[ "${PHP_SHARED_CAT}" != "php" ]] ; then mv -f "${D}/usr/share/php" "${D}/usr/share/${PHP_SHARED_CAT}" || die "Unable to move files" find "${D}/" -type f -exec sed -e "s|/usr/share/php|/usr/share/${PHP_SHARED_CAT}|g" -i {} \; || die "Unable to change PHP path" einfo diff --git a/eclass/php-pear-r1.eclass b/eclass/php-pear-r1.eclass index 9f9d742ee9c9..552b5516f280 100644 --- a/eclass/php-pear-r1.eclass +++ b/eclass/php-pear-r1.eclass @@ -1,41 +1,40 @@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear-r1.eclass,v 1.13 2006/03/10 10:47:49 sebastian Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-pear-r1.eclass,v 1.14 2007/03/05 01:50:47 chtekk Exp $ # # Author: Tal Peer -# Maintained by the PHP Herd +# Author: Luca Longinotti +# Maintained by the PHP Team # # The php-pear-r1 eclass provides means for an easy installation of PEAR -# packages, see http://pear.php.net +# packages, see http://pear.php.net/ # Note that this eclass doesn't handle PEAR packages' dependencies on -# purpose, please use (R)DEPEND to define them. +# purpose, please use (R)DEPEND to define them correctly! 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-/} +DEPEND="dev-lang/php >=dev-php/PEAR-PEAR-1.4.6" +RDEPEND="${DEPEND}" -# We must depend on the base package as we need it to do -# install tasks (it provides the pear binary). -DEPEND="${DEPEND} dev-lang/php >=dev-php/PEAR-PEAR-1.3.6" -RDEPEND="${RDEPEND} ${DEPEND}" +# Set this if the the PEAR package name is different than the one in +# Portage (generally shouldn't be the case). +[[ -z "${PHP_PEAR_PKG_NAME}" ]] && PHP_PEAR_PKG_NAME="${PN/PEAR-/}" fix_PEAR_PV() { - tmp=${PV} - tmp=${tmp/_/} - tmp=${tmp/rc/RC} - tmp=${tmp/beta/b} - PEAR_PV=${tmp} + tmp="${PV}" + tmp="${tmp/_/}" + tmp="${tmp/rc/RC}" + tmp="${tmp/beta/b}" + PEAR_PV="${tmp}" } PEAR_PV="" fix_PEAR_PV -PEAR_PN=${PHP_PEAR_PKG_NAME}-${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}" @@ -53,23 +52,19 @@ php-pear-r1_src_install() { fi ;; dev-php4) PHP_BIN="/usr/lib/php4/bin/php" ;; dev-php5) PHP_BIN="/usr/lib/php5/bin/php" ;; - *) die "I don't know which version of PHP packages in ${CATEGORY} require" + *) die "Version of PHP required by packages in category ${CATEGORY} unknown" esac cd "${S}" - mv "${WORKDIR}/package.xml" "${S}" + mv -f "${WORKDIR}/package.xml" "${S}" - if has_version '=dev-php/PEAR-PEAR-1.3*' ; then - pear -d php_bin="${PHP_BIN}" install --nodeps --installroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" + if has_version '>=dev-php/PEAR-PEAR-1.4.8' ; then + pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" else - if has_version '>=dev-php/PEAR-PEAR-1.4.8' ; then - pear -d php_bin="${PHP_BIN}" install --force --loose --nodeps --offline --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" - else - pear -d php_bin="${PHP_BIN}" install --nodeps --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" - fi + pear -d php_bin="${PHP_BIN}" install --nodeps --packagingroot="${D}" "${S}/package.xml" > /dev/null || die "Unable to install PEAR package" fi - rm -rf "${D}/usr/share/php/.channels" \ + rm -Rf "${D}/usr/share/php/.channels" \ "${D}/usr/share/php/.depdblock" \ "${D}/usr/share/php/.depdb" \ "${D}/usr/share/php/.filemap" \ diff --git a/eclass/php4_4-sapi.eclass b/eclass/php4_4-sapi.eclass index 5fe44522d4ea..a35cf3cd32db 100644 --- a/eclass/php4_4-sapi.eclass +++ b/eclass/php4_4-sapi.eclass @@ -1,27 +1,30 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 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.31 2006/12/07 08:47:47 flameeyes Exp $ -# -# ######################################################################## +# $Header: /var/cvsroot/gentoo-x86/eclass/php4_4-sapi.eclass,v 1.32 2007/03/05 01:50:47 chtekk Exp $ + +# ======================================================================== # -# eclass/php4_4-sapi.eclass -# Eclass for building different php4 SAPI instances +# php4_4-sapi.eclass +# Eclass for building different php4 SAPI instances # -# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES +# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES # -# Based on robbat2's work on the php4 sapi eclass +# Based on robbat2's work on the php4 sapi eclass # -# Author(s) Stuart Herbert -# +# Author: Stuart Herbert +# # -# Luca Longinotti -# +# Author: Luca Longinotti +# # # ======================================================================== -PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase mnogosearch msql oci8 oracle7 ovrimos pfpro sapdb solid sybase sybase-ct" +PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase mnogosearch msql oci8 oracle7 pfpro sapdb solid sybase sybase-ct" + +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" -inherit flag-o-matic toolchain-funcs libtool eutils phpconfutils php-common-r1 +inherit flag-o-matic autotools toolchain-funcs libtool eutils phpconfutils php-common-r1 # set MY_PHP_P in the ebuild @@ -38,7 +41,7 @@ if [[ "${PHP_PACKAGE}" == 1 ]] ; then S="${WORKDIR}/${MY_PHP_P}" fi -IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl db2 dbase dbmaker dbx debug doc empress empress-bcs esoob exif expat frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hardenedphp hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-internal java-external kerberos ldap libedit mcal mcve memlimit mhash ming mnogosearch msql mssql mysql ncurses nls oci8 oci8-instant-client odbc oracle7 overload ovrimos pcntl pcre pfpro pic posix postgres readline recode sapdb session sharedext sharedmem snmp sockets solid spell sqlite ssl sybase sybase-ct sysvipc tokenizer truetype unicode wddx xml xmlrpc xpm xsl yaz zip zlib" +IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl db2 dbase dbmaker dbx debug doc empress empress-bcs esoob exif expat frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-internal java-external kerberos ldap libedit mcal mcve memlimit mhash ming mnogosearch msql mssql mysql ncurses nls oci8 oci8-instant-client odbc oracle7 overload pcntl pcre pfpro pic posix postgres readline recode sapdb session sharedext sharedmem snmp sockets solid spell sqlite ssl suhosin sybase sybase-ct sysvipc tokenizer truetype unicode wddx xml xmlrpc xpm xsl yaz zip zlib" # these USE flags should have the correct dependencies DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) @@ -64,11 +67,11 @@ DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) iconv? ( virtual/libiconv ) imap? ( virtual/imap-c-client ) iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) - java-internal? ( >=virtual/jdk-1.4.2 dev-java/java-config !dev-php4/php-java-bridge ) + java-internal? ( >=virtual/jdk-1.4.2 dev-java/java-config ) kerberos? ( virtual/krb5 ) ldap? ( >=net-nds/openldap-1.2.11 ) - libedit? ( dev-libs/libedit ) - mcal? ( dev-libs/libmcal !=dev-libs/libmcal-0.7-r2 ) + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) ) + mcal? ( >=dev-libs/libmcal-0.7-r5 ) mcve? ( net-libs/libmonetra >=dev-libs/openssl-0.9.7 ) mhash? ( app-crypt/mhash ) ming? ( media-libs/ming ) @@ -111,11 +114,7 @@ RDEPEND="${DEPEND}" # those are only needed at compile-time DEPEND="${DEPEND} >=sys-devel/m4-1.4.3 - >=sys-devel/libtool-1.5.18 - >=sys-devel/automake-1.9.6 - sys-devel/automake-wrapper - >=sys-devel/autoconf-2.59 - sys-devel/autoconf-wrapper" + >=sys-devel/libtool-1.5.18" # Additional features # @@ -127,6 +126,9 @@ PDEPEND="doc? ( app-doc/php-docs ) yaz? ( dev-php4/pecl-yaz ) zip? ( dev-php4/pecl-zip )" +# Until Suhosin is stable on all archs +[[ "${PV}" == "4.4.6" ]] && PDEPEND="${PDEPEND} suhosin? ( dev-php4/suhosin )" + # ======================================================================== # php.ini Support # ======================================================================== @@ -139,8 +141,8 @@ PHP_INI_UPSTREAM="php.ini-dist" # PHP patchsets support SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" -# Hardened-PHP patch support -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +# Suhosin patch support +[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )" # ======================================================================== @@ -157,18 +159,19 @@ php4_4-sapi_check_use_flags() { phpconfutils_use_depend_any "exif" "gd" "gd" "gd-external" # Simple USE dependencies - phpconfutils_use_depend_all "xpm" "gd" + phpconfutils_use_depend_all "xpm" "gd" phpconfutils_use_depend_all "gd" "zlib" phpconfutils_use_depend_all "xml" "zlib" phpconfutils_use_depend_all "xmlrpc" "iconv" phpconfutils_use_depend_all "xsl" "iconv" phpconfutils_use_depend_all "java-external" "session" phpconfutils_use_depend_all "mcve" "ssl" + phpconfutils_use_depend_all "suhosin" "unicode" phpconfutils_use_depend_all "adabas" "odbc" phpconfutils_use_depend_all "birdstep" "odbc" phpconfutils_use_depend_all "dbmaker" "odbc" phpconfutils_use_depend_all "empress-bcs" "odbc" "empress" - phpconfutils_use_depend_all "empress" "odbc" + phpconfutils_use_depend_all "empress" "odbc" phpconfutils_use_depend_all "esoob" "odbc" phpconfutils_use_depend_all "db2" "odbc" phpconfutils_use_depend_all "iodbc" "odbc" @@ -218,7 +221,8 @@ php4_4-sapi_install_ini() { # work out where we are installing the ini file php4_4-sapi_set_php_ini_dir - local phpinisrc=${PHP_INI_UPSTREAM} + cp "${PHP_INI_UPSTREAM}" "${PHP_INI_UPSTREAM}-${PHPSAPI}" + local phpinisrc="${PHP_INI_UPSTREAM}-${PHPSAPI}" # Set the extension dir einfo "Setting extension_dir in php.ini" @@ -232,6 +236,36 @@ php4_4-sapi_install_ini() { einfo "Setting correct include_path" sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php4:/usr/share/php"|' -i ${phpinisrc} + # Add needed MySQL extension charset configuration + local phpmycnfcharset="" + + if [[ "${PHPSAPI}" == "cli" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cli`" + einfo "MySQL extension charset for 'cli' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "cgi" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cgi-fcgi`" + einfo "MySQL extension charset for 'cgi' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "apache" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset apache`" + einfo "MySQL extension charset for 'apache' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "apache2" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset apache2handler`" + einfo "MySQL extension charset for 'apache2' SAPI is: ${phpmycnfcharset}" + else + einfo "No supported SAPI found for which to get the MySQL charset." + fi + + if [[ -n "${phpmycnfcharset}" ]] && [[ "${phpmycnfcharset}" != "empty" ]] ; then + einfo "Setting MySQL extension charset to ${phpmycnfcharset}" + echo "" >> ${phpinisrc} + echo "; MySQL extension default connection charset settings" >> ${phpinisrc} + echo "mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + else + echo "" >> ${phpinisrc} + echo "; MySQL extension default connection charset settings" >> ${phpinisrc} + echo ";mysql.connect_charset = utf8" >> ${phpinisrc} + fi + dodir ${PHP_INI_DIR} insinto ${PHP_INI_DIR} newins ${phpinisrc} ${PHP_INI_FILE} @@ -243,7 +277,7 @@ php4_4-sapi_install_ini() { php_install_java_inifile # Install any extensions built as shared objects - if useq sharedext ; then + if use sharedext ; then for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort | sed -e "s|.*java.*||g"` ; do inifilename=${x/.so/.ini} inifilename=`basename ${inifilename}` @@ -306,28 +340,28 @@ php4_4-sapi_src_unpack() { fi # Patch for PostgreSQL support - if useq postgres ; then + if use postgres ; then sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths" fi - # Hardened-PHP support - if useq hardenedphp ; then - if [[ -n "${HARDENEDPHP_PATCH}" ]] && [[ -f "${DISTDIR}/${HARDENEDPHP_PATCH}" ]] ; then - epatch "${DISTDIR}/${HARDENEDPHP_PATCH}" + # Suhosin support + if use suhosin ; then + if [[ -n "${SUHOSIN_PATCH}" ]] && [[ -f "${DISTDIR}/${SUHOSIN_PATCH}" ]] ; then + epatch "${DISTDIR}/${SUHOSIN_PATCH}" else - ewarn "There is no Hardened-PHP patch available for this PHP release yet!" + ewarn "There is no Suhosin patch available for this PHP release yet!" fi fi - # Fix configure scripts to correctly support Hardened-PHP + # Fix configure scripts to correctly support Suhosin einfo "Running aclocal" - WANT_AUTOMAKE=1.9 aclocal --force || die "Unable to run aclocal successfully" + aclocal --force || die "Unable to run aclocal successfully" einfo "Running libtoolize" libtoolize --copy --force || die "Unable to run libtoolize successfully" # Rebuild configure to make sure it's up to date einfo "Rebuilding configure script" - WANT_AUTOCONF=2.5 autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully" + autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully" # Run elibtoolize elibtoolize @@ -384,7 +418,6 @@ php4_4-sapi_src_compile() { phpconfutils_extension_with "openssl" "ssl" 0 phpconfutils_extension_with "openssl-dir" "ssl" 0 "/usr" phpconfutils_extension_disable "overload" "overload" 0 - phpconfutils_extension_with "ovrimos" "ovrimos" 1 phpconfutils_extension_enable "pcntl" "pcntl" 1 phpconfutils_extension_without "pcre-regex" "pcre" 0 phpconfutils_extension_with "pfpro" "pfpro" 1 @@ -408,7 +441,7 @@ php4_4-sapi_src_compile() { phpconfutils_extension_enable "debug" "debug" 0 # DBA support - if useq cdb || useq berkdb || useq flatfile || useq gdbm || useq inifile ; then + if use cdb || use berkdb || use flatfile || use gdbm || use inifile ; then my_conf="${my_conf} --enable-dba${shared}" fi @@ -423,7 +456,7 @@ php4_4-sapi_src_compile() { phpconfutils_extension_enable "dbx" "dbx" 1 # Support for the GD graphics library - if useq gd-external || phpconfutils_usecheck gd-external ; then + if use gd-external || phpconfutils_usecheck gd-external ; then phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 @@ -442,30 +475,30 @@ php4_4-sapi_src_compile() { fi # Java support - if useq java-internal || phpconfutils_usecheck java-internal ; then + if use java-internal || phpconfutils_usecheck java-internal ; then phpconfutils_extension_with "java" "java-internal" 0 "`java-config --jdk-home`" fi # IMAP support - if useq imap || phpconfutils_usecheck imap ; then + if use imap || phpconfutils_usecheck imap ; then phpconfutils_extension_with "imap" "imap" 1 phpconfutils_extension_with "imap-ssl" "ssl" 0 fi # Interbase support - if useq firebird || useq interbase ; then + if use firebird || use interbase ; then my_conf="${my_conf} --with-interbase=/usr" fi # LDAP support - if useq ldap || phpconfutils_usecheck ldap ; then + if use ldap || phpconfutils_usecheck ldap ; then phpconfutils_extension_with "ldap" "ldap" 1 fi # MySQL support # In PHP4, MySQL is enabled by default, so if no 'mysql' USE flag is set, # we must turn it off explicitely - if useq mysql ; then + if use mysql ; then phpconfutils_extension_with "mysql" "mysql" 1 "/usr" phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" else @@ -473,14 +506,14 @@ php4_4-sapi_src_compile() { fi # ODBC support - if useq odbc || phpconfutils_usecheck odbc ; then + if use odbc || phpconfutils_usecheck odbc ; then phpconfutils_extension_with "unixODBC" "odbc" 1 "/usr" phpconfutils_extension_with "adabas" "adabas" 1 phpconfutils_extension_with "birdstep" "birdstep" 1 phpconfutils_extension_with "dbmaker" "dbmaker" 1 phpconfutils_extension_with "empress" "empress" 1 - if useq empress || phpconfutils_usecheck empress ; then + if use empress || phpconfutils_usecheck empress ; then phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 fi phpconfutils_extension_with "esoob" "esoob" 1 @@ -498,20 +531,20 @@ php4_4-sapi_src_compile() { # Sablotron/XSLT support phpconfutils_extension_enable "xslt" "xsl" 1 phpconfutils_extension_with "xslt-sablot" "xsl" 1 - if useq xml || phpconfutils_usecheck xml ; then + if use xml || phpconfutils_usecheck xml ; then phpconfutils_extension_with "dom-xslt" "xsl" 0 "/usr" phpconfutils_extension_with "dom-exslt" "xsl" 0 "/usr" fi # Session support - if ! useq session && ! phpconfutils_usecheck session ; then + if ! use session && ! phpconfutils_usecheck session ; then phpconfutils_extension_disable "session" "session" 0 else phpconfutils_extension_with "mm" "sharedmem" 0 fi # Fix ELF-related problems - if useq pic || phpconfutils_usecheck pic ; then + if use pic || phpconfutils_usecheck pic ; then einfo "Enabling PIC support" my_conf="${my_conf} --with-pic" fi @@ -546,7 +579,7 @@ php4_4-sapi_src_install() { make INSTALL_ROOT="${D}" install-build install-headers install-programs || die "make install failed" # Install missing header files - if useq unicode || phpconfutils_usecheck unicode ; then + if use unicode || phpconfutils_usecheck unicode ; then dodir ${destdir}/include/php/ext/mbstring insinto ${destdir}/include/php/ext/mbstring doins ext/mbstring/mbregex/mbregex.h @@ -556,7 +589,7 @@ php4_4-sapi_src_install() { [[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`" # And install the modules to it - if useq sharedext ; then + if use sharedext ; then for x in `ls "${S}/modules/"*.so | sort | sed -e "s|.*java.*||g"` ; do module=`basename ${x}` modulename=${module/.so/} @@ -584,7 +617,7 @@ php4_4-sapi_pkg_postinst() { ewarn "with the newer PHP packages releases, so please reemerge any" ewarn "PHP extensions you have installed to automatically adapt to" ewarn "the new configuration layout." - if useq sharedext ; then + if use sharedext ; then ewarn "The core PHP extensions are now loaded through external" ewarn ".ini files, not anymore using a 'extension=name.so' line" ewarn "in the php.ini file. Portage will take care of this by" @@ -593,7 +626,7 @@ php4_4-sapi_pkg_postinst() { fi ewarn - if useq curl ; then + if use curl ; then ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions." ewarn "This can be a security risk!" ewarn @@ -607,6 +640,13 @@ php4_4-sapi_pkg_postinst() { ewarn "certain PaX options in the kernel." ewarn + ewarn "The Ovrimos extension was recently removed and has no available" + ewarn "substitute, our ebuilds reflect this." + ewarn "Hardened-PHP was also removed from the PHP 4.4 ebuilds in" + ewarn "favour of its successor Suhosin, enable the 'suhosin' USE" + ewarn "flag to install it." + ewarn + ewarn "The 'xml' and 'xml2' USE flags were unified in only the 'xml' USE" ewarn "flag. To get the features that were once controlled by the 'xml2'" ewarn "USE flag, turn the 'xml' USE flag on. To get the features that were" diff --git a/eclass/php5_0-sapi.eclass b/eclass/php5_0-sapi.eclass index 21880068ae1c..c49f566c70d2 100644 --- a/eclass/php5_0-sapi.eclass +++ b/eclass/php5_0-sapi.eclass @@ -1,27 +1,30 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 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.30 2006/12/07 08:47:47 flameeyes Exp $ -# -# ######################################################################## +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_0-sapi.eclass,v 1.31 2007/03/05 01:50:47 chtekk Exp $ + +# ======================================================================== # -# eclass/php5_0-sapi.eclass -# Eclass for building different php5.0 SAPI instances +# php5_0-sapi.eclass +# Eclass for building different php5.0 SAPI instances # -# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES +# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES # -# Based on robbat2's work on the php4 sapi eclass +# Based on robbat2's work on the php4 sapi eclass # -# Author(s) Stuart Herbert -# +# Author: Stuart Herbert +# # -# Luca Longinotti -# +# Author: Luca Longinotti +# # # ======================================================================== PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase mnogosearch msql oci8 oracle7 ovrimos pfpro sapdb solid sybase sybase-ct" -inherit flag-o-matic toolchain-funcs libtool eutils phpconfutils php-common-r1 +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +inherit flag-o-matic autotools toolchain-funcs libtool eutils phpconfutils php-common-r1 # set MY_PHP_P in the ebuild @@ -38,7 +41,7 @@ if [[ "${PHP_PACKAGE}" == 1 ]] ; then S="${WORKDIR}/${MY_PHP_P}" fi -IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase 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 kerberos ldap libedit mcve memlimit mhash ming mnogosearch msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc oracle7 ovrimos pcntl pcre pdo-external pfpro pic posix postgres qdbm readline recode sapdb sasl session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl sybase sybase-ct sysvipc tidy tokenizer truetype unicode wddx xml xmlrpc xpm xsl yaz zip zlib" +IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase dbmaker debug doc empress empress-bcs esoob exif frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-external kerberos ldap ldap-sasl libedit mcve memlimit mhash ming mnogosearch msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc oracle7 ovrimos pcntl pcre pdo-external pfpro pic posix postgres qdbm readline recode sapdb session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl suhosin sybase sybase-ct sysvipc tidy tokenizer truetype unicode wddx xml xmlrpc xpm xsl yaz zip zlib" # these USE flags should have the correct dependencies DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) @@ -66,7 +69,8 @@ DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) kerberos? ( virtual/krb5 ) ldap? ( >=net-nds/openldap-1.2.11 ) - libedit? ( dev-libs/libedit ) + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) ) mcve? ( >=dev-libs/openssl-0.9.7 ) mhash? ( app-crypt/mhash ) ming? ( media-libs/ming ) @@ -82,7 +86,6 @@ DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) readline? ( sys-libs/readline ) recode? ( app-text/recode ) sapdb? ( >=dev-db/unixODBC-1.8.13 ) - sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) sharedmem? ( dev-libs/mm ) simplexml? ( >=dev-libs/libxml2-2.6.8 ) snmp? ( >=net-analyzer/net-snmp-5.2 ) @@ -113,11 +116,7 @@ RDEPEND="${DEPEND}" # those are only needed at compile-time DEPEND="${DEPEND} >=sys-devel/m4-1.4.3 - >=sys-devel/libtool-1.5.18 - >=sys-devel/automake-1.9.6 - sys-devel/automake-wrapper - >=sys-devel/autoconf-2.59 - sys-devel/autoconf-wrapper" + >=sys-devel/libtool-1.5.18" # Additional features # @@ -129,6 +128,9 @@ PDEPEND="doc? ( app-doc/php-docs ) yaz? ( dev-php5/pecl-yaz ) zip? ( dev-php5/pecl-zip )" +# Until Suhosin is stable on all archs +#PDEPEND="${PDEPEND} suhosin? ( dev-php5/suhosin )" + # ======================================================================== # php.ini Support # ======================================================================== @@ -141,8 +143,8 @@ PHP_INI_UPSTREAM="php.ini-dist" # PHP patchsets support SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" -# Hardened-PHP patch support -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +# Suhosin patch support +[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )" # ======================================================================== @@ -159,27 +161,28 @@ php5_0-sapi_check_use_flags() { phpconfutils_use_depend_any "exif" "gd" "gd" "gd-external" # Simple USE dependencies - phpconfutils_use_depend_all "xpm" "gd" - phpconfutils_use_depend_all "gd" "zlib" - phpconfutils_use_depend_all "simplexml" "xml" - phpconfutils_use_depend_all "soap" "xml" - phpconfutils_use_depend_all "wddx" "xml" - phpconfutils_use_depend_all "xmlrpc" "xml" - phpconfutils_use_depend_all "xsl" "xml" - phpconfutils_use_depend_all "xmlrpc" "iconv" - phpconfutils_use_depend_all "java-external" "session" - phpconfutils_use_depend_all "sasl" "ldap" - phpconfutils_use_depend_all "mcve" "ssl" - phpconfutils_use_depend_all "adabas" "odbc" - phpconfutils_use_depend_all "birdstep" "odbc" - phpconfutils_use_depend_all "dbmaker" "odbc" - phpconfutils_use_depend_all "empress-bcs" "odbc" "empress" - phpconfutils_use_depend_all "empress" "odbc" - phpconfutils_use_depend_all "esoob" "odbc" - phpconfutils_use_depend_all "db2" "odbc" - phpconfutils_use_depend_all "iodbc" "odbc" - phpconfutils_use_depend_all "sapdb" "odbc" - phpconfutils_use_depend_all "solid" "odbc" + phpconfutils_use_depend_all "xpm" "gd" + phpconfutils_use_depend_all "gd" "zlib" + phpconfutils_use_depend_all "simplexml" "xml" + phpconfutils_use_depend_all "soap" "xml" + phpconfutils_use_depend_all "wddx" "xml" + phpconfutils_use_depend_all "xmlrpc" "xml" + phpconfutils_use_depend_all "xsl" "xml" + phpconfutils_use_depend_all "xmlrpc" "iconv" + phpconfutils_use_depend_all "java-external" "session" + phpconfutils_use_depend_all "ldap-sasl" "ldap" + phpconfutils_use_depend_all "mcve" "ssl" + phpconfutils_use_depend_all "suhosin" "unicode" + phpconfutils_use_depend_all "adabas" "odbc" + phpconfutils_use_depend_all "birdstep" "odbc" + phpconfutils_use_depend_all "dbmaker" "odbc" + phpconfutils_use_depend_all "empress-bcs" "odbc" "empress" + phpconfutils_use_depend_all "empress" "odbc" + phpconfutils_use_depend_all "esoob" "odbc" + phpconfutils_use_depend_all "db2" "odbc" + phpconfutils_use_depend_all "iodbc" "odbc" + phpconfutils_use_depend_all "sapdb" "odbc" + phpconfutils_use_depend_all "solid" "odbc" # Direct USE conflicts phpconfutils_use_conflict "gd" "gd-external" @@ -243,7 +246,7 @@ php5_0-sapi_install_ini() { dodir ${PHP_EXT_INI_DIR_ACTIVE} # Install any extensions built as shared objects - if useq sharedext ; then + if use sharedext ; then for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort` ; do inifilename=${x/.so/.ini} inifilename=`basename ${inifilename}` @@ -306,28 +309,28 @@ php5_0-sapi_src_unpack() { fi # Patch for PostgreSQL support - if useq postgres ; then + if use postgres ; then sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths" fi - # Hardened-PHP support - if useq hardenedphp ; then - if [[ -n "${HARDENEDPHP_PATCH}" ]] && [[ -f "${DISTDIR}/${HARDENEDPHP_PATCH}" ]] ; then - epatch "${DISTDIR}/${HARDENEDPHP_PATCH}" + # Suhosin support + if use suhosin ; then + if [[ -n "${SUHOSIN_PATCH}" ]] && [[ -f "${DISTDIR}/${SUHOSIN_PATCH}" ]] ; then + epatch "${DISTDIR}/${SUHOSIN_PATCH}" else - ewarn "There is no Hardened-PHP patch available for this PHP release yet!" + ewarn "There is no Suhosin patch available for this PHP release yet!" fi fi - # Fix configure scripts to correctly support Hardened-PHP + # Fix configure scripts to correctly support Suhosin einfo "Running aclocal" - WANT_AUTOMAKE=1.9 aclocal --force || die "Unable to run aclocal successfully" + aclocal --force || die "Unable to run aclocal successfully" einfo "Running libtoolize" libtoolize --copy --force || die "Unable to run libtoolize successfully" # Rebuild configure to make sure it's up to date einfo "Rebuilding configure script" - WANT_AUTOCONF=2.5 autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully" + autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully" # Run elibtoolize elibtoolize @@ -412,7 +415,7 @@ php5_0-sapi_src_compile() { phpconfutils_extension_enable "debug" "debug" 0 # DBA support - if useq cdb || useq berkdb || useq flatfile || useq gdbm || useq inifile || useq qdbm ; then + if use cdb || use berkdb || use flatfile || use gdbm || use inifile || use qdbm ; then my_conf="${my_conf} --enable-dba${shared}" fi @@ -425,7 +428,7 @@ php5_0-sapi_src_compile() { phpconfutils_extension_with "qdbm" "qdbm" 0 # Support for the GD graphics library - if useq gd-external || phpconfutils_usecheck gd-external ; then + if use gd-external || phpconfutils_usecheck gd-external ; then phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 @@ -444,24 +447,24 @@ php5_0-sapi_src_compile() { fi # IMAP support - if useq imap || phpconfutils_usecheck imap ; then + if use imap || phpconfutils_usecheck imap ; then phpconfutils_extension_with "imap" "imap" 1 phpconfutils_extension_with "imap-ssl" "ssl" 0 fi # Interbase support - if useq firebird || useq interbase ; then + if use firebird || use interbase ; then my_conf="${my_conf} --with-interbase=/usr" fi # LDAP support - if useq ldap || phpconfutils_usecheck ldap ; then + if use ldap || phpconfutils_usecheck ldap ; then phpconfutils_extension_with "ldap" "ldap" 1 - phpconfutils_extension_with "ldap-sasl" "sasl" 0 + phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0 fi # MySQL support - if useq mysql ; then + if use mysql ; then phpconfutils_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" fi @@ -470,14 +473,14 @@ php5_0-sapi_src_compile() { phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" # ODBC support - if useq odbc || phpconfutils_usecheck odbc ; then + if use odbc || phpconfutils_usecheck odbc ; then phpconfutils_extension_with "unixODBC" "odbc" 1 "/usr" phpconfutils_extension_with "adabas" "adabas" 1 phpconfutils_extension_with "birdstep" "birdstep" 1 phpconfutils_extension_with "dbmaker" "dbmaker" 1 phpconfutils_extension_with "empress" "empress" 1 - if useq empress || phpconfutils_usecheck empress ; then + if use empress || phpconfutils_usecheck empress ; then phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 fi phpconfutils_extension_with "esoob" "esoob" 1 @@ -493,14 +496,14 @@ php5_0-sapi_src_compile() { phpconfutils_extension_with "libedit" "libedit" 0 # Session support - if ! useq session && ! phpconfutils_usecheck session ; then + if ! use session && ! phpconfutils_usecheck session ; then phpconfutils_extension_disable "session" "session" 0 else phpconfutils_extension_with "mm" "sharedmem" 0 fi # SQLite support - if ! useq sqlite && ! phpconfutils_usecheck sqlite ; then + if ! use sqlite && ! phpconfutils_usecheck sqlite ; then phpconfutils_extension_without "sqlite" "sqlite" 0 else phpconfutils_extension_with "sqlite" "sqlite" 0 "/usr" @@ -508,7 +511,7 @@ php5_0-sapi_src_compile() { fi # Fix ELF-related problems - if useq pic || phpconfutils_usecheck pic ; then + if use pic || phpconfutils_usecheck pic ; then einfo "Enabling PIC support" my_conf="${my_conf} --with-pic" fi @@ -543,10 +546,10 @@ php5_0-sapi_src_install() { make INSTALL_ROOT="${D}" install-build install-headers install-programs || die "make install failed" # Install missing header files - if useq unicode || phpconfutils_usecheck unicode ; then + if use unicode || phpconfutils_usecheck unicode ; then dodir ${destdir}/include/php/ext/mbstring insinto ${destdir}/include/php/ext/mbstring - for x in `ls "${S}/ext/mbstring/"*.h` ; do + for x in `ls "${S}/ext/mbstring/"*.h` ; do file=`basename ${x}` doins ext/mbstring/${file} done @@ -568,7 +571,7 @@ php5_0-sapi_src_install() { [[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`" # And install the modules to it - if useq sharedext ; then + if use sharedext ; then for x in `ls "${S}/modules/"*.so | sort` ; do module=`basename ${x}` modulename=${module/.so/} @@ -593,7 +596,7 @@ php5_0-sapi_pkg_postinst() { ewarn "with the newer PHP packages releases, so please reemerge any" ewarn "PHP extensions you have installed to automatically adapt to" ewarn "the new configuration layout." - if useq sharedext ; then + if use sharedext ; then ewarn "The core PHP extensions are now loaded through external" ewarn ".ini files, not anymore using a 'extension=name.so' line" ewarn "in the php.ini file. Portage will take care of this by" @@ -602,7 +605,7 @@ php5_0-sapi_pkg_postinst() { fi ewarn - if useq curl ; then + if use curl ; then ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions." ewarn "This can be a security risk!" ewarn @@ -616,6 +619,11 @@ php5_0-sapi_pkg_postinst() { ewarn "certain PaX options in the kernel." ewarn + ewarn "Hardened-PHP was also removed from the PHP 5.0 ebuilds in" + ewarn "favour of its successor Suhosin, enable the 'suhosin' USE" + ewarn "flag to install it." + ewarn + ewarn "The 'xml' and 'xml2' USE flags were unified in only the 'xml' USE" ewarn "flag. To get the features that were once controlled by the 'xml2'" ewarn "USE flag, turn the 'xml' USE flag on." diff --git a/eclass/php5_1-sapi.eclass b/eclass/php5_1-sapi.eclass index 0c61e899e24c..ba002dfc15d8 100644 --- a/eclass/php5_1-sapi.eclass +++ b/eclass/php5_1-sapi.eclass @@ -1,27 +1,30 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 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.36 2006/12/07 08:47:47 flameeyes Exp $ -# -# ######################################################################## +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_1-sapi.eclass,v 1.37 2007/03/05 01:50:47 chtekk Exp $ + +# ======================================================================== # -# eclass/php5_1-sapi.eclass -# Eclass for building different php5.1 SAPI instances +# php5_1-sapi.eclass +# Eclass for building different php5.1 SAPI instances # -# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES +# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES # -# Based on robbat2's work on the php4 sapi eclass +# Based on robbat2's work on the php4 sapi eclass # -# Author(s) Stuart Herbert -# +# Author: Stuart Herbert +# # -# Luca Longinotti -# +# Author: Luca Longinotti +# # # ======================================================================== PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase msql oci8 sapdb solid sybase sybase-ct" -inherit flag-o-matic toolchain-funcs libtool eutils phpconfutils php-common-r1 +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +inherit flag-o-matic autotools toolchain-funcs libtool eutils phpconfutils php-common-r1 # set MY_PHP_P in the ebuild @@ -38,7 +41,7 @@ if [[ "${PHP_PACKAGE}" == 1 ]] ; then S="${WORKDIR}/${MY_PHP_P}" fi -IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase dbmaker debug doc empress empress-bcs esoob exif frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hardenedphp hash hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-external kerberos ldap libedit mcve memlimit mhash ming msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc pcntl pcre pdo pdo-external pic posix postgres qdbm readline reflection recode sapdb sasl session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl sybase sybase-ct sysvipc tidy tokenizer truetype unicode vm-goto vm-switch wddx xml xmlreader xmlwriter xmlrpc xpm xsl yaz zip zlib" +IUSE="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase dbmaker debug doc empress empress-bcs esoob exif filter frontbase fdftk filepro firebird flatfile ftp gd gd-external gdbm gmp hash hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-external kerberos ldap ldap-sasl libedit mcve memlimit mhash ming msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc pcntl pcre pdo pdo-external pic posix postgres qdbm readline reflection recode sapdb session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl suhosin sybase sybase-ct sysvipc tidy tokenizer truetype unicode wddx xml xmlreader xmlwriter xmlrpc xpm xsl yaz zip zlib" # these USE flags should have the correct dependencies DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) @@ -66,7 +69,8 @@ DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) kerberos? ( virtual/krb5 ) ldap? ( >=net-nds/openldap-1.2.11 ) - libedit? ( dev-libs/libedit ) + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) ) mcve? ( >=dev-libs/openssl-0.9.7 ) mhash? ( app-crypt/mhash ) ming? ( media-libs/ming ) @@ -82,7 +86,6 @@ DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) readline? ( sys-libs/readline ) recode? ( app-text/recode ) sapdb? ( >=dev-db/unixODBC-1.8.13 ) - sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) sharedmem? ( dev-libs/mm ) simplexml? ( >=dev-libs/libxml2-2.6.8 ) snmp? ( >=net-analyzer/net-snmp-5.2 ) @@ -115,16 +118,13 @@ RDEPEND="${DEPEND}" # those are only needed at compile-time DEPEND="${DEPEND} >=sys-devel/m4-1.4.3 - >=sys-devel/libtool-1.5.18 - >=sys-devel/automake-1.9.6 - sys-devel/automake-wrapper - >=sys-devel/autoconf-2.59 - sys-devel/autoconf-wrapper" + >=sys-devel/libtool-1.5.18" # Additional features # # They are in PDEPEND because we need PHP installed first! PDEPEND="doc? ( app-doc/php-docs ) + filter? ( dev-php5/pecl-filter ) java-external? ( dev-php5/php-java-bridge ) mcve? ( dev-php5/pecl-mcve ) pdo? ( !dev-php5/pecl-pdo ) @@ -132,6 +132,9 @@ PDEPEND="doc? ( app-doc/php-docs ) yaz? ( dev-php5/pecl-yaz ) zip? ( dev-php5/pecl-zip )" +# Until Suhosin is stable on all archs +#PDEPEND="${PDEPEND} suhosin? ( dev-php5/suhosin )" + # ======================================================================== # php.ini Support # ======================================================================== @@ -144,8 +147,8 @@ PHP_INI_UPSTREAM="php.ini-dist" # PHP patchsets support SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" -# Hardened-PHP patch support -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +# Suhosin patch support +[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )" # ======================================================================== @@ -162,29 +165,31 @@ php5_1-sapi_check_use_flags() { phpconfutils_use_depend_any "exif" "gd" "gd" "gd-external" # Simple USE dependencies - phpconfutils_use_depend_all "xpm" "gd" - phpconfutils_use_depend_all "gd" "zlib" - phpconfutils_use_depend_all "simplexml" "xml" - phpconfutils_use_depend_all "soap" "xml" - phpconfutils_use_depend_all "wddx" "xml" - phpconfutils_use_depend_all "xmlrpc" "xml" - phpconfutils_use_depend_all "xmlreader" "xml" - phpconfutils_use_depend_all "xmlwriter" "xml" - phpconfutils_use_depend_all "xsl" "xml" - phpconfutils_use_depend_all "xmlrpc" "iconv" - phpconfutils_use_depend_all "java-external" "session" - phpconfutils_use_depend_all "sasl" "ldap" - phpconfutils_use_depend_all "mcve" "ssl" - phpconfutils_use_depend_all "adabas" "odbc" - phpconfutils_use_depend_all "birdstep" "odbc" - phpconfutils_use_depend_all "dbmaker" "odbc" - phpconfutils_use_depend_all "empress-bcs" "odbc" "empress" - phpconfutils_use_depend_all "empress" "odbc" - phpconfutils_use_depend_all "esoob" "odbc" - phpconfutils_use_depend_all "db2" "odbc" - phpconfutils_use_depend_all "iodbc" "odbc" - phpconfutils_use_depend_all "sapdb" "odbc" - phpconfutils_use_depend_all "solid" "odbc" + phpconfutils_use_depend_all "xpm" "gd" + phpconfutils_use_depend_all "gd" "zlib" + phpconfutils_use_depend_all "simplexml" "xml" + phpconfutils_use_depend_all "soap" "xml" + phpconfutils_use_depend_all "wddx" "xml" + phpconfutils_use_depend_all "xmlrpc" "xml" + phpconfutils_use_depend_all "xmlreader" "xml" + phpconfutils_use_depend_all "xmlwriter" "xml" + phpconfutils_use_depend_all "xsl" "xml" + phpconfutils_use_depend_all "xmlrpc" "iconv" + phpconfutils_use_depend_all "filter" "pcre" + phpconfutils_use_depend_all "java-external" "session" + phpconfutils_use_depend_all "ldap-sasl" "ldap" + phpconfutils_use_depend_all "mcve" "ssl" + phpconfutils_use_depend_all "suhosin" "unicode" + phpconfutils_use_depend_all "adabas" "odbc" + phpconfutils_use_depend_all "birdstep" "odbc" + phpconfutils_use_depend_all "dbmaker" "odbc" + phpconfutils_use_depend_all "empress-bcs" "odbc" "empress" + phpconfutils_use_depend_all "empress" "odbc" + phpconfutils_use_depend_all "esoob" "odbc" + phpconfutils_use_depend_all "db2" "odbc" + phpconfutils_use_depend_all "iodbc" "odbc" + phpconfutils_use_depend_all "sapdb" "odbc" + phpconfutils_use_depend_all "solid" "odbc" # Direct USE conflicts phpconfutils_use_conflict "gd" "gd-external" @@ -194,7 +199,6 @@ php5_1-sapi_check_use_flags() { phpconfutils_use_conflict "readline" "libedit" phpconfutils_use_conflict "recode" "mysql" "imap" "yaz" phpconfutils_use_conflict "sharedmem" "threads" - phpconfutils_use_conflict "vm-goto" "vm-switch" # IMAP support php_check_imap @@ -228,7 +232,8 @@ php5_1-sapi_install_ini() { # work out where we are installing the ini file php5_1-sapi_set_php_ini_dir - local phpinisrc=${PHP_INI_UPSTREAM} + cp "${PHP_INI_UPSTREAM}" "${PHP_INI_UPSTREAM}-${PHPSAPI}" + local phpinisrc="${PHP_INI_UPSTREAM}-${PHPSAPI}" # Set the extension dir einfo "Setting extension_dir in php.ini" @@ -242,6 +247,40 @@ php5_1-sapi_install_ini() { einfo "Setting correct include_path" sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc} + # Add needed MySQL extensions charset configuration + local phpmycnfcharset="" + + if [[ "${PHPSAPI}" == "cli" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cli`" + einfo "MySQL extensions charset for 'cli' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "cgi" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cgi-fcgi`" + einfo "MySQL extensions charset for 'cgi' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "apache" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset apache`" + einfo "MySQL extensions charset for 'apache' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "apache2" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset apache2handler`" + einfo "MySQL extensions charset for 'apache2' SAPI is: ${phpmycnfcharset}" + else + einfo "No supported SAPI found for which to get the MySQL charset." + fi + + if [[ -n "${phpmycnfcharset}" ]] && [[ "${phpmycnfcharset}" != "empty" ]] ; then + einfo "Setting MySQL extensions charset to ${phpmycnfcharset}" + echo "" >> ${phpinisrc} + echo "; MySQL extensions default connection charset settings" >> ${phpinisrc} + echo "mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + echo "mysqli.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + echo "pdo_mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + else + echo "" >> ${phpinisrc} + echo "; MySQL extensions default connection charset settings" >> ${phpinisrc} + echo ";mysql.connect_charset = utf8" >> ${phpinisrc} + echo ";mysqli.connect_charset = utf8" >> ${phpinisrc} + echo ";pdo_mysql.connect_charset = utf8" >> ${phpinisrc} + fi + dodir ${PHP_INI_DIR} insinto ${PHP_INI_DIR} newins ${phpinisrc} ${PHP_INI_FILE} @@ -250,7 +289,7 @@ php5_1-sapi_install_ini() { dodir ${PHP_EXT_INI_DIR_ACTIVE} # Install any extensions built as shared objects - if useq sharedext ; then + if use sharedext ; then for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort` ; do inifilename=${x/.so/.ini} inifilename=`basename ${inifilename}` @@ -313,28 +352,28 @@ php5_1-sapi_src_unpack() { fi # Patch for PostgreSQL support - if useq postgres ; then + if use postgres ; then sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths" fi - # Hardened-PHP support - if useq hardenedphp ; then - if [[ -n "${HARDENEDPHP_PATCH}" ]] && [[ -f "${DISTDIR}/${HARDENEDPHP_PATCH}" ]] ; then - epatch "${DISTDIR}/${HARDENEDPHP_PATCH}" + # Suhosin support + if use suhosin ; then + if [[ -n "${SUHOSIN_PATCH}" ]] && [[ -f "${DISTDIR}/${SUHOSIN_PATCH}" ]] ; then + epatch "${DISTDIR}/${SUHOSIN_PATCH}" else - ewarn "There is no Hardened-PHP patch available for this PHP release yet!" + ewarn "There is no Suhosin patch available for this PHP release yet!" fi fi - # Fix configure scripts to correctly support Hardened-PHP + # Fix configure scripts to correctly support Suhosin einfo "Running aclocal" - WANT_AUTOMAKE=1.9 aclocal --force || die "Unable to run aclocal successfully" + aclocal --force || die "Unable to run aclocal successfully" einfo "Running libtoolize" libtoolize --copy --force || die "Unable to run libtoolize successfully" # Rebuild configure to make sure it's up to date einfo "Rebuilding configure script" - WANT_AUTOCONF=2.5 autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully" + autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully" # Run elibtoolize elibtoolize @@ -418,7 +457,7 @@ php5_1-sapi_src_compile() { phpconfutils_extension_enable "debug" "debug" 0 # DBA support - if useq cdb || useq berkdb || useq flatfile || useq gdbm || useq inifile || useq qdbm ; then + if use cdb || use berkdb || use flatfile || use gdbm || use inifile || use qdbm ; then my_conf="${my_conf} --enable-dba${shared}" fi @@ -431,7 +470,7 @@ php5_1-sapi_src_compile() { phpconfutils_extension_with "qdbm" "qdbm" 0 # Support for the GD graphics library - if useq gd-external || phpconfutils_usecheck gd-external ; then + if use gd-external || phpconfutils_usecheck gd-external ; then phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 @@ -450,24 +489,24 @@ php5_1-sapi_src_compile() { fi # IMAP support - if useq imap || phpconfutils_usecheck imap ; then + if use imap || phpconfutils_usecheck imap ; then phpconfutils_extension_with "imap" "imap" 1 phpconfutils_extension_with "imap-ssl" "ssl" 0 fi # Interbase support - if useq firebird || useq interbase ; then + if use firebird || use interbase ; then my_conf="${my_conf} --with-interbase=/usr" fi # LDAP support - if useq ldap || phpconfutils_usecheck ldap ; then + if use ldap || phpconfutils_usecheck ldap ; then phpconfutils_extension_with "ldap" "ldap" 1 - phpconfutils_extension_with "ldap-sasl" "sasl" 0 + phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0 fi # MySQL support - if useq mysql ; then + if use mysql ; then phpconfutils_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" fi @@ -476,14 +515,14 @@ php5_1-sapi_src_compile() { phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" # ODBC support - if useq odbc || phpconfutils_usecheck odbc ; then + if use odbc || phpconfutils_usecheck odbc ; then phpconfutils_extension_with "unixODBC" "odbc" 1 "/usr" phpconfutils_extension_with "adabas" "adabas" 1 phpconfutils_extension_with "birdstep" "birdstep" 1 phpconfutils_extension_with "dbmaker" "dbmaker" 1 phpconfutils_extension_with "empress" "empress" 1 - if useq empress || phpconfutils_usecheck empress ; then + if use empress || phpconfutils_usecheck empress ; then phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 fi phpconfutils_extension_with "esoob" "esoob" 1 @@ -494,25 +533,25 @@ php5_1-sapi_src_compile() { fi # Oracle support - if useq oci8 ; then + if use oci8 ; then phpconfutils_extension_with "oci8" "oci8" 1 fi - if useq oci8-instant-client ; then + if use oci8-instant-client ; then OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`" OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`" phpconfutils_extension_with "oci8" "oci8-instant-client" 1 "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib" fi # PDO support - if useq pdo || phpconfutils_usecheck pdo ; then + if use pdo || phpconfutils_usecheck pdo ; then phpconfutils_extension_with "pdo-dblib" "mssql" 1 # The PDO-Firebird driver is broken and unmaintained upstream # phpconfutils_extension_with "pdo-firebird" "firebird" 1 phpconfutils_extension_with "pdo-mysql" "mysql" 1 "/usr" - if useq oci8 ; then + if use oci8 ; then phpconfutils_extension_with "pdo-oci" "oci8" 1 fi - if useq oci8-instant-client ; then + if use oci8-instant-client ; then OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`" OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`" phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 "instantclient,/usr,${OCI8IC_PKG}" @@ -528,32 +567,22 @@ php5_1-sapi_src_compile() { phpconfutils_extension_with "libedit" "libedit" 0 # Session support - if ! useq session && ! phpconfutils_usecheck session ; then + if ! use session && ! phpconfutils_usecheck session ; then phpconfutils_extension_disable "session" "session" 0 else phpconfutils_extension_with "mm" "sharedmem" 0 fi # SQLite support - if ! useq sqlite && ! phpconfutils_usecheck sqlite ; then + if ! use sqlite && ! phpconfutils_usecheck sqlite ; then phpconfutils_extension_without "sqlite" "sqlite" 0 else phpconfutils_extension_with "sqlite" "sqlite" 0 "/usr" phpconfutils_extension_enable "sqlite-utf8" "unicode" 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 useq pic || phpconfutils_usecheck pic ; then + if use pic || phpconfutils_usecheck pic ; then einfo "Enabling PIC support" my_conf="${my_conf} --with-pic" fi @@ -588,7 +617,7 @@ php5_1-sapi_src_install() { make INSTALL_ROOT="${D}" install-build install-headers install-programs || die "make install failed" # Install missing header files - if useq unicode || phpconfutils_usecheck unicode ; then + if use unicode || phpconfutils_usecheck unicode ; then dodir ${destdir}/include/php/ext/mbstring insinto ${destdir}/include/php/ext/mbstring for x in `ls "${S}/ext/mbstring/"*.h` ; do @@ -613,7 +642,7 @@ php5_1-sapi_src_install() { [[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`" # And install the modules to it - if useq sharedext ; then + if use sharedext ; then for x in `ls "${S}/modules/"*.so | sort` ; do module=`basename ${x}` modulename=${module/.so/} @@ -638,7 +667,7 @@ php5_1-sapi_pkg_postinst() { ewarn "with the newer PHP packages releases, so please reemerge any" ewarn "PHP extensions you have installed to automatically adapt to" ewarn "the new configuration layout." - if useq sharedext ; then + if use sharedext ; then ewarn "The core PHP extensions are now loaded through external" ewarn ".ini files, not anymore using a 'extension=name.so' line" ewarn "in the php.ini file. Portage will take care of this by" @@ -647,7 +676,7 @@ php5_1-sapi_pkg_postinst() { fi ewarn - if useq curl ; then + if use curl ; then ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions." ewarn "This can be a security risk!" ewarn @@ -670,6 +699,12 @@ php5_1-sapi_pkg_postinst() { ewarn "and thus can now be found in dev-php5/pecl-mcve. The Ovrimos" ewarn "and Pfpro extensions were removed altogether and have no" ewarn "available substitute." + ewarn "The 'vm-goto' and 'vm-switch' USE flags were also removed," + ewarn "since the alternative VMs aren't really supported upstream." + ewarn "Once their state becomes clearer, we'll consider readding them." + ewarn "Hardened-PHP was also removed from the PHP 5.1 ebuilds in" + ewarn "favour of its successor Suhosin, enable the 'suhosin' USE" + ewarn "flag to install it." ewarn ewarn "The 'xml' and 'xml2' USE flags were unified in only the 'xml' USE" diff --git a/eclass/php5_2-sapi.eclass b/eclass/php5_2-sapi.eclass new file mode 100644 index 000000000000..81a09c99d962 --- /dev/null +++ b/eclass/php5_2-sapi.eclass @@ -0,0 +1,721 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_2-sapi.eclass,v 1.1 2007/03/05 01:50:47 chtekk Exp $ + +# ======================================================================== +# +# php5_2-sapi.eclass +# Eclass for building different php5.2 SAPI instances +# +# USE THIS ECLASS FOR THE "CONCENTRATED" PACKAGES +# +# Based on robbat2's work on the php4 sapi eclass +# +# Author: Stuart Herbert +# +# +# Author: Luca Longinotti +# +# +# ======================================================================== + +PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase interbase msql oci8 sapdb solid sybase sybase-ct" + +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +inherit flag-o-matic autotools toolchain-funcs libtool eutils phpconfutils 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="adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase dbmaker debug doc empress empress-bcs esoob exif frontbase fdftk filter firebird flatfile ftp gd gd-external gdbm gmp hash iconv imap inifile interbase iodbc ipv6 java-external json kerberos ldap ldap-sasl libedit mcve mhash msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc pcntl pcre pdo pdo-external pic posix postgres qdbm readline reflection recode sapdb session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl suhosin sybase sybase-ct sysvipc tidy tokenizer truetype unicode wddx xml xmlreader xmlwriter xmlrpc xpm xsl yaz zip zip-external zlib" + +# these USE flags should have the correct dependencies +DEPEND="adabas? ( >=dev-db/unixODBC-1.8.13 ) + berkdb? ( =sys-libs/db-4* ) + birdstep? ( >=dev-db/unixODBC-1.8.13 ) + bzip2? ( app-arch/bzip2 ) + cdb? ( dev-db/cdb ) + cjk? ( !gd? ( !gd-external? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) ) ) + crypt? ( >=dev-libs/libmcrypt-2.4 ) + curl? ( >=net-misc/curl-7.10.5 ) + db2? ( >=dev-db/unixODBC-1.8.13 ) + dbmaker? ( >=dev-db/unixODBC-1.8.13 ) + empress? ( >=dev-db/unixODBC-1.8.13 ) + empress-bcs? ( >=dev-db/unixODBC-1.8.13 ) + esoob? ( >=dev-db/unixODBC-1.8.13 ) + exif? ( !gd? ( !gd-external? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) ) ) + fdftk? ( app-text/fdftk ) + firebird? ( dev-db/firebird ) + gd? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) + gd-external? ( media-libs/gd ) + gdbm? ( >=sys-libs/gdbm-1.8.0 ) + gmp? ( >=dev-libs/gmp-4.1.2 ) + iconv? ( virtual/libiconv ) + imap? ( virtual/imap-c-client ) + iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) + kerberos? ( virtual/krb5 ) + ldap? ( >=net-nds/openldap-1.2.11 ) + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) ) + mcve? ( >=dev-libs/openssl-0.9.7 ) + mhash? ( app-crypt/mhash ) + mssql? ( dev-db/freetds ) + mysql? ( virtual/mysql ) + mysqli? ( >=virtual/mysql-4.1 ) + ncurses? ( sys-libs/ncurses ) + nls? ( sys-devel/gettext ) + oci8-instant-client? ( dev-db/oracle-instantclient-basic ) + odbc? ( >=dev-db/unixODBC-1.8.13 ) + postgres? ( >=dev-db/libpq-7.1 ) + qdbm? ( dev-db/qdbm ) + readline? ( sys-libs/readline ) + recode? ( app-text/recode ) + sapdb? ( >=dev-db/unixODBC-1.8.13 ) + 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 ) + solid? ( >=dev-db/unixODBC-1.8.13 ) + spell? ( >=app-text/aspell-0.50 ) + sqlite? ( =dev-db/sqlite-2* pdo? ( =dev-db/sqlite-3* ) ) + ssl? ( >=dev-libs/openssl-0.9.7 ) + sybase? ( dev-db/freetds ) + tidy? ( app-text/htmltidy ) + truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 !gd? ( !gd-external? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) ) ) + wddx? ( >=dev-libs/libxml2-2.6.8 ) + xml? ( >=dev-libs/libxml2-2.6.8 ) + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv ) + xmlreader? ( >=dev-libs/libxml2-2.6.8 ) + xmlwriter? ( >=dev-libs/libxml2-2.6.8 ) + xpm? ( || ( x11-libs/libXpm virtual/x11 ) >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) + xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 ) + zip? ( sys-libs/zlib ) + 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" + +# force use of the internal extensions, +# as they're better maintained upstream +DEPEND="${DEPEND} + !dev-php5/pecl-filter + !dev-php5/pecl-json" + +# simplistic for now +RDEPEND="${DEPEND}" + +# those are only needed at compile-time +DEPEND="${DEPEND} + >=sys-devel/m4-1.4.3 + >=sys-devel/libtool-1.5.18" + +# Additional features +# +# They are in PDEPEND because we need PHP installed first! +PDEPEND="doc? ( app-doc/php-docs ) + filter? ( !dev-php5/pecl-filter ) + java-external? ( dev-php5/php-java-bridge ) + json? ( !dev-php5/pecl-json ) + mcve? ( dev-php5/pecl-mcve ) + pdo? ( !dev-php5/pecl-pdo ) + pdo-external? ( dev-php5/pecl-pdo ) + suhosin? ( dev-php5/suhosin ) + yaz? ( dev-php5/pecl-yaz ) + zip? ( !dev-php5/pecl-zip ) + zip-external? ( dev-php5/pecl-zip )" + +# ======================================================================== +# php.ini Support +# ======================================================================== + +PHP_INI_FILE="php.ini" +PHP_INI_UPSTREAM="php.ini-dist" + +# ======================================================================== + +# PHP patchsets support +SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" + +# Suhosin patch support +[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )" + +# ======================================================================== + +EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst + +# ======================================================================== +# INTERNAL FUNCTIONS +# ======================================================================== + +php5_2-sapi_check_use_flags() { + # Multiple USE dependencies + phpconfutils_use_depend_any "truetype" "gd" "gd" "gd-external" + phpconfutils_use_depend_any "cjk" "gd" "gd" "gd-external" + phpconfutils_use_depend_any "exif" "gd" "gd" "gd-external" + + # Simple USE dependencies + phpconfutils_use_depend_all "xpm" "gd" + phpconfutils_use_depend_all "gd" "zlib" + phpconfutils_use_depend_all "simplexml" "xml" + phpconfutils_use_depend_all "soap" "xml" + phpconfutils_use_depend_all "wddx" "xml" + phpconfutils_use_depend_all "xmlrpc" "xml" + phpconfutils_use_depend_all "xmlreader" "xml" + phpconfutils_use_depend_all "xmlwriter" "xml" + phpconfutils_use_depend_all "xsl" "xml" + phpconfutils_use_depend_all "filter" "pcre" + phpconfutils_use_depend_all "xmlrpc" "iconv" + phpconfutils_use_depend_all "java-external" "session" + phpconfutils_use_depend_all "ldap-sasl" "ldap" + phpconfutils_use_depend_all "mcve" "ssl" + phpconfutils_use_depend_all "suhosin" "unicode" + phpconfutils_use_depend_all "adabas" "odbc" + phpconfutils_use_depend_all "birdstep" "odbc" + phpconfutils_use_depend_all "dbmaker" "odbc" + phpconfutils_use_depend_all "empress-bcs" "odbc" "empress" + phpconfutils_use_depend_all "empress" "odbc" + phpconfutils_use_depend_all "esoob" "odbc" + phpconfutils_use_depend_all "db2" "odbc" + phpconfutils_use_depend_all "iodbc" "odbc" + phpconfutils_use_depend_all "sapdb" "odbc" + phpconfutils_use_depend_all "solid" "odbc" + + # Direct USE conflicts + phpconfutils_use_conflict "gd" "gd-external" + phpconfutils_use_conflict "oci8" "oci8-instant-client" + phpconfutils_use_conflict "pdo" "pdo-external" + phpconfutils_use_conflict "zip" "zip-external" + phpconfutils_use_conflict "qdbm" "gdbm" + phpconfutils_use_conflict "readline" "libedit" + phpconfutils_use_conflict "recode" "mysql" "imap" "yaz" + phpconfutils_use_conflict "sharedmem" "threads" + + # IMAP support + php_check_imap + + # Mail support + php_check_mta + + # PostgreSQL support + php_check_pgsql + + # Oracle support + php_check_oracle_8 + + phpconfutils_warn_about_external_deps + + export PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE}" +} + +php5_2-sapi_set_php_ini_dir() { + PHP_INI_DIR="/etc/php/${PHPSAPI}-php5" + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active" +} + +php5_2-sapi_install_ini() { + destdir=/usr/$(get_libdir)/php5 + + # get the extension dir, if not already defined + [[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`" + + # work out where we are installing the ini file + php5_2-sapi_set_php_ini_dir + + cp "${PHP_INI_UPSTREAM}" "${PHP_INI_UPSTREAM}-${PHPSAPI}" + local phpinisrc="${PHP_INI_UPSTREAM}-${PHPSAPI}" + + # Set the extension dir + einfo "Setting extension_dir in php.ini" + sed -e "s|^extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc} + + # A patch for PHP for security + 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 = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc} + + # Add needed MySQL extensions charset configuration + local phpmycnfcharset="" + + if [[ "${PHPSAPI}" == "cli" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cli`" + einfo "MySQL extensions charset for 'cli' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "cgi" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset cgi-fcgi`" + einfo "MySQL extensions charset for 'cgi' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "apache" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset apache`" + einfo "MySQL extensions charset for 'apache' SAPI is: ${phpmycnfcharset}" + elif [[ "${PHPSAPI}" == "apache2" ]] ; then + phpmycnfcharset="`php_get_mycnf_charset apache2handler`" + einfo "MySQL extensions charset for 'apache2' SAPI is: ${phpmycnfcharset}" + else + einfo "No supported SAPI found for which to get the MySQL charset." + fi + + if [[ -n "${phpmycnfcharset}" ]] && [[ "${phpmycnfcharset}" != "empty" ]] ; then + einfo "Setting MySQL extensions charset to ${phpmycnfcharset}" + echo "" >> ${phpinisrc} + echo "; MySQL extensions default connection charset settings" >> ${phpinisrc} + echo "mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + echo "mysqli.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + echo "pdo_mysql.connect_charset = ${phpmycnfcharset}" >> ${phpinisrc} + else + echo "" >> ${phpinisrc} + echo "; MySQL extensions default connection charset settings" >> ${phpinisrc} + echo ";mysql.connect_charset = utf8" >> ${phpinisrc} + echo ";mysqli.connect_charset = utf8" >> ${phpinisrc} + echo ";pdo_mysql.connect_charset = utf8" >> ${phpinisrc} + fi + + dodir ${PHP_INI_DIR} + insinto ${PHP_INI_DIR} + newins ${phpinisrc} ${PHP_INI_FILE} + + dodir ${PHP_EXT_INI_DIR} + dodir ${PHP_EXT_INI_DIR_ACTIVE} + + # Install any extensions built as shared objects + if use sharedext ; then + for x in `ls "${D}/${PHPEXTDIR}/"*.so | sort` ; do + inifilename=${x/.so/.ini} + inifilename=`basename ${inifilename}` + echo "extension=`basename ${x}`" >> "${D}/${PHP_EXT_INI_DIR}/${inifilename}" + dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}" + done + fi +} + +# ======================================================================== +# EXPORTED FUNCTIONS +# ======================================================================== + +php5_2-sapi_pkg_setup() { + # let's do all the USE flag testing before we do anything else + # this way saves a lot of time + php5_2-sapi_check_use_flags +} + +php5_2-sapi_src_unpack() { + cd "${S}" + + # Change PHP branding + PHPPR=${PR/r/} + sed -e "s|^EXTRA_VERSION=\"\"|EXTRA_VERSION=\"-pl${PHPPR}-gentoo\"|g" -i configure.in || die "Unable to change PHP branding to -pl${PHPPR}-gentoo" + + # multilib-strict support + if [[ -n "${MULTILIB_PATCH}" ]] && [[ -f "${WORKDIR}/${MULTILIB_PATCH}" ]] ; then + epatch "${WORKDIR}/${MULTILIB_PATCH}" + else + ewarn "There is no multilib-strict patch available for this PHP release yet!" + fi + + # Apply general PHP5 patches + if [[ -d "${WORKDIR}/${MY_PHP_PV}/php5" ]] ; then + EPATCH_SOURCE="${WORKDIR}/${MY_PHP_PV}/php5" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch + fi + + # Apply version-specific PHP patches + if [[ -d "${WORKDIR}/${MY_PHP_PV}/${MY_PHP_PV}" ]] ; then + EPATCH_SOURCE="${WORKDIR}/${MY_PHP_PV}/${MY_PHP_PV}" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch + fi + + # Patch PHP to show Gentoo as the server platform + sed -e "s/PHP_UNAME=\`uname -a | xargs\`/PHP_UNAME=\`uname -s -n -r -v | xargs\`/g" -i configure.in || die "Failed to fix server platform name" + + # Disable interactive make test + sed -e 's/'`echo "\!getenv('NO_INTERACTION')"`'/false/g' -i run-tests.php + + # 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 + + # Patch PHP to support heimdal instead of mit-krb5 + if has_version "app-crypt/heimdal" ; then + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 || die "Failed to fix heimdal libname" + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 || die "Failed to fix heimdal crypt library reference" + fi + + # Patch for PostgreSQL support + if use postgres ; then + sed -e 's|include/postgresql|include/postgresql include/postgresql/pgsql|g' -i ext/pgsql/config.m4 || die "Failed to fix PostgreSQL include paths" + fi + + # Suhosin support + if use suhosin ; then + if [[ -n "${SUHOSIN_PATCH}" ]] && [[ -f "${DISTDIR}/${SUHOSIN_PATCH}" ]] ; then + epatch "${DISTDIR}/${SUHOSIN_PATCH}" + else + ewarn "There is no Suhosin patch available for this PHP release yet!" + fi + fi + + # Fix configure scripts to correctly support Suhosin + einfo "Running aclocal" + aclocal --force || die "Unable to run aclocal successfully" + einfo "Running libtoolize" + libtoolize --copy --force || die "Unable to run libtoolize successfully" + + # Rebuild configure to make sure it's up to date + einfo "Rebuilding configure script" + autoreconf --force -W no-cross || die "Unable to regenerate configure script successfully" + + # Run elibtoolize + elibtoolize + + # Just in case ;-) + chmod 0755 configure || die "Failed to chmod configure to 0755" +} + +php5_2-sapi_src_compile() { + destdir=/usr/$(get_libdir)/php5 + + php5_2-sapi_set_php_ini_dir + + cd "${S}" + + phpconfutils_init + + my_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE} --without-pear" + + # extension USE flag shared support? + phpconfutils_extension_enable "bcmath" "bcmath" 1 + phpconfutils_extension_with "bz2" "bzip2" 1 + phpconfutils_extension_enable "calendar" "calendar" 1 + phpconfutils_extension_disable "ctype" "ctype" 0 + phpconfutils_extension_with "curl" "curl" 1 + phpconfutils_extension_with "curlwrappers" "curlwrappers" 0 + phpconfutils_extension_enable "dbase" "dbase" 1 + phpconfutils_extension_disable "dom" "xml" 0 + phpconfutils_extension_enable "exif" "exif" 1 + phpconfutils_extension_with "fbsql" "frontbase" 1 + phpconfutils_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" + phpconfutils_extension_disable "filter" "filter" 0 + phpconfutils_extension_enable "ftp" "ftp" 1 + phpconfutils_extension_with "gettext" "nls" 1 + phpconfutils_extension_with "gmp" "gmp" 1 + phpconfutils_extension_disable "hash" "hash" 0 + phpconfutils_extension_without "iconv" "iconv" 0 + phpconfutils_extension_disable "ipv6" "ipv6" 0 + phpconfutils_extension_disable "json" "json" 0 + phpconfutils_extension_with "kerberos" "kerberos" 0 "/usr" + phpconfutils_extension_disable "libxml" "xml" 0 + phpconfutils_extension_enable "mbstring" "unicode" 1 + phpconfutils_extension_with "mcrypt" "crypt" 1 + phpconfutils_extension_with "mhash" "mhash" 1 + phpconfutils_extension_with "msql" "msql" 1 + phpconfutils_extension_with "mssql" "mssql" 1 + phpconfutils_extension_with "ncurses" "ncurses" 1 + phpconfutils_extension_with "openssl" "ssl" 0 + phpconfutils_extension_with "openssl-dir" "ssl" 0 "/usr" + phpconfutils_extension_enable "pcntl" "pcntl" 1 + phpconfutils_extension_without "pcre-regex" "pcre" 0 + phpconfutils_extension_disable "pdo" "pdo" 0 + phpconfutils_extension_with "pgsql" "postgres" 1 + phpconfutils_extension_disable "posix" "posix" 0 + phpconfutils_extension_with "pspell" "spell" 1 + phpconfutils_extension_with "recode" "recode" 1 + phpconfutils_extension_disable "reflection" "reflection" 0 + phpconfutils_extension_disable "simplexml" "simplexml" 0 + phpconfutils_extension_enable "shmop" "sharedmem" 0 + phpconfutils_extension_with "snmp" "snmp" 1 + phpconfutils_extension_enable "soap" "soap" 1 + phpconfutils_extension_enable "sockets" "sockets" 1 + phpconfutils_extension_disable "spl" "spl" 0 + phpconfutils_extension_with "sybase" "sybase" 1 + phpconfutils_extension_with "sybase-ct" "sybase-ct" 1 + phpconfutils_extension_enable "sysvmsg" "sysvipc" 1 + phpconfutils_extension_enable "sysvsem" "sysvipc" 1 + phpconfutils_extension_enable "sysvshm" "sysvipc" 1 + phpconfutils_extension_with "tidy" "tidy" 1 + phpconfutils_extension_disable "tokenizer" "tokenizer" 0 + phpconfutils_extension_enable "wddx" "wddx" 1 + phpconfutils_extension_disable "xml" "xml" 0 + phpconfutils_extension_disable "xmlreader" "xmlreader" 0 + phpconfutils_extension_disable "xmlwriter" "xmlwriter" 0 + phpconfutils_extension_with "xmlrpc" "xmlrpc" 1 + phpconfutils_extension_with "xsl" "xsl" 1 + phpconfutils_extension_enable "zip" "zip" 1 + phpconfutils_extension_with "zlib" "zlib" 1 + phpconfutils_extension_enable "debug" "debug" 0 + + # DBA support + if use cdb || use berkdb || use flatfile || use gdbm || use inifile || use qdbm ; then + my_conf="${my_conf} --enable-dba${shared}" + fi + + # DBA drivers support + phpconfutils_extension_with "cdb" "cdb" 0 + phpconfutils_extension_with "db4" "berkdb" 0 + phpconfutils_extension_with "flatfile" "flatfile" 0 + phpconfutils_extension_with "gdbm" "gdbm" 0 + phpconfutils_extension_with "inifile" "inifile" 0 + phpconfutils_extension_with "qdbm" "qdbm" 0 + + # Support for the GD graphics library + if use gd-external || phpconfutils_usecheck gd-external ; then + phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" + phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" + phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 + phpconfutils_extension_enable "gd-native-ttf" "truetype" 0 + phpconfutils_extension_with "gd" "gd-external" 1 "/usr" + else + phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" + phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" + phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 + phpconfutils_extension_enable "gd-native-ttf" "truetype" 0 + phpconfutils_extension_with "jpeg-dir" "gd" 0 "/usr" + phpconfutils_extension_with "png-dir" "gd" 0 "/usr" + phpconfutils_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6" + # enable gd last, so configure can pick up the previous settings + phpconfutils_extension_with "gd" "gd" 0 + fi + + # IMAP support + if use imap || phpconfutils_usecheck imap ; then + phpconfutils_extension_with "imap" "imap" 1 + phpconfutils_extension_with "imap-ssl" "ssl" 0 + fi + + # Interbase support + if use firebird || use interbase ; then + my_conf="${my_conf} --with-interbase=/usr" + fi + + # LDAP support + if use ldap || phpconfutils_usecheck ldap ; then + phpconfutils_extension_with "ldap" "ldap" 1 + phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0 + fi + + # MySQL support + if use mysql ; then + phpconfutils_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" + phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + fi + + # MySQLi support + phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" + + # ODBC support + if use odbc || phpconfutils_usecheck odbc ; then + phpconfutils_extension_with "unixODBC" "odbc" 1 "/usr" + + phpconfutils_extension_with "adabas" "adabas" 1 + phpconfutils_extension_with "birdstep" "birdstep" 1 + phpconfutils_extension_with "dbmaker" "dbmaker" 1 + phpconfutils_extension_with "empress" "empress" 1 + if use empress || phpconfutils_usecheck empress ; then + phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 + fi + phpconfutils_extension_with "esoob" "esoob" 1 + phpconfutils_extension_with "ibm-db2" "db2" 1 + phpconfutils_extension_with "iodbc" "iodbc" 1 "/usr" + phpconfutils_extension_with "sapdb" "sapdb" 1 + phpconfutils_extension_with "solid" "solid" 1 + fi + + # Oracle support + if use oci8 ; then + phpconfutils_extension_with "oci8" "oci8" 1 + fi + if use oci8-instant-client ; then + OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`" + OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`" + phpconfutils_extension_with "oci8" "oci8-instant-client" 1 "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib" + fi + + # PDO support + if use pdo || phpconfutils_usecheck pdo ; then + phpconfutils_extension_with "pdo-dblib" "mssql" 1 + # The PDO-Firebird driver is broken and unmaintained upstream + # phpconfutils_extension_with "pdo-firebird" "firebird" 1 + phpconfutils_extension_with "pdo-mysql" "mysql" 1 "/usr" + if use oci8 ; then + phpconfutils_extension_with "pdo-oci" "oci8" 1 + fi + if use oci8-instant-client ; then + OCI8IC_PKG="`best_version dev-db/oracle-instantclient-basic`" + OCI8IC_PKG="`printf ${OCI8IC_PKG} | sed -e 's|dev-db/oracle-instantclient-basic-||g' | sed -e 's|-r.*||g'`" + phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 "instantclient,/usr,${OCI8IC_PKG}" + fi + phpconfutils_extension_with "pdo-odbc" "odbc" 1 "unixODBC,/usr" + phpconfutils_extension_with "pdo-pgsql" "postgres" 1 + phpconfutils_extension_with "pdo-sqlite" "sqlite" 1 "/usr" + fi + + # readline/libedit support + # You can use readline or libedit, but you can't use both + phpconfutils_extension_with "readline" "readline" 0 + phpconfutils_extension_with "libedit" "libedit" 0 + + # Session support + if ! use session && ! phpconfutils_usecheck session ; then + phpconfutils_extension_disable "session" "session" 0 + else + phpconfutils_extension_with "mm" "sharedmem" 0 + fi + + # SQLite support + if ! use sqlite && ! phpconfutils_usecheck sqlite ; then + phpconfutils_extension_without "sqlite" "sqlite" 0 + else + phpconfutils_extension_with "sqlite" "sqlite" 0 "/usr" + phpconfutils_extension_enable "sqlite-utf8" "unicode" 0 + fi + + # Fix ELF-related problems + if use pic || phpconfutils_usecheck pic ; then + einfo "Enabling PIC support" + my_conf="${my_conf} --with-pic" + fi + + # Catch CFLAGS problems + php_check_cflags + + # multilib support + if [[ $(get_libdir) != lib ]] ; then + my_conf="--with-libdir=$(get_libdir) ${my_conf}" + fi + + # Support user-passed configuration parameters + [[ -z "${EXTRA_ECONF}" ]] && EXTRA_ECONF="" + + # Set the correct compiler for cross-compilation + tc-export CC + + # We don't use econf, because we need to override all of its settings + ./configure --prefix=${destdir} --host=${CHOST} --mandir=${destdir}/man --infodir=${destdir}/info --sysconfdir=/etc --cache-file=./config.cache ${my_conf} ${EXTRA_ECONF} || die "configure failed" + emake || die "make failed" +} + +php5_2-sapi_src_install() { + destdir=/usr/$(get_libdir)/php5 + + cd "${S}" + + addpredict /usr/share/snmp/mibs/.index + + # Install PHP + make INSTALL_ROOT="${D}" install-build install-headers install-programs || die "make install failed" + + # Install missing header files + if use unicode || phpconfutils_usecheck unicode ; then + dodir ${destdir}/include/php/ext/mbstring + insinto ${destdir}/include/php/ext/mbstring + for x in `ls "${S}/ext/mbstring/"*.h` ; do + file=`basename ${x}` + doins ext/mbstring/${file} + done + dodir ${destdir}/include/php/ext/mbstring/oniguruma + insinto ${destdir}/include/php/ext/mbstring/oniguruma + for x in `ls "${S}/ext/mbstring/oniguruma/"*.h` ; do + file=`basename ${x}` + doins ext/mbstring/oniguruma/${file} + done + dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl + for x in `ls "${S}/ext/mbstring/libmbfl/mbfl/"*.h` ; do + file=`basename ${x}` + doins ext/mbstring/libmbfl/mbfl/${file} + done + fi + + # Get the extension dir, if not already defined + [[ -z "${PHPEXTDIR}" ]] && PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`" + + # And install the modules to it + if use sharedext ; then + for x in `ls "${S}/modules/"*.so | sort` ; do + module=`basename ${x}` + modulename=${module/.so/} + insinto "${PHPEXTDIR}" + einfo "Installing PHP ${modulename} extension" + doins "modules/${module}" + done + fi + + # Generate the USE file for PHP + phpconfutils_generate_usefile + + # Create the directory where we'll put php5-only php scripts + keepdir /usr/share/php5 +} + +php5_2-sapi_pkg_postinst() { + ewarn + ewarn "If you have additional third party PHP extensions (such as" + ewarn "dev-php5/phpdbg) you may need to recompile them now." + ewarn "A new way of enabling/disabling PHP extensions was introduced" + ewarn "with the newer PHP packages releases, so please reemerge any" + ewarn "PHP extensions you have installed to automatically adapt to" + ewarn "the new configuration layout." + if use sharedext ; then + ewarn "The core PHP extensions are now loaded through external" + ewarn ".ini files, not anymore using a 'extension=name.so' line" + ewarn "in the php.ini file. Portage will take care of this by" + ewarn "creating new, updated config-files, please make sure to" + ewarn "install those using etc-update or dispatch-conf." + fi + ewarn + + if use curl ; then + ewarn "Please be aware that CURL can allow the bypass of open_basedir restrictions." + ewarn "This can be a security risk!" + ewarn + fi + + ewarn "The 'pic' USE flag was added to newer releases of dev-lang/php." + ewarn "With PIC enabled, your PHP installation may become slower, but" + ewarn "PIC is required on Hardened-Gentoo platforms (where the USE flag" + ewarn "is enabled automatically). You may also need this on other" + ewarn "configurations where TEXTRELs are disabled, for example when using" + ewarn "certain PaX options in the kernel." + ewarn + + ewarn "With PHP 5.2, some extensions were removed from PHP because" + ewarn "they were unmaintained or moved to PECL. Our ebuilds reflect" + ewarn "this: the Filepro and HwAPI (Hyperwave-API) extensions were" + ewarn "removed altogether and have no available substitute." + ewarn "The Informix extension was also removed, as well as the optional" + ewarn "memory-limit setting: memory-limit is now always enforced!" + ewarn "The 'vm-goto' and 'vm-switch' USE flags were also removed," + ewarn "since the alternative VMs aren't really supported upstream" + ewarn "and were found to behave badly with PHP 5.2. Once their" + ewarn "state becomes clearer, we'll consider readding the USE flags." + ewarn "The Ming extension was removed from our PHP 5.2 ebuild, because" + ewarn "there were serious problems with compilation and the required" + ewarn "Ming library. This functionality will be reintroduced later" + ewarn "as an independant, external PHP extension." + ewarn "Hardened-PHP was also removed from the PHP 5.2 ebuilds in" + ewarn "favour of its successor Suhosin, enable the 'suhosin' USE" + ewarn "flag to install it." + ewarn + + ewarn "The 'xml' and 'xml2' USE flags were unified in only the 'xml' USE" + ewarn "flag. To get the features that were once controlled by the 'xml2'" + ewarn "USE flag, turn the 'xml' USE flag on." + ewarn +} -- 2.26.2