From bef8daa9f07be4762772d6d0bc4e7bcd4693f240 Mon Sep 17 00:00:00 2001 From: Benedikt Böhm Date: Sun, 17 Oct 2010 09:33:56 +0200 Subject: merge latest changes to php ebuild --- dev-lang/php/Manifest | 25 +- dev-lang/php/files/70_mod_php5.conf-apache2 | 14 + .../php/files/70_mod_php5_concurr.conf-apache2 | 14 + dev-lang/php/files/eblits/common-v1.eblit | 9 + dev-lang/php/files/eblits/pkg_postinst-v1.eblit | 72 ++ dev-lang/php/files/eblits/pkg_setup-v1.eblit | 28 + dev-lang/php/files/eblits/src_compile-v1.eblit | 60 ++ dev-lang/php/files/eblits/src_configure-v52.eblit | 296 +++++++ dev-lang/php/files/eblits/src_install-v1.eblit | 156 ++++ dev-lang/php/files/eblits/src_prepare-v1.eblit | 70 ++ dev-lang/php/files/eblits/src_test-v1.eblit | 54 ++ dev-lang/php/files/php-fpm.init | 6 +- dev-lang/php/php-5.2.12.ebuild | 639 --------------- dev-lang/php/php-5.2.13.ebuild | 642 --------------- dev-lang/php/php-5.2.14.ebuild | 909 +++++++-------------- 15 files changed, 1086 insertions(+), 1908 deletions(-) create mode 100644 dev-lang/php/files/70_mod_php5.conf-apache2 create mode 100644 dev-lang/php/files/70_mod_php5_concurr.conf-apache2 create mode 100644 dev-lang/php/files/eblits/common-v1.eblit create mode 100644 dev-lang/php/files/eblits/pkg_postinst-v1.eblit create mode 100644 dev-lang/php/files/eblits/pkg_setup-v1.eblit create mode 100644 dev-lang/php/files/eblits/src_compile-v1.eblit create mode 100644 dev-lang/php/files/eblits/src_configure-v52.eblit create mode 100644 dev-lang/php/files/eblits/src_install-v1.eblit create mode 100644 dev-lang/php/files/eblits/src_prepare-v1.eblit create mode 100644 dev-lang/php/files/eblits/src_test-v1.eblit delete mode 100644 dev-lang/php/php-5.2.12.ebuild delete mode 100644 dev-lang/php/php-5.2.13.ebuild (limited to 'dev-lang') diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest index cf54978..0faa620 100644 --- a/dev-lang/php/Manifest +++ b/dev-lang/php/Manifest @@ -1,18 +1,21 @@ AUX 20php5-envd 145 RMD160 8c81fb7dc1d1ddf16fd956d748514db3bcb27603 SHA1 f1cef57c0def8e2c5422aaf136f40b4ff47801d2 SHA256 efaae9e6ae5f7010e073c2ab6d8a9dda009f0707c7d7b0c027e142c94f7041a4 +AUX 70_mod_php5.conf-apache2 348 RMD160 9f3f49a52ebf92c2650501c5ceb6f95ce4bb2e76 SHA1 62992e793446b4a9a64900d1ecba7bae06873382 SHA256 5bb8a45570582b4389a7d3feea0398e1c13ed4ced96e559b9406ed8c965dea8c AUX 70_mod_php5.conf-apache2-r1 374 RMD160 ca06cdc9d1a3dc4129a60c938ee3a1b542497fbb SHA1 4733066b6324c5870e716485484c44c7c26a9ff1 SHA256 815c1ca23c9afe8479568ceaac4057eb91ea5444fbd863866b29adb4eea2c82b +AUX 70_mod_php5_concurr.conf-apache2 348 RMD160 9f3f49a52ebf92c2650501c5ceb6f95ce4bb2e76 SHA1 62992e793446b4a9a64900d1ecba7bae06873382 SHA256 5bb8a45570582b4389a7d3feea0398e1c13ed4ced96e559b9406ed8c965dea8c AUX 70_mod_php5_concurr.conf-apache2-r1 376 RMD160 4f7de5c0784b6191450b5c1a7de7ad941620e199 SHA1 c42a23bd7a1d3e8c7e0ac906f50f180116349f76 SHA256 c05f499d9c8927391c586b94716a9f59d63767165552ea527ec7ff63c36eaa40 +AUX eblits/common-v1.eblit 379 RMD160 60b526e9a736553f6e4883c9fb9525464192bde2 SHA1 97c4e1c9475d73227f26cbef80640f43d838af6f SHA256 65c909a6d0501a6746518f539c4a4021426469cbf20b2a212fb0d60b48da5362 +AUX eblits/pkg_postinst-v1.eblit 2184 RMD160 ce65ba811eab10862d067c7e2b4bdc8d2b0aee56 SHA1 11c14f2235041cfb08e33cf2550bebef2037e92b SHA256 9e1cd81be4f051f3156de0ce5398a338b2ab6f8e73047c5983beda47f2f762b0 +AUX eblits/pkg_setup-v1.eblit 777 RMD160 aa63e7ab1bae34feffbbfaae902f11c6e797ba9d SHA1 f7334a4750b1a1bb2f24021dff884733a88ac347 SHA256 2613f51ee9e3a258dbab38ff2df724f2971a50a5ad8c097cb5a4e3744df5fc8a +AUX eblits/src_compile-v1.eblit 1283 RMD160 83fbb374e2dfaa9d164e6b32b57c268ed06bf519 SHA1 09124cbc9008bfb72eb24cd24b2319d22df52c2c SHA256 5ec76ae24304c5f803a615a98394c219018da1b1ce2018f92f6ac8c5becf6c99 +AUX eblits/src_configure-v52.eblit 11624 RMD160 18839a2767e3555475cc2825e86085aa849b487e SHA1 4b12838725f76df106c52235b09d17fcacf54218 SHA256 6452720a08bee237c9bc5c0772b506ce99bec240ed5a3aa1de211bba647aa288 +AUX eblits/src_install-v1.eblit 4988 RMD160 c73323512498249ed0688b1aceaff29e97e73bef SHA1 7c2ff80e1896670a0381606ccbcb3950032bcf85 SHA256 11de8d065c04a32ca47b5b6a955c16dba78803af17d029c5e708889b2512284c +AUX eblits/src_prepare-v1.eblit 2616 RMD160 ccff64d09cc90ada1ea5d1311457cf9a05f12f8e SHA1 7db40d0ca7ef01e5b61962f261511803f768f1bc SHA256 915b9755a37f7670f6e436fe5072dae8f5e6b437ccdfbff835e26bb2f9d22b1e +AUX eblits/src_test-v1.eblit 1530 RMD160 10031a5128dab729106c6fbfe4e899b1583818cb SHA1 0f1abf995913c2c381e2496b8670ea4f6e97964b SHA256 67501925cfdaf9043e4985d0f1c797e62fb42bf47e6863b5ffdecb104888e82c AUX php-5.2.12-libpng14.patch 222 RMD160 d63bd712d077d9606a02d6620c7084bca7197c01 SHA1 a25a47386d625a47698094fc4825208c6ec8f2a4 SHA256 af94a9c2a104dcb037aa059dd46b6f534adb939ea44ad4cb9e3a0a7c49b64fab -AUX php-fpm.init 469 RMD160 ad033da115f868fe85081d6b39cbdf7ee97b6ea9 SHA1 9af9a7975818fa412c073bd81e79a3c775b734f3 SHA256 4cd7a7068efc17aa0524f94b1695c1d81d7ce8a5fafa1f8b8cbf32fcbfade6a1 +AUX php-fpm.init 444 RMD160 9898cc7dd53ab288f310eaed61f8abd08b95048f SHA1 cb46c81abf7732c5992f9a5700d7a3e59cd2b6e0 SHA256 5482ad44a6cad13485617c575b024d4cf8d9d9fb2c42cba7a0ecf1556db59f84 AUX php5-ldvs 22 RMD160 5846dab2745b68a88175dd4e72d0b8cf4756dd46 SHA1 592398c92575adb14ec972847ce2aca28a7b9c2c SHA256 b79d0e52b1b3b4543b31ad45525ae1c2814a27ea8e676772ab10bf6fb12dfe79 -DIST php-5.2.12.tar.bz2 9075161 RMD160 027f3597fd961d2a95682e2f0738415f8a911371 SHA1 6605f23b70e3db824047830f08d636e09ec10ff3 SHA256 e65756a8412726a491ca48da1e0693eaeb3f38f19fb6cbc8f53005cab1f2491a -DIST php-5.2.13.tar.bz2 9084518 RMD160 9e21d32a7b757d25ed827834b26235ea1eebfcc8 SHA1 7127a21f1b493e3cd43f45cadecdb46b623eb1fb SHA256 2b50a2535e3bb9a98cd4d1633f9452d877276c40b385915261f040d535c7eadb DIST php-5.2.14.tar.bz2 9055945 RMD160 f699488f5b266a1c5e36df570c4d5896dc4e0aea SHA1 311b44b2c0f2eea8ab8dab876d2a6b6e7a55632e SHA256 515b5fd41258798d59b93d86b0d752ab0b03e5738c32af444fba1907763c2bd1 DIST php-fpm-0.6~5.2.patch 285105 RMD160 297db9b433233abb0ee38a3e2d3744db36082e65 SHA1 3a8d0825cb6f728f5c9b9e956eb2221a9c07845c SHA256 569f07eb95cf258c655b0dcab2bf75b1b2ccc38d17f31b44d804790f5c2f0c54 -DIST php-patchset-5.2.12-r0.tar.bz2 10181 RMD160 e78dc3a500838e163da4eb5853dfe539430486c3 SHA1 91244c62af3ef3a0ebd1a396dbe22d2732512c89 SHA256 ca0cb19e98cb073fa0dd9157c728a9285b97198f1b522727e040f0f00dd8255f -DIST php-patchset-5.2.13-r0.tar.bz2 10207 RMD160 b367c17742553fcfbf4cb1b76f8dd4aae9f08cf8 SHA1 20b60e3aef34d0b558f0c896c6981957490b2ba9 SHA256 c71dad65178186786393164a0cb4f056b85f0e00579da3dc2dbe5b863ec4262b -DIST php-patchset-5.2.14-r0.tar.bz2 10414 RMD160 ce0d1dca4aaed5cd31bacd83e71711f4f2f4804d SHA1 2a0f77e69842481c9bb62960ddb9e35bfe8a5ab0 SHA256 3de5685514ff65fbaec71c4df93f14a0bb6b66de91b242d083e23329bf5c4bee -DIST suhosin-patch-5.2.11-0.9.7.patch.gz 23050 RMD160 0f6d442aace34c221f9fbff42a63e7f3b4489f15 SHA1 248419332131efc53f3306c2a57a4b1a9dc92cc1 SHA256 392f10c9b7d9c47f30e989fb7775cc46d36153b933bf7ac9ccd8826b2954584b -DIST suhosin-patch-5.2.13-0.9.7.patch.gz 22989 RMD160 63a022a5bf0fb8c6688f4c0ebcfaa8a437ea6935 SHA1 e2faf8db2d7facbd44cee2f737ce87732835d341 SHA256 787743e5d201ab2ce3fcc3f252eedd7f167470fa1f55af0646d7f03aab89d184 -EBUILD php-5.2.12.ebuild 19820 RMD160 6ac87ce3670630b5512b1f135022f517c5acf789 SHA1 ee7f7cdc7c0a6dfab3221796c693f8dfcf1e6b22 SHA256 9e1e9c20afe824d4bf21193492992de67cfad8faadf7e299fd3433d6eb5e97a2 -EBUILD php-5.2.13.ebuild 19875 RMD160 d8e0df3cd6a30868292d7481f3d7bf5a1e8e0b43 SHA1 5b466a8b1ffa095bad0bd21dbdd886e5e005005e SHA256 b1d3da5f2c7494550a0f35ba31b541cb390fd10b4f3331ec30918eed58ce26a3 -EBUILD php-5.2.14.ebuild 19875 RMD160 d8e0df3cd6a30868292d7481f3d7bf5a1e8e0b43 SHA1 5b466a8b1ffa095bad0bd21dbdd886e5e005005e SHA256 b1d3da5f2c7494550a0f35ba31b541cb390fd10b4f3331ec30918eed58ce26a3 +DIST php-patchset-5.2.14-r1.tar.bz2 8381 RMD160 7f562ac7df8f918f6d73f61c4e2096a88759889d SHA1 0453926bccfd5bd8089c311f6e16f1e4a8c08993 SHA256 f49aacef203cee8e7ad038492ed43e7677ed2d22e0fef07dc840195cacc95d34 +DIST suhosin-patch-5.2.14-0.9.7.patch.gz 23057 RMD160 bc7790cd36dc4101322684b754db3ca2d4385ba6 SHA1 0a12d3589f9c26dc7d6b6452ef7987b2e6527a30 SHA256 bd03ade44673f7e6fa116d746350f16c60be7170d6c41816a2d51faaeb5a31ae +EBUILD php-5.2.14.ebuild 9427 RMD160 3938fbbd9dc2225eb0d86bce094d2dceee120fa7 SHA1 949dca86aa77e114bdb91c52385483a97df7ed1f SHA256 674e48c9ac083397f1f01bed02a0d6921cb4a4b7c0efe8beae389f0f4078f08d diff --git a/dev-lang/php/files/70_mod_php5.conf-apache2 b/dev-lang/php/files/70_mod_php5.conf-apache2 new file mode 100644 index 0000000..7ec8739 --- /dev/null +++ b/dev-lang/php/files/70_mod_php5.conf-apache2 @@ -0,0 +1,14 @@ + + # Load the module first + + LoadModule php5_module modules/libphp5.so + + + # Set it to handle the files + + AddHandler application/x-httpd-php .php .php5 .phtml + AddHandler application/x-httpd-php-source .phps + + + DirectoryIndex index.php index.phtml + diff --git a/dev-lang/php/files/70_mod_php5_concurr.conf-apache2 b/dev-lang/php/files/70_mod_php5_concurr.conf-apache2 new file mode 100644 index 0000000..7ec8739 --- /dev/null +++ b/dev-lang/php/files/70_mod_php5_concurr.conf-apache2 @@ -0,0 +1,14 @@ + + # Load the module first + + LoadModule php5_module modules/libphp5.so + + + # Set it to handle the files + + AddHandler application/x-httpd-php .php .php5 .phtml + AddHandler application/x-httpd-php-source .phps + + + DirectoryIndex index.php index.phtml + diff --git a/dev-lang/php/files/eblits/common-v1.eblit b/dev-lang/php/files/eblits/common-v1.eblit new file mode 100644 index 0000000..ae21475 --- /dev/null +++ b/dev-lang/php/files/eblits/common-v1.eblit @@ -0,0 +1,9 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/common-v1.eblit,v 1.2 2010/10/08 18:25:10 olemarkus Exp $ + +php_set_ini_dir() { + PHP_INI_DIR="/etc/php/${1}-php${SLOT}" + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active" +} diff --git a/dev-lang/php/files/eblits/pkg_postinst-v1.eblit b/dev-lang/php/files/eblits/pkg_postinst-v1.eblit new file mode 100644 index 0000000..3441735 --- /dev/null +++ b/dev-lang/php/files/eblits/pkg_postinst-v1.eblit @@ -0,0 +1,72 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/pkg_postinst-v1.eblit,v 1.1 2010/05/27 23:05:04 mabi Exp $ + +eblit-php-pkg_postinst() { + # Output some general info to the user + if use apache2 ; then + APACHE2_MOD_DEFINE="PHP${PHP_MV}" + if use concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php${PHP_MV}_concurr" + else + APACHE2_MOD_CONF="70_mod_php${PHP_MV}" + fi + apache-module_pkg_postinst + fi + + # Update Apache2 to use mod_php + if use apache2 ; then + "${ROOT}/usr/sbin/php-select" -t apache2 php${PHP_MV} > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache2 php${PHP_MV} + elif [[ ${exitStatus} == 4 ]] ; then + ewarn "To make Apache2 use php-${PHP_MV}, use" + ewarn " php-select apache2 php${PHP_MV}" + ewarn + fi + fi + + # Create the symlinks for php-cli + if use cli ; then + "${ROOT}/usr/sbin/php-select" -t php php${PHP_MV} > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php php${PHP_MV} + elif [[ ${exitStatus} == 4 ]] ; then + ewarn "To make usr/bin/php point to php-${PHP_MV}, use" + ewarn " php-select php php${PHP_MV}" + ewarn + fi + fi + + # Create the symlinks for php-cgi + if use cgi ; then + "${ROOT}/usr/sbin/php-select" -t php-cgi php${PHP_MV} > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php-cgi php${PHP_MV} + elif [[ ${exitStatus} == 4 ]] ; then + ewarn "To make usr/bin/php-cgi point to php-${PHP_MV}, use" + ewarn " php-select php-cgi php${PHP_MV}" + ewarn + fi + fi + + # Create the symlinks for php-devel + "${ROOT}/usr/sbin/php-select" -t php-devel php${PHP_MV} > /dev/null 2>&1 + exitStatus=$? + if [[ $exitStatus == 5 ]] ; then + php-select php-devel php${PHP_MV} + elif [[ $exitStatus == 4 ]] ; then + ewarn "To make usr/bin/php-config and usr/bin/phpize point to php-${PHP_MV}, use" + ewarn " php-select php-devel php${PHP_MV}" + ewarn + fi + + ewarn "You may have to recompile third-party extensions now" + ewarn "(includes every dev-php5/pecl-* package and probably others in that category)" + ewarn +} + + diff --git a/dev-lang/php/files/eblits/pkg_setup-v1.eblit b/dev-lang/php/files/eblits/pkg_setup-v1.eblit new file mode 100644 index 0000000..f487a0b --- /dev/null +++ b/dev-lang/php/files/eblits/pkg_setup-v1.eblit @@ -0,0 +1,28 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/pkg_setup-v1.eblit,v 1.2 2010/07/08 22:39:52 mabi Exp $ + +eblit-php-pkg_setup() { + if use concurrentmodphp || use kolab ; then + ewarn "concurrentmodphp and kolab are Gentoo-specific experimental" + ewarn "patches. Before reporting any bugs to bugs.php.net, make sure to" + ewarn "rebuild PHP with those USE flags disabled" + ewarn + fi + + # Mail support + php_check_mta + + # imap support + # if virtuals/imap-c-client goes to new style virtual, we can exchange this + # for proper use-deps + php_check_imap + + # Oracle support + php_check_oracle_8 + + phpconfutils_warn_about_external_deps + depend.apache_pkg_setup +} + + diff --git a/dev-lang/php/files/eblits/src_compile-v1.eblit b/dev-lang/php/files/eblits/src_compile-v1.eblit new file mode 100644 index 0000000..cb0d56c --- /dev/null +++ b/dev-lang/php/files/eblits/src_compile-v1.eblit @@ -0,0 +1,60 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_compile-v1.eblit,v 1.6 2010/08/14 19:37:31 mabi Exp $ + +eblit-php-src_compile() { + # snmp seems to run during src_compile, too (bug #324739) + addpredict /usr/share/snmp/mibs/.index + + SAPI_DIR="${WORKDIR}/sapis" + + for sapi in ${SAPIS} ; do + use "${sapi}" || continue + + php_sapi_build "${sapi}" + php_sapi_copy "${sapi}" + done +} + +php_sapi_build() { + mkdir -p "${SAPI_DIR}/$1" + + cd "${WORKDIR}/sapis-build/$1" + emake || die "emake failed" +} + +php_sapi_copy() { + local sapi="$1" + local source="" + + case "$sapi" in + cli) + source="sapi/cli/php" + ;; + cgi) + source="sapi/cgi/php-cgi" + ;; + fpm) + source="sapi/fpm/php-fpm" + ;; + embed) + source="libs/libphp${PHP_MV}.so" + ;; + + apache2) + # apache2 is a special case; the necessary files + # (yes, multiple) are copied by make install, not + # by the ebuild; that's the reason, why apache2 has + # to be the last sapi + emake INSTALL_ROOT="${SAPI_DIR}/${sapi}/" install-sapi + ;; + + *) + die "unhandled sapi in php_sapi_copy" + ;; + esac + + if [[ "${source}" ]] ; then + cp "$source" "${SAPI_DIR}/$sapi" || die "Unable to copy ${sapi} SAPI" + fi +} diff --git a/dev-lang/php/files/eblits/src_configure-v52.eblit b/dev-lang/php/files/eblits/src_configure-v52.eblit new file mode 100644 index 0000000..421af93 --- /dev/null +++ b/dev-lang/php/files/eblits/src_configure-v52.eblit @@ -0,0 +1,296 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_configure-v52.eblit,v 1.5 2010/09/19 15:15:08 mabi Exp $ + +eblit-php-src_configure() { + export CFLAGS="${CFLAGS} -D_GNU_SOURCE" + PHP_DESTDIR="/usr/$(get_libdir)/php${SLOT}" + + # This is a global variable and should be in caps. It isn't because the + # phpconfutils eclass relies on exactly this name... + my_conf=" + --prefix="${PHP_DESTDIR}" + --mandir="${PHP_DESTDIR}"/man + --infodir="${PHP_DESTDIR}"/info + --libdir="${PHP_DESTDIR}"/lib + --with-libdir=$(get_libdir) + --without-pear + $(use_enable threads maintainer-zts)" + + phpconfutils_init + + # extension USE flag shared + phpconfutils_extension_enable "bcmath" "bcmath" 1 + phpconfutils_extension_with "bz2" "bzip2" 1 + phpconfutils_extension_enable "calendar" "calendar" 1 + phpconfutils_extension_disable "ctype" "ctype" 0 + phpconfutils_extension_with "curl" "curl" 1 + phpconfutils_extension_with "curlwrappers" "curlwrappers" 0 + phpconfutils_extension_enable "dbase" "dbase" 1 + phpconfutils_extension_disable "dom" "xml" 0 + phpconfutils_extension_enable "exif" "exif" 1 + phpconfutils_extension_with "fbsql" "frontbase" 1 + phpconfutils_extension_with "fdftk" "fdftk" 1 "/opt/fdftk-6.0" + phpconfutils_extension_disable "filter" "filter" 0 + phpconfutils_extension_enable "ftp" "ftp" 1 + phpconfutils_extension_with "gettext" "nls" 1 + phpconfutils_extension_with "gmp" "gmp" 1 + phpconfutils_extension_disable "hash" "hash" 0 + phpconfutils_extension_without "iconv" "iconv" 0 + phpconfutils_extension_disable "ipv6" "ipv6" 0 + phpconfutils_extension_disable "json" "json" 0 + phpconfutils_extension_with "kerberos" "kerberos" 0 "/usr" + phpconfutils_extension_disable "libxml" "xml" 0 + phpconfutils_extension_enable "mbstring" "unicode" 1 + phpconfutils_extension_with "mcrypt" "crypt" 1 + phpconfutils_extension_with "mhash" "mhash" 1 + phpconfutils_extension_with "msql" "msql" 1 + phpconfutils_extension_with "mssql" "mssql" 1 + phpconfutils_extension_with "ncurses" "ncurses" 1 + phpconfutils_extension_with "openssl" "ssl" 0 + phpconfutils_extension_with "openssl-dir" "ssl" 0 "/usr" + phpconfutils_extension_enable "pcntl" "pcntl" 1 + phpconfutils_extension_without "pcre-regex" "pcre" 0 + phpconfutils_extension_disable "pdo" "pdo" 0 + phpconfutils_extension_with "pgsql" "postgres" 1 + phpconfutils_extension_disable "posix" "posix" 0 + phpconfutils_extension_with "pspell" "spell" 1 + phpconfutils_extension_with "recode" "recode" 1 + phpconfutils_extension_disable "reflection" "reflection" 0 + phpconfutils_extension_disable "simplexml" "simplexml" 0 + phpconfutils_extension_enable "shmop" "sharedmem" 0 + phpconfutils_extension_with "snmp" "snmp" 1 + phpconfutils_extension_enable "soap" "soap" 1 + phpconfutils_extension_enable "sockets" "sockets" 1 + phpconfutils_extension_disable "spl" "spl" 0 + phpconfutils_extension_with "sybase-ct" "sybase-ct" 1 + phpconfutils_extension_enable "sysvmsg" "sysvipc" 1 + phpconfutils_extension_enable "sysvsem" "sysvipc" 1 + phpconfutils_extension_enable "sysvshm" "sysvipc" 1 + phpconfutils_extension_with "tidy" "tidy" 1 + phpconfutils_extension_disable "tokenizer" "tokenizer" 0 + phpconfutils_extension_enable "wddx" "wddx" 1 + phpconfutils_extension_disable "xml" "xml" 0 + phpconfutils_extension_disable "xmlreader" "xmlreader" 0 + phpconfutils_extension_disable "xmlwriter" "xmlwriter" 0 + phpconfutils_extension_with "xmlrpc" "xmlrpc" 1 + phpconfutils_extension_with "xsl" "xsl" 1 + phpconfutils_extension_enable "zip" "zip" 1 + phpconfutils_extension_with "zlib" "zlib" 1 + phpconfutils_extension_enable "debug" "debug" 0 + + # DBA support + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \ + || use qdbm ; then + my_conf="${my_conf} --enable-dba${shared}" + fi + + # DBA drivers support + phpconfutils_extension_with "cdb" "cdb" 0 + phpconfutils_extension_with "db4" "berkdb" 0 + phpconfutils_extension_enable "flatfile" "flatfile" 0 + phpconfutils_extension_with "gdbm" "gdbm" 0 + phpconfutils_extension_enable "inifile" "inifile" 0 + phpconfutils_extension_with "qdbm" "qdbm" 0 + + # Support for the GD graphics library + if use 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_with "gd" "gd-external" 1 "/usr" + else + phpconfutils_extension_with "freetype-dir" "truetype" 0 "/usr" + phpconfutils_extension_with "t1lib" "truetype" 0 "/usr" + phpconfutils_extension_enable "gd-jis-conv" "cjk" 0 + phpconfutils_extension_with "jpeg-dir" "gd" 0 "/usr" + phpconfutils_extension_with "png-dir" "gd" 0 "/usr" + phpconfutils_extension_with "xpm-dir" "xpm" 0 "/usr" + # enable gd last, so configure can pick up the previous settings + phpconfutils_extension_with "gd" "gd" 0 + fi + + # IMAP support + if use imap ; then + phpconfutils_extension_with "imap" "imap" 1 + phpconfutils_extension_with "imap-ssl" "ssl" 0 + fi + + phpconfutils_extension_with "interbase" "interbase" 0 "/opt" + phpconfutils_extension_with "interbase" "firebird" 0 "/usr" + + # LDAP support + if use ldap ; then + if use oci8 ; then + phpconfutils_extension_with "ldap" "ldap" 1 "${ORACLE_HOME}" + else + phpconfutils_extension_with "ldap" "ldap" 1 + phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0 + fi + fi + + # MySQL support + if use mysql ; then + phpconfutils_extension_with "mysql" "mysql" 1 "/usr" + phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock" + fi + + # MySQLi support + phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config" + + # ODBC support + if use odbc ; then + phpconfutils_extension_with "unixODBC" "odbc" 1 "/usr" + phpconfutils_extension_with "adabas" "adabas" 1 + phpconfutils_extension_with "birdstep" "birdstep" 1 + phpconfutils_extension_with "dbmaker" "dbmaker" 1 + phpconfutils_extension_with "empress" "empress" 1 + if use empress ; then + phpconfutils_extension_with "empress-bcs" "empress-bcs" 0 + fi + phpconfutils_extension_with "esoob" "esoob" 1 + # Needed to run conftest for IBM DB2 + [[ -n ${DB2_HOME} ]] && export LD_LIBRARY_PATH="${DB2_HOME}/`get_libdir`" + phpconfutils_extension_with "ibm-db2" "db2" 1 "${DB2_HOME}" + phpconfutils_extension_with "sapdb" "sapdb" 1 + phpconfutils_extension_with "solid" "solid" 1 + fi + + if use iodbc ; then + phpconfutils_extension_with "iodbc" "iodbc" 1 "/usr" + fi + + # Oracle support + phpconfutils_extension_with "oci8" "oci8" 1 + if use oci8-instant-client ; then + OCI8IC_PKG="$(best_version dev-db/oracle-instantclient-basic | \ + sed -e 's|dev-db/oracle-instantclient-basic-||g' | \ + sed -e 's|-r.*||g')" + + phpconfutils_extension_with "oci8" "oci8-instant-client" 1 \ + "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib" + fi + + # PDO support + if use pdo ; then + phpconfutils_extension_with "pdo-dblib" "mssql" 1 + phpconfutils_extension_with "pdo-mysql" "mysql" 1 "/usr" + phpconfutils_extension_with "pdo-pgsql" "postgres" 1 + phpconfutils_extension_with "pdo-sqlite" "sqlite" 1 "/usr" + phpconfutils_extension_with "pdo-odbc" "odbc" 1 "unixODBC,/usr" + if use oci8 ; then + phpconfutils_extension_with "pdo-oci" "oci8" 1 + fi + if use oci8-instant-client ; then + phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 \ + "instantclient,/usr,${OCI8IC_PKG}" + fi + fi + + # readline/libedit support + phpconfutils_extension_with "readline" "readline" 0 + phpconfutils_extension_with "libedit" "libedit" 0 + + # Session support + if use session ; then + phpconfutils_extension_with "mm" "sharedmem" 0 + else + phpconfutils_extension_disable "session" "session" 0 + fi + + # SQLite support + if use sqlite ; then + phpconfutils_extension_with "sqlite" "sqlite" 0 "/usr" + phpconfutils_extension_enable "sqlite-utf8" "unicode" 0 + else + phpconfutils_extension_without "sqlite" "sqlite" 0 + fi + + if use pic ; then + my_conf="${my_conf} --with-pic" + fi + + # we use the system copy of pcre + # --with-pcre-regex affects ext/pcre + # --with-pcre-dir affects ext/filter and ext/zip + if use pcre ; then + my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr" + fi + + # Catch CFLAGS problems + php_check_cflags + + # Support user-passed configuration parameters + my_conf="${my_conf} ${EXTRA_ECONF:-}" + + # Support the Apache2 extras, they must be set globally for all + # SAPIs to work correctly, especially for external PHP extensions + if use apache2 ; then + # Concurrent PHP Apache2 modules support + if use concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php${PHP_MV}-ldvs" + fi + fi + + mkdir -p "${WORKDIR}/sapis-build" + for one_sapi in $SAPIS ; do + use "${one_sapi}" || continue + php_set_ini_dir "${one_sapi}" + + cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}" + cd "${WORKDIR}/sapis-build/${one_sapi}" + + sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR} + --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}" + + for sapi in $SAPIS ; do + case "$sapi" in + cli|embed) + if [[ "${one_sapi}" == "${sapi}" ]] ; then + sapi_conf="${sapi_conf} --enable-${sapi}" + else + sapi_conf="${sapi_conf} --disable-${sapi}" + fi + ;; + + fpm) + if [[ "${one_sapi}" == "${sapi}" ]] ; then + sapi_conf="${sapi_conf} \ + --with-fpm \ + --with-libevent=shared,/usr/lib \ + --with-fpm-conf=/etc/php/fpm-php5/php-fpm.conf \ + --with-fpm-user=php-fpm \ + --with-fpm-group=php-fpm \ + --with-fpm-log=/var/log/php-fpm.log \ + --with-fpm-pid=/var/run/php-fpm.pid" + sapi_conf+=" --enable-cgi --enable-fastcgi" + use discard-path && sapi_conf+=" --enable-discard-path" + use force-cgi-redirect && sapi_conf+=" --enable-force-cgi-redirect" + else + sapi_conf+=" --without-fpm" + fi + ;; + + cgi) + if [[ "${one_sapi}" == "${sapi}" ]] ; then + sapi_conf+=" --enable-cgi --enable-fastcgi" + use discard-path && sapi_conf+=" --enable-discard-path" + use force-cgi-redirect && sapi_conf+=" --enable-force-cgi-redirect" + else + sapi_conf+=" --disable-${sapi}" + fi + ;; + + apache2) + if [[ "${one_sapi}" == "${sapi}" ]] ; then + sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs" + else + sapi_conf="${sapi_conf} --without-apxs2" + fi + ;; + esac + done + + econf ${sapi_conf} + done +} diff --git a/dev-lang/php/files/eblits/src_install-v1.eblit b/dev-lang/php/files/eblits/src_install-v1.eblit new file mode 100644 index 0000000..4ec1324 --- /dev/null +++ b/dev-lang/php/files/eblits/src_install-v1.eblit @@ -0,0 +1,156 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_install-v1.eblit,v 1.10 2010/08/11 19:13:32 mabi Exp $ + +eblit-php-src_install() { + # see bug #324739 for what happens when we don't have that + addpredict /usr/share/snmp/mibs/.index + + # grab the first SAPI that got built and install common files from there + local first_sapi="" + for sapi in $SAPIS ; do + if use $sapi ; then + first_sapi=$sapi + break + fi + done + + # Makefile forgets to create this before trying to write to it... + dodir "${PHP_DESTDIR}/bin" + + # Install php environment (without any sapis) + cd "${WORKDIR}/sapis-build/$first_sapi" + emake INSTALL_ROOT="${D}" \ + install-build install-headers install-programs \ + || die "emake install failed" + + local extension_dir="$("${D}/${PHP_DESTDIR}/bin/php-config" --extension-dir)" + + # And install the modules to it + if use sharedext ; then + insinto "${extension_dir}" + doins "${WORKDIR}/sapis-build/${first_sapi}/modules/"*.so + fi + + # Generate the USE file for PHP + phpconfutils_generate_usefile + + # Create the directory where we'll put version-specific php scripts + keepdir /usr/share/php${PHP_MV} + + local sapi="", file="" + local sapi_list="" + + for sapi in ${SAPIS}; do + if use "${sapi}" ; then + einfo "Installing SAPI: ${sapi}" + cd "${WORKDIR}/sapis-build/${sapi}" + # needed each time, php_install_ini would reset it + into "${PHP_DESTDIR}" + file=$(find "${SAPI_DIR}/${sapi}/" -type f | head -n 1) + + if [[ "${file: -3}" == ".so" ]]; then + if [[ "${sapi}" == "apache2" ]]; then + insinto "${PHP_DESTDIR}/../apache2/modules/" + newins "${file}" "${file/*\/}" + else + dolib.so "${file}" || die "Unable to install ${sapi} sapi" + fi + else + dobin "${file}" || die "Unable to install ${sapi} sapi" + fi + + php_install_ini "${sapi}" + + # construct correct SAPI string for php-config + # thanks to ferringb for the bash voodoo + if [[ "${sapi}" == "apache2" ]]; then + sapi_list="${sapi_list:+${sapi_list} }apache2handler" + else + sapi_list="${sapi_list:+${sapi_list} }${sapi}" + fi + fi + done + + # Install env.d files + newenvd "${FILESDIR}/20php${PHP_MV}-envd" \ + "20php${PHP_MV}" + sed -e "s|/lib/|/$(get_libdir)/|g" -i \ + "${D}/etc/env.d/20php${PHP_MV}" + + # set php-config variable correctly (bug #278439) + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \ + "${D}/usr/$(get_libdir)/php5/bin/php-config" +} + +php_install_ini() { + local phpsapi="${1}" + + # work out where we are installing the ini file + php_set_ini_dir "${phpsapi}" + + local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}" + cp "${PHP_INI_UPSTREAM}" "${phpinisrc}" + + # default to expose_php=Off, bug 300695 + sed -e 's|^expose_php .*|expose_php = Off|g' -i "${phpinisrc}" + + # default to /tmp for save_path, bug #282768 + sed -e 's|^;session.save_path .*$|session.save_path = "/tmp"|g' -i "${phpinisrc}" + + # Set the extension dir + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}" + + # Set the include path to point to where we want to find PEAR packages + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php'${PHP_MV}':/usr/share/php"|' -i "${phpinisrc}" + + dodir "${PHP_INI_DIR}" + insinto "${PHP_INI_DIR}" + newins "${phpinisrc}" "${PHP_INI_FILE}" + + dodir "${PHP_EXT_INI_DIR}" + dodir "${PHP_EXT_INI_DIR_ACTIVE}" + + # Install any extensions built as shared objects + if use sharedext ; then + insinto "${PHP_EXT_INI_DIR}" + for extension in "${D}/${extension_dir}/"*.so ; do + extension="${extension##*/}" + inifilename="${extension/.so/.ini}" + echo "extension=${extension}" > "${WORKDIR}/sapis-build/${phpsapi}/modules/$inifilename" + doins "${WORKDIR}/sapis-build/${phpsapi}/modules/$inifilename" + dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}" + done + fi + + # SAPI-specific handling + if [[ "${sapi}" == "apache2" ]] ; then + if use concurrentmodphp ; then + einfo "Installing Apache2 config file 70_mod_php${PHP_MV}_concurr.conf" + insinto "${APACHE_MODULES_CONFDIR}" + newins "${FILESDIR}/70_mod_php${PHP_MV}_concurr.conf-apache2" \ + "70_mod_php${PHP_MV}_concurr.conf" + + # Put the ld version script in the right place so + # it's always accessible + insinto "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/" + doins "${FILESDIR}/php${PHP_MV}-ldvs" + else + einfo "Installing Apache2 config 70_mod_php${PHP_MV}.conf" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php${PHP_MV}.conf-apache2" \ + "70_mod_php${PHP_MV}.conf" + fi + fi + + if [[ "${sapi}" == "fpm" ]] ; then + einfo "Installing FPM CGI config file php-fpm.conf" + insinto ${PHP_INI_DIR} + newins "${WORKDIR}/sapis-build/fpm/sapi/fpm/php_fpm.conf" "php-fpm.conf" + dodir "/etc/init.d" + insinto "/etc/init.d" + newins "${FILESDIR}/php-fpm.init" "php-fpm" + fperms 755 "/etc/init.d/php-fpm" + dosym "${PHP_DESTDIR}/bin/php-fpm" "/usr/bin/php-fpm" + fi +} diff --git a/dev-lang/php/files/eblits/src_prepare-v1.eblit b/dev-lang/php/files/eblits/src_prepare-v1.eblit new file mode 100644 index 0000000..d6856b8 --- /dev/null +++ b/dev-lang/php/files/eblits/src_prepare-v1.eblit @@ -0,0 +1,70 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_prepare-v1.eblit,v 1.3 2010/06/01 16:17:05 mabi Exp $ + +eblit-php-src_prepare() { + # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path + # ([empty session.save_path]/session_mm_[sapi][gid].sem) + # there is no easy way to circumvent that, all php calls during + # install use -n, so no php.ini file will be used. + # As such, this is the easiest way to get around + addpredict /session_mm_cli250.sem + addpredict /session_mm_cli0.sem + + # Concurrent PHP Apache2 modules support + use apache2 && use concurrentmodphp && \ + epatch "${WORKDIR}/${PV}/opt/concurrent_apache_modules.patch" + + # kolab support (support for imap annotations) + use kolab && epatch "${WORKDIR}/${PV}/opt/imap-kolab-annotations.patch" + + # Change PHP branding + sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-pl${PR/r/}-gentoo\2|g" \ + -i configure.in || die "Unable to change PHP branding" + + # Apply generic PHP patches + EPATCH_SOURCE="${WORKDIR}/${PV}/generic" EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch + + # Patch PHP to show Gentoo as the server platform + sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \ + -i configure.in || die "Failed to fix server platform name" + + # Prevent PHP from activating the Apache config, + # as we will do that ourselves + sed -i \ + -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \ + -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \ + configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 + + # Patch PHP to support heimdal instead of mit-krb5 + if has_version "app-crypt/heimdal" ; then + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \ + || die "Failed to fix heimdal libname" + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \ + || die "Failed to fix heimdal crypt library reference" + fi + + # Suhosin support + if use suhosin ; then + epatch "${WORKDIR}/${SUHOSIN_PATCH}" + fi + + # rebuild the whole autotools stuff as we are heavily patching it + # (suhosin, fastbuild, ...) + + # eaclocal doesn't accept --force, so we try to force re-generation + # this way + rm aclocal.m4 + + # work around divert() issues with newer autoconf, bug #281697 + if has_version '>=sys-devel/autoconf-2.64' ; then + sed -i -r \ + -e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \ + $(grep -l divert $(find . -name '*.m4') configure.in) || die + fi + eautoreconf --force -W no-cross +} + + diff --git a/dev-lang/php/files/eblits/src_test-v1.eblit b/dev-lang/php/files/eblits/src_test-v1.eblit new file mode 100644 index 0000000..95ebc7d --- /dev/null +++ b/dev-lang/php/files/eblits/src_test-v1.eblit @@ -0,0 +1,54 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_test-v1.eblit,v 1.2 2010/08/09 10:47:57 mabi Exp $ + +eblit-php-src_test() { + vecho ">>> Test phase [test]: ${CATEGORY}/${PF}" + + if [[ ! -x "${WORKDIR}/sapis/cli/php" ]] ; then + ewarn "Test phase requires USE=cli, skipping" + return + else + export TEST_PHP_EXECUTABLE="${WORKDIR}/sapis/cli/php" + fi + + if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi" + fi + + + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \ + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}" + + for name in ${EXPECTED_TEST_FAILURES}; do + mv "${name}.out" "${name}.out.orig" 2>/dev/null + done + + local failed="$(find -name '*.out')" + if [[ ${failed} != "" ]] ; then + ewarn "The following test cases failed unexpectedly:" + for name in ${failed}; do + ewarn " ${name/.out/}" + done + else + einfo "No unexpected test failures, all fine" + fi + + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then + local passed="" + for name in ${EXPECTED_TEST_FAILURES}; do + [[ -f "${name}.diff" ]] && continue + passed="${passed} ${name}" + done + if [[ ${passed} != "" ]] ; then + einfo "The following test cases passed unexpectedly:" + for name in ${passed}; do + ewarn " ${passed}" + done + else + einfo "None of the known-to-fail tests passed, all fine" + fi + fi +} + + diff --git a/dev-lang/php/files/php-fpm.init b/dev-lang/php/files/php-fpm.init index 5fb07f3..e0965bc 100644 --- a/dev-lang/php/files/php-fpm.init +++ b/dev-lang/php/files/php-fpm.init @@ -8,14 +8,14 @@ depend() { start() { ebegin "Starting PHP FastCGI server" - start-stop-daemon --quiet --start --pidfile=/var/run/php-fpm.pid \ - --exec /usr/lib/php5/bin/php-fpm + start-stop-daemon --start --pidfile=/var/run/php-fpm.pid \ + --exec /usr/bin/php-fpm eend $? } stop() { ebegin "Stopping PHP FastCGI server" - start-stop-daemon --quiet --stop --pidfile=/var/run/php-fpm.pid + start-stop-daemon --stop --pidfile=/var/run/php-fpm.pid eend $? } diff --git a/dev-lang/php/php-5.2.12.ebuild b/dev-lang/php/php-5.2.12.ebuild deleted file mode 100644 index 01fc87c..0000000 --- a/dev-lang/php/php-5.2.12.ebuild +++ /dev/null @@ -1,639 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.2.12.ebuild,v 1.8 2010/01/05 19:56:43 armin76 Exp $ - -CGI_SAPI_USE="discard-path force-cgi-redirect" -APACHE2_SAPI_USE="concurrentmodphp threads" -IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild fpm" - -KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd" - -# NOTE: Portage doesn't support setting PROVIDE based on the USE flags -# that have been enabled, so we have to PROVIDE everything for now -# and hope for the best -PROVIDE="virtual/php virtual/httpd-php" - -# php package settings -SLOT="5" -MY_PHP_PV="${PV}" -MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE="1" -# php patch settings, general -PHP_PATCHSET_REV="${PR/r/}" -PHP_PATCHSET_URI="http://dev.gentoo.org/~hoffie/distfiles/php-patchset-${PV}-r${PHP_PATCHSET_REV}.tar.bz2" -SUHOSIN_PATCH="suhosin-patch-5.2.11-0.9.7.patch.gz" -FPM_PATCH="php-fpm-0.6~5.2.patch" -MULTILIB_PATCH="${MY_PHP_PV}/opt/multilib-search-path.patch" -# php patch settings, ebuild specific -FASTBUILD_PATCH="${MY_PHP_PV}/opt/fastbuild.patch" -CONCURRENTMODPHP_PATCH="${MY_PHP_PV}/opt/concurrent_apache_modules.patch" -# kolab patch - http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/patches/php/ -# bugs about this go to wrobel@gentoo.org -KOLAB_PATCH="${MY_PHP_PV}/opt/kolab-imap-annotations.patch" - -inherit versionator php5_2-sapi apache-module - -# Suhosin patch support -[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )" - -# FPM patch support -[[ -n "${FPM_PATCH}" ]] && SRC_URI="${SRC_URI} fpm? ( http://code.launchpad.net/php-fpm/master/0.6/+download/${FPM_PATCH} )" - -DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache2 SAPIs." - -DEPEND="app-admin/php-toolkit - fpm? ( >=dev-libs/libxml2-2.7.2-r2 >=dev-libs/libevent-1.4.11 ) - imap? ( >=virtual/imap-c-client-2006k ) - pcre? ( >=dev-libs/libpcre-7.8 ) - xml? ( >=dev-libs/libxml2-2.7.2-r2 ) - xmlrpc? ( >=dev-libs/libxml2-2.7.2-r2 virtual/libiconv )" - -RDEPEND="${DEPEND}" -if [[ -n "${KOLAB_PATCH}" ]] ; then - IUSE="${IUSE} kolab" - DEPEND="${DEPEND} - kolab? ( >=net-libs/c-client-2004g-r1 )" -fi - -PDEPEND="suhosin? ( >=dev-php5/suhosin-0.9.29 )" - -want_apache - -pkg_setup() { - PHPCONFUTILS_AUTO_USE="" - - # Make sure the user has specified at least one SAPI - einfo "Determining SAPI(s) to build" - phpconfutils_require_any " Enabled SAPI:" " Disabled SAPI:" cli cgi apache2 - - # php-fpm patch support - if use fpm && ! use cgi ; then - eerror - eerror "You must enable CGI SAPI for php-fpm patch to work" - eerror - ebeep 1 - die - fi - - # Threaded Apache2 support - if use apache2 ; then - has_apache_threads - fi - - # Concurrent PHP Apache2 modules support - if use apache2 ; then - if use concurrentmodphp ; then - ewarn - ewarn "'concurrentmodphp' makes it possible to load multiple, differently" - ewarn "versioned mod_php's into the same Apache instance. This is done with" - ewarn "a few linker tricks and workarounds, and is not guaranteed to always" - ewarn "work correctly, so use it at your own risk. Especially, do not use" - ewarn "this in conjunction with PHP modules (PECL, ...) other than the ones" - ewarn "you may find in the Portage tree or the PHP Overlay!" - ewarn "This is an experimental feature, so please rebuild PHP" - ewarn "without the 'concurrentmodphp' USE flag if you experience" - ewarn "any problems, and then reproduce any bugs before filing" - ewarn "them in Gentoo's Bugzilla or bugs.php.net." - ewarn "If you have conclusive evidence that a bug directly" - ewarn "derives from 'concurrentmodphp', please file a bug in" - ewarn "Gentoo's Bugzilla only." - ewarn - ebeep 5 - fi - fi - - # fastbuild support - if use fastbuild ; then - ewarn - ewarn "'fastbuild' attempts to build all SAPIs in a single pass." - ewarn "This is an experimental feature, so please rebuild PHP" - ewarn "without the 'fastbuild' USE flag if you experience" - ewarn "any problems, and then reproduce any bugs before filing" - ewarn "them in Gentoo's Bugzilla or bugs.php.net." - ewarn "If you have conclusive evidence that a bug directly" - ewarn "derives from 'fastbuild', please file a bug in" - ewarn "Gentoo's Bugzilla only." - ewarn - fi - - if use pcre ; then - built_with_use dev-libs/libpcre unicode || \ - die "Please rebuild dev-libs/libpcre with USE=unicode" - fi - - depend.apache_pkg_setup - php5_2-sapi_pkg_setup -} - -php_determine_sapis() { - # holds the list of sapis that we want to build - PHPSAPIS= - - if use cli || phpconfutils_usecheck cli ; then - PHPSAPIS="${PHPSAPIS} cli" - fi - - if use cgi ; then - PHPSAPIS="${PHPSAPIS} cgi" - fi - - if use fpm ; then - PHPSAPIS="${PHPSAPIS} fpm" - fi - - # note - apache SAPI comes after the simpler cli/cgi sapis - if use apache2 ; then - PHPSAPIS="${PHPSAPIS} apache${APACHE_VERSION}" - fi -} - -src_unpack() { - if [[ "${PHP_PACKAGE}" == 1 ]] ; then - unpack ${A} - fi - - cd "${S}" - - # php-fpm support - if use fpm ; then - EPATCH_OPTS="-p1 -d ${S}" epatch "${DISTDIR}/${FPM_PATCH}" - fi - - # Concurrent PHP Apache2 modules support - if use apache2 ; then - if use concurrentmodphp ; then - if [[ -n "${CONCURRENTMODPHP_PATCH}" ]] && [[ -f "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" ]] ; then - epatch "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" - else - ewarn "There is no concurrent mod_php patch available for this PHP release yet!" - fi - fi - fi - - # fastbuild support - if use fastbuild ; then - if [[ -n "${FASTBUILD_PATCH}" ]] && [[ -f "${WORKDIR}/${FASTBUILD_PATCH}" ]] ; then - epatch "${WORKDIR}/${FASTBUILD_PATCH}" - else - ewarn "There is no fastbuild patch available for this PHP release yet!" - fi - fi - - # kolab support - if [[ -n "${KOLAB_PATCH}" ]] ; then - use kolab && epatch "${WORKDIR}/${KOLAB_PATCH}" - fi - - # pretend to not have flex, bug 221357 - sed -re 's:( +)PHP_SUBST\(LEX\):\1LEX="exit 0;"\n\0:' -i acinclude.m4 - - # Now let the eclass do the rest and regenerate the configure - php5_2-sapi_src_unpack - - # Fix Makefile.global:test to consider the CGI SAPI if present - if use cgi ; then - sed -e "s|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\"|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\" \&\& test \! -z \"\$(top_builddir)/php-cgi\" \&\& test -x \"\$(top_builddir)/php-cgi\"|g" -i Makefile.global - sed -e "s|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\"|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\" TEST_PHP_CGI_EXECUTABLE=\"\$(top_builddir)/php-cgi\"|g" -i Makefile.global - fi - - # try to fix some test cases which fail because of sandbox otherwise - sed -e 's:/no/such/:.\0:' -i ext/standard/tests/file/005_error.phpt \ - ext/standard/tests/file/006_error.phpt \ - ext/standard/tests/file/touch.phpt - - # REMOVING BROKEN TESTS: - # removing this test as it has been broken for ages and is not easily - # fixable (depends on a lot of factors) - rm ext/standard/tests/general_functions/phpinfo.phpt - - # never worked properly, no easy fix - rm ext/iconv/tests/iconv_stream_filter.phpt - - # needs write access to /tmp and others - rm ext/session/tests/session_save_path_variation5.phpt - - # new tests since 5.2.7 which have never been working for me - rm ext/spl/tests/arrayObject___construct_basic4.phpt \ - ext/spl/tests/arrayObject___construct_basic5.phpt \ - ext/spl/tests/arrayObject_exchangeArray_basic3.phpt \ - ext/spl/tests/arrayObject_setFlags_basic1.phpt - - # those might as well be related to suhosin - rm ext/session/tests/session_decode_variation3.phpt \ - ext/session/tests/session_encode_variation8.phpt - - # missing skipif - use reflection || \ - rm ext/standard/tests/directory/DirectoryClass_basic_001.phpt - - # sandbox-related (sandbox checks for permissions before even looking - # at the fs, but the tests expect "No such file or directory" - sed -e 's:/blah:./bla:' -i \ - ext/session/tests/session_save_path_variation{2,3}.phpt - rm ext/standard/tests/file/rename_variation13.phpt - - # test passes, but run-tests.php claims failure - rm ext/standard/tests/file/tempnam_variation4.phpt - - # these tests behave differently with suhosin enabled, adapting them... - use suhosin && sed -e 's:File(\.\./):File(..):g' -i \ - tests/security/open_basedir*{.inc,.phpt} -} - -src_compile() { - # bug 217392 (autconf-2.62 behavior changes) - export CFLAGS="${CFLAGS} -D_GNU_SOURCE" - export CXXFLAGS="${CXXFLAGS} -D_GNU_SOURCE" - if use fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then - src_compile_fastbuild - else - src_compile_normal - fi -} - -src_compile_fastbuild() { - php_determine_sapis - - build_cli=0 - build_cgi=0 - build_fpm=0 - build_apache2=0 - my_conf="" - - for x in ${PHPSAPIS} ; do - case ${x} in - cli) - build_cli=1 - ;; - cgi) - build_cgi=1 - ;; - fpm) - build_fpm=1 - ;; - apache2) - build_apache2=1 - ;; - esac - done - - if [[ ${build_cli} = 1 ]] ; then - my_conf="${my_conf} --enable-cli" - else - my_conf="${my_conf} --disable-cli" - fi - - if [[ ${build_cgi} = 1 ]] ; then - my_conf="${my_conf} --enable-cgi --enable-fastcgi" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - else - my_conf="${my_conf} --disable-cgi" - fi - - if [[ ${build_fpm} = 1 ]] ; then - my_conf="${my_conf} \ - --with-fpm \ - --with-libevent=shared,/usr/lib \ - --with-fpm-conf=/etc/php/fpm-php5/php-fpm.conf \ - --with-fpm-user=php-fpm \ - --with-fpm-group=php-fpm \ - --with-fpm-log=/var/log/php-fpm.log \ - --with-fpm-pid=/var/run/php-fpm.pid" - fi - - if [[ ${build_apache2} = 1 ]] ; then - my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" - - # Threaded Apache2 support - if use threads ; then - my_conf="${my_conf} --enable-maintainer-zts" - ewarn "Enabling ZTS for Apache2 MPM" - fi - - # Concurrent PHP Apache2 modules support - if use concurrentmodphp ; then - append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" - fi - fi - - if use pcre || phpconfutils_usecheck pcre ; then - myconf="${my_conf} --with-pcre-dir=/usr" - phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr" - fi - - # Now we know what we are building, build it - php5_2-sapi_src_compile - - # To keep the separate php.ini files for each SAPI, we change the - # build-defs.h and recompile - - if [[ ${build_cli} = 1 ]] ; then - einfo - einfo "Building CLI SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cli-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cli-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/cli/php || die "Unable to make CLI SAPI" - cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" - fi - - if [[ ${build_cgi} = 1 ]] ; then - einfo - einfo "Building CGI SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cgi-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cgi-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/cgi/php-cgi || die "Unable to make CGI SAPI" - cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI" - fi - - if [[ ${build_fpm} = 1 ]] ; then - einfo - einfo "Building FPM SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/fpm-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/fpm-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/fpm/php-fpm || die "Unable to make FPM SAPI" - cp sapi/fpm/php-fpm php-fpm || die "Unable to copy FPM SAPI" - fi - - if [[ ${build_apache2} = 1 ]] ; then - einfo - einfo "Building apache${APACHE_VERSION} SAPI" - einfo - - sed -e "s|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH \"/etc/php/apache${APACHE_VERSION}-php5\"|g;" -i main/build-defs.h - sed -e "s|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR \"/etc/php/apache${APACHE_VERSION}-php5/ext-active\"|g;" -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make || die "Unable to make apache${APACHE_VERSION} SAPI" - fi -} - -src_compile_normal() { - php_determine_sapis - - CLEAN_REQUIRED=0 - my_conf="" - - # Support the Apache2 extras, they must be set globally for all - # SAPIs to work correctly, especially for external PHP extensions - if use apache2 ; then - # Concurrent PHP Apache2 modules support - if use concurrentmodphp ; then - append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" - fi - fi - - for x in ${PHPSAPIS} ; do - if use pcre || phpconfutils_usecheck pcre ; then - myconf="${my_conf} --with-pcre-dir=/usr" - phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr" - fi - - # Support the Apache2 extras, they must be set globally for all - # SAPIs to work correctly, especially for external PHP extensions - if use apache2 ; then - # Threaded Apache2 support - if use threads ; then - my_conf="${my_conf} --enable-maintainer-zts" - ewarn "Enabling ZTS for Apache2 MPM" - fi - fi - - if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then - make clean - fi - - PHPSAPI="${x}" - - case ${x} in - cli) - my_conf="${my_conf} --enable-cli --disable-cgi" - php5_2-sapi_src_compile - cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" - ;; - cgi) - my_conf="${my_conf} --disable-cli --enable-cgi --enable-fastcgi" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - php5_2-sapi_src_compile - cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI" - ;; - fpm) - my_conf="${my_conf} \ - --with-fpm \ - --with-libevent=shared,/usr/lib \ - --with-fpm-conf=/etc/php/fpm-php5/php-fpm.conf \ - --with-fpm-user=php-fpm \ - --with-fpm-group=php-fpm \ - --with-fpm-log=/var/log/php-fpm.log \ - --with-fpm-pid=/var/run/php-fpm.pid" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - php5_2-sapi_src_compile - cp sapi/fpm/php-fpm php-fpm || die "Unable to copy CGI SAPI" - ;; - apache2) - my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" - php5_2-sapi_src_compile - ;; - esac - - CLEAN_REQUIRED=1 - my_conf="" - done -} - -src_install() { - php_determine_sapis - - destdir=/usr/$(get_libdir)/php5 - - # Let the eclass do the common work - php5_2-sapi_src_install - - einfo - einfo "Installing SAPI(s) ${PHPSAPIS}" - einfo - - for x in ${PHPSAPIS} ; do - - PHPSAPI="${x}" - - case ${x} in - cli) - einfo "Installing CLI SAPI" - into ${destdir} - newbin php-cli php || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - ;; - cgi) - einfo "Installing CGI SAPI" - into ${destdir} - dobin php-cgi || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - ;; - fpm) - einfo "Installing FPM SAPI" - into ${destdir} - dobin php-fpm || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - insinto ${PHP_INI_DIR} - newins "${S}/sapi/fpm/php_fpm.conf" "php-fpm.conf" || die "Failed to install php-fpm.conf" - newins "${S}/sapi/fpm/php_fpm.conf" "php-fpm.conf.dist" || die "Failed to install php-fpm.conf.dist" - einfo "Installing php-fpm init.d" - newinitd "${FILESDIR}/php-fpm.init" "php-fpm" - ;; - apache2) - einfo "Installing Apache${APACHE_VERSION} SAPI" - make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if use concurrentmodphp ; then - einfo "Installing Apache${APACHE_VERSION} config file for PHP5-concurrent (70_mod_php5_concurr.conf)" - insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5_concurr.conf-apache2-r1" "70_mod_php5_concurr.conf" - - # Put the ld version script in the right place so it's always accessible - insinto "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/" - doins "${FILESDIR}/php5-ldvs" - - # Redefine the extension dir to have the modphp suffix - PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned" - else - einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" - insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5.conf-apache2-r1" "70_mod_php5.conf" - fi - php5_2-sapi_install_ini - ;; - esac - done - - # Install env.d files - newenvd "${FILESDIR}/20php5-envd" "20php5" - sed -e "s|/lib/|/$(get_libdir)/|g" -i "${D}/etc/env.d/20php5" -} - -pkg_postinst() { - # Output some general info to the user - if use apache2 ; then - APACHE2_MOD_DEFINE="PHP5" - if use concurrentmodphp ; then - APACHE2_MOD_CONF="70_mod_php5_concurr" - else - APACHE2_MOD_CONF="70_mod_php5" - fi - apache-module_pkg_postinst - fi - - # Update Apache2 to use mod_php - if use apache2 ; then - "${ROOT}/usr/sbin/php-select" -t apache2 php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 2 ]] ; then - php-select apache2 php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "Apache2 is configured to load a different version of PHP." - ewarn "To make Apache2 use PHP v5, use php-select:" - ewarn - ewarn " php-select apache2 php5" - ewarn - fi - fi - - # Create the symlinks for php-cli - if use cli || phpconfutils_usecheck cli ; then - "${ROOT}/usr/sbin/php-select" -t php php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "/usr/bin/php links to a different version of PHP." - ewarn "To make /usr/bin/php point to PHP v5, use php-select:" - ewarn - ewarn " php-select php php5" - ewarn - fi - fi - - # Create the symlinks for php-cgi - if use cgi ; then - "${ROOT}/usr/sbin/php-select" -t php-cgi php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php-cgi php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "/usr/bin/php-cgi links to a different version of PHP." - ewarn "To make /usr/bin/php-cgi point to PHP v5, use php-select:" - ewarn - ewarn " php-select php-cgi php5" - ewarn - fi - fi - - # Create the symlinks and user for php-fpm - if use fpm ; then - "${ROOT}/usr/sbin/php-select" -t php-fpm php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php-fpm php5 - fi - ebegin "Creating php-fpm user and group" - enewgroup php-fpm - enewuser php-fpm -1 -1 /dev/null php-fpm - eend ${?} - einfo "php-fpm config installed to /etc/php/fpm-php5/php-fpm.conf" - fi - - # Create the symlinks for php-devel - "${ROOT}/usr/sbin/php-select" -t php-devel php5 > /dev/null 2>&1 - exitStatus=$? - if [[ $exitStatus == 5 ]] ; then - php-select php-devel php5 - elif [[ $exitStatus == 4 ]] ; then - ewarn - ewarn "/usr/bin/php-config and/or /usr/bin/phpize are linked to a" - ewarn "different version of PHP. To make them point to PHP v5, use" - ewarn "php-select:" - ewarn - ewarn " php-select php-devel php5" - ewarn - fi - - php5_2-sapi_pkg_postinst -} - -src_test() { - echo ">>> Test phase [test]: ${CATEGORY}/${PF}" - if [[ ! -x "${S}"/php-cli ]]; then - ewarn "Running the php test suite requires USE=cli" - return - fi - - export TEST_PHP_EXECUTABLE="${S}"/php-cli - if [[ -x "${S}"/php-cgi ]]; then - export TEST_PHP_CGI_EXECUTABLE="${S}"/php-cgi - fi - REPORT_EXIT_STATUS=1 "${S}"/php-cli -n "${S}"/run-tests.php -n - - if [[ $? != 0 ]] ; then - eerror "Not all tests were successful!" - fi -} diff --git a/dev-lang/php/php-5.2.13.ebuild b/dev-lang/php/php-5.2.13.ebuild deleted file mode 100644 index e3fd540..0000000 --- a/dev-lang/php/php-5.2.13.ebuild +++ /dev/null @@ -1,642 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.2.12.ebuild,v 1.8 2010/01/05 19:56:43 armin76 Exp $ - -CGI_SAPI_USE="discard-path force-cgi-redirect" -APACHE2_SAPI_USE="concurrentmodphp threads" -IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild fpm" - -KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd" - -# NOTE: Portage doesn't support setting PROVIDE based on the USE flags -# that have been enabled, so we have to PROVIDE everything for now -# and hope for the best -PROVIDE="virtual/php virtual/httpd-php" - -# php package settings -SLOT="5" -MY_PHP_PV="${PV}" -MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE="1" -# php patch settings, general -PHP_PATCHSET_REV="${PR/r/}" -PHP_PATCHSET_URI="http://dev.gentoo.org/~keytoaster/distfiles/php-patchset-${PV}-r${PHP_PATCHSET_REV}.tar.bz2" -SUHOSIN_PATCH="suhosin-patch-5.2.13-0.9.7.patch.gz" -FPM_PATCH="php-fpm-0.6~5.2.patch" -MULTILIB_PATCH="${MY_PHP_PV}/opt/multilib-search-path.patch" -# php patch settings, ebuild specific -FASTBUILD_PATCH="${MY_PHP_PV}/opt/fastbuild.patch" -CONCURRENTMODPHP_PATCH="${MY_PHP_PV}/opt/concurrent_apache_modules.patch" -# kolab patch - http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/patches/php/ -# bugs about this go to wrobel@gentoo.org -KOLAB_PATCH="${MY_PHP_PV}/opt/kolab-imap-annotations.patch" - -inherit versionator php5_2-sapi apache-module - -# Suhosin patch support -[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( -http://download.suhosin.org/${SUHOSIN_PATCH} )" - -# FPM patch support -[[ -n "${FPM_PATCH}" ]] && SRC_URI="${SRC_URI} fpm? ( http://code.launchpad.net/php-fpm/master/0.6/+download/${FPM_PATCH} )" - -DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache2 SAPIs." - -DEPEND="app-admin/php-toolkit - fpm? ( >=dev-libs/libxml2-2.7.2-r2 >=dev-libs/libevent-1.4.11 ) - imap? ( >=virtual/imap-c-client-2006k ) - pcre? ( >=dev-libs/libpcre-7.8 ) - xml? ( >=dev-libs/libxml2-2.7.2-r2 ) - xmlrpc? ( >=dev-libs/libxml2-2.7.2-r2 virtual/libiconv )" - -RDEPEND="${DEPEND}" -if [[ -n "${KOLAB_PATCH}" ]] ; then - IUSE="${IUSE} kolab" - DEPEND="${DEPEND} - kolab? ( >=net-libs/c-client-2004g-r1 )" -fi - -PDEPEND="suhosin? ( >=dev-php5/suhosin-0.9.29 )" - -want_apache - -pkg_setup() { - PHPCONFUTILS_AUTO_USE="" - - # Make sure the user has specified at least one SAPI - einfo "Determining SAPI(s) to build" - phpconfutils_require_any " Enabled SAPI:" " Disabled SAPI:" cli cgi apache2 - - # php-fpm patch support - if use fpm && ! use cgi ; then - eerror - eerror "You must enable CGI SAPI for php-fpm patch to work" - eerror - ebeep 1 - die - fi - - # Threaded Apache2 support - if use apache2 ; then - has_apache_threads - fi - - # Concurrent PHP Apache2 modules support - if use apache2 ; then - if use concurrentmodphp ; then - ewarn - ewarn "'concurrentmodphp' makes it possible to load multiple, differently" - ewarn "versioned mod_php's into the same Apache instance. This is done with" - ewarn "a few linker tricks and workarounds, and is not guaranteed to always" - ewarn "work correctly, so use it at your own risk. Especially, do not use" - ewarn "this in conjunction with PHP modules (PECL, ...) other than the ones" - ewarn "you may find in the Portage tree or the PHP Overlay!" - ewarn "This is an experimental feature, so please rebuild PHP" - ewarn "without the 'concurrentmodphp' USE flag if you experience" - ewarn "any problems, and then reproduce any bugs before filing" - ewarn "them in Gentoo's Bugzilla or bugs.php.net." - ewarn "If you have conclusive evidence that a bug directly" - ewarn "derives from 'concurrentmodphp', please file a bug in" - ewarn "Gentoo's Bugzilla only." - ewarn - ebeep 5 - fi - fi - - # fastbuild support - if use fastbuild ; then - ewarn - ewarn "'fastbuild' attempts to build all SAPIs in a single pass." - ewarn "This is an experimental feature, so please rebuild PHP" - ewarn "without the 'fastbuild' USE flag if you experience" - ewarn "any problems, and then reproduce any bugs before filing" - ewarn "them in Gentoo's Bugzilla or bugs.php.net." - ewarn "If you have conclusive evidence that a bug directly" - ewarn "derives from 'fastbuild', please file a bug in" - ewarn "Gentoo's Bugzilla only." - ewarn - fi - - if use pcre ; then - built_with_use dev-libs/libpcre unicode || \ - die "Please rebuild dev-libs/libpcre with USE=unicode" - fi - - depend.apache_pkg_setup - php5_2-sapi_pkg_setup -} - -php_determine_sapis() { - # holds the list of sapis that we want to build - PHPSAPIS= - - if use cli || phpconfutils_usecheck cli ; then - PHPSAPIS="${PHPSAPIS} cli" - fi - - if use cgi ; then - PHPSAPIS="${PHPSAPIS} cgi" - fi - - if use fpm ; then - PHPSAPIS="${PHPSAPIS} fpm" - fi - - # note - apache SAPI comes after the simpler cli/cgi sapis - if use apache2 ; then - PHPSAPIS="${PHPSAPIS} apache${APACHE_VERSION}" - fi -} - -src_unpack() { - if [[ "${PHP_PACKAGE}" == 1 ]] ; then - unpack ${A} - fi - - cd "${S}" - - epatch "${FILESDIR}"/${PN}-5.2.12-libpng14.patch - - # php-fpm support - if use fpm ; then - EPATCH_OPTS="-p1 -d ${S}" epatch "${DISTDIR}/${FPM_PATCH}" - fi - - # Concurrent PHP Apache2 modules support - if use apache2 ; then - if use concurrentmodphp ; then - if [[ -n "${CONCURRENTMODPHP_PATCH}" ]] && [[ -f "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" ]] ; then - epatch "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" - else - ewarn "There is no concurrent mod_php patch available for this PHP release yet!" - fi - fi - fi - - # fastbuild support - if use fastbuild ; then - if [[ -n "${FASTBUILD_PATCH}" ]] && [[ -f "${WORKDIR}/${FASTBUILD_PATCH}" ]] ; then - epatch "${WORKDIR}/${FASTBUILD_PATCH}" - else - ewarn "There is no fastbuild patch available for this PHP release yet!" - fi - fi - - # kolab support - if [[ -n "${KOLAB_PATCH}" ]] ; then - use kolab && epatch "${WORKDIR}/${KOLAB_PATCH}" - fi - - # pretend to not have flex, bug 221357 - sed -re 's:( +)PHP_SUBST\(LEX\):\1LEX="exit 0;"\n\0:' -i acinclude.m4 - - # Now let the eclass do the rest and regenerate the configure - php5_2-sapi_src_unpack - - # Fix Makefile.global:test to consider the CGI SAPI if present - if use cgi ; then - sed -e "s|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\"|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\" \&\& test \! -z \"\$(top_builddir)/php-cgi\" \&\& test -x \"\$(top_builddir)/php-cgi\"|g" -i Makefile.global - sed -e "s|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\"|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\" TEST_PHP_CGI_EXECUTABLE=\"\$(top_builddir)/php-cgi\"|g" -i Makefile.global - fi - - # try to fix some test cases which fail because of sandbox otherwise - sed -e 's:/no/such/:.\0:' -i ext/standard/tests/file/005_error.phpt \ - ext/standard/tests/file/006_error.phpt \ - ext/standard/tests/file/touch.phpt - - # REMOVING BROKEN TESTS: - # removing this test as it has been broken for ages and is not easily - # fixable (depends on a lot of factors) - rm ext/standard/tests/general_functions/phpinfo.phpt - - # never worked properly, no easy fix - rm ext/iconv/tests/iconv_stream_filter.phpt - - # needs write access to /tmp and others - rm ext/session/tests/session_save_path_variation5.phpt - - # new tests since 5.2.7 which have never been working for me - rm ext/spl/tests/arrayObject___construct_basic4.phpt \ - ext/spl/tests/arrayObject___construct_basic5.phpt \ - ext/spl/tests/arrayObject_exchangeArray_basic3.phpt \ - ext/spl/tests/arrayObject_setFlags_basic1.phpt - - # those might as well be related to suhosin - rm ext/session/tests/session_decode_variation3.phpt \ - ext/session/tests/session_encode_variation8.phpt - - # missing skipif - use reflection || \ - rm ext/standard/tests/directory/DirectoryClass_basic_001.phpt - - # sandbox-related (sandbox checks for permissions before even looking - # at the fs, but the tests expect "No such file or directory" - sed -e 's:/blah:./bla:' -i \ - ext/session/tests/session_save_path_variation{2,3}.phpt - rm ext/standard/tests/file/rename_variation13.phpt - - # test passes, but run-tests.php claims failure - rm ext/standard/tests/file/tempnam_variation4.phpt - - # these tests behave differently with suhosin enabled, adapting them... - use suhosin && sed -e 's:File(\.\./):File(..):g' -i \ - tests/security/open_basedir*{.inc,.phpt} -} - -src_compile() { - # bug 217392 (autconf-2.62 behavior changes) - export CFLAGS="${CFLAGS} -D_GNU_SOURCE" - export CXXFLAGS="${CXXFLAGS} -D_GNU_SOURCE" - if use fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then - src_compile_fastbuild - else - src_compile_normal - fi -} - -src_compile_fastbuild() { - php_determine_sapis - - build_cli=0 - build_cgi=0 - build_fpm=0 - build_apache2=0 - my_conf="" - - for x in ${PHPSAPIS} ; do - case ${x} in - cli) - build_cli=1 - ;; - cgi) - build_cgi=1 - ;; - fpm) - build_fpm=1 - ;; - apache2) - build_apache2=1 - ;; - esac - done - - if [[ ${build_cli} = 1 ]] ; then - my_conf="${my_conf} --enable-cli" - else - my_conf="${my_conf} --disable-cli" - fi - - if [[ ${build_cgi} = 1 ]] ; then - my_conf="${my_conf} --enable-cgi --enable-fastcgi" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - else - my_conf="${my_conf} --disable-cgi" - fi - - if [[ ${build_fpm} = 1 ]] ; then - my_conf="${my_conf} \ - --with-fpm \ - --with-libevent=shared,/usr/lib \ - --with-fpm-conf=/etc/php/fpm-php5/php-fpm.conf \ - --with-fpm-user=php-fpm \ - --with-fpm-group=php-fpm \ - --with-fpm-log=/var/log/php-fpm.log \ - --with-fpm-pid=/var/run/php-fpm.pid" - fi - - if [[ ${build_apache2} = 1 ]] ; then - my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" - - # Threaded Apache2 support - if use threads ; then - my_conf="${my_conf} --enable-maintainer-zts" - ewarn "Enabling ZTS for Apache2 MPM" - fi - - # Concurrent PHP Apache2 modules support - if use concurrentmodphp ; then - append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" - fi - fi - - if use pcre || phpconfutils_usecheck pcre ; then - myconf="${my_conf} --with-pcre-dir=/usr" - phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr" - fi - - # Now we know what we are building, build it - php5_2-sapi_src_compile - - # To keep the separate php.ini files for each SAPI, we change the - # build-defs.h and recompile - - if [[ ${build_cli} = 1 ]] ; then - einfo - einfo "Building CLI SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cli-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cli-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/cli/php || die "Unable to make CLI SAPI" - cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" - fi - - if [[ ${build_cgi} = 1 ]] ; then - einfo - einfo "Building CGI SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cgi-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cgi-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/cgi/php-cgi || die "Unable to make CGI SAPI" - cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI" - fi - - if [[ ${build_fpm} = 1 ]] ; then - einfo - einfo "Building FPM SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/fpm-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/fpm-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/fpm/php-fpm || die "Unable to make FPM SAPI" - cp sapi/fpm/php-fpm php-fpm || die "Unable to copy FPM SAPI" - fi - - if [[ ${build_apache2} = 1 ]] ; then - einfo - einfo "Building apache${APACHE_VERSION} SAPI" - einfo - - sed -e "s|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH \"/etc/php/apache${APACHE_VERSION}-php5\"|g;" -i main/build-defs.h - sed -e "s|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR \"/etc/php/apache${APACHE_VERSION}-php5/ext-active\"|g;" -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make || die "Unable to make apache${APACHE_VERSION} SAPI" - fi -} - -src_compile_normal() { - php_determine_sapis - - CLEAN_REQUIRED=0 - my_conf="" - - # Support the Apache2 extras, they must be set globally for all - # SAPIs to work correctly, especially for external PHP extensions - if use apache2 ; then - # Concurrent PHP Apache2 modules support - if use concurrentmodphp ; then - append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" - fi - fi - - for x in ${PHPSAPIS} ; do - if use pcre || phpconfutils_usecheck pcre ; then - myconf="${my_conf} --with-pcre-dir=/usr" - phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr" - fi - - # Support the Apache2 extras, they must be set globally for all - # SAPIs to work correctly, especially for external PHP extensions - if use apache2 ; then - # Threaded Apache2 support - if use threads ; then - my_conf="${my_conf} --enable-maintainer-zts" - ewarn "Enabling ZTS for Apache2 MPM" - fi - fi - - if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then - make clean - fi - - PHPSAPI="${x}" - - case ${x} in - cli) - my_conf="${my_conf} --enable-cli --disable-cgi" - php5_2-sapi_src_compile - cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" - ;; - cgi) - my_conf="${my_conf} --disable-cli --enable-cgi --enable-fastcgi" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - php5_2-sapi_src_compile - cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI" - ;; - fpm) - my_conf="${my_conf} \ - --with-fpm \ - --with-libevent=shared,/usr/lib \ - --with-fpm-conf=/etc/php/fpm-php5/php-fpm.conf \ - --with-fpm-user=php-fpm \ - --with-fpm-group=php-fpm \ - --with-fpm-log=/var/log/php-fpm.log \ - --with-fpm-pid=/var/run/php-fpm.pid" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - php5_2-sapi_src_compile - cp sapi/fpm/php-fpm php-fpm || die "Unable to copy CGI SAPI" - ;; - apache2) - my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" - php5_2-sapi_src_compile - ;; - esac - - CLEAN_REQUIRED=1 - my_conf="" - done -} - -src_install() { - php_determine_sapis - - destdir=/usr/$(get_libdir)/php5 - - # Let the eclass do the common work - php5_2-sapi_src_install - - einfo - einfo "Installing SAPI(s) ${PHPSAPIS}" - einfo - - for x in ${PHPSAPIS} ; do - - PHPSAPI="${x}" - - case ${x} in - cli) - einfo "Installing CLI SAPI" - into ${destdir} - newbin php-cli php || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - ;; - cgi) - einfo "Installing CGI SAPI" - into ${destdir} - dobin php-cgi || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - ;; - fpm) - einfo "Installing FPM SAPI" - into ${destdir} - dobin php-fpm || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - insinto ${PHP_INI_DIR} - newins "${S}/sapi/fpm/php_fpm.conf" "php-fpm.conf" || die "Failed to install php-fpm.conf" - newins "${S}/sapi/fpm/php_fpm.conf" "php-fpm.conf.dist" || die "Failed to install php-fpm.conf.dist" - einfo "Installing php-fpm init.d" - newinitd "${FILESDIR}/php-fpm.init" "php-fpm" - ;; - apache2) - einfo "Installing Apache${APACHE_VERSION} SAPI" - make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if use concurrentmodphp ; then - einfo "Installing Apache${APACHE_VERSION} config file for PHP5-concurrent (70_mod_php5_concurr.conf)" - insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5_concurr.conf-apache2-r1" "70_mod_php5_concurr.conf" - - # Put the ld version script in the right place so it's always accessible - insinto "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/" - doins "${FILESDIR}/php5-ldvs" - - # Redefine the extension dir to have the modphp suffix - PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned" - else - einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" - insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5.conf-apache2-r1" "70_mod_php5.conf" - fi - php5_2-sapi_install_ini - ;; - esac - done - - # Install env.d files - newenvd "${FILESDIR}/20php5-envd" "20php5" - sed -e "s|/lib/|/$(get_libdir)/|g" -i "${D}/etc/env.d/20php5" -} - -pkg_postinst() { - # Output some general info to the user - if use apache2 ; then - APACHE2_MOD_DEFINE="PHP5" - if use concurrentmodphp ; then - APACHE2_MOD_CONF="70_mod_php5_concurr" - else - APACHE2_MOD_CONF="70_mod_php5" - fi - apache-module_pkg_postinst - fi - - # Update Apache2 to use mod_php - if use apache2 ; then - "${ROOT}/usr/sbin/php-select" -t apache2 php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 2 ]] ; then - php-select apache2 php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "Apache2 is configured to load a different version of PHP." - ewarn "To make Apache2 use PHP v5, use php-select:" - ewarn - ewarn " php-select apache2 php5" - ewarn - fi - fi - - # Create the symlinks for php-cli - if use cli || phpconfutils_usecheck cli ; then - "${ROOT}/usr/sbin/php-select" -t php php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "/usr/bin/php links to a different version of PHP." - ewarn "To make /usr/bin/php point to PHP v5, use php-select:" - ewarn - ewarn " php-select php php5" - ewarn - fi - fi - - # Create the symlinks for php-cgi - if use cgi ; then - "${ROOT}/usr/sbin/php-select" -t php-cgi php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php-cgi php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "/usr/bin/php-cgi links to a different version of PHP." - ewarn "To make /usr/bin/php-cgi point to PHP v5, use php-select:" - ewarn - ewarn " php-select php-cgi php5" - ewarn - fi - fi - - # Create the symlinks and user for php-fpm - if use fpm ; then - "${ROOT}/usr/sbin/php-select" -t php-fpm php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php-fpm php5 - fi - ebegin "Creating php-fpm user and group" - enewgroup php-fpm - enewuser php-fpm -1 -1 /dev/null php-fpm - eend ${?} - einfo "php-fpm config installed to /etc/php/fpm-php5/php-fpm.conf" - fi - - # Create the symlinks for php-devel - "${ROOT}/usr/sbin/php-select" -t php-devel php5 > /dev/null 2>&1 - exitStatus=$? - if [[ $exitStatus == 5 ]] ; then - php-select php-devel php5 - elif [[ $exitStatus == 4 ]] ; then - ewarn - ewarn "/usr/bin/php-config and/or /usr/bin/phpize are linked to a" - ewarn "different version of PHP. To make them point to PHP v5, use" - ewarn "php-select:" - ewarn - ewarn " php-select php-devel php5" - ewarn - fi - - php5_2-sapi_pkg_postinst -} - -src_test() { - echo ">>> Test phase [test]: ${CATEGORY}/${PF}" - if [[ ! -x "${S}"/php-cli ]]; then - ewarn "Running the php test suite requires USE=cli" - return - fi - - export TEST_PHP_EXECUTABLE="${S}"/php-cli - if [[ -x "${S}"/php-cgi ]]; then - export TEST_PHP_CGI_EXECUTABLE="${S}"/php-cgi - fi - REPORT_EXIT_STATUS=1 "${S}"/php-cli -n "${S}"/run-tests.php -n - - if [[ $? != 0 ]] ; then - eerror "Not all tests were successful!" - fi -} diff --git a/dev-lang/php/php-5.2.14.ebuild b/dev-lang/php/php-5.2.14.ebuild index e3fd540..fc97276 100644 --- a/dev-lang/php/php-5.2.14.ebuild +++ b/dev-lang/php/php-5.2.14.ebuild @@ -1,642 +1,325 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.2.12.ebuild,v 1.8 2010/01/05 19:56:43 armin76 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.2.14.ebuild,v 1.11 2010/09/07 21:22:40 mabi Exp $ -CGI_SAPI_USE="discard-path force-cgi-redirect" -APACHE2_SAPI_USE="concurrentmodphp threads" -IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild fpm" +EAPI=2 -KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd" - -# NOTE: Portage doesn't support setting PROVIDE based on the USE flags -# that have been enabled, so we have to PROVIDE everything for now -# and hope for the best -PROVIDE="virtual/php virtual/httpd-php" - -# php package settings -SLOT="5" -MY_PHP_PV="${PV}" -MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE="1" -# php patch settings, general -PHP_PATCHSET_REV="${PR/r/}" -PHP_PATCHSET_URI="http://dev.gentoo.org/~keytoaster/distfiles/php-patchset-${PV}-r${PHP_PATCHSET_REV}.tar.bz2" -SUHOSIN_PATCH="suhosin-patch-5.2.13-0.9.7.patch.gz" -FPM_PATCH="php-fpm-0.6~5.2.patch" -MULTILIB_PATCH="${MY_PHP_PV}/opt/multilib-search-path.patch" -# php patch settings, ebuild specific -FASTBUILD_PATCH="${MY_PHP_PV}/opt/fastbuild.patch" -CONCURRENTMODPHP_PATCH="${MY_PHP_PV}/opt/concurrent_apache_modules.patch" -# kolab patch - http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/patches/php/ -# bugs about this go to wrobel@gentoo.org -KOLAB_PATCH="${MY_PHP_PV}/opt/kolab-imap-annotations.patch" - -inherit versionator php5_2-sapi apache-module - -# Suhosin patch support -[[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( -http://download.suhosin.org/${SUHOSIN_PATCH} )" - -# FPM patch support -[[ -n "${FPM_PATCH}" ]] && SRC_URI="${SRC_URI} fpm? ( http://code.launchpad.net/php-fpm/master/0.6/+download/${FPM_PATCH} )" +PHPCONFUTILS_MISSING_DEPS="adabas birdstep db2 dbmaker empress empress-bcs esoob +interbase msql oci8 sapdb solid" -DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache2 SAPIs." +# inherit autotools, because we call eautoreconf in the eblits +inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use phpconfutils php-common-r1 libtool -DEPEND="app-admin/php-toolkit - fpm? ( >=dev-libs/libxml2-2.7.2-r2 >=dev-libs/libevent-1.4.11 ) - imap? ( >=virtual/imap-c-client-2006k ) - pcre? ( >=dev-libs/libpcre-7.8 ) - xml? ( >=dev-libs/libxml2-2.7.2-r2 ) - xmlrpc? ( >=dev-libs/libxml2-2.7.2-r2 virtual/libiconv )" - -RDEPEND="${DEPEND}" -if [[ -n "${KOLAB_PATCH}" ]] ; then - IUSE="${IUSE} kolab" - DEPEND="${DEPEND} - kolab? ( >=net-libs/c-client-2004g-r1 )" -fi - -PDEPEND="suhosin? ( >=dev-php5/suhosin-0.9.29 )" +PHP_PATCHSET="1" +SUHOSIN_VERSION="$PV-0.9.7" +EXPECTED_TEST_FAILURES="" -want_apache +KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd" -pkg_setup() { - PHPCONFUTILS_AUTO_USE="" - - # Make sure the user has specified at least one SAPI - einfo "Determining SAPI(s) to build" - phpconfutils_require_any " Enabled SAPI:" " Disabled SAPI:" cli cgi apache2 - - # php-fpm patch support - if use fpm && ! use cgi ; then - eerror - eerror "You must enable CGI SAPI for php-fpm patch to work" - eerror - ebeep 1 - die - fi - - # Threaded Apache2 support - if use apache2 ; then - has_apache_threads - fi - - # Concurrent PHP Apache2 modules support - if use apache2 ; then - if use concurrentmodphp ; then - ewarn - ewarn "'concurrentmodphp' makes it possible to load multiple, differently" - ewarn "versioned mod_php's into the same Apache instance. This is done with" - ewarn "a few linker tricks and workarounds, and is not guaranteed to always" - ewarn "work correctly, so use it at your own risk. Especially, do not use" - ewarn "this in conjunction with PHP modules (PECL, ...) other than the ones" - ewarn "you may find in the Portage tree or the PHP Overlay!" - ewarn "This is an experimental feature, so please rebuild PHP" - ewarn "without the 'concurrentmodphp' USE flag if you experience" - ewarn "any problems, and then reproduce any bugs before filing" - ewarn "them in Gentoo's Bugzilla or bugs.php.net." - ewarn "If you have conclusive evidence that a bug directly" - ewarn "derives from 'concurrentmodphp', please file a bug in" - ewarn "Gentoo's Bugzilla only." - ewarn - ebeep 5 - fi - fi - - # fastbuild support - if use fastbuild ; then - ewarn - ewarn "'fastbuild' attempts to build all SAPIs in a single pass." - ewarn "This is an experimental feature, so please rebuild PHP" - ewarn "without the 'fastbuild' USE flag if you experience" - ewarn "any problems, and then reproduce any bugs before filing" - ewarn "them in Gentoo's Bugzilla or bugs.php.net." - ewarn "If you have conclusive evidence that a bug directly" - ewarn "derives from 'fastbuild', please file a bug in" - ewarn "Gentoo's Bugzilla only." - ewarn - fi - - if use pcre ; then - built_with_use dev-libs/libpcre unicode || \ - die "Please rebuild dev-libs/libpcre with USE=unicode" - fi - - depend.apache_pkg_setup - php5_2-sapi_pkg_setup +function php_get_uri () +{ + case "${1}" in + "php-pre") + echo "http://downloads.php.net/johannes/${2}" + ;; + "php") + echo "http://www.php.net/distributions/${2}" + ;; + "suhosin") + echo "http://download.suhosin.org/${2}" + ;; + "gentoo") + echo "mirror://gentoo/${2}" + ;; + *) + die "unhandled case in php_get_uri" + ;; + esac } -php_determine_sapis() { - # holds the list of sapis that we want to build - PHPSAPIS= - - if use cli || phpconfutils_usecheck cli ; then - PHPSAPIS="${PHPSAPIS} cli" - fi - - if use cgi ; then - PHPSAPIS="${PHPSAPIS} cgi" - fi - - if use fpm ; then - PHPSAPIS="${PHPSAPIS} fpm" - fi - - # note - apache SAPI comes after the simpler cli/cgi sapis - if use apache2 ; then - PHPSAPIS="${PHPSAPIS} apache${APACHE_VERSION}" - fi -} +PHP_MV="$(get_major_version)" + +# alias, so we can handle different types of releases (finals, rcs, alphas, +# betas, ...) w/o changing the whole ebuild +PHP_PV="${PV/_rc/RC}" +PHP_RELEASE="php" +PHP_P="${PN}-${PHP_PV}" +PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")" + +PHP_PATCHSET="${PHP_PATCHSET:-${PR/r/}}" +PHP_PATCHSET_URI=" + $(php_get_uri gentoo "php-patchset-${PV}-r${PHP_PATCHSET}.tar.bz2")" + +if [[ ${SUHOSIN_VERSION} == *-gentoo ]]; then + # in some cases we use our own suhosin patch (very recent version, + # patch conflicts, etc.) + SUHOSIN_TYPE="gentoo" +else + SUHOSIN_TYPE="suhosin" +fi -src_unpack() { - if [[ "${PHP_PACKAGE}" == 1 ]] ; then - unpack ${A} - fi +SUHOSIN_PATCH="suhosin-patch-${SUHOSIN_VERSION}.patch" +SUHOSIN_URI="$(php_get_uri ${SUHOSIN_TYPE} ${SUHOSIN_PATCH}.gz )" - cd "${S}" +FPM_PATCH="php-fpm-0.6~5.2.patch" +FPM_URI="http://code.launchpad.net/php-fpm/master/0.6/+download/${FPM_PATCH}" + +SRC_URI=" + ${PHP_SRC_URI} + ${PHP_PATCHSET_URI} + suhosin? ( ${SUHOSIN_URI} ) + fpm? ( ${FPM_URI} )" + +DESCRIPTION="The PHP language runtime engine: CLI, CGI, Apache2 and embed SAPIs." +HOMEPAGE="http://php.net/" +LICENSE="PHP-3" + +# We can build the following SAPIs in the given order +SAPIS="cli cgi fpm embed apache2" + +# Gentoo-specific, common features +IUSE="kolab" + +# SAPIs and SAPI-specific USE flags (cli SAPI is default on): +IUSE="${IUSE} + ${SAPIS/cli/+cli} + discard-path force-cgi-redirect + concurrentmodphp threads" + +IUSE="${IUSE} adabas bcmath berkdb birdstep bzip2 calendar cdb cjk + crypt +ctype curl curlwrappers db2 dbase dbmaker debug doc empress + empress-bcs esoob exif fdftk frontbase +filter firebird + flatfile ftp gd gd-external gdbm gmp +hash +iconv imap inifile + interbase iodbc ipv6 +json kerberos ldap ldap-sasl libedit + mcve mhash msql mssql mysql mysqli ncurses nls oci8 + oci8-instant-client odbc pcntl +pcre pdo pic +posix postgres qdbm + readline recode +reflection sapdb +session sharedext sharedmem + +simplexml snmp soap sockets solid spell +spl sqlite ssl suhosin + sybase-ct sysvipc tidy +tokenizer truetype unicode wddx + +xml +xmlreader +xmlwriter xmlrpc xpm xsl yaz zip zlib" - epatch "${FILESDIR}"/${PN}-5.2.12-libpng14.patch +DEPEND="app-admin/php-toolkit + pcre? ( >=dev-libs/libpcre-7.9[unicode] ) + adabas? ( >=dev-db/unixODBC-1.8.13 ) + apache2? ( www-servers/apache[threads=] ) + berkdb? ( =sys-libs/db-4* ) + birdstep? ( >=dev-db/unixODBC-1.8.13 ) + bzip2? ( app-arch/bzip2 ) + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) ) + 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 ) + fpm? ( >=dev-libs/libxml2-2.7.2-r2 >=dev-libs/libevent-1.4.12 ) + gd? ( >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) + gd-external? ( media-libs/gd ) + gdbm? ( >=sys-libs/gdbm-1.8.0 ) + gmp? ( >=dev-libs/gmp-4.1.2 ) + iconv? ( virtual/libiconv ) + imap? ( virtual/imap-c-client ) + iodbc? ( dev-db/libiodbc ) + kerberos? ( virtual/krb5 ) + kolab? ( >=net-libs/c-client-2004g-r1 ) + ldap? ( !oci8? ( >=net-nds/openldap-1.2.11 ) ) + ldap-sasl? ( !oci8? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) ) + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) ) + mhash? ( app-crypt/mhash ) + mssql? ( dev-db/freetds[mssql] ) + mysql? ( virtual/mysql ) + mysqli? ( >=virtual/mysql-4.1 ) + ncurses? ( sys-libs/ncurses ) + nls? ( sys-devel/gettext ) + oci8-instant-client? ( dev-db/oracle-instantclient-basic ) + odbc? ( >=dev-db/unixODBC-1.8.13 ) + postgres? ( dev-db/postgresql-base ) + qdbm? ( dev-db/qdbm ) + readline? ( sys-libs/readline ) + recode? ( app-text/recode ) + sapdb? ( >=dev-db/unixODBC-1.8.13 ) + sharedmem? ( dev-libs/mm ) + simplexml? ( >=dev-libs/libxml2-2.6.8 ) + snmp? ( >=net-analyzer/net-snmp-5.2 ) + soap? ( >=dev-libs/libxml2-2.6.8 ) + solid? ( >=dev-db/unixODBC-1.8.13 ) + spell? ( >=app-text/aspell-0.50 ) + sqlite? ( =dev-db/sqlite-2* pdo? ( =dev-db/sqlite-3* ) ) + ssl? ( >=dev-libs/openssl-0.9.7 ) + sybase-ct? ( dev-db/freetds ) + tidy? ( app-text/htmltidy ) + truetype? ( + =media-libs/freetype-2* + >=media-libs/t1lib-5.0.0 + !gd? ( !gd-external? ( + >=media-libs/jpeg-6b media-libs/libpng sys-libs/zlib ) ) + ) + wddx? ( >=dev-libs/libxml2-2.6.8 ) + xml? ( >=dev-libs/libxml2-2.6.8 ) + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv ) + xmlreader? ( >=dev-libs/libxml2-2.6.8 ) + xmlwriter? ( >=dev-libs/libxml2-2.6.8 ) + xpm? ( + x11-libs/libXpm + >=media-libs/jpeg-6b + media-libs/libpng sys-libs/zlib + ) + xsl? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 ) + zip? ( sys-libs/zlib ) + zlib? ( sys-libs/zlib ) + virtual/mta +" + +php="=${CATEGORY}/${PF}" +RDEPEND="${DEPEND} + truetype? ( || ( $php[gd] $php[gd-external] ) ) + cjk? ( || ( $php[gd] $php[gd-external] ) ) + exif? ( || ( $php[gd] $php[gd-external] ) ) + + xpm? ( $php[gd] ) + gd? ( $php[zlib,-gd-external] ) + gd-external? ( $php[-gd] ) + simplexml? ( $php[xml] ) + soap? ( $php[xml] ) + wddx? ( $php[xml] ) + xmlrpc? ( || ( $php[xml] $php[iconv] ) ) + xmlreader? ( $php[xml] ) + xsl? ( $php[xml] ) + ldap-sasl? ( $php[ldap,-oci8] ) + suhosin? ( $php[unicode] ) + adabas? ( $php[odbc] ) + birdstep? ( $php[odbc] ) + dbmaker? ( $php[odbc] ) + empress-bcs? ( $php[empress] ) + empress? ( $php[odbc] ) + esoob? ( $php[odbc] ) + db2? ( $php[odbc] ) + sapdb? ( $php[odbc] ) + solid? ( $php[odbc] ) + kolab? ( $php[imap] ) + + oci8? ( $php[-oci8-instant-client,-ldap-sasl] ) + oci8-instant-client? ( $php[-oci8] ) + + qdbm? ( $php[-gdbm] ) + readline? ( $php[-libedit] ) + recode? ( $php[-imap,-mysql,-mysqli] ) + firebird? ( $php[-interbase] ) + sharedmem? ( $php[-threads] ) + + !cli? ( !cgi? ( !apache2? ( !embed? ( $php[cli] ) ) ) ) + + filter? ( !dev-php${PHP_MV}/pecl-filter ) + json? ( !dev-php${PHP_MV}/pecl-json ) + zip? ( !dev-php${PHP_MV}/pecl-zip )" + +DEPEND="${DEPEND} + sys-devel/flex + >=sys-devel/m4-1.4.3 + >=sys-devel/libtool-1.5.18" + +# They are in PDEPEND because we need PHP installed first! +PDEPEND="doc? ( app-doc/php-docs ) + suhosin? ( dev-php${PHP_MV}/suhosin ) + mcve? ( dev-php${PHP_MV}/pecl-mcve ) + yaz? ( dev-php${PHP_MV}/pecl-yaz )" + +# Portage doesn't support setting PROVIDE based on the USE flags that +# have been enabled, so we have to PROVIDE everything for now and hope +# for the best +PROVIDE="virtual/php" + +SLOT="${PHP_MV}" +S="${WORKDIR}/${PHP_P}" + +PHP_INI_FILE="php.ini" +PHP_INI_UPSTREAM="php.ini-dist" - # php-fpm support - if use fpm ; then - EPATCH_OPTS="-p1 -d ${S}" epatch "${DISTDIR}/${FPM_PATCH}" - fi +want_apache - # Concurrent PHP Apache2 modules support - if use apache2 ; then - if use concurrentmodphp ; then - if [[ -n "${CONCURRENTMODPHP_PATCH}" ]] && [[ -f "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" ]] ; then - epatch "${WORKDIR}/${CONCURRENTMODPHP_PATCH}" - else - ewarn "There is no concurrent mod_php patch available for this PHP release yet!" - fi +# eblit-core +# Usage: [version] [eval] +# Main eblit engine +eblit-core() { + [[ -z $FILESDIR ]] && FILESDIR="$(dirname $EBUILD)/files" + local e v func=$1 ver=$2 eval_=$3 + for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do + e="${FILESDIR}/eblits/${func}${v}.eblit" + if [[ -e ${e} ]] ; then + . "${e}" + [[ ${eval_} == 1 ]] && eval "${func}() { eblit-run ${func} ${ver} ; }" + return 0 fi - fi - - # fastbuild support - if use fastbuild ; then - if [[ -n "${FASTBUILD_PATCH}" ]] && [[ -f "${WORKDIR}/${FASTBUILD_PATCH}" ]] ; then - epatch "${WORKDIR}/${FASTBUILD_PATCH}" - else - ewarn "There is no fastbuild patch available for this PHP release yet!" - fi - fi - - # kolab support - if [[ -n "${KOLAB_PATCH}" ]] ; then - use kolab && epatch "${WORKDIR}/${KOLAB_PATCH}" - fi - - # pretend to not have flex, bug 221357 - sed -re 's:( +)PHP_SUBST\(LEX\):\1LEX="exit 0;"\n\0:' -i acinclude.m4 - - # Now let the eclass do the rest and regenerate the configure - php5_2-sapi_src_unpack - - # Fix Makefile.global:test to consider the CGI SAPI if present - if use cgi ; then - sed -e "s|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\"|test \! -z \"\$(top_builddir)/php-cli\" \&\& test -x \"\$(top_builddir)/php-cli\" \&\& test \! -z \"\$(top_builddir)/php-cgi\" \&\& test -x \"\$(top_builddir)/php-cgi\"|g" -i Makefile.global - sed -e "s|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\"|TEST_PHP_EXECUTABLE=\"\$(top_builddir)/php-cli\" TEST_PHP_CGI_EXECUTABLE=\"\$(top_builddir)/php-cgi\"|g" -i Makefile.global - fi - - # try to fix some test cases which fail because of sandbox otherwise - sed -e 's:/no/such/:.\0:' -i ext/standard/tests/file/005_error.phpt \ - ext/standard/tests/file/006_error.phpt \ - ext/standard/tests/file/touch.phpt - - # REMOVING BROKEN TESTS: - # removing this test as it has been broken for ages and is not easily - # fixable (depends on a lot of factors) - rm ext/standard/tests/general_functions/phpinfo.phpt - - # never worked properly, no easy fix - rm ext/iconv/tests/iconv_stream_filter.phpt - - # needs write access to /tmp and others - rm ext/session/tests/session_save_path_variation5.phpt - - # new tests since 5.2.7 which have never been working for me - rm ext/spl/tests/arrayObject___construct_basic4.phpt \ - ext/spl/tests/arrayObject___construct_basic5.phpt \ - ext/spl/tests/arrayObject_exchangeArray_basic3.phpt \ - ext/spl/tests/arrayObject_setFlags_basic1.phpt - - # those might as well be related to suhosin - rm ext/session/tests/session_decode_variation3.phpt \ - ext/session/tests/session_encode_variation8.phpt - - # missing skipif - use reflection || \ - rm ext/standard/tests/directory/DirectoryClass_basic_001.phpt - - # sandbox-related (sandbox checks for permissions before even looking - # at the fs, but the tests expect "No such file or directory" - sed -e 's:/blah:./bla:' -i \ - ext/session/tests/session_save_path_variation{2,3}.phpt - rm ext/standard/tests/file/rename_variation13.phpt - - # test passes, but run-tests.php claims failure - rm ext/standard/tests/file/tempnam_variation4.phpt - - # these tests behave differently with suhosin enabled, adapting them... - use suhosin && sed -e 's:File(\.\./):File(..):g' -i \ - tests/security/open_basedir*{.inc,.phpt} + done + return 1 } -src_compile() { - # bug 217392 (autconf-2.62 behavior changes) - export CFLAGS="${CFLAGS} -D_GNU_SOURCE" - export CXXFLAGS="${CXXFLAGS} -D_GNU_SOURCE" - if use fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then - src_compile_fastbuild - else - src_compile_normal - fi +# eblit-include +# Usage: [--skip] [version] +# Includes an "eblit" -- a chunk of common code among ebuilds in a given +# package so that its functions can be sourced and utilized within the +# ebuild. +eblit-include() { + local skipable=false r=0 + [[ $1 == "--skip" ]] && skipable=true && shift + [[ $1 == pkg_* ]] && skipable=true + + [[ -z $1 ]] && die "Usage: eblit-include [version]" + eblit-core $1 $2 + r="$?" + ${skipable} && return 0 + [[ "$r" -gt "0" ]] && die "Could not locate requested eblit '$1' in ${FILESDIR}/eblits/" } -src_compile_fastbuild() { - php_determine_sapis - - build_cli=0 - build_cgi=0 - build_fpm=0 - build_apache2=0 - my_conf="" - - for x in ${PHPSAPIS} ; do - case ${x} in - cli) - build_cli=1 - ;; - cgi) - build_cgi=1 - ;; - fpm) - build_fpm=1 - ;; - apache2) - build_apache2=1 - ;; - esac - done - - if [[ ${build_cli} = 1 ]] ; then - my_conf="${my_conf} --enable-cli" - else - my_conf="${my_conf} --disable-cli" - fi - - if [[ ${build_cgi} = 1 ]] ; then - my_conf="${my_conf} --enable-cgi --enable-fastcgi" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - else - my_conf="${my_conf} --disable-cgi" - fi - - if [[ ${build_fpm} = 1 ]] ; then - my_conf="${my_conf} \ - --with-fpm \ - --with-libevent=shared,/usr/lib \ - --with-fpm-conf=/etc/php/fpm-php5/php-fpm.conf \ - --with-fpm-user=php-fpm \ - --with-fpm-group=php-fpm \ - --with-fpm-log=/var/log/php-fpm.log \ - --with-fpm-pid=/var/run/php-fpm.pid" - fi - - if [[ ${build_apache2} = 1 ]] ; then - my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" - - # Threaded Apache2 support - if use threads ; then - my_conf="${my_conf} --enable-maintainer-zts" - ewarn "Enabling ZTS for Apache2 MPM" - fi - - # Concurrent PHP Apache2 modules support - if use concurrentmodphp ; then - append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" - fi - fi - - if use pcre || phpconfutils_usecheck pcre ; then - myconf="${my_conf} --with-pcre-dir=/usr" - phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr" - fi - - # Now we know what we are building, build it - php5_2-sapi_src_compile - - # To keep the separate php.ini files for each SAPI, we change the - # build-defs.h and recompile - - if [[ ${build_cli} = 1 ]] ; then - einfo - einfo "Building CLI SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cli-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cli-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/cli/php || die "Unable to make CLI SAPI" - cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" - fi - - if [[ ${build_cgi} = 1 ]] ; then - einfo - einfo "Building CGI SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/cgi-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cgi-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/cgi/php-cgi || die "Unable to make CGI SAPI" - cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI" - fi - - if [[ ${build_fpm} = 1 ]] ; then - einfo - einfo "Building FPM SAPI" - einfo - - sed -e 's|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH "/etc/php/fpm-php5"|g;' -i main/build-defs.h - sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/fpm-php5/ext-active"|g;' -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make sapi/fpm/php-fpm || die "Unable to make FPM SAPI" - cp sapi/fpm/php-fpm php-fpm || die "Unable to copy FPM SAPI" - fi - - if [[ ${build_apache2} = 1 ]] ; then - einfo - einfo "Building apache${APACHE_VERSION} SAPI" - einfo - - sed -e "s|^#define PHP_CONFIG_FILE_PATH.*|#define PHP_CONFIG_FILE_PATH \"/etc/php/apache${APACHE_VERSION}-php5\"|g;" -i main/build-defs.h - sed -e "s|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR \"/etc/php/apache${APACHE_VERSION}-php5/ext-active\"|g;" -i main/build-defs.h - for x in main/main.o main/main.lo main/php_ini.o main/php_ini.lo ; do - [[ -f ${x} ]] && rm -f ${x} - done - make || die "Unable to make apache${APACHE_VERSION} SAPI" - fi +# eblit-run-maybe +# Usage: +# Runs a function if it is defined in an eblit +eblit-run-maybe() { + [[ $(type -t "$@") == "function" ]] && "$@" } -src_compile_normal() { - php_determine_sapis - - CLEAN_REQUIRED=0 - my_conf="" - - # Support the Apache2 extras, they must be set globally for all - # SAPIs to work correctly, especially for external PHP extensions - if use apache2 ; then - # Concurrent PHP Apache2 modules support - if use concurrentmodphp ; then - append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" - fi - fi - - for x in ${PHPSAPIS} ; do - if use pcre || phpconfutils_usecheck pcre ; then - myconf="${my_conf} --with-pcre-dir=/usr" - phpconfutils_extension_with "pcre-regex" "pcre" 0 "/usr" - fi - - # Support the Apache2 extras, they must be set globally for all - # SAPIs to work correctly, especially for external PHP extensions - if use apache2 ; then - # Threaded Apache2 support - if use threads ; then - my_conf="${my_conf} --enable-maintainer-zts" - ewarn "Enabling ZTS for Apache2 MPM" - fi - fi - - if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then - make clean - fi +# eblit-run +# Usage: [version] +# Runs a function defined in an eblit +eblit-run() { + eblit-include --skip common "${*:2}" + eblit-include "$@" + eblit-run-maybe eblit-$1-pre + eblit-${PN}-$1 + eblit-run-maybe eblit-$1-post +} - PHPSAPI="${x}" - - case ${x} in - cli) - my_conf="${my_conf} --enable-cli --disable-cgi" - php5_2-sapi_src_compile - cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" - ;; - cgi) - my_conf="${my_conf} --disable-cli --enable-cgi --enable-fastcgi" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - php5_2-sapi_src_compile - cp sapi/cgi/php-cgi php-cgi || die "Unable to copy CGI SAPI" - ;; - fpm) - my_conf="${my_conf} \ - --with-fpm \ - --with-libevent=shared,/usr/lib \ - --with-fpm-conf=/etc/php/fpm-php5/php-fpm.conf \ - --with-fpm-user=php-fpm \ - --with-fpm-group=php-fpm \ - --with-fpm-log=/var/log/php-fpm.log \ - --with-fpm-pid=/var/run/php-fpm.pid" - phpconfutils_extension_enable "discard-path" "discard-path" 0 - phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 - php5_2-sapi_src_compile - cp sapi/fpm/php-fpm php-fpm || die "Unable to copy CGI SAPI" - ;; - apache2) - my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" - php5_2-sapi_src_compile - ;; - esac - - CLEAN_REQUIRED=1 - my_conf="" - done +# eblit-pkg +# Usage: [version] +# Includes the given functions AND evals them so they're included in the binpkgs +eblit-pkg() { + [[ -z $1 ]] && die "Usage: eblit-pkg [version]" + eblit-core $1 $2 1 } -src_install() { - php_determine_sapis - - destdir=/usr/$(get_libdir)/php5 - - # Let the eclass do the common work - php5_2-sapi_src_install - - einfo - einfo "Installing SAPI(s) ${PHPSAPIS}" - einfo - - for x in ${PHPSAPIS} ; do - - PHPSAPI="${x}" - - case ${x} in - cli) - einfo "Installing CLI SAPI" - into ${destdir} - newbin php-cli php || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - ;; - cgi) - einfo "Installing CGI SAPI" - into ${destdir} - dobin php-cgi || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - ;; - fpm) - einfo "Installing FPM SAPI" - into ${destdir} - dobin php-fpm || die "Unable to install ${x} sapi" - php5_2-sapi_install_ini - insinto ${PHP_INI_DIR} - newins "${S}/sapi/fpm/php_fpm.conf" "php-fpm.conf" || die "Failed to install php-fpm.conf" - newins "${S}/sapi/fpm/php_fpm.conf" "php-fpm.conf.dist" || die "Failed to install php-fpm.conf.dist" - einfo "Installing php-fpm init.d" - newinitd "${FILESDIR}/php-fpm.init" "php-fpm" - ;; - apache2) - einfo "Installing Apache${APACHE_VERSION} SAPI" - make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if use concurrentmodphp ; then - einfo "Installing Apache${APACHE_VERSION} config file for PHP5-concurrent (70_mod_php5_concurr.conf)" - insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5_concurr.conf-apache2-r1" "70_mod_php5_concurr.conf" - - # Put the ld version script in the right place so it's always accessible - insinto "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/" - doins "${FILESDIR}/php5-ldvs" - - # Redefine the extension dir to have the modphp suffix - PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned" - else - einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" - insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5.conf-apache2-r1" "70_mod_php5.conf" - fi - php5_2-sapi_install_ini - ;; - esac - done +eblit-pkg pkg_setup v1 - # Install env.d files - newenvd "${FILESDIR}/20php5-envd" "20php5" - sed -e "s|/lib/|/$(get_libdir)/|g" -i "${D}/etc/env.d/20php5" +src_prepare() { + EPATCH_OPTS="-p1 -d ${S}" epatch "${DISTDIR}/${FPM_PATCH}" + eblit-run src_prepare v1 } -pkg_postinst() { - # Output some general info to the user - if use apache2 ; then - APACHE2_MOD_DEFINE="PHP5" - if use concurrentmodphp ; then - APACHE2_MOD_CONF="70_mod_php5_concurr" - else - APACHE2_MOD_CONF="70_mod_php5" - fi - apache-module_pkg_postinst - fi - - # Update Apache2 to use mod_php - if use apache2 ; then - "${ROOT}/usr/sbin/php-select" -t apache2 php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 2 ]] ; then - php-select apache2 php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "Apache2 is configured to load a different version of PHP." - ewarn "To make Apache2 use PHP v5, use php-select:" - ewarn - ewarn " php-select apache2 php5" - ewarn - fi - fi - - # Create the symlinks for php-cli - if use cli || phpconfutils_usecheck cli ; then - "${ROOT}/usr/sbin/php-select" -t php php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "/usr/bin/php links to a different version of PHP." - ewarn "To make /usr/bin/php point to PHP v5, use php-select:" - ewarn - ewarn " php-select php php5" - ewarn - fi - fi - - # Create the symlinks for php-cgi - if use cgi ; then - "${ROOT}/usr/sbin/php-select" -t php-cgi php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php-cgi php5 - elif [[ ${exitStatus} == 4 ]] ; then - ewarn - ewarn "/usr/bin/php-cgi links to a different version of PHP." - ewarn "To make /usr/bin/php-cgi point to PHP v5, use php-select:" - ewarn - ewarn " php-select php-cgi php5" - ewarn - fi - fi - - # Create the symlinks and user for php-fpm - if use fpm ; then - "${ROOT}/usr/sbin/php-select" -t php-fpm php5 > /dev/null 2>&1 - exitStatus=$? - if [[ ${exitStatus} == 5 ]] ; then - php-select php-fpm php5 - fi - ebegin "Creating php-fpm user and group" - enewgroup php-fpm - enewuser php-fpm -1 -1 /dev/null php-fpm - eend ${?} - einfo "php-fpm config installed to /etc/php/fpm-php5/php-fpm.conf" - fi - - # Create the symlinks for php-devel - "${ROOT}/usr/sbin/php-select" -t php-devel php5 > /dev/null 2>&1 - exitStatus=$? - if [[ $exitStatus == 5 ]] ; then - php-select php-devel php5 - elif [[ $exitStatus == 4 ]] ; then - ewarn - ewarn "/usr/bin/php-config and/or /usr/bin/phpize are linked to a" - ewarn "different version of PHP. To make them point to PHP v5, use" - ewarn "php-select:" - ewarn - ewarn " php-select php-devel php5" - ewarn - fi - - php5_2-sapi_pkg_postinst -} +src_configure() { eblit-run src_configure v52 ; } +src_compile() { eblit-run src_compile v1 ; } +src_install() { eblit-run src_install v1 ; } +src_test() { eblit-run src_test v1 ; } -src_test() { - echo ">>> Test phase [test]: ${CATEGORY}/${PF}" - if [[ ! -x "${S}"/php-cli ]]; then - ewarn "Running the php test suite requires USE=cli" - return - fi - - export TEST_PHP_EXECUTABLE="${S}"/php-cli - if [[ -x "${S}"/php-cgi ]]; then - export TEST_PHP_CGI_EXECUTABLE="${S}"/php-cgi - fi - REPORT_EXIT_STATUS=1 "${S}"/php-cli -n "${S}"/run-tests.php -n - - if [[ $? != 0 ]] ; then - eerror "Not all tests were successful!" - fi -} +eblit-pkg pkg_postinst v1 -- cgit v1.2.3-65-gdbad