--- patches/php-patches/5.2.3/opt/php5.2.3-concurrent_apache_modules.patch (revision 0) +++ patches/php-patches/5.2.3/opt/php5.2.3-concurrent_apache_modules.patch (revision 0) @@ -0,0 +1,57 @@ +--- sapi/apache2handler/sapi_apache2.c 2006-06-26 12:23:36.000000000 +0200 @@ -0,0 +1,237 @@ +diff -urd php-5.2.3/acinclude.m4 php-5.2.3-fastbuild/acinclude.m4 +--- php-5.2.3/acinclude.m4 2007-06-09 11:44:40.000000000 +0200 @@ -0,0 +1,133 @@ +diff -u -r php-5.2.3-orig/acinclude.m4 php-5.2.3/acinclude.m4 +--- php-5.2.3-orig/acinclude.m4 2007-06-09 10:46:29.000000000 +0200 @@ -0,0 +1,111 @@ +--- ext/pdo_mysql/mysql_driver.c 2006-12-02 17:26:53.000000000 +0100 @@ -0,0 +1,20 @@ +--- Zend/zend_execute.c 2007/04/16 08:09:54 1.716.2.12.2.19 @@ -0,0 +1,14 @@ +--- ext/gd/libgd/gd_gif_in.c 2007/04/04 11:40:11 1.5.4.2.2.11 @@ -0,0 +1,13 @@ +diff -ur php-5.2.3-orig/ext/dba/config.m4 php-5.2.3/ext/dba/config.m4 +--- php-5.2.3-orig/ext/dba/config.m4 2007-06-09 10:46:29.000000000 +0200 @@ -0,0 +1,76 @@ +--- ext/mysqli/mysqli_api.c 2006-12-01 16:30:36.000000000 +0100 @@ -0,0 +1,22 @@ +--- Zend/zend_ini.c 2007/04/16 08:09:54 1.39.2.2.2.8 @@ -0,0 +1,33 @@ +--- ext/gd/gd.c 2007/05/22 10:22:49 1.312.2.20.2.26 @@ -0,0 +1,27 @@ +diff -ur php-5.2.3-orig/ext/standard/string.c php-5.2.3/ext/standard/string.c +--- php-5.2.3-orig/ext/standard/string.c 2007-06-09 10:46:29.000000000 +0200 @@ -0,0 +1,60 @@ +--- ext/simplexml/simplexml.c 2007/04/24 14:11:28 1.151.2.22.2.26 @@ -0,0 +1,84 @@ +diff -ur php-5.2.3-orig/ext/zip/php_zip.c php-5.2.3/ext/zip/php_zip.c +--- php-5.2.3-orig/ext/zip/php_zip.c 2007-06-09 10:46:29.000000000 +0200 @@ -0,0 +1,35 @@ +--- ext/standard/string.c 2007/05/30 00:33:13 1.445.2.14.2.58 @@ -0,0 +1,100 @@ +diff -ur php-5.2.3-orig/ext/gd/gd.c php-5.2.3/ext/gd/gd.c +--- php-5.2.3-orig/ext/gd/gd.c 2007-06-09 10:46:29.000000000 +0200 @@ -0,0 +1,44 @@ +--- sapi/cgi/cgi_main.c 2007/05/28 08:11:59 1.267.2.15.2.40 @@ -0,0 +1,5 @@ +OUR_PATCHES +php5.2.2-dba_config.patch +php5.2.2-mysql-charsetphpini.patch +php5.2.2-mysqli-charsetphpini.patch +php5.2.2-pdo_mysql-charsetphpini.patch --- patches/php-patches/5.2.3/5.2.3/php5.2.3-mysql-charsetphpini.patch (revision 0) +++ patches/php-patches/5.2.3/5.2.3/php5.2.3-mysql-charsetphpini.patch (revision 0) @@ -0,0 +1,78 @@ +diff -ur php-5.2.3-orig/ext/mysql/php_mysql.c php-5.2.3/ext/mysql/php_mysql.c +--- php-5.2.3-orig/ext/mysql/php_mysql.c 2007-06-09 10:46:29.000000000 +0200 @@ -0,0 +1,47 @@ +--- main/php_variables.c 2007/04/17 15:06:50 1.104.2.10.2.8 @@ -0,0 +1,13 @@ +--- ext/odbc/php_odbc_includes.h 2005-02-22 17:55:18.000000000 +0000 @@ -0,0 +1,15 @@ +--- ext/imap/config.m4 2006-10-21 21:25:24.000000000 +0200 @@ -0,0 +1,104 @@ +diff -urd php-5.2.3-orig/Makefile.global php-5.2.3/Makefile.global +--- php-5.2.3-orig/Makefile.global 2007-06-09 10:46:29.000000000 +0200 @@ -0,0 +1,22 @@ +--- sapi/apache2filter/config.m4 2006-02-08 22:13:06.000000000 +0100 @@ -0,0 +1,14 @@ +--- ext/odbc/config.m4 2006-10-21 21:25:24.000000000 +0200 @@ -0,0 +1,9 @@ +MD5 eb50b751c8e1ced05bd012d5a0e4dec3 php-5.2.3.tar.bz2 7417635 +RMD160 3c895cf7e513e5a3d7d9f742a9d56102cbb3a79b php-5.2.3.tar.bz2 7417635 +SHA256 eedffda5069caa801a7fec217c77619657416a5fcaefb79ba4620432f0befe29 php-5.2.3.tar.bz2 7417635 +MD5 ae4ac6323d228aeecab75aa4aef4c20d php-patchset-5.2.3-r1.tar.bz2 13848 +RMD160 189d71704c212d8d3be98cbd25ad5463d3e4dc5d php-patchset-5.2.3-r1.tar.bz2 13848 +SHA256 c21bfe7191a601cfe715aeebf65363cedd95e6dfcb57c7158b890edba0becc7d php-patchset-5.2.3-r1.tar.bz2 13848 +MD5 f217d04f9513222e48cea6588ac65b89 suhosin-patch-5.2.3-0.9.6.2.patch.gz 22789 +RMD160 3adfe1038b8436dac56cb05c63a2b1305a6a0266 suhosin-patch-5.2.3-0.9.6.2.patch.gz 22789 +SHA256 214c43e4808483f0700f36ffa57aba909a669cb335c179d46c1e8f765d70bd1f suhosin-patch-5.2.3-0.9.6.2.patch.gz 22789 --- testing/dev-lang/php/Manifest (revision 0) +++ testing/dev-lang/php/Manifest (revision 0) @@ -0,0 +1,50 @@ +AUX 20php4-envd 145 RMD160 fb57b2d202ab1031303e7525a8ef5b353dc04ef8 SHA1 34ef066d2de22f147fc86bbe884692af7631f726 SHA256 17cd1a952434988b4c2125e4d1eef1df7114809f404605d35f255674419dd5d5 +MD5 77e3309d68e4a820b2abd408cd6c0ca0 files/20php4-envd 145 +RMD160 fb57b2d202ab1031303e7525a8ef5b353dc04ef8 files/20php4-envd 145 +SHA256 17cd1a952434988b4c2125e4d1eef1df7114809f404605d35f255674419dd5d5 files/20php4-envd 145 +AUX 20php5-envd 145 RMD160 8c81fb7dc1d1ddf16fd956d748514db3bcb27603 SHA1 f1cef57c0def8e2c5422aaf136f40b4ff47801d2 SHA256 efaae9e6ae5f7010e073c2ab6d8a9dda009f0707c7d7b0c027e142c94f7041a4 +MD5 9de5c2b4ffa3f2753b5e5e690fdade42 files/20php5-envd 145 +RMD160 8c81fb7dc1d1ddf16fd956d748514db3bcb27603 files/20php5-envd 145 +SHA256 efaae9e6ae5f7010e073c2ab6d8a9dda009f0707c7d7b0c027e142c94f7041a4 files/20php5-envd 145 +AUX 70_mod_php.conf-apache2 457 RMD160 3db748289c54547b815f6b2069cc02f4a18f16da SHA1 31f1ef36ad414beaf1dcbd99c3b41db7967c129d SHA256 03059ce0ece6c9b4db2d3bbf4b6352e0a4193a45843f3888ce3c37cc447748a1 +MD5 159253d05611d995e6ec3ca73bd372ca files/70_mod_php.conf-apache2 457 +RMD160 3db748289c54547b815f6b2069cc02f4a18f16da files/70_mod_php.conf-apache2 457 +SHA256 03059ce0ece6c9b4db2d3bbf4b6352e0a4193a45843f3888ce3c37cc447748a1 files/70_mod_php.conf-apache2 457 +AUX 70_mod_php5.conf-apache2 493 RMD160 c4ace955ff65ca2ce964cf4c8d2b42f6a41e90ef SHA1 226e31837e28675addb82f48d12f05bb4e0a5e66 SHA256 9de8f6073983e0b2ff784271047563782870d981a241abdecbdda8a038b15033 +MD5 d2b2325e816b90d3be7bd23388980421 files/70_mod_php5.conf-apache2 493 +RMD160 c4ace955ff65ca2ce964cf4c8d2b42f6a41e90ef files/70_mod_php5.conf-apache2 493 +SHA256 9de8f6073983e0b2ff784271047563782870d981a241abdecbdda8a038b15033 files/70_mod_php5.conf-apache2 493 +AUX 70_mod_php5_concurr.conf-apache2 417 RMD160 2f6bc0900fd2a94268f36254f7f6717b7a5fd649 SHA1 5490af6724ecdb5801ec12ed20ab80ac26d2f950 SHA256 f09cedf53f0355130f3a449920191fd4456f7303ebfcedaf57a636a2b18c29ba +MD5 ddc2f34aaaf326706aff17e220aec916 files/70_mod_php5_concurr.conf-apache2 417 +RMD160 2f6bc0900fd2a94268f36254f7f6717b7a5fd649 files/70_mod_php5_concurr.conf-apache2 417 +SHA256 f09cedf53f0355130f3a449920191fd4456f7303ebfcedaf57a636a2b18c29ba files/70_mod_php5_concurr.conf-apache2 417 +AUX 70_mod_php_concurr.conf-apache2 332 RMD160 e7691ce9ab686e32c48c7b204da339db098f3ef1 SHA1 fdfcebb517a25d78bc4373fec8756b147fd02fad SHA256 bb1764de57b950ca971d20a28a75ea98f907c11e2d8cc82996eda5eacd4baf7f +MD5 b325972ed888590c3f371458d3aa3d76 files/70_mod_php_concurr.conf-apache2 332 +RMD160 e7691ce9ab686e32c48c7b204da339db098f3ef1 files/70_mod_php_concurr.conf-apache2 332 +SHA256 bb1764de57b950ca971d20a28a75ea98f907c11e2d8cc82996eda5eacd4baf7f files/70_mod_php_concurr.conf-apache2 332 +AUX php4-ldvs 22 RMD160 e70c565b3930d9d9e3253062b7c633346cb99a63 SHA1 8c66355dfb80e2ecc6ee6faae30bf7dbb1727651 SHA256 4aee18478b09cda7e925ccde157db6099ea0122b5c4efb0868e3761b65688dde +MD5 abaacd6115552db702b3a8df140d107d files/php4-ldvs 22 +RMD160 e70c565b3930d9d9e3253062b7c633346cb99a63 files/php4-ldvs 22 +SHA256 4aee18478b09cda7e925ccde157db6099ea0122b5c4efb0868e3761b65688dde files/php4-ldvs 22 +AUX php5-ldvs 22 RMD160 5846dab2745b68a88175dd4e72d0b8cf4756dd46 SHA1 592398c92575adb14ec972847ce2aca28a7b9c2c SHA256 b79d0e52b1b3b4543b31ad45525ae1c2814a27ea8e676772ab10bf6fb12dfe79 +MD5 9b26422d0bda7252a77a81d1b734e1bd files/php5-ldvs 22 +RMD160 5846dab2745b68a88175dd4e72d0b8cf4756dd46 files/php5-ldvs 22 +SHA256 b79d0e52b1b3b4543b31ad45525ae1c2814a27ea8e676772ab10bf6fb12dfe79 files/php5-ldvs 22 +DIST php-5.2.3.tar.bz2 7417635 RMD160 3c895cf7e513e5a3d7d9f742a9d56102cbb3a79b SHA1 0a02e05e1c663c0d4ee0b253917c0e140e606261 SHA256 eedffda5069caa801a7fec217c77619657416a5fcaefb79ba4620432f0befe29 +DIST php-patchset-5.2.3-r1.tar.bz2 13848 RMD160 189d71704c212d8d3be98cbd25ad5463d3e4dc5d SHA1 3e5c9ca800dd9feafde7d1d1f87c60e26f8db48d SHA256 c21bfe7191a601cfe715aeebf65363cedd95e6dfcb57c7158b890edba0becc7d +DIST suhosin-patch-5.2.3-0.9.6.2.patch.gz 22789 RMD160 3adfe1038b8436dac56cb05c63a2b1305a6a0266 SHA1 9f4ee79b049df097efc634eb9d60249320441df3 SHA256 214c43e4808483f0700f36ffa57aba909a669cb335c179d46c1e8f765d70bd1f +EBUILD php-5.2.3.ebuild 14243 RMD160 9c0354b3905f47f6a5e43fa5653612e86ea8b682 SHA1 09f4815665db04c8720c636bf2bd041b17f28e67 SHA256 3f75703fbb6b204caa5b38d73cdbe2027f27b45bfab2c0810eb954566876c031 +MD5 58eb3f2cebf5c7dd63beecaf25ef398b php-5.2.3.ebuild 14243 +RMD160 9c0354b3905f47f6a5e43fa5653612e86ea8b682 php-5.2.3.ebuild 14243 +SHA256 3f75703fbb6b204caa5b38d73cdbe2027f27b45bfab2c0810eb954566876c031 php-5.2.3.ebuild 14243 +MISC metadata.xml 157 RMD160 a98db3a086fae3c09a903dadbc05f60443ec4b1a SHA1 ddaa23cc35eb917bf8962b652442bebb1ce0f440 SHA256 54f8878ca0228e380abbaa4b529806b5533a6b9b51b3b16c0909e906586a91a1 +MD5 c58d07ca1c1235bbad9bccaec96fc062 metadata.xml 157 +RMD160 a98db3a086fae3c09a903dadbc05f60443ec4b1a metadata.xml 157 +SHA256 54f8878ca0228e380abbaa4b529806b5533a6b9b51b3b16c0909e906586a91a1 metadata.xml 157 +MISC php-5.2.3.ebuild.org 14526 RMD160 0129646862f572d7fa168330608e1e3fae297772 SHA1 10366d7a94fd2669fc0e74629e7788869efd350a SHA256 395bfa44e53f785dec5e8ce6f1ca283e548b860a83a8f9b3a6a6af1272bc5e13 +MD5 8d5112bce4ff1970856ebd6275d906e6 php-5.2.3.ebuild.org 14526 +RMD160 0129646862f572d7fa168330608e1e3fae297772 php-5.2.3.ebuild.org 14526 +SHA256 395bfa44e53f785dec5e8ce6f1ca283e548b860a83a8f9b3a6a6af1272bc5e13 php-5.2.3.ebuild.org 14526 +MD5 2b9aa811913f7afb0d0a11789cbc3d94 files/digest-php-5.2.3 786 +RMD160 ed85ae7800e1d7f5d65b0d38a3c0558312b152c4 files/digest-php-5.2.3 786 +SHA256 36ea9374fb4e85802dbcc8d23f9657d116cd74ac0102dfe21724009a1f5df567 files/digest-php-5.2.3 786 --- testing/dev-lang/php/php-5.2.3.ebuild (revision 0) +++ testing/dev-lang/php/php-5.2.3.ebuild (revision 0) @@ -0,0 +1,477 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.2.2-r1.ebuild,v 1.9 2007/05/12 11:26:51 corsair Exp $ + +CGI_SAPI_USE="discard-path force-cgi-redirect" +APACHE2_SAPI_USE="concurrentmodphp threads" +IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild" + +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="1" +SUHOSIN_PATCH="suhosin-patch-${MY_PHP_PV}-0.9.6.2.patch.gz" +MULTILIB_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-multilib-search-path.patch" +# php patch settings, ebuild specific +FASTBUILD_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-fastbuild.patch" +CONCURRENTMODPHP_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-concurrent_apache_modules.patch" + +inherit php5_2-sapi apache-module + +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache2 SAPIs." + +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" + +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 + + # Threaded Apache2 support + if use apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if ! use threads ; then + APACHE2_SAFE_MPMS="itk peruser prefork" + else + APACHE2_SAFE_MPMS="event leader metuxmpm perchild threadpool worker" + fi + + ewarn + ewarn "If this package fails with a fatal error about Apache2 not having" + ewarn "been compiled with a compatible MPM, this is normally because you" + ewarn "need to toggle the 'threads' USE flag." + ewarn + ewarn "If 'threads' is off, try switching it on." + ewarn "If 'threads' is on, try switching it off." + ewarn + + apache-module_pkg_setup + fi + fi + + # Concurrent PHP Apache2 modules support + if use apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; 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 + 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 + + 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 + + # note - apache SAPI comes after the simpler cli/cgi sapis + if use apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + PHPSAPIS="${PHPSAPIS} apache${APACHE_VERSION}" + fi + fi +} + +src_unpack() { + if [[ "${PHP_PACKAGE}" == 1 ]] ; then + unpack ${A} + fi + + cd "${S}" + + # Concurrent PHP Apache2 modules support + if use apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; 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 + 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 + + # 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 +} + +src_compile() { + 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_apache2=0 + my_conf="" + + for x in ${PHPSAPIS} ; do + case ${x} in + cli) + build_cli=1 + ;; + cgi) + build_cgi=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_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 + + # 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_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 + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if use concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" + fi + fi + fi + + for x in ${PHPSAPIS} ; do + # Support the Apache2 extras, they must be set globally for all + # SAPIs to work correctly, especially for external PHP extensions + if use apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if use threads ; then + my_conf="${my_conf} --enable-maintainer-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + 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" + ;; + 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 + ;; + 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" "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" "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 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() { + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + if ! emake -j1 test ; then + hasq test ${FEATURES} && die "Make test failed. See above for details." + hasq test ${FEATURES} || eerror "Make test failed. See above for details." + fi +}