diff options
-rw-r--r-- | eclass/depend.php.eclass | 353 | ||||
-rw-r--r-- | eclass/php-common-r1.eclass | 100 | ||||
-rw-r--r-- | eclass/php4_4-sapi.eclass | 390 | ||||
-rw-r--r-- | eclass/php5_0-sapi.eclass | 392 | ||||
-rw-r--r-- | eclass/php5_1-sapi.eclass | 426 | ||||
-rw-r--r-- | eclass/phpconfutils.eclass | 457 |
6 files changed, 1272 insertions, 846 deletions
diff --git a/eclass/depend.php.eclass b/eclass/depend.php.eclass index 3f1796f7e130..1a8619132229 100644 --- a/eclass/depend.php.eclass +++ b/eclass/depend.php.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.11 2006/01/21 11:48:29 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.php.eclass,v 1.12 2006/03/24 23:05:47 chtekk Exp $ # # ======================================================================== # @@ -17,34 +17,30 @@ # # ======================================================================== -inherit eutils +inherit eutils phpconfutils # PHP4-only depend functions -need_php4_cli() -{ +need_php4_cli() { DEPEND="${DEPEND} =virtual/php-4*" RDEPEND="${RDEPEND} =virtual/php-4*" - PHP_VERSION=4 + PHP_VERSION="4" } -need_php4_httpd() -{ +need_php4_httpd() { DEPEND="${DEPEND} =virtual/httpd-php-4*" RDEPEND="${RDEPEND} =virtual/httpd-php-4*" - PHP_VERSION=4 + PHP_VERSION="4" } -need_php4() -{ +need_php4() { DEPEND="${DEPEND} =dev-lang/php-4*" RDEPEND="${RDEPEND} =dev-lang/php-4*" - PHP_VERSION=4 + PHP_VERSION="4" PHP_SHARED_CAT="php4" } # common settings go in here -uses_php4() -{ +uses_php4() { # cache this libdir=$(get_libdir) @@ -61,31 +57,27 @@ uses_php4() } # PHP5-only depend functions -need_php5_cli() -{ +need_php5_cli() { DEPEND="${DEPEND} =virtual/php-5*" RDEPEND="${RDEPEND} =virtual/php-5*" - PHP_VERSION=5 + PHP_VERSION="5" } -need_php5_httpd() -{ +need_php5_httpd() { DEPEND="${DEPEND} =virtual/httpd-php-5*" RDEPEND="${RDEPEND} =virtual/httpd-php-5*" - PHP_VERSION=5 + PHP_VERSION="5" } -need_php5() -{ +need_php5() { DEPEND="${DEPEND} =dev-lang/php-5*" RDEPEND="${RDEPEND} =dev-lang/php-5*" - PHP_VERSION=5 + PHP_VERSION="5" PHP_SHARED_CAT="php5" } # common settings go in here -uses_php5() -{ +uses_php5() { # cache this libdir=$(get_libdir) @@ -102,27 +94,23 @@ uses_php5() } # general PHP depend functions -need_php_cli() -{ +need_php_cli() { DEPEND="${DEPEND} virtual/php" RDEPEND="${RDEPEND} virtual/php" } -need_php_httpd() -{ +need_php_httpd() { DEPEND="${DEPEND} virtual/httpd-php" RDEPEND="${RDEPEND} virtual/httpd-php" } -need_php() -{ +need_php() { DEPEND="${DEPEND} dev-lang/php" RDEPEND="${RDEPEND} dev-lang/php" PHP_SHARED_CAT="php" } -need_php_by_category() -{ +need_php_by_category() { case "${CATEGORY}" in dev-php) need_php ;; dev-php4) need_php4 ;; @@ -131,22 +119,44 @@ need_php_by_category() esac } -# call this function from pkg_setup if your PHP extension only works with +# Call this function from your pkg_setup, src_compile and src_install methods +# if you need to know where the PHP binaries are installed and their data + +has_php() { + # If PHP_PKG is already set, then we have remembered our PHP settings + # from last time + if [[ -n ${PHP_PKG} ]] ; then + return + fi + + if [[ -z ${PHP_VERSION} ]] ; then + # Detect which PHP version we have installed + if has_version '=dev-lang/php-5*' ; then + PHP_VERSION="5" + elif has_version '=dev-lang/php-4*' ; then + PHP_VERSION="4" + else + die "Unable to find an installed dev-lang/php package" + fi + fi + + # If we get here, then PHP_VERSION tells us which version of PHP we + # want to use + uses_php${PHP_VERSION} +} + +# Call this function from pkg_setup if your package only works with # specific SAPIs # -# this function will disappear when USE-based deps are supported by -# Portage +# $1 ... a list of PHP SAPI USE flags (cli, cgi, apache, apache2) # -# $1 ... a list of SAPI USE flags (eg cli, cgi, apache2) -# -# returns if any one of the listed SAPIs has been installed -# dies if none of the listed SAPIs has been installed +# Returns if any one of the listed SAPIs have been installed +# Dies if none of the listed SAPIs have been installed -require_php_sapi_from() -{ +require_php_sapi_from() { has_php - local has_sapi=0 + local has_sapi="0" local x einfo "Checking for compatible SAPI(s)" @@ -154,11 +164,11 @@ require_php_sapi_from() for x in $@ ; do if built_with_use =${PHP_PKG} ${x} ; then einfo " Discovered compatible SAPI ${x}" - has_sapi=1 + has_sapi="1" fi done - if [[ ${has_sapi} == 1 ]]; then + if [[ "${has_sapi}" == "1" ]] ; then return fi @@ -168,22 +178,18 @@ require_php_sapi_from() eerror eerror " $@" eerror - die "Re-install ${PHP_PKG}" + die "No compatible PHP SAPIs found" } -# call this function from pkg_setup if your package requires PHP compiled +# Call this function from pkg_setup if your package requires PHP compiled # with specific USE flags # -# this function will disappear when USE-based deps are supported by -# Portage -# # $1 ... a list of USE flags # -# returns if all of the listed USE flags are set -# dies if any of the listed USE flags are not set +# Returns if all of the listed USE flags are enabled +# Dies if any of the listed USE flags are disabled -require_php_with_use() -{ +require_php_with_use() { has_php local missing_use="" @@ -192,7 +198,7 @@ require_php_with_use() einfo "Checking for required PHP feature(s):" for x in $@ ; do - if ! built_with_use =${PHP_PKG} ${x} ; then + if ! built_with_use =${PHP_PKG} ${x} && ! phpconfutils_built_with_use =${PHP_PKG} ${x} ; then einfo " Discovered missing USE flag ${x}" missing_use="${missing_use} ${x}" fi @@ -208,48 +214,56 @@ require_php_with_use() eerror eerror " $@" eerror - die "Re-install ${PHP_PKG}" + die "Missing PHP USE flags found" } -# call this function from your pkg_setup, src_compile & src_install methods -# if you need to know where the PHP binaries are installed and their data +# Call this function from pkg_setup if your package requires PHP compiled +# with any of specified USE flags +# +# $1 ... a list of USE flags +# +# Returns if any of the listed USE flags are enabled +# Dies if all of the listed USE flags are disabled -has_php() -{ - # if PHP_PKG is set, then we have remembered our PHP settings - # from last time +require_php_with_any_use() { + has_php - if [[ -n ${PHP_PKG} ]] ; then - return - fi + local missing_use="" + local x - if [[ -z ${PHP_VERSION} ]] ; then - # detect which PHP version installed - if has_version '=dev-lang/php-5*' ; then - PHP_VERSION=5 - elif has_version '=dev-lang/php-4*' ; then - PHP_VERSION=4 + einfo "Checking for required PHP feature(s):" + + for x in $@ ; do + if built_with_use =${PHP_PKG} ${x} || phpconfutils_built_with_use =${PHP_PKG} ${x} ; then + einfo " USE flag ${x} is enabled, ok ..." + return else - die "Unable to find an installed dev-lang/php package" + missing_use="${missing_use} ${x}" fi - fi + done - # if we get here, then PHP_VERSION tells us which version of PHP we - # want to use + if [[ -z ${missing_use} ]] ; then + return + fi - uses_php${PHP_VERSION} + eerror + eerror "${PHP_PKG} needs to be re-installed with any of the following" + eerror "USE flags enabled:" + eerror + eerror " $@" + eerror + die "Missing PHP USE flags found" } # ======================================================================== # has_*() functions # -# these functions return 0 if the condition is satisfied, or 1 otherwise +# These functions return 0 if the condition is satisfied, 1 otherwise # ======================================================================== -# check if our PHP was compiled with ZTS (Zend Thread Safety) +# Check if our PHP was compiled with ZTS (Zend Thread Safety) enabled -has_zts() -{ +has_zts() { has_php if built_with_use =${PHP_PKG} apache2 threads ; then @@ -259,10 +273,9 @@ has_zts() return 1 } -# check if our PHP was built with Hardened-PHP active +# Check if our PHP was built with Hardened-PHP enabled -has_hardenedphp() -{ +has_hardenedphp() { has_php if built_with_use =${PHP_PKG} hardenedphp ; then @@ -272,21 +285,31 @@ has_hardenedphp() return 1 } +# Check if our PHP was built with debug support enabled + +has_debug() { + has_php + + if built_with_use =${PHP_PKG} debug ; then + return 0 + fi + + return 1 +} + # ======================================================================== # require_*() functions # -# These functions die() if PHP was built without the required USE flag(s) +# These functions die() if PHP was built without the required features # ======================================================================== -# require a PHP built with PDO support for PHP5 +# Require a PHP built with PDO support (PHP5 only) -require_pdo() -{ +require_pdo() { has_php - # do we have php5 installed? - - if [[ ${PHP_VERSION} == 4 ]] ; then + # Do we have PHP5 installed? + if [[ "${PHP_VERSION}" == "4" ]] ; then eerror eerror "This package requires PDO." eerror "PDO is only available for PHP 5." @@ -299,26 +322,22 @@ require_pdo() die "PHP 5 not installed" fi - # was php5 compiled w/ pdo support? - + # Was PHP5 compiled with internal PDO support? if built_with_use =${PHP_PKG} pdo ; then return fi - # ok, maybe PDO was built as an external extension? - - if built_with_use =${PHP_PKG} pdo-external && has_version dev-php5/pecl-pdo ; then + # Ok, maybe PDO was built as an external extension? + if built_with_use =${PHP_PKG} pdo-external && has_version 'dev-php5/pecl-pdo' ; then return fi - # ok, as last resort, it suffices that pecl-pdo was installed to have PDO support - - if has_version dev-php5/pecl-pdo ; then + # Ok, as last resort, it suffices that pecl-pdo was installed to have PDO support + if has_version 'dev-php5/pecl-pdo' ; then return fi - # if we get here, then we have no PDO support - + # If we get here, then we have no PDO support eerror eerror "No PDO extension for PHP found." eerror "Please note that PDO only exists for PHP 5." @@ -329,36 +348,36 @@ require_pdo() eerror "the 'pdo' or the 'pdo-external' USE flags" eerror "turned on." eerror - die "No PDO extension found for PHP 5" + die "No PDO extension for PHP 5 found" } -# determines which installed PHP version has the CLI sapi -# useful for PEAR eclass, or anything which needs to run PHP -# scripts depending on the cli sapi +# Determines which installed PHP version has the CLI SAPI enabled, +# useful for PEAR stuff, or anything which needs to run PHP +# scripts depending on the CLI SAPI -require_php_cli() -{ - # if PHP_PKG is set, then we have remembered our PHP settings +require_php_cli() { + # If PHP_PKG is set, then we have remembered our PHP settings # from last time - if [[ -n ${PHP_PKG} ]] ; then return fi - # detect which PHP version installed + local PHP_PACKAGE_FOUND="" + + # Detect which PHP version we have installed if has_version '=dev-lang/php-4*' ; then - PHP_PACKAGE_FOUND=1 + PHP_PACKAGE_FOUND="1" pkg="`best_version '=dev-lang/php-4*'`" if built_with_use =${pkg} cli ; then - PHP_VERSION=4 + PHP_VERSION="4" fi fi if has_version '=dev-lang/php-5*' ; then - PHP_PACKAGE_FOUND=1 + PHP_PACKAGE_FOUND="1" pkg="`best_version '=dev-lang/php-5*'`" if built_with_use =${pkg} cli ; then - PHP_VERSION=5 + PHP_VERSION="5" fi fi @@ -370,39 +389,38 @@ require_php_cli() die "No PHP CLI installed" fi - # if we get here, then PHP_VERSION tells us which version of PHP we + # If we get here, then PHP_VERSION tells us which version of PHP we # want to use - uses_php${PHP_VERSION} } -# determines which installed PHP version has the CGI sapi +# Determines which installed PHP version has the CGI SAPI enabled, # useful for anything which needs to run PHP scripts -# depending on the cgi sapi +# depending on the CGI SAPI -require_php_cgi() -{ - # if PHP_PKG is set, then we have remembered our PHP settings +require_php_cgi() { + # If PHP_PKG is set, then we have remembered our PHP settings # from last time - if [[ -n ${PHP_PKG} ]] ; then return fi - # detect which PHP version installed + local PHP_PACKAGE_FOUND="" + + # Detect which PHP version we have installed if has_version '=dev-lang/php-4*' ; then - PHP_PACKAGE_FOUND=1 + PHP_PACKAGE_FOUND="1" pkg="`best_version '=dev-lang/php-4*'`" if built_with_use =${pkg} cgi ; then - PHP_VERSION=4 + PHP_VERSION="4" fi fi if has_version '=dev-lang/php-5*' ; then - PHP_PACKAGE_FOUND=1 + PHP_PACKAGE_FOUND="1" pkg="`best_version '=dev-lang/php-5*'`" if built_with_use =${pkg} cgi ; then - PHP_VERSION=5 + PHP_VERSION="5" fi fi @@ -414,63 +432,54 @@ require_php_cgi() die "No PHP CGI installed" fi - # if we get here, then PHP_VERSION tells us which version of PHP we + # If we get here, then PHP_VERSION tells us which version of PHP we # want to use - uses_php${PHP_VERSION} } -# require a PHP built with sqlite support +# Require a PHP built with SQLite support -require_sqlite() -{ +require_sqlite() { has_php - # has our PHP been built with sqlite? - - if built_with_use =${PHP_PKG} sqlite ; then + # Has our PHP been built with SQLite support? + if built_with_use =${PHP_PKG} sqlite || phpconfutils_built_with_use =${PHP_PKG} sqlite ; then return fi - # do we have pecl-sqlite installed for PHP 4? - - if [[ ${PHP_VERSION} == 4 ]] ; then - if has_version dev-php4/pecl-sqlite ; then + # Do we have pecl-sqlite installed for PHP4? + if [[ "${PHP_VERSION}" == "4" ]] ; then + if has_version 'dev-php4/pecl-sqlite' ; then return fi fi - # if we get here, then we don't have any sqlite support for PHP installed - + # If we get here, then we don't have any SQLite support for PHP installed eerror - eerror "No sqlite extension for PHP found." - eerror "Please install an sqlite extension for PHP," + eerror "No SQLite extension for PHP found." + eerror "Please install an SQLite extension for PHP," eerror "this is done best by simply adding the" eerror "'sqlite' USE flag when emerging dev-lang/php." eerror - die "No sqlite extension for PHP found" + die "No SQLite extension for PHP found" } -# require a PHP built with GD support +# Require a PHP built with GD support -require_gd() -{ +require_gd() { has_php - # do we have the internal GD support installed? - - if built_with_use =${PHP_PKG} gd ; then + # Do we have the internal GD support installed? + if built_with_use =${PHP_PKG} gd || phpconfutils_built_with_use =${PHP_PKG} gd ; then return fi - # ok, maybe GD was built using the external support? - - if built_with_use =${PHP_PKG} gd-external ; then + # Ok, maybe GD was built using the external library support? + if built_with_use =${PHP_PKG} gd-external || phpconfutils_built_with_use =${PHP_PKG} gd-external ; then return fi - # if we get here, then we have no GD support - + # If we get here, then we have no GD support eerror eerror "No GD support for PHP found." eerror "Please install the GD support for PHP," @@ -487,12 +496,14 @@ require_gd() # These functions provide miscellaneous checks and functionality. # ======================================================================== -# executes some checks needed when installing a binary PHP extension +# Executes some checks needed when installing a binary PHP extension php_binary_extension() { has_php - # binary extensions do not support the change of PHP + local PUSE_ENABLED="" + + # Binary extensions do not support the change of PHP # API version, so they can't be installed when USE flags # are enabled wich change the PHP API version @@ -503,7 +514,7 @@ php_binary_extension() { eerror "Please reemerge dev-lang/php with the" eerror "'hardenedphp' USE flag turned off." eerror - die "'hardenedphp' USE flag turned on" + PUSE_ENABLED="1" fi if built_with_use =${PHP_PKG} debug ; then @@ -513,34 +524,38 @@ php_binary_extension() { eerror "Please reemerge dev-lang/php with the" eerror "'debug' USE flag turned off." eerror - die "'debug' USE flag turned on" + PUSE_ENABLED="1" + fi + + if [[ -n ${PUSE_ENABLED} ]] ; then + die "'hardenedphp' and/or 'debug' USE flags turned on" fi } -# alternative to dodoc for use in our php eclasses and ebuilds -# stored here because depend.php gets always sourced everywhere -# in the PHP ebuilds and eclasses -# it simply is dodoc with a changed path to the docs -# no support for docinto is given! +# Alternative to dodoc function for use in our PHP eclasses and +# ebuilds. +# Stored here because depend.php gets always sourced everywhere +# in the PHP ebuilds and eclasses. +# It simply is dodoc with a changed path to the docs. +# NOTE: no support for docinto is given! -dodoc-php() -{ -if [ $# -lt 1 ] ; then +dodoc-php() { +if [[ $# -lt 1 ]] ; then echo "$0: at least one argument needed" 1>&2 exit 1 fi phpdocdir="${D}/usr/share/doc/${CATEGORY}/${PF}/" -if [ ! -d "${phpdocdir}" ] ; then +if [[ ! -d "${phpdocdir}" ]] ; then install -d "${phpdocdir}" fi -for x in "$@" ; do - if [ -s "${x}" ] ; then +for x in $@ ; do + if [[ -s "${x}" ]] ; then install -m0644 "${x}" "${phpdocdir}" gzip -f -9 "${phpdocdir}/${x##*/}" - elif [ ! -e "${x}" ] ; then + elif [[ ! -e "${x}" ]] ; then echo "dodoc-php: ${x} does not exist" 1>&2 fi done diff --git a/eclass/php-common-r1.eclass b/eclass/php-common-r1.eclass index 2ebad67054bf..e6101211100c 100644 --- a/eclass/php-common-r1.eclass +++ b/eclass/php-common-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/php-common-r1.eclass,v 1.5 2006/01/04 09:22:48 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php-common-r1.eclass,v 1.6 2006/03/24 23:05:49 chtekk Exp $ # ######################################################################## # @@ -13,8 +13,7 @@ # Based on robbat2's work on the php4 sapi eclass # Based on stuart's work on the php5 sapi eclass # -# Maintainer: -# php-bugs@gentoo.org +# Maintained by the PHP Herd <php-bugs@gentoo.org> # # ######################################################################## @@ -23,15 +22,15 @@ # ######################################################################## php_check_cflags() { - # filter the following from C[XX]FLAGS regardless, as apache won't be - # supporting LFS until 2.2 is released and in the tree. Fixes bug #24373. + # Filter the following from C[XX]FLAGS regardless, as apache won't be + # supporting LFS until 2.2 is released and in the tree. Fixes bug #24373. filter-flags "-D_FILE_OFFSET_BITS=64" filter-flags "-D_FILE_OFFSET_BITS=32" filter-flags "-D_LARGEFILE_SOURCE=1" filter-flags "-D_LARGEFILE_SOURCE" - #fixes bug #14067 - # changed order to run it in reverse for bug #32022 and #12021 + # Fixes bug #14067. + # Changed order to run it in reverse for bug #32022 and #12021. replace-flags "-march=k6-3" "-march=i586" replace-flags "-march=k6-2" "-march=i586" replace-flags "-march=k6" "-march=i586" @@ -42,16 +41,23 @@ php_check_cflags() { # ######################################################################## php_check_imap() { - if ! useq imap ; then + if ! useq "imap" && ! phpconfutils_usecheck "imap" ; then return fi - if useq ssl ; then + if useq "ssl" || phpconfutils_usecheck "ssl" ; then if ! built_with_use virtual/imap-c-client ssl ; then eerror - eerror "IMAP+SSL requested, but your IMAP libraries are built without SSL!" + eerror "IMAP with SSL requested, but your IMAP C-Client libraries are built without SSL!" eerror - die "Please recompile IMAP libraries w/ SSL support enabled" + die "Please recompile the IMAP C-Client libraries with SSL support enabled" + fi + else + if built_with_use virtual/imap-c-client ssl ; then + eerror + eerror "IMAP without SSL requested, but your IMAP C-Client libraries are built with SSL!" + eerror + die "Please recompile the IMAP C-Client libraries with SSL support disabled" fi fi } @@ -64,13 +70,13 @@ php_check_imap() { # ######################################################################## php_check_java() { - if ! useq java-internal ; then - return 1 + if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + return fi JDKHOME="`java-config --jdk-home`" - NOJDKERROR="You need to use java-config to set your JVM to a JDK!" - if [ -z "${JDKHOME}" ] || [ ! -d "${JDKHOME}" ]; then + NOJDKERROR="You need to use the 'java-config' utility to set your JVM to a JDK!" + if [[ -z "${JDKHOME}" ]] || [[ ! -d "${JDKHOME}" ]] ; then eerror "${NOJDKERROR}" die "${NOJDKERROR}" fi @@ -85,10 +91,10 @@ php_check_java() { eerror "To build PHP without Java support, please re-run this emerge" eerror "and place the line:" eerror " USE='-java-internal'" - eerror "in front of your emerge command; e.g." + eerror "in front of your emerge command, for example:" eerror " USE='-java-internal' emerge =dev-lang/php-4*" eerror - eerror "or edit your USE flags in /etc/make.conf" + eerror "or edit your USE flags in /etc/make.conf." die "Kaffe JVM not supported" fi @@ -97,36 +103,36 @@ php_check_java() { case "${JDKVER}" in 1.4.*) ;; 1.5.*) ewarn "Java 1.5 is NOT supported at this time, and might not work." ;; - *) eerror "A Java 1.4 JDK is required for Java support in PHP." ; die ;; + *) eerror "A Java 1.4 JDK is recommended for Java support in PHP." ; die ;; esac } php_install_java() { - if ! useq java-internal ; then - return 1 + if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + return fi - # we put these into /usr/lib so that they cannot conflict with + # We put these into /usr/lib so that they cannot conflict with # other versions of PHP (e.g. PHP 4 & PHP 5) - insinto ${PHPEXTDIR} + insinto "${PHPEXTDIR}" einfo "Installing JAR for PHP" - doins ext/java/php_java.jar + doins "ext/java/php_java.jar" einfo "Installing Java test page" - newins ext/java/except.php java-test.php + newins "ext/java/except.php" "java-test.php" einfo "Installing Java extension for PHP" - doins modules/java.so + doins "modules/java.so" - dosym ${PHPEXTDIR}/java.so ${PHPEXTDIR}/libphp_java.so + dosym "${PHPEXTDIR}/java.so" "${PHPEXTDIR}/libphp_java.so" } php_install_java_inifile() { - if ! useq java-internal ; then - return 1 + if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then + return fi - JAVA_LIBRARY="`grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;'| sort | uniq `" + JAVA_LIBRARY="`grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;' | sort -u`" echo "extension = java.so" >> "${D}/${PHP_EXT_INI_DIR}/java.ini" echo "java.library = ${JAVA_LIBRARY}" >> "${D}/${PHP_EXT_INI_DIR}/java.ini" @@ -141,7 +147,15 @@ php_install_java_inifile() { # ######################################################################## php_check_mta() { - [ -x "${ROOT}/usr/sbin/sendmail" ] || die "You need a virtual/mta that provides /usr/sbin/sendmail!" + if ! [[ -x "${ROOT}/usr/sbin/sendmail" ]] ; then + ewarn + ewarn "You need a virtual/mta that provides a sendmail compatible binary!" + ewarn "All major MTAs provide this, and it's usually some symlink created" + ewarn "as '${ROOT}/usr/sbin/sendmail*'. You should also be able to use other" + ewarn "MTAs directly, but you'll have to edit the sendmail_path directive" + ewarn "in your php.ini for this to work." + ewarn + fi } # ######################################################################## @@ -149,33 +163,43 @@ php_check_mta() { # ######################################################################## php_check_oracle_all() { - if useq oci8 && [ -z "${ORACLE_HOME}" ]; then + if useq "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then eerror - eerror "You must have the ORACLE_HOME variable in your environment!" + eerror "You must have the ORACLE_HOME variable set in your environment to" + eerror "compile the Oracle extension." eerror die "Oracle configuration incorrect; user error" fi - if useq oci8 || useq oracle7 ; then + if useq "oci8" || useq "oracle7" ; then if has_version 'dev-db/oracle-instantclient-basic' ; then + ewarn ewarn "Please ensure you have a full install of the Oracle client." - ewarn "dev-db/oracle-instantclient* is NOT sufficient." + ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient." + ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you" + ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client." + ewarn fi fi } php_check_oracle_8() { - if useq oci8 && [ -z "${ORACLE_HOME}" ]; then + if useq "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then eerror - eerror "You must have the ORACLE_HOME variable in your environment!" + eerror "You must have the ORACLE_HOME variable set in your environment to" + eerror "compile the Oracle extension." eerror die "Oracle configuration incorrect; user error" fi - if useq oci8 ; then + if useq "oci8" ; then if has_version 'dev-db/oracle-instantclient-basic' ; then + ewarn ewarn "Please ensure you have a full install of the Oracle client." - ewarn "dev-db/oracle-instantclient* is NOT sufficient." + ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient." + ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you" + ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client." + ewarn fi fi } diff --git a/eclass/php4_4-sapi.eclass b/eclass/php4_4-sapi.eclass index 10042bf57bad..711f06fcd030 100644 --- a/eclass/php4_4-sapi.eclass +++ b/eclass/php4_4-sapi.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 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.14 2006/03/18 18:38:11 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php4_4-sapi.eclass,v 1.15 2006/03/24 23:05:49 chtekk Exp $ # # ######################################################################## # @@ -20,9 +20,9 @@ # ======================================================================== CONFUTILS_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" -EBUILD_SUPPORTS_SHAREDEXT=1 +EBUILD_SUPPORTS_SHAREDEXT="1" -inherit flag-o-matic eutils confutils libtool php-common-r1 +inherit flag-o-matic eutils phpconfutils libtool php-common-r1 # set MY_PHP_P in the ebuild @@ -39,32 +39,41 @@ if [[ "${PHP_PACKAGE}" == 1 ]] ; then S="${WORKDIR}/${MY_PHP_P}" fi -IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl db2 dba dbase dbmaker dbx debug doc empress empress-bcs esoob exif expat fastbuild 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 threads tiff tokenizer truetype wddx xml xmlrpc xpm xsl yaz zip zlib" +IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl db2 dbase dbmaker dbx debug doc empress empress-bcs esoob exif expat fastbuild 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 threads tokenizer truetype wddx xml xmlrpc xpm xsl yaz zip zlib" # these USE flags should have the correct dependencies DEPEND="${DEPEND} !dev-php/php !dev-php/php-cgi !dev-php/mod_php + 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 ) + 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 ) imap? ( virtual/imap-c-client ) - iodbc? ( dev-db/libiodbc ) + iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) java-internal? ( =virtual/jdk-1.4* dev-java/java-config !dev-php4/php-java-bridge ) kerberos? ( virtual/krb5 ) ldap? ( >=net-nds/openldap-1.2.11 ) libedit? ( dev-libs/libedit ) mcal? ( dev-libs/libmcal !=dev-libs/libmcal-0.7-r2 ) - mcve? ( net-libs/libmonetra ) + mcve? ( net-libs/libmonetra >=dev-libs/openssl-0.9.7 ) mhash? ( app-crypt/mhash ) ming? ( media-libs/ming ) mssql? ( dev-db/freetds ) @@ -76,16 +85,17 @@ DEPEND="${DEPEND} postgres? ( >=dev-db/libpq-7.1 ) readline? ( sys-libs/readline ) recode? ( app-text/recode ) + sapdb? ( >=dev-db/unixODBC-1.8.13 ) sharedmem? ( dev-libs/mm ) snmp? ( >=net-analyzer/net-snmp-5.2 ) + solid? ( >=dev-db/unixODBC-1.8.13 ) spell? ( >=app-text/aspell-0.50 ) ssl? ( >=dev-libs/openssl-0.9.7 ) sybase? ( dev-db/freetds ) - tiff? ( media-libs/tiff ) - truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 ) - xpm? ( || ( x11-libs/libXpm virtual/x11 ) ) - xml? ( dev-libs/libxml2 xsl? ( dev-libs/libxslt ) ) + truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 !gd? ( !gd-external? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) ) ) + xml? ( dev-libs/libxml2 sys-libs/zlib xsl? ( dev-libs/libxslt ) ) xmlrpc? ( dev-libs/expat ) + xpm? ( || ( x11-libs/libXpm virtual/x11 ) >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) xsl? ( app-text/sablotron dev-libs/expat ) zlib? ( sys-libs/zlib ) virtual/mta" @@ -133,87 +143,54 @@ EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst # INTERNAL FUNCTIONS # ======================================================================== -php4_4-sapi_check_awkward_uses() { - # ------------------------------------ - # Rules for things unexpectedly broken - # go below here - # - # These rules override the "normal" - # rules listed later on - # ------------------------------------ - - # No special rules at the moment - - # ------------------------------------ - # Normal rules go below here - # ------------------------------------ - - # A variety of extensions need DBA - confutils_use_depend_all "berkdb" "dba" - confutils_use_depend_all "cdb" "dba" - confutils_use_depend_all "flatfile" "dba" - confutils_use_depend_all "gdbm" "dba" - confutils_use_depend_all "inifile" "dba" - - # DBX checks - confutils_use_depend_any "dbx" "frontbase" "mssql" "odbc" "postgres" "sybase-ct" "oci8" "oci8-instant-client" - - # DOM XML support - confutils_use_depend_all "xml" "zlib" - - # EXIF only gets built if we support a file format that uses it - confutils_use_depend_any "exif" "gd" "gd-external" "tiff" - - # support for the GD graphics library - confutils_use_conflict "gd" "gd-external" - confutils_use_depend_any "truetype" "gd" "gd-external" - confutils_use_depend_any "cjk" "gd" "gd-external" - confutils_use_depend_all "tiff" "gd" - confutils_use_depend_all "xpm" "gd" - confutils_use_depend_all "gd" "zlib" +php4_4-sapi_check_use_flags() { + PHPCONFUTILS_AUTO_USE="" + + # 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 "xml" "zlib" + phpconfutils_use_depend_all "java-external" "session" + 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" + + # Direct USE conflicts + phpconfutils_use_conflict "gd" "gd-external" + phpconfutils_use_conflict "java-external" "java-internal" + phpconfutils_use_conflict "oci8" "oci8-instant-client" + phpconfutils_use_conflict "readline" "libedit" + phpconfutils_use_conflict "recode" "mysql" "imap" "yaz" + phpconfutils_use_conflict "sharedmem" "threads" # IMAP support php_check_imap - # Java support - php_check_java - - # Java-external support - confutils_use_conflict "java-external" "java-internal" - confutils_use_depend_all "java-external" "session" - # Mail support php_check_mta + # Java support + php_check_java + # Oracle support - confutils_use_conflict "oci8" "oci8-instant-client" php_check_oracle_all - # MCVE needs OpenSSL - confutils_use_depend_all "mcve" "ssl" + phpconfutils_warn_about_external_deps - # ODBC support - confutils_use_depend_all "adabas" "odbc" - confutils_use_depend_all "birdstep" "odbc" - confutils_use_depend_all "dbmaker" "odbc" - confutils_use_depend_all "empress" "odbc" - confutils_use_depend_all "empress-bcs" "odbc" "empress" - confutils_use_depend_all "esoob" "odbc" - confutils_use_depend_all "db2" "odbc" - confutils_use_depend_all "iodbc" "odbc" - confutils_use_depend_all "sapdb" "odbc" - confutils_use_depend_all "solid" "odbc" - - # Readline and libedit do the same thing; you can't have both - confutils_use_conflict "readline" "libedit" - - # Recode is not liked - confutils_use_conflict "recode" "mysql" "imap" "yaz" - - # the MM extension isn't thread-safe - confutils_use_conflict "sharedmem" "threads" - - confutils_warn_about_missing_deps + export PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE}" } php4_4-sapi_set_php_ini_dir() { @@ -261,7 +238,7 @@ php4_4-sapi_install_ini() { php4_4-sapi_pkg_setup() { # let's do all the USE flag testing before we do anything else # this way saves a lot of time - php4_4-sapi_check_awkward_uses + php4_4-sapi_check_use_flags } php4_4-sapi_src_unpack() { @@ -359,116 +336,113 @@ php4_4-sapi_src_compile() { php4_4-sapi_set_php_ini_dir cd "${S}" - confutils_init + 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? - enable_extension_enable "bcmath" "bcmath" 1 - enable_extension_with "bz2" "bzip2" 1 - enable_extension_enable "calendar" "calendar" 1 - enable_extension_disable "ctype" "ctype" 0 - enable_extension_with "curl" "curl" 1 - enable_extension_enable "dbase" "dbase" 1 - enable_extension_with "dom" "xml" 0 - enable_extension_enable "exif" "exif" 1 - enable_extension_with "fbsql" "frontbase" 1 - enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" - enable_extension_enable "filepro" "filepro" 1 - enable_extension_enable "ftp" "ftp" 1 - enable_extension_with "gettext" "nls" 1 - enable_extension_with "gmp" "gmp" 1 - enable_extension_with "hwapi" "hyperwave-api" 1 - enable_extension_with "iconv" "iconv" 1 - enable_extension_with "informix" "informix" 1 - enable_extension_disable "ipv6" "ipv6" 0 - # ircg extension not supported on Gentoo at this time - enable_extension_with "kerberos" "kerberos" 0 "/usr" - enable_extension_enable "mbstring" "nls" 1 - enable_extension_with "mcal" "mcal" 1 "/usr" - enable_extension_with "mcrypt" "crypt" 1 - enable_extension_with "mcve" "mcve" 1 - enable_extension_enable "memory-limit" "memlimit" 0 - enable_extension_with "mhash" "mhash" 1 - enable_extension_with "ming" "ming" 1 - enable_extension_with "mnogosearch" "mnogosearch" 1 - enable_extension_with "msql" "msql" 1 - enable_extension_with "mssql" "mssql" 1 - enable_extension_with "ncurses" "ncurses" 1 - enable_extension_with "oci8" "oci8" 1 - enable_extension_with "oci8-instant-client" "oci8-instant-client" 1 - enable_extension_with "oracle" "oracle7" 1 - enable_extension_with "openssl" "ssl" 0 - enable_extension_with "openssl-dir" "ssl" 0 "/usr" - enable_extension_disable "overload" "overload" 0 - enable_extension_with "ovrimos" "ovrimos" 1 - enable_extension_enable "pcntl" "pcntl" 1 - enable_extension_without "pcre-regex" "pcre" 0 - enable_extension_with "pfpro" "pfpro" 1 - enable_extension_with "pgsql" "postgres" 1 - enable_extension_disable "posix" "posix" 1 - enable_extension_with "pspell" "spell" 1 - enable_extension_with "recode" "recode" 1 - enable_extension_enable "shmop" "sharedmem" 0 - enable_extension_with "snmp" "snmp" 1 - enable_extension_enable "sockets" "sockets" 1 - enable_extension_with "sybase" "sybase" 1 - enable_extension_with "sybase-ct" "sybase-ct" 1 - enable_extension_enable "sysvmsg" "sysvipc" 1 - enable_extension_enable "sysvsem" "sysvipc" 1 - enable_extension_enable "sysvshm" "sysvipc" 1 - enable_extension_disable "tokenizer" "tokenizer" 1 - enable_extension_enable "wddx" "wddx" 1 - enable_extension_disable "xml" "expat" 0 - enable_extension_with "xmlrpc" "xmlrpc" 1 - enable_extension_with "zlib" "zlib" 1 - enable_extension_enable "debug" "debug" 0 + # 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_enable "dbase" "dbase" 1 + phpconfutils_extension_with "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_enable "filepro" "filepro" 1 + phpconfutils_extension_enable "ftp" "ftp" 1 + phpconfutils_extension_with "gettext" "nls" 1 + phpconfutils_extension_with "gmp" "gmp" 1 + phpconfutils_extension_with "hwapi" "hyperwave-api" 1 + phpconfutils_extension_with "iconv" "iconv" 1 + phpconfutils_extension_with "informix" "informix" 1 + phpconfutils_extension_disable "ipv6" "ipv6" 0 + phpconfutils_extension_with "kerberos" "kerberos" 0 "/usr" + phpconfutils_extension_enable "mbstring" "nls" 1 + phpconfutils_extension_with "mcal" "mcal" 1 "/usr" + phpconfutils_extension_with "mcrypt" "crypt" 1 + phpconfutils_extension_with "mcve" "mcve" 1 + phpconfutils_extension_enable "memory-limit" "memlimit" 0 + phpconfutils_extension_with "mhash" "mhash" 1 + phpconfutils_extension_with "ming" "ming" 1 + phpconfutils_extension_with "mnogosearch" "mnogosearch" 1 + phpconfutils_extension_with "msql" "msql" 1 + phpconfutils_extension_with "mssql" "mssql" 1 + phpconfutils_extension_with "ncurses" "ncurses" 1 + phpconfutils_extension_with "oci8" "oci8" 1 + phpconfutils_extension_with "oci8-instant-client" "oci8-instant-client" 1 + phpconfutils_extension_with "oracle" "oracle7" 1 + 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 + phpconfutils_extension_with "pgsql" "postgres" 1 + phpconfutils_extension_disable "posix" "posix" 1 + phpconfutils_extension_with "pspell" "spell" 1 + phpconfutils_extension_with "recode" "recode" 1 + phpconfutils_extension_enable "shmop" "sharedmem" 0 + phpconfutils_extension_with "snmp" "snmp" 1 + phpconfutils_extension_enable "sockets" "sockets" 1 + 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_disable "tokenizer" "tokenizer" 1 + phpconfutils_extension_enable "wddx" "wddx" 1 + phpconfutils_extension_disable "xml" "expat" 0 + phpconfutils_extension_with "xmlrpc" "xmlrpc" 1 + phpconfutils_extension_with "zlib" "zlib" 1 + phpconfutils_extension_enable "debug" "debug" 0 # DBA support - enable_extension_enable "dba" "dba" 1 - - if useq dba ; then - enable_extension_with "cdb" "cdb" 1 - enable_extension_with "db4" "berkdb" 1 - enable_extension_with "flatfile" "flatfile" 1 - enable_extension_with "gdbm" "gdbm" 1 - enable_extension_with "inifile" "inifile" 1 + if useq cdb || useq berkdb || useq flatfile || useq gdbm || useq inifile ; then + my_conf="${my_conf} --enable-dba${shared}" fi + # DBA drivers support + phpconfutils_extension_with "cdb" "cdb" 1 + phpconfutils_extension_with "db4" "berkdb" 1 + phpconfutils_extension_with "flatfile" "flatfile" 1 + phpconfutils_extension_with "gdbm" "gdbm" 1 + phpconfutils_extension_with "inifile" "inifile" 1 + # DBX support - if useq dbx ; then - enable_extension_enable "dbx" "dbx" 1 - fi + phpconfutils_extension_enable "dbx" "dbx" 1 # Support for the GD graphics library - if useq gd-external ; then - enable_extension_with "freetype-dir" "truetype" 0 "/usr" - enable_extension_with "t1lib" "truetype" 0 "/usr" - enable_extension_enable "gd-jis-conv" "cjk" 0 - enable_extension_enable "gd-native-ttf" "truetype" 0 - enable_extension_with "gd" "gd-external" 1 "/usr" + if useq 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 - enable_extension_with "freetype-dir" "truetype" 0 "/usr" - enable_extension_with "t1lib" "truetype" 0 "/usr" - enable_extension_enable "gd-jis-conv" "cjk" 0 - enable_extension_enable "gd-native-ttf" "truetype" 0 - enable_extension_with "jpeg-dir" "gd" 0 "/usr" - enable_extension_with "png-dir" "gd" 0 "/usr" - enable_extension_with "tiff-dir" "tiff" 0 "/usr" - enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6" + 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 - enable_extension_with "gd" "gd" 0 + phpconfutils_extension_with "gd" "gd" 0 fi # Java support - if useq java-internal ; then - enable_extension_with "java" "java-internal" 0 "`java-config --jdk-home`" + if useq java-internal || phpconfutils_usecheck java-internal ; then + phpconfutils_extension_with "java" "java-internal" 0 "`java-config --jdk-home`" fi # IMAP support - if useq imap ; then - enable_extension_with "imap" "imap" 1 - enable_extension_with "imap-ssl" "ssl" 0 + if useq imap || phpconfutils_usecheck imap ; then + phpconfutils_extension_with "imap" "imap" 1 + phpconfutils_extension_with "imap-ssl" "ssl" 0 fi # Interbase support @@ -477,57 +451,56 @@ php4_4-sapi_src_compile() { fi # LDAP support - if useq ldap ; then - enable_extension_with "ldap" "ldap" 1 + if useq 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, + # In PHP4, MySQL is enabled by default, so if no 'mysql' USE flag is set, # we must turn it off. - if ! useq mysql ; then - enable_extension_without "mysql" "mysql" 1 "/usr" - fi if useq mysql ; then - enable_extension_with "mysql" "mysql" 1 "/usr" - enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + phpconfutils_extension_with "mysql" "mysql" 1 "/usr" + phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + else + phpconfutils_extension_without "mysql" "mysql" 1 "/usr" fi # ODBC support - if useq odbc ; then - enable_extension_with "unixODBC" "odbc" 1 "/usr" - - enable_extension_with "adabas" "adabas" 1 - enable_extension_with "birdstep" "birdstep" 1 - enable_extension_with "dbmaker" "dbmaker" 1 - enable_extension_with "empress" "empress" 1 - if useq empress ; then - enable_extension_with "empress-bcs" "empress-bcs" 0 + if useq 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 + phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 fi - enable_extension_with "esoob" "esoob" 1 - enable_extension_with "ibm-db2" "db2" 1 - enable_extension_with "iodbc" "iodbc" 1 "/usr" - enable_extension_with "sapdb" "sapdb" 1 - enable_extension_with "solid" "solid" 1 + 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 # readline/libedit support - # you can use readline or libedit, but you can't use both - enable_extension_with "readline" "readline" 0 - enable_extension_with "libedit" "libedit" 1 + # You can use readline or libedit, but you can't use both + phpconfutils_extension_with "readline" "readline" 0 + phpconfutils_extension_with "libedit" "libedit" 0 # Sablotron/XSLT support - enable_extension_enable "xslt" "xsl" 1 - enable_extension_with "xslt-sablot" "xsl" 1 - if useq xml ; then - enable_extension_with "dom-xslt" "xsl" 0 "/usr" - enable_extension_with "dom-exslt" "xsl" 0 "/usr" + phpconfutils_extension_enable "xslt" "xsl" 1 + phpconfutils_extension_with "xslt-sablot" "xsl" 1 + if useq 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 ; then - enable_extension_disable "session" "session" 1 + if ! useq session && ! phpconfutils_usecheck session ; then + phpconfutils_extension_disable "session" "session" 1 else - enable_extension_with "mm" "sharedmem" 0 + phpconfutils_extension_with "mm" "sharedmem" 0 fi # Fix ELF-related problems @@ -584,6 +557,9 @@ php4_4-sapi_src_install() { # Java module and support needs to be installed php_install_java + # Generate the USE file for PHP + phpconfutils_generate_usefile + # Create the directory where we'll put php4-only php scripts keepdir /usr/share/php4 } diff --git a/eclass/php5_0-sapi.eclass b/eclass/php5_0-sapi.eclass index 4c919563c65d..c1e98490ef41 100644 --- a/eclass/php5_0-sapi.eclass +++ b/eclass/php5_0-sapi.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 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.16 2006/03/18 18:38:11 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_0-sapi.eclass,v 1.17 2006/03/24 23:05:49 chtekk Exp $ # # ######################################################################## # @@ -20,9 +20,9 @@ # ======================================================================== CONFUTILS_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" -EBUILD_SUPPORTS_SHAREDEXT=1 +EBUILD_SUPPORTS_SHAREDEXT="1" -inherit flag-o-matic eutils confutils libtool php-common-r1 +inherit flag-o-matic eutils phpconfutils libtool php-common-r1 # set MY_PHP_P in the ebuild @@ -39,29 +39,39 @@ if [[ "${PHP_PACKAGE}" == 1 ]] ; then S="${WORKDIR}/${MY_PHP_P}" fi -IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dba 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 threads tidy tiff tokenizer truetype wddx xml xmlrpc xpm xsl yaz zip zlib" +IUSE="${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 threads tidy tokenizer truetype wddx xml xmlrpc xpm xsl yaz zip zlib" # these USE flags should have the correct dependencies DEPEND="${DEPEND} !dev-php/php !dev-php/php-cgi !dev-php/mod_php + 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 ) + 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 ) imap? ( virtual/imap-c-client ) - iodbc? ( dev-db/libiodbc ) + iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) kerberos? ( virtual/krb5 ) ldap? ( >=net-nds/openldap-1.2.11 ) libedit? ( dev-libs/libedit ) + mcve? ( >=dev-libs/openssl-0.9.7 ) mhash? ( app-crypt/mhash ) ming? ( media-libs/ming ) mssql? ( dev-db/freetds ) @@ -75,21 +85,22 @@ DEPEND="${DEPEND} qdbm? ( dev-db/qdbm ) readline? ( sys-libs/readline ) recode? ( app-text/recode ) - sasl? ( dev-libs/cyrus-sasl ) + 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 ) soap? ( >=dev-libs/libxml2-2.6.8 ) + solid? ( >=dev-db/unixODBC-1.8.13 ) spell? ( >=app-text/aspell-0.50 ) ssl? ( >=dev-libs/openssl-0.9.7 ) sybase? ( dev-db/freetds ) tidy? ( app-text/htmltidy ) - tiff? ( media-libs/tiff ) - truetype? ( =media-libs/freetype-2* >=media-libs/t1lib-5.0.0 ) + 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 ) - xpm? ( || ( x11-libs/libXpm virtual/x11 ) ) + 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 ) zlib? ( sys-libs/zlib ) virtual/mta" @@ -135,91 +146,56 @@ EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst # INTERNAL FUNCTIONS # ======================================================================== -php5_0-sapi_check_awkward_uses() { - # ------------------------------------ - # Rules for things unexpectedly broken - # go below here - # - # These rules override the "normal" - # rules listed later on - # ------------------------------------ - - # No special rules at the moment - - # ------------------------------------ - # Normal rules go below here - # ------------------------------------ - - # A variety of extensions need DBA - confutils_use_depend_all "berkdb" "dba" - confutils_use_depend_all "cdb" "dba" - confutils_use_depend_all "flatfile" "dba" - confutils_use_depend_all "gdbm" "dba" - confutils_use_depend_all "inifile" "dba" - confutils_use_depend_all "qdbm" "dba" - - # EXIF only gets built if we support a file format that uses it - confutils_use_depend_any "exif" "gd" "gd-external" "tiff" - - # support for the GD graphics library - confutils_use_conflict "gd" "gd-external" - confutils_use_depend_any "truetype" "gd" "gd-external" - confutils_use_depend_any "cjk" "gd" "gd-external" - confutils_use_depend_all "tiff" "gd" - confutils_use_depend_all "xpm" "gd" - confutils_use_depend_all "gd" "zlib" - - # XML related extensions - confutils_use_depend_all "soap" "xml" - confutils_use_depend_all "simplexml" "xml" - confutils_use_depend_all "xmlrpc" "xml" - confutils_use_depend_all "xsl" "xml" - confutils_use_depend_all "wddx" "xml" +php5_0-sapi_check_use_flags() { + PHPCONFUTILS_AUTO_USE="" + + # 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 "xsl" "xml" + 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" + + # Direct USE conflicts + phpconfutils_use_conflict "gd" "gd-external" + phpconfutils_use_conflict "oci8" "oci8-instant-client" + 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 - # Java-external support - confutils_use_depend_all "java-external" "session" - # Mail support php_check_mta # Oracle support - confutils_use_conflict "oci8" "oci8-instant-client" php_check_oracle_all - # LDAP-sasl support - confutils_use_depend_all "sasl" "ldap" - - # MCVE needs OpenSSL - confutils_use_depend_all "mcve" "ssl" + phpconfutils_warn_about_external_deps - # ODBC support - confutils_use_depend_all "adabas" "odbc" - confutils_use_depend_all "birdstep" "odbc" - confutils_use_depend_all "dbmaker" "odbc" - confutils_use_depend_all "empress" "odbc" - confutils_use_depend_all "empress-bcs" "odbc" "empress" - confutils_use_depend_all "esoob" "odbc" - confutils_use_depend_all "db2" "odbc" - confutils_use_depend_all "iodbc" "odbc" - confutils_use_depend_all "sapdb" "odbc" - confutils_use_depend_all "solid" "odbc" - - # QDBM doesn't play nicely with GDBM - confutils_use_conflict "qdbm" "gdbm" - - # Readline and libedit do the same thing; you can't have both - confutils_use_conflict "readline" "libedit" - - # Recode is not liked - confutils_use_conflict "recode" "mysql" "imap" "yaz" - - # the MM extension isn't thread-safe - confutils_use_conflict "sharedmem" "threads" - - confutils_warn_about_missing_deps + export PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE}" } php5_0-sapi_set_php_ini_dir() { @@ -264,7 +240,7 @@ php5_0-sapi_install_ini() { php5_0-sapi_pkg_setup() { # let's do all the USE flag testing before we do anything else # this way saves a lot of time - php5_0-sapi_check_awkward_uses + php5_0-sapi_check_use_flags } php5_0-sapi_src_unpack() { @@ -353,111 +329,110 @@ php5_0-sapi_src_compile() { php5_0-sapi_set_php_ini_dir cd "${S}" - confutils_init + 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? - enable_extension_enable "bcmath" "bcmath" 1 - enable_extension_with "bz2" "bzip2" 1 - enable_extension_enable "calendar" "calendar" 1 - enable_extension_disable "ctype" "ctype" 0 - enable_extension_with "curl" "curl" 1 - enable_extension_with "curlwrappers" "curlwrappers" 1 - enable_extension_enable "dbase" "dbase" 1 - enable_extension_disable "dom" "xml" 0 - enable_extension_enable "exif" "exif" 1 - enable_extension_with "fbsql" "frontbase" 1 - enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" - enable_extension_enable "filepro" "filepro" 1 - enable_extension_enable "ftp" "ftp" 1 - enable_extension_with "gettext" "nls" 1 - enable_extension_with "gmp" "gmp" 1 - enable_extension_with "hwapi" "hyperwave-api" 1 - enable_extension_without "iconv" "iconv" 0 - enable_extension_with "informix" "informix" 1 - enable_extension_disable "ipv6" "ipv6" 0 - # ircg extension not supported on Gentoo at this time - enable_extension_with "kerberos" "kerberos" 0 "/usr" - enable_extension_disable "libxml" "xml" 0 - enable_extension_enable "mbstring" "nls" 1 - enable_extension_with "mcrypt" "crypt" 1 - enable_extension_enable "memory-limit" "memlimit" 0 - enable_extension_with "mhash" "mhash" 1 - enable_extension_with "ming" "ming" 1 - enable_extension_with "mnogosearch" "mnogosearch" 1 - enable_extension_with "msql" "msql" 1 - enable_extension_with "mssql" "mssql" 1 - enable_extension_with "ncurses" "ncurses" 1 - enable_extension_with "oci8" "oci8" 1 - enable_extension_with "oci8-instant-client" "oci8-instant-client" 1 - enable_extension_with "oracle" "oracle7" 1 - enable_extension_with "openssl" "ssl" 0 - enable_extension_with "openssl-dir" "ssl" 0 "/usr" - enable_extension_with "ovrimos" "ovrimos" 1 - enable_extension_enable "pcntl" "pcntl" 1 - enable_extension_without "pcre-regex" "pcre" 0 - enable_extension_with "pfpro" "pfpro" 1 - enable_extension_with "pgsql" "postgres" 1 - enable_extension_disable "posix" "posix" 1 - enable_extension_with "pspell" "spell" 1 - enable_extension_with "recode" "recode" 1 - enable_extension_disable "simplexml" "simplexml" 1 - enable_extension_enable "shmop" "sharedmem" 0 - enable_extension_with "snmp" "snmp" 1 - enable_extension_enable "soap" "soap" 1 - enable_extension_enable "sockets" "sockets" 1 - enable_extension_disable "spl" "spl" 1 - enable_extension_with "sybase" "sybase" 1 - enable_extension_with "sybase-ct" "sybase-ct" 1 - enable_extension_enable "sysvmsg" "sysvipc" 1 - enable_extension_enable "sysvsem" "sysvipc" 1 - enable_extension_enable "sysvshm" "sysvipc" 1 - enable_extension_with "tidy" "tidy" 1 - enable_extension_disable "tokenizer" "tokenizer" 1 - enable_extension_enable "wddx" "wddx" 1 - enable_extension_disable "xml" "xml" 0 - enable_extension_with "xmlrpc" "xmlrpc" 1 - enable_extension_with "xsl" "xsl" 1 - enable_extension_with "zlib" "zlib" 1 - enable_extension_enable "debug" "debug" 0 + # 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" 1 + 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_enable "filepro" "filepro" 1 + phpconfutils_extension_enable "ftp" "ftp" 1 + phpconfutils_extension_with "gettext" "nls" 1 + phpconfutils_extension_with "gmp" "gmp" 1 + phpconfutils_extension_with "hwapi" "hyperwave-api" 1 + phpconfutils_extension_without "iconv" "iconv" 0 + phpconfutils_extension_with "informix" "informix" 1 + phpconfutils_extension_disable "ipv6" "ipv6" 0 + phpconfutils_extension_with "kerberos" "kerberos" 0 "/usr" + phpconfutils_extension_disable "libxml" "xml" 0 + phpconfutils_extension_enable "mbstring" "nls" 1 + phpconfutils_extension_with "mcrypt" "crypt" 1 + phpconfutils_extension_enable "memory-limit" "memlimit" 0 + phpconfutils_extension_with "mhash" "mhash" 1 + phpconfutils_extension_with "ming" "ming" 1 + phpconfutils_extension_with "mnogosearch" "mnogosearch" 1 + phpconfutils_extension_with "msql" "msql" 1 + phpconfutils_extension_with "mssql" "mssql" 1 + phpconfutils_extension_with "ncurses" "ncurses" 1 + phpconfutils_extension_with "oci8" "oci8" 1 + phpconfutils_extension_with "oci8-instant-client" "oci8-instant-client" 1 + phpconfutils_extension_with "oracle" "oracle7" 1 + phpconfutils_extension_with "openssl" "ssl" 0 + phpconfutils_extension_with "openssl-dir" "ssl" 0 "/usr" + 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 + phpconfutils_extension_with "pgsql" "postgres" 1 + phpconfutils_extension_disable "posix" "posix" 1 + phpconfutils_extension_with "pspell" "spell" 1 + phpconfutils_extension_with "recode" "recode" 1 + phpconfutils_extension_disable "simplexml" "simplexml" 1 + 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" 1 + 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" 1 + phpconfutils_extension_enable "wddx" "wddx" 1 + phpconfutils_extension_disable "xml" "xml" 0 + phpconfutils_extension_with "xmlrpc" "xmlrpc" 1 + phpconfutils_extension_with "xsl" "xsl" 1 + phpconfutils_extension_with "zlib" "zlib" 1 + phpconfutils_extension_enable "debug" "debug" 0 # DBA support - enable_extension_enable "dba" "dba" 1 - - if useq dba ; then - enable_extension_with "cdb" "cdb" 1 - enable_extension_with "db4" "berkdb" 1 - enable_extension_with "flatfile" "flatfile" 1 - enable_extension_with "gdbm" "gdbm" 1 - enable_extension_with "inifile" "inifile" 1 - enable_extension_with "qdbm" "qdbm" 1 + if useq cdb || useq berkdb || useq flatfile || useq gdbm || useq inifile || useq qdbm ; then + my_conf="${my_conf} --enable-dba${shared}" fi + # DBA drivers support + phpconfutils_extension_with "cdb" "cdb" 1 + phpconfutils_extension_with "db4" "berkdb" 1 + phpconfutils_extension_with "flatfile" "flatfile" 1 + phpconfutils_extension_with "gdbm" "gdbm" 1 + phpconfutils_extension_with "inifile" "inifile" 1 + phpconfutils_extension_with "qdbm" "qdbm" 1 + # Support for the GD graphics library - if useq gd-external ; then - enable_extension_with "freetype-dir" "truetype" 0 "/usr" - enable_extension_with "t1lib" "truetype" 0 "/usr" - enable_extension_enable "gd-jis-conv" "cjk" 0 - enable_extension_enable "gd-native-ttf" "truetype" 0 - enable_extension_with "gd" "gd-external" 1 "/usr" + if useq 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 - enable_extension_with "freetype-dir" "truetype" 0 "/usr" - enable_extension_with "t1lib" "truetype" 0 "/usr" - enable_extension_enable "gd-jis-conv" "cjk" 0 - enable_extension_enable "gd-native-ttf" "truetype" 0 - enable_extension_with "jpeg-dir" "gd" 0 "/usr" - enable_extension_with "png-dir" "gd" 0 "/usr" - enable_extension_with "tiff-dir" "tiff" 0 "/usr" - enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6" + 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 - enable_extension_with "gd" "gd" 0 + phpconfutils_extension_with "gd" "gd" 0 fi # IMAP support - if useq imap ; then - enable_extension_with "imap" "imap" 1 - enable_extension_with "imap-ssl" "ssl" 0 + if useq imap || phpconfutils_usecheck imap ; then + phpconfutils_extension_with "imap" "imap" 1 + phpconfutils_extension_with "imap-ssl" "ssl" 0 fi # Interbase support @@ -466,55 +441,55 @@ php5_0-sapi_src_compile() { fi # LDAP support - if useq ldap ; then - enable_extension_with "ldap" "ldap" 1 - enable_extension_with "ldap-sasl" "sasl" 0 + if useq ldap || phpconfutils_usecheck ldap ; then + phpconfutils_extension_with "ldap" "ldap" 1 + phpconfutils_extension_with "ldap-sasl" "sasl" 0 fi # MySQL support if useq mysql ; then - enable_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" - enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + phpconfutils_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" + phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" fi # MySQLi support - enable_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" + phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" # ODBC support - if useq odbc ; then - enable_extension_with "unixODBC" "odbc" 1 "/usr" - - enable_extension_with "adabas" "adabas" 1 - enable_extension_with "birdstep" "birdstep" 1 - enable_extension_with "dbmaker" "dbmaker" 1 - enable_extension_with "empress" "empress" 1 - if useq empress ; then - enable_extension_with "empress-bcs" "empress-bcs" 0 + if useq 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 + phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 fi - enable_extension_with "esoob" "esoob" 1 - enable_extension_with "ibm-db2" "db2" 1 - enable_extension_with "iodbc" "iodbc" 1 "/usr" - enable_extension_with "sapdb" "sapdb" 1 - enable_extension_with "solid" "solid" 1 + 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 # readline/libedit support - # you can use readline or libedit, but you can't use both - enable_extension_with "readline" "readline" 0 - enable_extension_with "libedit" "libedit" 1 + # 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 ! useq session ; then - enable_extension_disable "session" "session" 1 + if ! useq session && ! phpconfutils_usecheck session ; then + phpconfutils_extension_disable "session" "session" 1 else - enable_extension_with "mm" "sharedmem" 0 + phpconfutils_extension_with "mm" "sharedmem" 0 fi # Sqlite support - if ! useq sqlite ; then - enable_extension_without "sqlite" "sqlite" 0 + if ! useq sqlite && ! phpconfutils_usecheck sqlite ; then + phpconfutils_extension_without "sqlite" "sqlite" 0 else - enable_extension_enable "sqlite-utf8" "nls" 0 + phpconfutils_extension_enable "sqlite-utf8" "nls" 0 fi # Fix ELF-related problems @@ -553,7 +528,7 @@ php5_0-sapi_src_install() { make INSTALL_ROOT="${D}" ${PHP_INSTALLTARGETS} || die "install failed" # Install missing header files - if useq nls ; then + if useq nls || phpconfutils_usecheck nls ; then dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl for x in mbfilter.h mbfl_consts.h mbfl_encoding.h mbfl_language.h mbfl_string.h mbfl_convert.h mbfl_ident.h mbfl_memory_device.h mbfl_allocators.h mbfl_defs.h mbfl_filter_output.h mbfilter_pass.h mbfilter_wchar.h mbfilter_8bit.h ; do @@ -577,6 +552,9 @@ php5_0-sapi_src_install() { einfo "Setting correct include_path" sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc} + # Generate the USE file for PHP + phpconfutils_generate_usefile + # Create the directory where we'll put php5-only php scripts keepdir /usr/share/php5 } diff --git a/eclass/php5_1-sapi.eclass b/eclass/php5_1-sapi.eclass index 2876012a1834..5ac2aa44b443 100644 --- a/eclass/php5_1-sapi.eclass +++ b/eclass/php5_1-sapi.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 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.19 2006/03/18 18:38:11 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php5_1-sapi.eclass,v 1.20 2006/03/24 23:05:49 chtekk Exp $ # # ######################################################################## # @@ -20,9 +20,9 @@ # ======================================================================== CONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob frontbase hyperwave-api informix interbase msql oci8 sapdb solid sybase sybase-ct" -EBUILD_SUPPORTS_SHAREDEXT=1 +EBUILD_SUPPORTS_SHAREDEXT="1" -inherit flag-o-matic eutils confutils libtool php-common-r1 +inherit flag-o-matic eutils phpconfutils libtool php-common-r1 # set MY_PHP_P in the ebuild @@ -39,29 +39,39 @@ if [[ "${PHP_PACKAGE}" == 1 ]] ; then S="${WORKDIR}/${MY_PHP_P}" fi -IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dba dbase dbmaker debug doc empress empress-bcs esoob exif fastbuild 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 threads tidy tokenizer truetype vm-goto vm-switch wddx xml xmlreader xmlwriter xmlrpc xpm xsl yaz zip zlib" +IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb cjk crypt ctype curl curlwrappers db2 dbase dbmaker debug doc empress empress-bcs esoob exif fastbuild 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 threads tidy tokenizer truetype vm-goto vm-switch wddx xml xmlreader xmlwriter xmlrpc xpm xsl yaz zip zlib" # these USE flags should have the correct dependencies DEPEND="${DEPEND} !dev-php/php !dev-php/php-cgi !dev-php/mod_php + 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 ) + 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 ) imap? ( virtual/imap-c-client ) - iodbc? ( dev-db/libiodbc ) + iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) kerberos? ( virtual/krb5 ) ldap? ( >=net-nds/openldap-1.2.11 ) libedit? ( dev-libs/libedit ) + mcve? ( >=dev-libs/openssl-0.9.7 ) mhash? ( app-crypt/mhash ) ming? ( media-libs/ming ) mssql? ( dev-db/freetds ) @@ -75,22 +85,24 @@ DEPEND="${DEPEND} qdbm? ( dev-db/qdbm ) readline? ( sys-libs/readline ) recode? ( app-text/recode ) - sasl? ( dev-libs/cyrus-sasl ) + 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 ) soap? ( >=dev-libs/libxml2-2.6.8 ) + solid? ( >=dev-db/unixODBC-1.8.13 ) spell? ( >=app-text/aspell-0.50 ) 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 ) + 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 ) xmlreader? ( >=dev-libs/libxml2-2.6.8 ) xmlwriter? ( >=dev-libs/libxml2-2.6.8 ) - xmlrpc? ( >=dev-libs/libxml2-2.6.8 ) - xpm? ( || ( x11-libs/libXpm virtual/x11 ) ) + 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 ) zlib? ( sys-libs/zlib ) virtual/mta" @@ -136,99 +148,60 @@ EXPORT_FUNCTIONS pkg_setup src_compile src_install src_unpack pkg_postinst # INTERNAL FUNCTIONS # ======================================================================== -php5_1-sapi_check_awkward_uses() { - # ------------------------------------ - # Rules for things unexpectedly broken - # go below here - # - # These rules override the "normal" - # rules listed later on - # ------------------------------------ - - # No special rules at the moment - - # ------------------------------------ - # Normal rules go below here - # ------------------------------------ - - # A variety of extensions need DBA - confutils_use_depend_all "berkdb" "dba" - confutils_use_depend_all "cdb" "dba" - confutils_use_depend_all "flatfile" "dba" - confutils_use_depend_all "gdbm" "dba" - confutils_use_depend_all "inifile" "dba" - confutils_use_depend_all "qdbm" "dba" - - # EXIF only gets built if we support a file format that uses it - confutils_use_depend_any "exif" "gd" "gd-external" - - # support for the GD graphics library - confutils_use_conflict "gd" "gd-external" - confutils_use_depend_any "truetype" "gd" "gd-external" - confutils_use_depend_any "cjk" "gd" "gd-external" - confutils_use_depend_all "xpm" "gd" - confutils_use_depend_all "gd" "zlib" - - # XML related extensions - confutils_use_depend_all "soap" "xml" - confutils_use_depend_all "simplexml" "xml" - confutils_use_depend_all "xsl" "xml" - confutils_use_depend_all "xmlrpc" "xml" - confutils_use_depend_all "wddx" "xml" - confutils_use_depend_all "xmlreader" "xml" - confutils_use_depend_all "xmlwriter" "xml" +php5_1-sapi_check_use_flags() { + PHPCONFUTILS_AUTO_USE="" + + # 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 "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" + + # 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 "qdbm" "gdbm" + 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 - # Java-external support - confutils_use_depend_all "java-external" "session" - # Mail support php_check_mta # Oracle support - confutils_use_conflict "oci8" "oci8-instant-client" php_check_oracle_8 - # LDAP-sasl support - confutils_use_depend_all "sasl" "ldap" - - # MCVE needs OpenSSL - confutils_use_depend_all "mcve" "ssl" - - # ODBC support - confutils_use_depend_all "adabas" "odbc" - confutils_use_depend_all "birdstep" "odbc" - confutils_use_depend_all "dbmaker" "odbc" - confutils_use_depend_all "empress" "odbc" - confutils_use_depend_all "empress-bcs" "odbc" "empress" - confutils_use_depend_all "esoob" "odbc" - confutils_use_depend_all "db2" "odbc" - confutils_use_depend_all "iodbc" "odbc" - confutils_use_depend_all "sapdb" "odbc" - confutils_use_depend_all "solid" "odbc" - - # PDO can be built using the bundled code or the external PECL - # packages (dev-php5/pecl-pdo), but not both - confutils_use_conflict "pdo" "pdo-external" - - # QDBM doesn't play nicely with GDBM - confutils_use_conflict "qdbm" "gdbm" + phpconfutils_warn_about_external_deps - # Readline and libedit do the same thing; you can't have both - confutils_use_conflict "readline" "libedit" - - # Recode is not liked - confutils_use_conflict "recode" "mysql" "imap" "yaz" - - # the MM extension isn't thread-safe - confutils_use_conflict "sharedmem" "threads" - - # We can only have one Zend-VM option enabled at a time - confutils_use_conflict "vm-goto" "vm-switch" - - confutils_warn_about_missing_deps + export PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE}" } php5_1-sapi_set_php_ini_dir() { @@ -273,7 +246,7 @@ php5_1-sapi_install_ini() { php5_1-sapi_pkg_setup() { # let's do all the USE flag testing before we do anything else # this way saves a lot of time - php5_1-sapi_check_awkward_uses + php5_1-sapi_check_use_flags } php5_1-sapi_src_unpack() { @@ -314,7 +287,7 @@ php5_1-sapi_src_unpack() { # 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 + # 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} @@ -371,109 +344,109 @@ php5_1-sapi_src_compile() { php5_1-sapi_set_php_ini_dir cd "${S}" - confutils_init + 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? - enable_extension_enable "bcmath" "bcmath" 1 - enable_extension_with "bz2" "bzip2" 1 - enable_extension_enable "calendar" "calendar" 1 - enable_extension_disable "ctype" "ctype" 0 - enable_extension_with "curl" "curl" 1 - enable_extension_with "curlwrappers" "curlwrappers" 1 - enable_extension_enable "dbase" "dbase" 1 - enable_extension_disable "dom" "xml" 0 - enable_extension_enable "exif" "exif" 1 - enable_extension_with "fbsql" "frontbase" 1 - enable_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" - enable_extension_enable "filepro" "filepro" 1 - enable_extension_enable "ftp" "ftp" 1 - enable_extension_with "gettext" "nls" 1 - enable_extension_with "gmp" "gmp" 1 - enable_extension_disable "hash" "hash" 0 - enable_extension_with "hwapi" "hyperwave-api" 1 - enable_extension_without "iconv" "iconv" 0 - enable_extension_with "informix" "informix" 1 - enable_extension_disable "ipv6" "ipv6" 0 - # ircg extension not supported on Gentoo at this time - enable_extension_with "kerberos" "kerberos" 0 "/usr" - enable_extension_disable "libxml" "xml" 0 - enable_extension_enable "mbstring" "nls" 1 - enable_extension_with "mcrypt" "crypt" 1 - enable_extension_enable "memory-limit" "memlimit" 0 - enable_extension_with "mhash" "mhash" 1 - enable_extension_with "ming" "ming" 1 - enable_extension_with "msql" "msql" 1 - enable_extension_with "mssql" "mssql" 1 - enable_extension_with "ncurses" "ncurses" 1 - enable_extension_with "openssl" "ssl" 0 - enable_extension_with "openssl-dir" "ssl" 0 "/usr" - enable_extension_enable "pcntl" "pcntl" 1 - enable_extension_without "pcre-regex" "pcre" 0 - enable_extension_disable "pdo" "pdo" 1 - enable_extension_with "pgsql" "postgres" 1 - enable_extension_disable "posix" "posix" 1 - enable_extension_with "pspell" "spell" 1 - enable_extension_with "recode" "recode" 1 - enable_extension_disable "reflection" "reflection" 0 - enable_extension_disable "simplexml" "simplexml" 1 - enable_extension_enable "shmop" "sharedmem" 0 - enable_extension_with "snmp" "snmp" 1 - enable_extension_enable "soap" "soap" 1 - enable_extension_enable "sockets" "sockets" 1 - enable_extension_disable "spl" "spl" 1 - enable_extension_with "sybase" "sybase" 1 - enable_extension_with "sybase-ct" "sybase-ct" 1 - enable_extension_enable "sysvmsg" "sysvipc" 1 - enable_extension_enable "sysvsem" "sysvipc" 1 - enable_extension_enable "sysvshm" "sysvipc" 1 - enable_extension_with "tidy" "tidy" 1 - enable_extension_disable "tokenizer" "tokenizer" 1 - enable_extension_enable "wddx" "wddx" 1 - enable_extension_disable "xml" "xml" 0 - enable_extension_disable "xmlreader" "xmlreader" 1 - enable_extension_disable "xmlwriter" "xmlwriter" 1 - enable_extension_with "xmlrpc" "xmlrpc" 1 - enable_extension_with "xsl" "xsl" 1 - enable_extension_with "zlib" "zlib" 1 - enable_extension_enable "debug" "debug" 0 + # 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" 1 + 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_enable "filepro" "filepro" 1 + 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_with "hwapi" "hyperwave-api" 1 + phpconfutils_extension_without "iconv" "iconv" 0 + phpconfutils_extension_with "informix" "informix" 1 + phpconfutils_extension_disable "ipv6" "ipv6" 0 + phpconfutils_extension_with "kerberos" "kerberos" 0 "/usr" + phpconfutils_extension_disable "libxml" "xml" 0 + phpconfutils_extension_enable "mbstring" "nls" 1 + phpconfutils_extension_with "mcrypt" "crypt" 1 + phpconfutils_extension_enable "memory-limit" "memlimit" 0 + phpconfutils_extension_with "mhash" "mhash" 1 + phpconfutils_extension_with "ming" "ming" 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" 1 + phpconfutils_extension_with "pgsql" "postgres" 1 + phpconfutils_extension_disable "posix" "posix" 1 + phpconfutils_extension_with "pspell" "spell" 1 + phpconfutils_extension_with "recode" "recode" 1 + phpconfutils_extension_disable "reflection" "reflection" 0 + phpconfutils_extension_disable "simplexml" "simplexml" 1 + 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" 1 + 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" 1 + phpconfutils_extension_enable "wddx" "wddx" 1 + phpconfutils_extension_disable "xml" "xml" 0 + phpconfutils_extension_disable "xmlreader" "xmlreader" 1 + phpconfutils_extension_disable "xmlwriter" "xmlwriter" 1 + phpconfutils_extension_with "xmlrpc" "xmlrpc" 1 + phpconfutils_extension_with "xsl" "xsl" 1 + phpconfutils_extension_with "zlib" "zlib" 1 + phpconfutils_extension_enable "debug" "debug" 0 # DBA support - enable_extension_enable "dba" "dba" 1 - - if useq dba ; then - enable_extension_with "cdb" "cdb" 1 - enable_extension_with "db4" "berkdb" 1 - enable_extension_with "flatfile" "flatfile" 1 - enable_extension_with "gdbm" "gdbm" 1 - enable_extension_with "inifile" "inifile" 1 - enable_extension_with "qdbm" "qdbm" 1 + if useq cdb || useq berkdb || useq flatfile || useq gdbm || useq inifile || useq qdbm ; then + my_conf="${my_conf} --enable-dba${shared}" fi + # DBA drivers support + phpconfutils_extension_with "cdb" "cdb" 1 + phpconfutils_extension_with "db4" "berkdb" 1 + phpconfutils_extension_with "flatfile" "flatfile" 1 + phpconfutils_extension_with "gdbm" "gdbm" 1 + phpconfutils_extension_with "inifile" "inifile" 1 + phpconfutils_extension_with "qdbm" "qdbm" 1 + # Support for the GD graphics library - if useq gd-external ; then - enable_extension_with "freetype-dir" "truetype" 0 "/usr" - enable_extension_with "t1lib" "truetype" 0 "/usr" - enable_extension_enable "gd-jis-conv" "cjk" 0 - enable_extension_enable "gd-native-ttf" "truetype" 0 - enable_extension_with "gd" "gd-external" 1 "/usr" + if useq 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 - enable_extension_with "freetype-dir" "truetype" 0 "/usr" - enable_extension_with "t1lib" "truetype" 0 "/usr" - enable_extension_enable "gd-jis-conv" "cjk" 0 - enable_extension_enable "gd-native-ttf" "truetype" 0 - enable_extension_with "jpeg-dir" "gd" 0 "/usr" - enable_extension_with "png-dir" "gd" 0 "/usr" - enable_extension_with "xpm-dir" "xpm" 0 "/usr/X11R6" + 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 - enable_extension_with "gd" "gd" 0 + phpconfutils_extension_with "gd" "gd" 0 fi # IMAP support - if useq imap ; then - enable_extension_with "imap" "imap" 1 - enable_extension_with "imap-ssl" "ssl" 0 + if useq imap || phpconfutils_usecheck imap ; then + phpconfutils_extension_with "imap" "imap" 1 + phpconfutils_extension_with "imap-ssl" "ssl" 0 fi # Interbase support @@ -482,83 +455,83 @@ php5_1-sapi_src_compile() { fi # LDAP support - if useq ldap ; then - enable_extension_with "ldap" "ldap" 1 - enable_extension_with "ldap-sasl" "sasl" 0 + if useq ldap || phpconfutils_usecheck ldap ; then + phpconfutils_extension_with "ldap" "ldap" 1 + phpconfutils_extension_with "ldap-sasl" "sasl" 0 fi # MySQL support if useq mysql ; then - enable_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" - enable_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + phpconfutils_extension_with "mysql" "mysql" 1 "/usr/lib/mysql" + phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" fi # MySQLi support - enable_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" + phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" # ODBC support - if useq odbc ; then - enable_extension_with "unixODBC" "odbc" 1 "/usr" - - enable_extension_with "adabas" "adabas" 1 - enable_extension_with "birdstep" "birdstep" 1 - enable_extension_with "dbmaker" "dbmaker" 1 - enable_extension_with "empress" "empress" 1 - if useq empress ; then - enable_extension_with "empress-bcs" "empress-bcs" 0 + if useq 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 + phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 fi - enable_extension_with "esoob" "esoob" 1 - enable_extension_with "ibm-db2" "db2" 1 - enable_extension_with "iodbc" "iodbc" 1 "/usr" - enable_extension_with "sapdb" "sapdb" 1 - enable_extension_with "solid" "solid" 1 + 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 useq oci8 ; then - enable_extension_with "oci8" "oci8" 1 + phpconfutils_extension_with "oci8" "oci8" 1 fi if useq 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'`" - enable_extension_with "oci8" "oci8-instant-client" 1 "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib" + phpconfutils_extension_with "oci8" "oci8-instant-client" 1 "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib" fi # PDO support - if useq pdo ; then - enable_extension_with "pdo-dblib" "mssql" 1 - enable_extension_with "pdo-firebird" "firebird" 1 - enable_extension_with "pdo-mysql" "mysql" 1 "/usr" + if useq pdo || phpconfutils_usecheck pdo ; then + phpconfutils_extension_with "pdo-dblib" "mssql" 1 + phpconfutils_extension_with "pdo-firebird" "firebird" 1 + phpconfutils_extension_with "pdo-mysql" "mysql" 1 "/usr" if useq oci8 ; then - enable_extension_with "pdo-oci" "oci8" 1 + phpconfutils_extension_with "pdo-oci" "oci8" 1 fi if useq 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'`" - enable_extension_with "pdo-oci" "oci8-instant-client" 1 "instantclient,/usr,${OCI8IC_PKG}" + phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 "instantclient,/usr,${OCI8IC_PKG}" fi - enable_extension_with "pdo-odbc" "odbc" 1 "unixODBC,/usr" - enable_extension_with "pdo-pgsql" "postgres" 1 - enable_extension_without "pdo-sqlite" "sqlite" 1 + phpconfutils_extension_with "pdo-odbc" "odbc" 1 "unixODBC,/usr" + phpconfutils_extension_with "pdo-pgsql" "postgres" 1 + phpconfutils_extension_without "pdo-sqlite" "sqlite" 1 fi # readline/libedit support - # you can use readline or libedit, but you can't use both - enable_extension_with "readline" "readline" 0 - enable_extension_with "libedit" "libedit" 1 + # 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 ! useq session ; then - enable_extension_disable "session" "session" 1 + if ! useq session && ! phpconfutils_usecheck session ; then + phpconfutils_extension_disable "session" "session" 1 else - enable_extension_with "mm" "sharedmem" 0 + phpconfutils_extension_with "mm" "sharedmem" 0 fi # Sqlite support - if ! useq sqlite ; then - enable_extension_without "sqlite" "sqlite" 0 + if ! useq sqlite && ! phpconfutils_usecheck sqlite ; then + phpconfutils_extension_without "sqlite" "sqlite" 0 else - enable_extension_enable "sqlite-utf8" "nls" 0 + phpconfutils_extension_enable "sqlite-utf8" "nls" 0 fi # Zend-GOTO-VM support @@ -607,7 +580,7 @@ php5_1-sapi_src_install() { make INSTALL_ROOT="${D}" ${PHP_INSTALLTARGETS} || die "install failed" # Install missing header files - if useq nls ; then + if useq nls || phpconfutils_usecheck nls ; then dodir ${destdir}/include/php/ext/mbstring/libmbfl/mbfl insinto ${destdir}/include/php/ext/mbstring/libmbfl/mbfl for x in mbfilter.h mbfl_consts.h mbfl_encoding.h mbfl_language.h mbfl_string.h mbfl_convert.h mbfl_ident.h mbfl_memory_device.h mbfl_allocators.h mbfl_defs.h mbfl_filter_output.h mbfilter_pass.h mbfilter_wchar.h mbfilter_8bit.h ; do @@ -631,6 +604,9 @@ php5_1-sapi_src_install() { einfo "Setting correct include_path" sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php5:/usr/share/php"|' -i ${phpinisrc} + # Generate the USE file for PHP + phpconfutils_generate_usefile + # Create the directory where we'll put php5-only php scripts keepdir /usr/share/php5 } diff --git a/eclass/phpconfutils.eclass b/eclass/phpconfutils.eclass new file mode 100644 index 000000000000..26f764e659db --- /dev/null +++ b/eclass/phpconfutils.eclass @@ -0,0 +1,457 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/phpconfutils.eclass,v 1.1 2006/03/24 23:05:49 chtekk Exp $ +# +# ######################################################################## +# +# eclass/phpconfutils.eclass +# Utility functions to help with configuring PHP +# +# Based on stuart's work on the original confutils eclass +# +# Author(s) Luca Longinotti +# <chtekk@gentoo.org> +# +# Maintained by the PHP Herd <php-bugs@gentoo.org> +# +# ======================================================================== + +if [[ "${EBUILD_SUPPORTS_SHAREDEXT}" == "1" ]] ; then + IUSE="sharedext" +fi + +# ======================================================================== +# List of USE flags that need deps that aren't yet in Portage +# or that can't be (fex. certain commercial apps) +# +# You must define CONFUTILS_MISSING_DEPS if you need this + +# ======================================================================== +# phpconfutils_sort_flags() +# +# Sort and remove duplicates of the auto-enabled USE flags +# + +phpconfutils_sort_flags() { + # Sort the list of auto-magically enabled USE flags + PHPCONFUTILS_AUTO_USE="`echo ${PHPCONFUTILS_AUTO_USE} | tr '\040\010' '\012\012' | sort -u`" +} + +# ======================================================================== +# phpconfutils_init() +# +# Call this function from your src_compile() function to initialise +# this eclass first +# + +phpconfutils_init() { + # Define wheter we shall support shared extensions or not + if [[ "${EBUILD_SUPPORTS_SHAREDEXT}" == "1" ]] && useq "sharedext" ; then + shared="=shared" + else + shared="" + fi + + phpconfutils_sort_flags +} + +# ======================================================================== +# phpconfutils_usecheck() +# +# Check if the USE flag we want enabled is part of the auto-magical ones +# + +phpconfutils_usecheck() { + local x + local use="$1" + + for x in ${PHPCONFUTILS_AUTO_USE} ; do + if [[ "${use}+" == "${x}+" ]] ; then + return 0 + fi + done + + # If we get here, the USE is not among the auto-enabled ones + return 1 +} + +# ======================================================================== +# phpconfutils_require_any() +# +# Use this function to ensure one or more of the specified USE flags have +# been enabled and output the results +# +# $1 - message to output everytime a flag is found +# $2 - message to output everytime a flag is not found +# $3 .. - flags to check +# + +phpconfutils_require_any() { + local success_msg="$1" + shift + local fail_msg="$1" + shift + + local required_flags="$@" + local success="0" + + while [[ -n "$1" ]] ; do + if useq "$1" ; then + einfo "${success_msg} $1" + success="1" + else + ewarn "${fail_msg} $1" + fi + shift + done + + # Did we find what we are looking for? + if [[ "${success}" == "1" ]] ; then + return + fi + + # If we get here, then none of the required USE flags were enabled + eerror + eerror "You *must* enable one or more of the following USE flags:" + eerror " ${required_flags}" + eerror + eerror "You can do this by enabling these flags in /etc/portage/package.use:" + eerror " =${CATEGORY}/${PN}-${PVR} ${required_flags}" + eerror + die "Missing USE flags found" +} + +# ======================================================================== +# phpconfutils_use_conflict() +# +# Use this function to automatically complain to the user if USE flags +# that directly conflict have been enabled +# +# $1 - flag that conflicts with other flags +# $2 .. - flags that conflict +# + +phpconfutils_use_conflict() { + phpconfutils_sort_flags + + if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then + return + fi + + local my_flag="$1" + shift + + local my_present="" + local my_remove="" + + while [[ "$1+" != "+" ]] ; do + if useq "$1" || phpconfutils_usecheck "$1" ; then + my_present="${my_present} $1" + my_remove="${my_remove} -$1" + fi + shift + done + + if [[ -n "${my_present}" ]] ; then + eerror + eerror "USE flag '${my_flag}' conflicts with these USE flag(s):" + eerror " ${my_present}" + eerror + eerror "You must disable these conflicting flags before you can emerge this package." + eerror "You can do this by disabling these flags in /etc/portage/package.use:" + eerror " =${CATEGORY}/${PN}-${PVR} ${my_remove}" + eerror + die "Conflicting USE flags found" + fi +} + +# ======================================================================== +# phpconfutils_use_depend_all() +# +# Use this function to specify USE flags that depend on eachother, +# they will be automatically enabled and used for checks later +# +# $1 - flag that depends on other flags +# $2 .. - the flags that must be set for $1 to be valid +# + +phpconfutils_use_depend_all() { + phpconfutils_sort_flags + + if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then + return + fi + + local my_flag="$1" + shift + + local my_missing="" + + while [[ "$1+" != "+" ]] ; do + if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then + my_missing="${my_missing} $1" + fi + shift + done + + if [[ -n "${my_missing}" ]] ; then + PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE} ${my_missing}" + ewarn + ewarn "USE flag '${my_flag}' needs these additional flag(s) set:" + ewarn " ${my_missing}" + ewarn + ewarn "'${my_missing}' was automatically enabled and the required extensions will be" + ewarn "built. In any case it is recommended to enable those flags for" + ewarn "future reference, by adding the following to /etc/portage/package.use:" + ewarn " =${CATEGORY}/${PN}-${PVR} ${my_missing}" + ewarn + fi +} + +# ======================================================================== +# phpconfutils_use_depend_any() +# +# Use this function to automatically complain to the user if a USE flag +# depends on another USE flag that hasn't been enabled +# +# $1 - flag that depends on other flags +# $2 - flag that is used as default if none is enabled +# $3 .. - flags that must be set for $1 to be valid +# + +phpconfutils_use_depend_any() { + phpconfutils_sort_flags + + if ! useq "$1" && ! phpconfutils_usecheck "$1" ; then + return + fi + + local my_flag="$1" + shift + + local my_default_flag="$1" + shift + + local my_found="" + local my_missing="" + + while [[ "$1+" != "+" ]] ; do + if useq "$1" || phpconfutils_usecheck "$1" ; then + my_found="${my_found} $1" + else + my_missing="${my_missing} $1" + fi + shift + done + + if [[ -z "${my_found}" ]] ; then + PHPCONFUTILS_AUTO_USE="${PHPCONFUTILS_AUTO_USE} ${my_default_flag}" + ewarn + ewarn "USE flag '${my_flag}' needs one of these additional flag(s) set:" + ewarn " ${my_missing}" + ewarn + ewarn "'${my_default_flag}' was automatically selected and enabled." + ewarn "You can change that by enabling/disabling those flags accordingly" + ewarn "in /etc/portage/package.use." + ewarn + fi +} + +# ======================================================================== +# phpconfutils_extension_disable() +# +# Use this function to disable an extension that is enabled by default. +# This is provided for those rare configure scripts that don't support +# a --enable for the corresponding --disable +# +# $1 - extension name +# $2 - USE flag +# $3 - optional message to einfo() to the user +# + +phpconfutils_extension_disable() { + if ! useq "$2" && ! phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --disable-$1" + [[ -n "$3" ]] && einfo " Disabling $1" + else + [[ -n "$3" ]] && einfo " Enabling $1" + fi +} + +# ======================================================================== +# phpconfutils_extension_enable() +# +# This function is like use_enable(), except that it knows about +# enabling modules as shared libraries, and it supports passing +# additional data with the switch +# +# $1 - extension name +# $2 - USE flag +# $3 - 1 = support shared, 0 = never support shared +# $4 - additional setting for configure +# $5 - additional message to einfo out to the user +# + +phpconfutils_extension_enable() { + local my_shared + + if [[ "$3" == "1" ]] ; then + if [[ "${shared}+" != "+" ]] ; then + my_shared="${shared}" + if [[ "$4+" != "+" ]] ; then + my_shared="${my_shared},$4" + fi + elif [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + else + if [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + fi + + if useq "$2" || phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --enable-$1${my_shared}" + einfo " Enabling $1" + else + my_conf="${my_conf} --disable-$1" + einfo " Disabling $1" + fi +} + +# ======================================================================== +# phpconfutils_extension_without() +# +# Use this function to disable an extension that is enabled by default +# This function is provided for those rare configure scripts that support +# --without but not the corresponding --with +# +# $1 - extension name +# $2 - USE flag +# $3 - optional message to einfo() to the user +# + +phpconfutils_extension_without() { + if ! useq "$2" && ! phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --without-$1" + einfo " Disabling $1" + else + einfo " Enabling $1" + fi +} + +# ======================================================================== +# phpconfutils_extension_with() +# +# This function is a replacement for use_with. It supports building +# extensions as shared libraries, +# +# $1 - extension name +# $2 - USE flag +# $3 - 1 = support shared, 0 = never support shared +# $4 - additional setting for configure +# $5 - optional message to einfo() out to the user +# + +phpconfutils_extension_with() { + local my_shared + + if [[ "$3" == "1" ]] ; then + if [[ "${shared}+" != "+" ]] ; then + my_shared="${shared}" + if [[ "$4+" != "+" ]] ; then + my_shared="${my_shared},$4" + fi + elif [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + else + if [[ "$4+" != "+" ]] ; then + my_shared="=$4" + fi + fi + + if useq "$2" || phpconfutils_usecheck "$2" ; then + my_conf="${my_conf} --with-$1${my_shared}" + einfo " Enabling $1" + else + my_conf="${my_conf} --without-$1" + einfo " Disabling $1" + fi +} + +# ======================================================================== +# phpconfutils_warn_about_external_deps() +# +# This will output a warning to the user if he enables commercial or other +# software not currently present in Portage +# + +phpconfutils_warn_about_external_deps() { + phpconfutils_sort_flags + + local x + local my_found="0" + + for x in ${CONFUTILS_MISSING_DEPS} ; do + if useq "${x}" || phpconfutils_usecheck "${x}" ; then + ewarn "USE flag ${x} enables support for software not present in Portage" + my_found="1" + fi + done + + if [[ "${my_found}" == "1" ]] ; then + ewarn + ewarn "This ebuild will continue, but if you haven't already installed the" + ewarn "software required to satisfy the list above, this package will probably" + ewarn "fail to compile later on." + ewarn + sleep 5 + fi +} + +# ======================================================================== +# phpconfutils_built_with_use() +# +# Sobstitute for built_with_use() to support the magically enabled USE flags +# + +phpconfutils_built_with_use() { + local opt="$1" + [[ ${opt:0:1} = "-" ]] && shift || opt="-a" + + local PHP_PKG=$(best_version $1) + shift + + local PHP_USEFILE="${ROOT}/var/lib/php-pkg/${PHP_PKG}/PHP_USEFILE" + + [[ ! -e "${PHP_USEFILE}" ]] && return 0 + + local PHP_USE_BUILT=$(<${PHP_USEFILE}) + while [[ $# -gt 0 ]] ; do + if [[ ${opt} = "-o" ]] ; then + has $1 ${PHP_USE_BUILT} && return 0 + else + has $1 ${PHP_USE_BUILT} || return 1 + fi + shift + done + [[ ${opt} = "-a" ]] +} + +# ======================================================================== +# phpconfutils_generate_usefile() +# +# Generate the file used by phpconfutils_built_with_use() to check it's +# USE flags +# + +phpconfutils_generate_usefile() { + phpconfutils_sort_flags + + local PHP_USEFILE="${D}/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/PHP_USEFILE" + + # Write the auto-enabled USEs into the correct file + dodir "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/" + echo "${PHPCONFUTILS_AUTO_USE}" > "${PHP_USEFILE}" +} |