diff options
author | Luca Longinotti <chtekk@gentoo.org> | 2006-07-14 16:04:37 +0000 |
---|---|---|
committer | Luca Longinotti <chtekk@gentoo.org> | 2006-07-14 16:04:37 +0000 |
commit | b77dd4c02cbe26374a94db4673545874bff6ee75 (patch) | |
tree | 84246ed74c82ce8bca1d2f9941733ef63c0ce84e /dev-lang | |
parent | ppc stable, bug #139612 (diff) | |
download | gentoo-2-b77dd4c02cbe26374a94db4673545874bff6ee75.tar.gz gentoo-2-b77dd4c02cbe26374a94db4673545874bff6ee75.tar.bz2 gentoo-2-b77dd4c02cbe26374a94db4673545874bff6ee75.zip |
Update PHP ebuilds, fix various (security) issues.
(Portage version: 2.1.1_pre2-r6)
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/php/ChangeLog | 17 | ||||
-rw-r--r-- | dev-lang/php/files/70_mod_php5_concurr.conf-apache2 | 17 | ||||
-rw-r--r-- | dev-lang/php/files/70_mod_php_concurr.conf-apache2 | 15 | ||||
-rw-r--r-- | dev-lang/php/files/digest-php-4.3.11-r5 | 6 | ||||
-rw-r--r-- | dev-lang/php/files/digest-php-4.4.2-r6 | 9 | ||||
-rw-r--r-- | dev-lang/php/files/digest-php-5.0.5-r5 | 6 | ||||
-rw-r--r-- | dev-lang/php/files/digest-php-5.1.4-r4 | 9 | ||||
-rw-r--r-- | dev-lang/php/files/php4-ldvs | 1 | ||||
-rw-r--r-- | dev-lang/php/files/php5-ldvs | 1 | ||||
-rw-r--r-- | dev-lang/php/php-4.3.11-r5.ebuild | 329 | ||||
-rw-r--r-- | dev-lang/php/php-4.4.2-r2.ebuild | 304 | ||||
-rw-r--r-- | dev-lang/php/php-4.4.2-r6.ebuild | 498 | ||||
-rw-r--r-- | dev-lang/php/php-4.4.2.ebuild | 304 | ||||
-rw-r--r-- | dev-lang/php/php-5.0.5-r5.ebuild | 244 | ||||
-rw-r--r-- | dev-lang/php/php-5.1.4-r4.ebuild | 498 | ||||
-rw-r--r-- | dev-lang/php/php-5.1.4.ebuild | 304 |
16 files changed, 2314 insertions, 248 deletions
diff --git a/dev-lang/php/ChangeLog b/dev-lang/php/ChangeLog index a55eae1e209e..eed927ff167d 100644 --- a/dev-lang/php/ChangeLog +++ b/dev-lang/php/ChangeLog @@ -1,6 +1,21 @@ # ChangeLog for dev-lang/php # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.102 2006/07/13 16:20:54 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.103 2006/07/14 16:04:37 chtekk Exp $ + +*php-5.1.4-r4 (14 Jul 2006) +*php-4.4.2-r6 (14 Jul 2006) + + 14 Jul 2006; Luca Longinotti <chtekk@gentoo.org> + +files/70_mod_php5_concurr.conf-apache2, + +files/70_mod_php_concurr.conf-apache2, +files/php4-ldvs, + +files/php5-ldvs, php-4.3.11-r5.ebuild, php-4.4.2.ebuild, + php-4.4.2-r2.ebuild, -php-4.4.2-r5.ebuild, +php-4.4.2-r6.ebuild, + php-5.0.5-r5.ebuild, php-5.1.4.ebuild, -php-5.1.4-r3.ebuild, + +php-5.1.4-r4.ebuild: + Restructure PHP ebuilds and eclasses to accomodate for future expansion and + new features, cleaner separation between eclasses and ebuilds. Fixes + security related bugs #133524, #136566, #138180, #135860 and bugs #137568, + #134171, #138665. 13 Jul 2006; Luca Longinotti <chtekk@gentoo.org> -php-5.1.2.ebuild: Remove PHP 5.1.2. 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 000000000000..f95db6f1b60c --- /dev/null +++ b/dev-lang/php/files/70_mod_php5_concurr.conf-apache2 @@ -0,0 +1,17 @@ +<IfDefine PHP5> + + # Load the module first + <IfModule !mod_php5.c> + LoadModule php5_module modules/libphp5.so + </IfModule> + + # Set it to handle the files + <IfModule mod_mime.c> + AddType application/x-httpd-php5 .php + AddType application/x-httpd-php5 .phtml + AddType application/x-httpd-php5 .php5 + AddType application/x-httpd-php5-source .phps + </IfModule> + + AddDirectoryIndex index.php index.phtml +</IfDefine> diff --git a/dev-lang/php/files/70_mod_php_concurr.conf-apache2 b/dev-lang/php/files/70_mod_php_concurr.conf-apache2 new file mode 100644 index 000000000000..64f5b91eb47f --- /dev/null +++ b/dev-lang/php/files/70_mod_php_concurr.conf-apache2 @@ -0,0 +1,15 @@ +<IfDefine PHP4> + + # Load the module first + <IfModule !sapi_apache2.c> + LoadModule php4_module modules/libphp4.so + </IfModule> + + # Set it to handle the files + <IfModule mod_mime.c> + AddType application/x-httpd-php4 .php3 + AddType application/x-httpd-php4 .php4 + </IfModule> + + AddDirectoryIndex index.php index.phtml +</IfDefine> diff --git a/dev-lang/php/files/digest-php-4.3.11-r5 b/dev-lang/php/files/digest-php-4.3.11-r5 index 62d6b2d1a466..4bbbf0463d9b 100644 --- a/dev-lang/php/files/digest-php-4.3.11-r5 +++ b/dev-lang/php/files/digest-php-4.3.11-r5 @@ -4,9 +4,9 @@ SHA256 103e80cb39fc1a5b6b93e9d5faf9842ea1e1a7847cfc868369325f80421d29c7 hardenin MD5 fbc67d240812136a9842bc1f2a217b7a php-4.3.11.tar.bz2 4012575 RMD160 fe44f6c2783ddd469b94744e440e836cff3329e5 php-4.3.11.tar.bz2 4012575 SHA256 6b133db9ac17d4e1f393003683c1b4d15dff3197559c85fd8dd63ba4868a21c5 php-4.3.11.tar.bz2 4012575 -MD5 31c7af83657e23387116b2407aaf796c php-patchset-4.3.11-r2.tar.bz2 27051 -RMD160 0c0fa32570cd79eb0ce59b308fdb38c68c58280a php-patchset-4.3.11-r2.tar.bz2 27051 -SHA256 4235ac9ac8104fdcd39d11774de6c24493e6e94df7f840f69925430fec3b0d39 php-patchset-4.3.11-r2.tar.bz2 27051 +MD5 9fc7aed0586ccfee807af49762f71774 php-patchset-4.3.11-r3.tar.bz2 27977 +RMD160 a99c2eecca8e6e51cdb2f66e7da2d0a446fb8d50 php-patchset-4.3.11-r3.tar.bz2 27977 +SHA256 4b93cdebc3034e81d9c589e90fdf93e84ea67712a56afaad5b0b299edfe6d76b php-patchset-4.3.11-r3.tar.bz2 27977 MD5 33be24619f3a10953f9e1e32beeee97a php-pcrelib-new-secpatch.tar.bz2 357619 RMD160 1748ef9837f3f5ce7ad81f0dd751b430c8c2c6f6 php-pcrelib-new-secpatch.tar.bz2 357619 SHA256 7c49aa2c6be704b576720673fa123febdddc541d8152ccacea5cb2c9d1560a19 php-pcrelib-new-secpatch.tar.bz2 357619 diff --git a/dev-lang/php/files/digest-php-4.4.2-r6 b/dev-lang/php/files/digest-php-4.4.2-r6 new file mode 100644 index 000000000000..8b915b8daf0b --- /dev/null +++ b/dev-lang/php/files/digest-php-4.4.2-r6 @@ -0,0 +1,9 @@ +MD5 d53ac42b51ed80f8f23751a1d7113cfa hardening-patch-4.4.2-0.4.11-gentoo-r1.patch.gz 59709 +RMD160 6bd005bda596ff2690f5ee2563b2708671948c7c hardening-patch-4.4.2-0.4.11-gentoo-r1.patch.gz 59709 +SHA256 3e938f8f62322b061acbcc6f900c249b0dee0a8672557c7cbce3513c44f4dc04 hardening-patch-4.4.2-0.4.11-gentoo-r1.patch.gz 59709 +MD5 28051cd9ef43490dd9727a4d442011b5 php-4.4.2.tar.bz2 4371185 +RMD160 cbef0fa4e233529422bc0944dcfb79d866013f5e php-4.4.2.tar.bz2 4371185 +SHA256 a2024d665125a41611eb64451648d37a81e3579594c8810bb41ac8b2b63f81eb php-4.4.2.tar.bz2 4371185 +MD5 fad43ccccab8d21d962efcb03b03b236 php-patchset-4.4.2-r7.tar.bz2 24079 +RMD160 9bd72618cb3ac7584bcbf5f41c7c7926590bc85b php-patchset-4.4.2-r7.tar.bz2 24079 +SHA256 44c976ee3df7b99ed014a1579264cdd069e9bd57efa2757ee4e06112d073fc5b php-patchset-4.4.2-r7.tar.bz2 24079 diff --git a/dev-lang/php/files/digest-php-5.0.5-r5 b/dev-lang/php/files/digest-php-5.0.5-r5 index 17b526372619..a61252bffa1e 100644 --- a/dev-lang/php/files/digest-php-5.0.5-r5 +++ b/dev-lang/php/files/digest-php-5.0.5-r5 @@ -4,6 +4,6 @@ SHA256 6d8e61ff1fa10ce238600e936de1eac665c5237482ae6c3b4db05c6b7d684a7c hardenin MD5 b5d4ca75bbb11ee5b830fa67213d9f7f php-5.0.5.tar.bz2 4895556 RMD160 6a9a892affba229770154407860cd1c2a098eaf9 php-5.0.5.tar.bz2 4895556 SHA256 aa63e769059d2452b153db6d4e6b421228d0606cbe8b11ace00e4c1b5c2cdc4f php-5.0.5.tar.bz2 4895556 -MD5 6f9db1d66a81f95933ad6d9eb71c6f84 php-patchset-5.0.5-r2.tar.bz2 20314 -RMD160 2a929a6eb9f5e8a9e01c26b6304f7c60e4c1bf7d php-patchset-5.0.5-r2.tar.bz2 20314 -SHA256 46bfe8d324b28dbfc8c9399bf6c1f2ef3e44cca7b97e08a9083f986002482309 php-patchset-5.0.5-r2.tar.bz2 20314 +MD5 88f5caa59c695fc44384d83ef39ea213 php-patchset-5.0.5-r3.tar.bz2 20910 +RMD160 0f78808e3fe15568d5670ad852ed218589949aea php-patchset-5.0.5-r3.tar.bz2 20910 +SHA256 b4df50e7a857eea4072c0b7cde1585409eaebec8f64474d6c1611c5b9869c7f2 php-patchset-5.0.5-r3.tar.bz2 20910 diff --git a/dev-lang/php/files/digest-php-5.1.4-r4 b/dev-lang/php/files/digest-php-5.1.4-r4 new file mode 100644 index 000000000000..0ec44b224cd8 --- /dev/null +++ b/dev-lang/php/files/digest-php-5.1.4-r4 @@ -0,0 +1,9 @@ +MD5 5c05d2abcc496454c17deb1889c6131c hardening-patch-5.1.4-0.4.11-gentoo-r1.patch.gz 58168 +RMD160 8fe4085261c939944567a796e4be8d0af9fc4a66 hardening-patch-5.1.4-0.4.11-gentoo-r1.patch.gz 58168 +SHA256 fd07ac145966e931f961c392ca087a2a7e93ba9c6bcc0ff382ca80d5019480d6 hardening-patch-5.1.4-0.4.11-gentoo-r1.patch.gz 58168 +MD5 66a806161d4a2d3b5153ebe4cd0f2e1c php-5.1.4.tar.bz2 6356171 +RMD160 d4ab11884a3a899f21eef777767a553cf81584ce php-5.1.4.tar.bz2 6356171 +SHA256 b55253e9557eceb901d83217ec192da22c28c7b2fdf714d3f151f1db663b5a32 php-5.1.4.tar.bz2 6356171 +MD5 1563ba29dae55380ef1b88be07fe39c6 php-patchset-5.1.4-r5.tar.bz2 21025 +RMD160 ebe867eff66440c1714ac2cb87c11ee17f15d8ea php-patchset-5.1.4-r5.tar.bz2 21025 +SHA256 8d682d0b26dcbd5ee420bc2c2e1483a68a34ede6eecf7ae83f1ea9ca36a6c57f php-patchset-5.1.4-r5.tar.bz2 21025 diff --git a/dev-lang/php/files/php4-ldvs b/dev-lang/php/files/php4-ldvs new file mode 100644 index 000000000000..01b4eebed95f --- /dev/null +++ b/dev-lang/php/files/php4-ldvs @@ -0,0 +1 @@ +PHP_4 { global: *; }; diff --git a/dev-lang/php/files/php5-ldvs b/dev-lang/php/files/php5-ldvs new file mode 100644 index 000000000000..783b0f63ac70 --- /dev/null +++ b/dev-lang/php/files/php5-ldvs @@ -0,0 +1 @@ +PHP_5 { global: *; }; diff --git a/dev-lang/php/php-4.3.11-r5.ebuild b/dev-lang/php/php-4.3.11-r5.ebuild index 045efffd9488..99722b3df0a7 100644 --- a/dev-lang/php/php-4.3.11-r5.ebuild +++ b/dev-lang/php/php-4.3.11-r5.ebuild @@ -1,8 +1,11 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-4.3.11-r5.ebuild,v 1.11 2006/04/20 12:35:09 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-4.3.11-r5.ebuild,v 1.12 2006/07/14 16:04:37 chtekk Exp $ + +CGI_SAPI_USE="discard-path force-cgi-redirect" +APACHE2_SAPI_USE="concurrentmodphp threads" +IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild" -IUSE="cgi cli discard-path force-cgi-redirect" KEYWORDS="~alpha arm ia64 ~ppc s390 sh sparc x86" # NOTE: Portage doesn't support setting PROVIDE based on the USE flags @@ -14,28 +17,24 @@ PROVIDE="virtual/php virtual/httpd-php" SLOT="4" MY_PHP_PV="${PV}" MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE=1 +PHP_PACKAGE="1" -# php patch settings -PHP_PATCHSET_REV="2" +# php patch settings, general +PHP_PATCHSET_REV="3" HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.3-gentoo.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 php4_4-sapi apache-module want_apache -DESCRIPTION="The PHP language runtime engine." - -DEPEND="${DEPEND} app-admin/php-toolkit" -RDEPEND="${RDEPEND} app-admin/php-toolkit" +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache SAPIs." -# PHP patchsets -SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" - -# Hardened-PHP patch -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" # Fixed PCRE library for security issues, bug #102373 SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-pcrelib-new-secpatch.tar.bz2" @@ -43,14 +42,15 @@ SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-pcrelib-new-secpatch.tar.bz2 pkg_setup() { PHPCONFUTILS_AUTO_USE="" - # make sure the user has specified a SAPI + # 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 apache apache2 + # Threaded Apache2 support if useq apache2 ; then if [[ "${APACHE_VERSION}" != "0" ]] ; then if ! useq threads ; then - APACHE2_SAFE_MPMS="peruser prefork" + APACHE2_SAFE_MPMS="itk peruser prefork" else APACHE2_SAFE_MPMS="event leader metuxmpm perchild threadpool worker" fi @@ -68,39 +68,47 @@ pkg_setup() { fi fi + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq fastbuild ; then ewarn ewarn "'fastbuild' attempts to build all SAPIs in a single pass." - ewarn "This is an experimental feature, which may fail to compile" - ewarn "and may produce PHP binaries which are broken." - ewarn - ewarn "Rebuild without 'fastbuild' and reproduce any bugs before filing" - ewarn "any bugs in Gentoo's Bugzilla or bugs.php.net." + 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 php4_4-sapi_pkg_setup } -src_unpack() { - # custom src_unpack, used only for PHP ebuilds that need additional patches - # normally the eclass src_unpack is used - if [[ "${PHP_PACKAGE}" == 1 ]] ; then - unpack ${A} - fi - - cd "${S}" - - # Substitute the bundled PCRE library with a fixed version for bug #102373 - einfo "Updating bundled PCRE library" - rm -Rf "${S}/ext/pcre/pcrelib" && mv -f "${WORKDIR}/pcrelib-new" "${S}/ext/pcre/pcrelib" || die "Unable to update the bundled PCRE library" - - # we call the eclass src_unpack, but don't want ${A} to be unpacked again - PHP_PACKAGE=0 - php4_4-sapi_src_unpack - PHP_PACKAGE=1 -} - php_determine_sapis() { # holds the list of sapis that we want to build PHPSAPIS= @@ -122,6 +130,43 @@ php_determine_sapis() { fi } +src_unpack() { + if [[ "${PHP_PACKAGE}" == 1 ]] ; then + unpack ${A} + fi + + cd "${S}" + + # Substitute bundled PCRE library with a fixed version for bug #102373 + einfo "Updating bundled PCRE library" + rm -Rf "${S}/ext/pcre/pcrelib" && mv -f "${WORKDIR}/pcrelib-new" "${S}/ext/pcre/pcrelib" || die "Unable to update bundled PCRE library" + + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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 + php4_4-sapi_src_unpack +} + src_compile() { if useq fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then src_compile_fastbuild @@ -135,7 +180,9 @@ src_compile_fastbuild() { build_cli=0 build_cgi=0 - build_apache=0 + build_apache1=0 + build_apache2=0 + my_conf="" for x in ${PHPSAPIS} ; do case ${x} in @@ -145,8 +192,11 @@ src_compile_fastbuild() { cgi) build_cgi=1 ;; - apache*) - build_apache=1 + apache1) + build_apache1=1 + ;; + apache2) + build_apache2=1 ;; esac done @@ -165,14 +215,29 @@ src_compile_fastbuild() { my_conf="${my_conf} --disable-cgi" fi - if [[ ${build_apache} = 1 ]] ; then - my_conf="${my_conf} --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + if [[ ${build_apache1} = 1 ]] ; then + my_conf="${my_conf} --with-apxs=/usr/sbin/apxs" fi - # now we know what we are building, build it + if [[ ${build_apache2} = 1 ]] ; then + my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" + + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-ldvs" + fi + fi + + # Now we know what we are building, build it php4_4-sapi_src_compile - # to keep the separate php.ini files for each SAPI, we change the + # To keep the separate php.ini files for each SAPI, we change the # build-defs.h and recompile if [[ ${build_cli} = 1 ]] ; then @@ -203,9 +268,9 @@ src_compile_fastbuild() { cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" fi - if [[ ${build_apache} = 1 ]] ; then + if [[ ${build_apache1} = 1 ]] || [[ ${build_apache2} = 1 ]] ; then einfo - einfo "Building apache${USE_APACHE2} SAPI" + 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}-php4\"|g;" -i main/build-defs.h @@ -213,7 +278,7 @@ src_compile_fastbuild() { 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 build mod_php" + make || die "Unable to make apache${APACHE_VERSION} SAPI" fi } @@ -221,34 +286,63 @@ 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + fi + fi + if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then make clean fi - PHPSAPI=${x} + PHPSAPI="${x}" case ${x} in cli) - my_conf="--enable-cli --disable-cgi" + my_conf="${my_conf} --enable-cli --disable-cgi" php4_4-sapi_src_compile - cp sapi/cli/php php-cli + cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" ;; cgi) - my_conf="--disable-cli --enable-cgi --enable-fastcgi" + 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 php4_4-sapi_src_compile - cp sapi/cgi/php php-cgi + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" + ;; + apache1) + my_conf="${my_conf} --disable-cli --with-apxs=/usr/sbin/apxs" + php4_4-sapi_src_compile ;; - apache*) - my_conf="--disable-cli --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + apache2) + my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" php4_4-sapi_src_compile ;; esac CLEAN_REQUIRED=1 + my_conf="" done } @@ -257,7 +351,7 @@ src_install() { destdir=/usr/$(get_libdir)/php4 - # let the eclass do the heavy lifting + # Let the eclass do the common work php4_4-sapi_src_install einfo @@ -265,7 +359,9 @@ src_install() { einfo for x in ${PHPSAPIS} ; do - PHPSAPI=${x} + + PHPSAPI="${x}" + case ${x} in cli) einfo "Installing CLI SAPI" @@ -279,17 +375,32 @@ src_install() { dobin php-cgi || die "Unable to install ${x} sapi" php4_4-sapi_install_ini ;; - apache*) - einfo "Installing apache${USE_APACHE2} SAPI" + apache1) + einfo "Installing Apache${APACHE_VERSION} SAPI" make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if [[ -n "${USE_APACHE2}" ]] ; then - einfo "Installing Apache2 config file for PHP4 (70_mod_php.conf)" + einfo "Installing Apache${APACHE_VERSION} config file for PHP4 (70_mod_php.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php.conf-apache1" "70_mod_php.conf" + php4_4-sapi_install_ini + ;; + apache2) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + if useq concurrentmodphp ; then + einfo "Installing Apache${APACHE_VERSION} config file for PHP4-concurrent (70_mod_php_concurr.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf" + newins "${FILESDIR}/70_mod_php_concurr.conf-apache2" "70_mod_php_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}/php4-ldvs" + + # Redefine the extension dir to have the modphp suffix + PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned" else - einfo "Installing Apache config file for PHP4 (70_mod_php.conf)" + einfo "Installing Apache${APACHE_VERSION} config file for PHP4 (70_mod_php.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php.conf-apache1" "70_mod_php.conf" + newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf" fi php4_4-sapi_install_ini ;; @@ -303,8 +414,92 @@ pkg_postinst() { APACHE1_MOD_DEFINE="PHP4" APACHE1_MOD_CONF="70_mod_php" APACHE2_MOD_DEFINE="PHP4" - APACHE2_MOD_CONF="70_mod_php" + if useq concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php_concurr" + else + APACHE2_MOD_CONF="70_mod_php" + fi apache-module_pkg_postinst fi + + # Update Apache1 to use mod_php + if useq apache ; then + "${ROOT}/usr/sbin/php-select" -t apache1 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache1 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache1 is configured to load a different version of PHP." + ewarn "To make Apache1 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache1 php4" + ewarn + fi + fi + + # Update Apache2 to use mod_php + if useq apache2 ; then + "${ROOT}/usr/sbin/php-select" -t apache2 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache2 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache2 is configured to load a different version of PHP." + ewarn "To make Apache2 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache2 php4" + ewarn + fi + fi + + # Create the symlinks for php-cli + if useq cli || phpconfutils_usecheck cli ; then + "${ROOT}/usr/sbin/php-select" -t php php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php php4" + ewarn + fi + fi + + # Create the symlinks for php-cgi + if useq cgi ; then + "${ROOT}/usr/sbin/php-select" -t php-cgi php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php-cgi php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php-cgi php4" + ewarn + fi + fi + + # Create the symlinks for php-devel + "${ROOT}/usr/sbin/php-select" -t php-devel php4 > /dev/null 2>&1 + exitStatus=$? + if [[ $exitStatus == 5 ]] ; then + php-select php-devel php4 + 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 v4, use" + ewarn "php-select:" + ewarn + ewarn " php-select php-devel php4" + ewarn + fi + php4_4-sapi_pkg_postinst } diff --git a/dev-lang/php/php-4.4.2-r2.ebuild b/dev-lang/php/php-4.4.2-r2.ebuild index f4a289992307..73b0c8f97613 100644 --- a/dev-lang/php/php-4.4.2-r2.ebuild +++ b/dev-lang/php/php-4.4.2-r2.ebuild @@ -1,8 +1,11 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-4.4.2-r2.ebuild,v 1.10 2006/06/18 19:42:05 kloeri Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-4.4.2-r2.ebuild,v 1.11 2006/07/14 16:04:37 chtekk Exp $ + +CGI_SAPI_USE="discard-path force-cgi-redirect" +APACHE2_SAPI_USE="concurrentmodphp threads" +IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild" -IUSE="cgi cli discard-path force-cgi-redirect" 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 @@ -14,40 +17,37 @@ PROVIDE="virtual/php virtual/httpd-php" SLOT="4" MY_PHP_PV="${PV}" MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE=1 +PHP_PACKAGE="1" -# php patch settings +# php patch settings, general PHP_PATCHSET_REV="3" HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.9-gentoo.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 php4_4-sapi apache-module want_apache -DESCRIPTION="The PHP language runtime engine." - -DEPEND="${DEPEND} app-admin/php-toolkit" -RDEPEND="${RDEPEND} app-admin/php-toolkit" - -# PHP patchsets -SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache SAPIs." -# Hardened-PHP patch -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" pkg_setup() { PHPCONFUTILS_AUTO_USE="" - # make sure the user has specified a SAPI + # 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 apache apache2 + # Threaded Apache2 support if useq apache2 ; then if [[ "${APACHE_VERSION}" != "0" ]] ; then if ! useq threads ; then - APACHE2_SAFE_MPMS="peruser prefork" + APACHE2_SAFE_MPMS="itk peruser prefork" else APACHE2_SAFE_MPMS="event leader metuxmpm perchild threadpool worker" fi @@ -65,14 +65,41 @@ pkg_setup() { fi fi + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq fastbuild ; then ewarn ewarn "'fastbuild' attempts to build all SAPIs in a single pass." - ewarn "This is an experimental feature, which may fail to compile" - ewarn "and may produce PHP binaries which are broken." - ewarn - ewarn "Rebuild without 'fastbuild' and reproduce any bugs before filing" - ewarn "any bugs in Gentoo's Bugzilla or bugs.php.net." + 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 @@ -100,6 +127,39 @@ php_determine_sapis() { fi } +src_unpack() { + if [[ "${PHP_PACKAGE}" == 1 ]] ; then + unpack ${A} + fi + + cd "${S}" + + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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 + php4_4-sapi_src_unpack +} + src_compile() { if useq fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then src_compile_fastbuild @@ -113,7 +173,9 @@ src_compile_fastbuild() { build_cli=0 build_cgi=0 - build_apache=0 + build_apache1=0 + build_apache2=0 + my_conf="" for x in ${PHPSAPIS} ; do case ${x} in @@ -123,8 +185,11 @@ src_compile_fastbuild() { cgi) build_cgi=1 ;; - apache*) - build_apache=1 + apache1) + build_apache1=1 + ;; + apache2) + build_apache2=1 ;; esac done @@ -143,14 +208,29 @@ src_compile_fastbuild() { my_conf="${my_conf} --disable-cgi" fi - if [[ ${build_apache} = 1 ]] ; then - my_conf="${my_conf} --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + if [[ ${build_apache1} = 1 ]] ; then + my_conf="${my_conf} --with-apxs=/usr/sbin/apxs" + fi + + if [[ ${build_apache2} = 1 ]] ; then + my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" + + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-ldvs" + fi fi - # now we know what we are building, build it + # Now we know what we are building, build it php4_4-sapi_src_compile - # to keep the separate php.ini files for each SAPI, we change the + # To keep the separate php.ini files for each SAPI, we change the # build-defs.h and recompile if [[ ${build_cli} = 1 ]] ; then @@ -181,9 +261,9 @@ src_compile_fastbuild() { cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" fi - if [[ ${build_apache} = 1 ]] ; then + if [[ ${build_apache1} = 1 ]] || [[ ${build_apache2} = 1 ]] ; then einfo - einfo "Building apache${USE_APACHE2} SAPI" + 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}-php4\"|g;" -i main/build-defs.h @@ -191,7 +271,7 @@ src_compile_fastbuild() { 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 build mod_php" + make || die "Unable to make apache${APACHE_VERSION} SAPI" fi } @@ -199,34 +279,63 @@ 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + fi + fi + if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then make clean fi - PHPSAPI=${x} + PHPSAPI="${x}" case ${x} in cli) - my_conf="--enable-cli --disable-cgi" + my_conf="${my_conf} --enable-cli --disable-cgi" php4_4-sapi_src_compile - cp sapi/cli/php php-cli + cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" ;; cgi) - my_conf="--disable-cli --enable-cgi --enable-fastcgi" + 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 php4_4-sapi_src_compile - cp sapi/cgi/php php-cgi + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" ;; - apache*) - my_conf="--disable-cli --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + apache1) + my_conf="${my_conf} --disable-cli --with-apxs=/usr/sbin/apxs" + php4_4-sapi_src_compile + ;; + apache2) + my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" php4_4-sapi_src_compile ;; esac CLEAN_REQUIRED=1 + my_conf="" done } @@ -235,7 +344,7 @@ src_install() { destdir=/usr/$(get_libdir)/php4 - # let the eclass do the heavy lifting + # Let the eclass do the common work php4_4-sapi_src_install einfo @@ -243,7 +352,9 @@ src_install() { einfo for x in ${PHPSAPIS} ; do - PHPSAPI=${x} + + PHPSAPI="${x}" + case ${x} in cli) einfo "Installing CLI SAPI" @@ -257,17 +368,32 @@ src_install() { dobin php-cgi || die "Unable to install ${x} sapi" php4_4-sapi_install_ini ;; - apache*) - einfo "Installing apache${USE_APACHE2} SAPI" + apache1) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + einfo "Installing Apache${APACHE_VERSION} config file for PHP4 (70_mod_php.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php.conf-apache1" "70_mod_php.conf" + php4_4-sapi_install_ini + ;; + apache2) + einfo "Installing Apache${APACHE_VERSION} SAPI" make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if [[ -n "${USE_APACHE2}" ]] ; then - einfo "Installing Apache2 config file for PHP4 (70_mod_php.conf)" + if useq concurrentmodphp ; then + einfo "Installing Apache${APACHE_VERSION} config file for PHP4-concurrent (70_mod_php_concurr.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf" + newins "${FILESDIR}/70_mod_php_concurr.conf-apache2" "70_mod_php_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}/php4-ldvs" + + # Redefine the extension dir to have the modphp suffix + PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned" else - einfo "Installing Apache config file for PHP4 (70_mod_php.conf)" + einfo "Installing Apache${APACHE_VERSION} config file for PHP4 (70_mod_php.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php.conf-apache1" "70_mod_php.conf" + newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf" fi php4_4-sapi_install_ini ;; @@ -281,8 +407,92 @@ pkg_postinst() { APACHE1_MOD_DEFINE="PHP4" APACHE1_MOD_CONF="70_mod_php" APACHE2_MOD_DEFINE="PHP4" - APACHE2_MOD_CONF="70_mod_php" + if useq concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php_concurr" + else + APACHE2_MOD_CONF="70_mod_php" + fi apache-module_pkg_postinst fi + + # Update Apache1 to use mod_php + if useq apache ; then + "${ROOT}/usr/sbin/php-select" -t apache1 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache1 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache1 is configured to load a different version of PHP." + ewarn "To make Apache1 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache1 php4" + ewarn + fi + fi + + # Update Apache2 to use mod_php + if useq apache2 ; then + "${ROOT}/usr/sbin/php-select" -t apache2 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache2 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache2 is configured to load a different version of PHP." + ewarn "To make Apache2 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache2 php4" + ewarn + fi + fi + + # Create the symlinks for php-cli + if useq cli || phpconfutils_usecheck cli ; then + "${ROOT}/usr/sbin/php-select" -t php php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php php4" + ewarn + fi + fi + + # Create the symlinks for php-cgi + if useq cgi ; then + "${ROOT}/usr/sbin/php-select" -t php-cgi php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php-cgi php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php-cgi php4" + ewarn + fi + fi + + # Create the symlinks for php-devel + "${ROOT}/usr/sbin/php-select" -t php-devel php4 > /dev/null 2>&1 + exitStatus=$? + if [[ $exitStatus == 5 ]] ; then + php-select php-devel php4 + 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 v4, use" + ewarn "php-select:" + ewarn + ewarn " php-select php-devel php4" + ewarn + fi + php4_4-sapi_pkg_postinst } diff --git a/dev-lang/php/php-4.4.2-r6.ebuild b/dev-lang/php/php-4.4.2-r6.ebuild new file mode 100644 index 000000000000..a74e8fb2753b --- /dev/null +++ b/dev-lang/php/php-4.4.2-r6.ebuild @@ -0,0 +1,498 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-4.4.2-r6.ebuild,v 1.1 2006/07/14 16:04:37 chtekk 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="4" +MY_PHP_PV="${PV}" +MY_PHP_P="php-${MY_PHP_PV}" +PHP_PACKAGE="1" + +# php patch settings, general +PHP_PATCHSET_REV="7" +HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.11-gentoo-r1.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 php4_4-sapi apache-module + +want_apache + +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache SAPIs." + +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" + +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 apache apache2 + + # Threaded Apache2 support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if ! useq 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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 + + php4_4-sapi_pkg_setup +} + +php_determine_sapis() { + # holds the list of sapis that we want to build + PHPSAPIS= + + if useq cli || phpconfutils_usecheck cli ; then + PHPSAPIS="${PHPSAPIS} cli" + fi + + if useq cgi ; then + PHPSAPIS="${PHPSAPIS} cgi" + fi + + # note - we can only build one apache sapi for now + # note - apache SAPI comes after the simpler cli/cgi sapis + if useq apache || useq 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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 + php4_4-sapi_src_unpack +} + +src_compile() { + if useq 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_apache1=0 + build_apache2=0 + my_conf="" + + for x in ${PHPSAPIS} ; do + case ${x} in + cli) + build_cli=1 + ;; + cgi) + build_cgi=1 + ;; + apache1) + build_apache1=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_apache1} = 1 ]] ; then + my_conf="${my_conf} --with-apxs=/usr/sbin/apxs" + fi + + if [[ ${build_apache2} = 1 ]] ; then + my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" + + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-ldvs" + fi + fi + + # Now we know what we are building, build it + php4_4-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-php4"|g;' -i main/build-defs.h + sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cli-php4/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-php4"|g;' -i main/build-defs.h + sed -e 's|^#define PHP_CONFIG_FILE_SCAN_DIR.*|#define PHP_CONFIG_FILE_SCAN_DIR "/etc/php/cgi-php4/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 || die "Unable to make CGI SAPI" + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" + fi + + if [[ ${build_apache1} = 1 ]] || [[ ${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}-php4\"|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}-php4/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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-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" + php4_4-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 + php4_4-sapi_src_compile + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" + ;; + apache1) + my_conf="${my_conf} --disable-cli --with-apxs=/usr/sbin/apxs" + php4_4-sapi_src_compile + ;; + apache2) + my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" + php4_4-sapi_src_compile + ;; + esac + + CLEAN_REQUIRED=1 + my_conf="" + done +} + +src_install() { + php_determine_sapis + + destdir=/usr/$(get_libdir)/php4 + + # Let the eclass do the common work + php4_4-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" + php4_4-sapi_install_ini + ;; + cgi) + einfo "Installing CGI SAPI" + into ${destdir} + dobin php-cgi || die "Unable to install ${x} sapi" + php4_4-sapi_install_ini + ;; + apache1) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + einfo "Installing Apache${APACHE_VERSION} config file for PHP4 (70_mod_php.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php.conf-apache1" "70_mod_php.conf" + php4_4-sapi_install_ini + ;; + apache2) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + if useq concurrentmodphp ; then + einfo "Installing Apache${APACHE_VERSION} config file for PHP4-concurrent (70_mod_php_concurr.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php_concurr.conf-apache2" "70_mod_php_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}/php4-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 PHP4 (70_mod_php.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf" + fi + php4_4-sapi_install_ini + ;; + esac + done +} + +pkg_postinst() { + # Output some general info to the user + if useq apache || useq apache2 ; then + APACHE1_MOD_DEFINE="PHP4" + APACHE1_MOD_CONF="70_mod_php" + APACHE2_MOD_DEFINE="PHP4" + if useq concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php_concurr" + else + APACHE2_MOD_CONF="70_mod_php" + fi + apache-module_pkg_postinst + fi + + # Update Apache1 to use mod_php + if useq apache ; then + "${ROOT}/usr/sbin/php-select" -t apache1 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache1 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache1 is configured to load a different version of PHP." + ewarn "To make Apache1 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache1 php4" + ewarn + fi + fi + + # Update Apache2 to use mod_php + if useq apache2 ; then + "${ROOT}/usr/sbin/php-select" -t apache2 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache2 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache2 is configured to load a different version of PHP." + ewarn "To make Apache2 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache2 php4" + ewarn + fi + fi + + # Create the symlinks for php-cli + if useq cli || phpconfutils_usecheck cli ; then + "${ROOT}/usr/sbin/php-select" -t php php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php php4" + ewarn + fi + fi + + # Create the symlinks for php-cgi + if useq cgi ; then + "${ROOT}/usr/sbin/php-select" -t php-cgi php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php-cgi php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php-cgi php4" + ewarn + fi + fi + + # Create the symlinks for php-devel + "${ROOT}/usr/sbin/php-select" -t php-devel php4 > /dev/null 2>&1 + exitStatus=$? + if [[ $exitStatus == 5 ]] ; then + php-select php-devel php4 + 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 v4, use" + ewarn "php-select:" + ewarn + ewarn " php-select php-devel php4" + ewarn + fi + + php4_4-sapi_pkg_postinst +} diff --git a/dev-lang/php/php-4.4.2.ebuild b/dev-lang/php/php-4.4.2.ebuild index a7e68e1c7016..7e853768ec1c 100644 --- a/dev-lang/php/php-4.4.2.ebuild +++ b/dev-lang/php/php-4.4.2.ebuild @@ -1,8 +1,11 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-4.4.2.ebuild,v 1.11 2006/04/20 12:35:09 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-4.4.2.ebuild,v 1.12 2006/07/14 16:04:37 chtekk Exp $ + +CGI_SAPI_USE="discard-path force-cgi-redirect" +APACHE2_SAPI_USE="concurrentmodphp threads" +IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild" -IUSE="cgi cli discard-path force-cgi-redirect" KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86" # NOTE: Portage doesn't support setting PROVIDE based on the USE flags @@ -14,40 +17,37 @@ PROVIDE="virtual/php virtual/httpd-php" SLOT="4" MY_PHP_PV="${PV}" MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE=1 +PHP_PACKAGE="1" -# php patch settings +# php patch settings, general PHP_PATCHSET_REV="1" HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.8-gentoo.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 php4_4-sapi apache-module want_apache -DESCRIPTION="The PHP language runtime engine." - -DEPEND="${DEPEND} app-admin/php-toolkit" -RDEPEND="${RDEPEND} app-admin/php-toolkit" - -# PHP patchsets -SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache SAPIs." -# Hardened-PHP patch -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" pkg_setup() { PHPCONFUTILS_AUTO_USE="" - # make sure the user has specified a SAPI + # 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 apache apache2 + # Threaded Apache2 support if useq apache2 ; then if [[ "${APACHE_VERSION}" != "0" ]] ; then if ! useq threads ; then - APACHE2_SAFE_MPMS="peruser prefork" + APACHE2_SAFE_MPMS="itk peruser prefork" else APACHE2_SAFE_MPMS="event leader metuxmpm perchild threadpool worker" fi @@ -65,14 +65,41 @@ pkg_setup() { fi fi + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq fastbuild ; then ewarn ewarn "'fastbuild' attempts to build all SAPIs in a single pass." - ewarn "This is an experimental feature, which may fail to compile" - ewarn "and may produce PHP binaries which are broken." - ewarn - ewarn "Rebuild without 'fastbuild' and reproduce any bugs before filing" - ewarn "any bugs in Gentoo's Bugzilla or bugs.php.net." + 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 @@ -100,6 +127,39 @@ php_determine_sapis() { fi } +src_unpack() { + if [[ "${PHP_PACKAGE}" == 1 ]] ; then + unpack ${A} + fi + + cd "${S}" + + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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 + php4_4-sapi_src_unpack +} + src_compile() { if useq fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then src_compile_fastbuild @@ -113,7 +173,9 @@ src_compile_fastbuild() { build_cli=0 build_cgi=0 - build_apache=0 + build_apache1=0 + build_apache2=0 + my_conf="" for x in ${PHPSAPIS} ; do case ${x} in @@ -123,8 +185,11 @@ src_compile_fastbuild() { cgi) build_cgi=1 ;; - apache*) - build_apache=1 + apache1) + build_apache1=1 + ;; + apache2) + build_apache2=1 ;; esac done @@ -143,14 +208,29 @@ src_compile_fastbuild() { my_conf="${my_conf} --disable-cgi" fi - if [[ ${build_apache} = 1 ]] ; then - my_conf="${my_conf} --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + if [[ ${build_apache1} = 1 ]] ; then + my_conf="${my_conf} --with-apxs=/usr/sbin/apxs" + fi + + if [[ ${build_apache2} = 1 ]] ; then + my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" + + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-ldvs" + fi fi - # now we know what we are building, build it + # Now we know what we are building, build it php4_4-sapi_src_compile - # to keep the separate php.ini files for each SAPI, we change the + # To keep the separate php.ini files for each SAPI, we change the # build-defs.h and recompile if [[ ${build_cli} = 1 ]] ; then @@ -181,9 +261,9 @@ src_compile_fastbuild() { cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" fi - if [[ ${build_apache} = 1 ]] ; then + if [[ ${build_apache1} = 1 ]] || [[ ${build_apache2} = 1 ]] ; then einfo - einfo "Building apache${USE_APACHE2} SAPI" + 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}-php4\"|g;" -i main/build-defs.h @@ -191,7 +271,7 @@ src_compile_fastbuild() { 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 build mod_php" + make || die "Unable to make apache${APACHE_VERSION} SAPI" fi } @@ -199,34 +279,63 @@ 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php4-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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-experimental-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + fi + fi + if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then make clean fi - PHPSAPI=${x} + PHPSAPI="${x}" case ${x} in cli) - my_conf="--enable-cli --disable-cgi" + my_conf="${my_conf} --enable-cli --disable-cgi" php4_4-sapi_src_compile - cp sapi/cli/php php-cli + cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" ;; cgi) - my_conf="--disable-cli --enable-cgi --enable-fastcgi" + 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 php4_4-sapi_src_compile - cp sapi/cgi/php php-cgi + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" ;; - apache*) - my_conf="--disable-cli --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + apache1) + my_conf="${my_conf} --disable-cli --with-apxs=/usr/sbin/apxs" + php4_4-sapi_src_compile + ;; + apache2) + my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" php4_4-sapi_src_compile ;; esac CLEAN_REQUIRED=1 + my_conf="" done } @@ -235,7 +344,7 @@ src_install() { destdir=/usr/$(get_libdir)/php4 - # let the eclass do the heavy lifting + # Let the eclass do the common work php4_4-sapi_src_install einfo @@ -243,7 +352,9 @@ src_install() { einfo for x in ${PHPSAPIS} ; do - PHPSAPI=${x} + + PHPSAPI="${x}" + case ${x} in cli) einfo "Installing CLI SAPI" @@ -257,17 +368,32 @@ src_install() { dobin php-cgi || die "Unable to install ${x} sapi" php4_4-sapi_install_ini ;; - apache*) - einfo "Installing apache${USE_APACHE2} SAPI" + apache1) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + einfo "Installing Apache${APACHE_VERSION} config file for PHP4 (70_mod_php.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php.conf-apache1" "70_mod_php.conf" + php4_4-sapi_install_ini + ;; + apache2) + einfo "Installing Apache${APACHE_VERSION} SAPI" make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if [[ -n "${USE_APACHE2}" ]] ; then - einfo "Installing Apache2 config file for PHP4 (70_mod_php.conf)" + if useq concurrentmodphp ; then + einfo "Installing Apache${APACHE_VERSION} config file for PHP4-concurrent (70_mod_php_concurr.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf" + newins "${FILESDIR}/70_mod_php_concurr.conf-apache2" "70_mod_php_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}/php4-ldvs" + + # Redefine the extension dir to have the modphp suffix + PHPEXTDIR="`"${D}/${destdir}/bin/php-config" --extension-dir`-versioned" else - einfo "Installing Apache config file for PHP4 (70_mod_php.conf)" + einfo "Installing Apache${APACHE_VERSION} config file for PHP4 (70_mod_php.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php.conf-apache1" "70_mod_php.conf" + newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf" fi php4_4-sapi_install_ini ;; @@ -281,8 +407,92 @@ pkg_postinst() { APACHE1_MOD_DEFINE="PHP4" APACHE1_MOD_CONF="70_mod_php" APACHE2_MOD_DEFINE="PHP4" - APACHE2_MOD_CONF="70_mod_php" + if useq concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php_concurr" + else + APACHE2_MOD_CONF="70_mod_php" + fi apache-module_pkg_postinst fi + + # Update Apache1 to use mod_php + if useq apache ; then + "${ROOT}/usr/sbin/php-select" -t apache1 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache1 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache1 is configured to load a different version of PHP." + ewarn "To make Apache1 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache1 php4" + ewarn + fi + fi + + # Update Apache2 to use mod_php + if useq apache2 ; then + "${ROOT}/usr/sbin/php-select" -t apache2 php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache2 php4 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache2 is configured to load a different version of PHP." + ewarn "To make Apache2 use PHP v4, use php-select:" + ewarn + ewarn " php-select apache2 php4" + ewarn + fi + fi + + # Create the symlinks for php-cli + if useq cli || phpconfutils_usecheck cli ; then + "${ROOT}/usr/sbin/php-select" -t php php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php php4" + ewarn + fi + fi + + # Create the symlinks for php-cgi + if useq cgi ; then + "${ROOT}/usr/sbin/php-select" -t php-cgi php4 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 5 ]] ; then + php-select php-cgi php4 + 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 v4, use php-select:" + ewarn + ewarn " php-select php-cgi php4" + ewarn + fi + fi + + # Create the symlinks for php-devel + "${ROOT}/usr/sbin/php-select" -t php-devel php4 > /dev/null 2>&1 + exitStatus=$? + if [[ $exitStatus == 5 ]] ; then + php-select php-devel php4 + 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 v4, use" + ewarn "php-select:" + ewarn + ewarn " php-select php-devel php4" + ewarn + fi + php4_4-sapi_pkg_postinst } diff --git a/dev-lang/php/php-5.0.5-r5.ebuild b/dev-lang/php/php-5.0.5-r5.ebuild index f52af8006e29..a39a68f5289a 100644 --- a/dev-lang/php/php-5.0.5-r5.ebuild +++ b/dev-lang/php/php-5.0.5-r5.ebuild @@ -1,8 +1,11 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.0.5-r5.ebuild,v 1.14 2006/04/20 12:35:09 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.0.5-r5.ebuild,v 1.15 2006/07/14 16:04:37 chtekk Exp $ + +CGI_SAPI_USE="discard-path force-cgi-redirect" +APACHE2_SAPI_USE="concurrentmodphp threads" +IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE}" -IUSE="cgi cli discard-path force-cgi-redirect" KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86" # NOTE: Portage doesn't support setting PROVIDE based on the USE flags @@ -14,39 +17,36 @@ PROVIDE="virtual/php virtual/httpd-php" SLOT="5" MY_PHP_PV="${PV}" MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE=1 +PHP_PACKAGE="1" -# php patch settings -PHP_PATCHSET_REV="2" +# php patch settings, general +PHP_PATCHSET_REV="3" HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.8-gentoo.patch.gz" MULTILIB_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-multilib-search-path.patch" +# php patch settings, ebuild specific +CONCURRENTMODPHP_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-concurrent_apache_modules.patch" inherit php5_0-sapi apache-module want_apache -DESCRIPTION="The PHP language runtime engine." - -DEPEND="${DEPEND} app-admin/php-toolkit" -RDEPEND="${RDEPEND} app-admin/php-toolkit" - -# PHP patchsets -SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache SAPIs." -# Hardened-PHP patch -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" pkg_setup() { PHPCONFUTILS_AUTO_USE="" - # make sure the user has specified a SAPI + # 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 apache apache2 + # Threaded Apache2 support if useq apache2 ; then if [[ "${APACHE_VERSION}" != "0" ]] ; then if ! useq threads ; then - APACHE2_SAFE_MPMS="peruser prefork" + APACHE2_SAFE_MPMS="itk peruser prefork" else APACHE2_SAFE_MPMS="event leader metuxmpm perchild threadpool worker" fi @@ -64,6 +64,30 @@ pkg_setup() { fi fi + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 + php5_0-sapi_pkg_setup } @@ -88,38 +112,91 @@ php_determine_sapis() { fi } +src_unpack() { + if [[ "${PHP_PACKAGE}" == 1 ]] ; then + unpack ${A} + fi + + cd "${S}" + + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 + + # Now let the eclass do the rest and regenerate the configure + php5_0-sapi_src_unpack +} + src_compile() { 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if useq 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if useq 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} + PHPSAPI="${x}" case ${x} in cli) - my_conf="--enable-cli --disable-cgi" + my_conf="${my_conf} --enable-cli --disable-cgi" php5_0-sapi_src_compile - cp sapi/cli/php php-cli + cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" ;; cgi) - my_conf="--disable-cli --enable-cgi --enable-fastcgi" + 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_0-sapi_src_compile - cp sapi/cgi/php php-cgi + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" ;; - apache*) - my_conf="--disable-cli --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + apache1) + my_conf="${my_conf} --disable-cli --with-apxs=/usr/sbin/apxs" + php5_0-sapi_src_compile + ;; + apache2) + my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" php5_0-sapi_src_compile ;; esac CLEAN_REQUIRED=1 + my_conf="" done } @@ -128,7 +205,7 @@ src_install() { destdir=/usr/$(get_libdir)/php5 - # let the eclass do the heavy lifting + # Let the eclass do the common work php5_0-sapi_src_install einfo @@ -136,7 +213,9 @@ src_install() { einfo for x in ${PHPSAPIS} ; do - PHPSAPI=${x} + + PHPSAPI="${x}" + case ${x} in cli) einfo "Installing CLI SAPI" @@ -150,17 +229,32 @@ src_install() { dobin php-cgi || die "Unable to install ${x} sapi" php5_0-sapi_install_ini ;; - apache*) - einfo "Installing apache${USE_APACHE2} SAPI" + apache1) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php5.conf-apache1" "70_mod_php5.conf" + php5_0-sapi_install_ini + ;; + apache2) + einfo "Installing Apache${APACHE_VERSION} SAPI" make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if [[ -n "${USE_APACHE2}" ]] ; then - einfo "Installing Apache2 config file for PHP5 (70_mod_php5.conf)" + if useq 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.conf-apache2" "70_mod_php5.conf" + 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 config file for PHP5 (70_mod_php5.conf)" + einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5.conf-apache1" "70_mod_php5.conf" + newins "${FILESDIR}/70_mod_php5.conf-apache2" "70_mod_php5.conf" fi php5_0-sapi_install_ini ;; @@ -174,8 +268,92 @@ pkg_postinst() { APACHE1_MOD_DEFINE="PHP5" APACHE1_MOD_CONF="70_mod_php5" APACHE2_MOD_DEFINE="PHP5" - APACHE2_MOD_CONF="70_mod_php5" + if useq concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php5_concurr" + else + APACHE2_MOD_CONF="70_mod_php5" + fi apache-module_pkg_postinst fi + + # Update Apache1 to use mod_php + if useq apache ; then + "${ROOT}/usr/sbin/php-select" -t apache1 php5 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache1 php5 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache1 is configured to load a different version of PHP." + ewarn "To make Apache1 use PHP v5, use php-select:" + ewarn + ewarn " php-select apache1 php5" + ewarn + fi + fi + + # Update Apache2 to use mod_php + if useq 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 useq 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 useq 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_0-sapi_pkg_postinst } diff --git a/dev-lang/php/php-5.1.4-r4.ebuild b/dev-lang/php/php-5.1.4-r4.ebuild new file mode 100644 index 000000000000..8286e0336826 --- /dev/null +++ b/dev-lang/php/php-5.1.4-r4.ebuild @@ -0,0 +1,498 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.1.4-r4.ebuild,v 1.1 2006/07/14 16:04:37 chtekk 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="5" +HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.11-gentoo-r1.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_1-sapi apache-module + +want_apache + +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache SAPIs." + +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" + +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 apache apache2 + + # Threaded Apache2 support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if ! useq 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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_1-sapi_pkg_setup +} + +php_determine_sapis() { + # holds the list of sapis that we want to build + PHPSAPIS= + + if useq cli || phpconfutils_usecheck cli ; then + PHPSAPIS="${PHPSAPIS} cli" + fi + + if useq cgi ; then + PHPSAPIS="${PHPSAPIS} cgi" + fi + + # note - we can only build one apache sapi for now + # note - apache SAPI comes after the simpler cli/cgi sapis + if useq apache || useq 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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_1-sapi_src_unpack +} + +src_compile() { + if useq 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_apache1=0 + build_apache2=0 + my_conf="" + + for x in ${PHPSAPIS} ; do + case ${x} in + cli) + build_cli=1 + ;; + cgi) + build_cgi=1 + ;; + apache1) + build_apache1=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_apache1} = 1 ]] ; then + my_conf="${my_conf} --with-apxs=/usr/sbin/apxs" + fi + + if [[ ${build_apache2} = 1 ]] ; then + my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" + + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-maintainer-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" + fi + fi + + # Now we know what we are building, build it + php5_1-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 || die "Unable to make CGI SAPI" + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" + fi + + if [[ ${build_apache1} = 1 ]] || [[ ${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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if useq 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if useq 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_1-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_1-sapi_src_compile + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" + ;; + apache1) + my_conf="${my_conf} --disable-cli --with-apxs=/usr/sbin/apxs" + php5_1-sapi_src_compile + ;; + apache2) + my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" + php5_1-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_1-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_1-sapi_install_ini + ;; + cgi) + einfo "Installing CGI SAPI" + into ${destdir} + dobin php-cgi || die "Unable to install ${x} sapi" + php5_1-sapi_install_ini + ;; + apache1) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php5.conf-apache1" "70_mod_php5.conf" + php5_1-sapi_install_ini + ;; + apache2) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + if useq 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_1-sapi_install_ini + ;; + esac + done +} + +pkg_postinst() { + # Output some general info to the user + if useq apache || useq apache2 ; then + APACHE1_MOD_DEFINE="PHP5" + APACHE1_MOD_CONF="70_mod_php5" + APACHE2_MOD_DEFINE="PHP5" + if useq concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php5_concurr" + else + APACHE2_MOD_CONF="70_mod_php5" + fi + apache-module_pkg_postinst + fi + + # Update Apache1 to use mod_php + if useq apache ; then + "${ROOT}/usr/sbin/php-select" -t apache1 php5 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache1 php5 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache1 is configured to load a different version of PHP." + ewarn "To make Apache1 use PHP v5, use php-select:" + ewarn + ewarn " php-select apache1 php5" + ewarn + fi + fi + + # Update Apache2 to use mod_php + if useq 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 useq 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 useq 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_1-sapi_pkg_postinst +} diff --git a/dev-lang/php/php-5.1.4.ebuild b/dev-lang/php/php-5.1.4.ebuild index 4b5fd4373e7f..665ad7817116 100644 --- a/dev-lang/php/php-5.1.4.ebuild +++ b/dev-lang/php/php-5.1.4.ebuild @@ -1,8 +1,11 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.1.4.ebuild,v 1.11 2006/07/02 19:50:46 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.1.4.ebuild,v 1.12 2006/07/14 16:04:37 chtekk Exp $ + +CGI_SAPI_USE="discard-path force-cgi-redirect" +APACHE2_SAPI_USE="concurrentmodphp threads" +IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild" -IUSE="cgi cli discard-path force-cgi-redirect" 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 @@ -14,40 +17,37 @@ PROVIDE="virtual/php virtual/httpd-php" SLOT="5" MY_PHP_PV="${PV}" MY_PHP_P="php-${MY_PHP_PV}" -PHP_PACKAGE=1 +PHP_PACKAGE="1" -# php patch settings +# php patch settings, general PHP_PATCHSET_REV="1" HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.9-gentoo.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_1-sapi apache-module want_apache -DESCRIPTION="The PHP language runtime engine." - -DEPEND="${DEPEND} app-admin/php-toolkit" -RDEPEND="${RDEPEND} app-admin/php-toolkit" - -# PHP patchsets -SRC_URI="${SRC_URI} http://gentoo.longitekk.com/php-patchset-${MY_PHP_PV}-r${PHP_PATCHSET_REV}.tar.bz2" +DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache SAPIs." -# Hardened-PHP patch -[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )" +DEPEND="app-admin/php-toolkit" +RDEPEND="${DEPEND}" pkg_setup() { PHPCONFUTILS_AUTO_USE="" - # make sure the user has specified a SAPI + # 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 apache apache2 + # Threaded Apache2 support if useq apache2 ; then if [[ "${APACHE_VERSION}" != "0" ]] ; then if ! useq threads ; then - APACHE2_SAFE_MPMS="peruser prefork" + APACHE2_SAFE_MPMS="itk peruser prefork" else APACHE2_SAFE_MPMS="event leader metuxmpm perchild threadpool worker" fi @@ -65,14 +65,41 @@ pkg_setup() { fi fi + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq fastbuild ; then ewarn ewarn "'fastbuild' attempts to build all SAPIs in a single pass." - ewarn "This is an experimental feature, which may fail to compile" - ewarn "and may produce PHP binaries which are broken." - ewarn - ewarn "Rebuild without 'fastbuild' and reproduce any bugs before filing" - ewarn "any bugs in Gentoo's Bugzilla or bugs.php.net." + 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 @@ -100,6 +127,39 @@ php_determine_sapis() { fi } +src_unpack() { + if [[ "${PHP_PACKAGE}" == 1 ]] ; then + unpack ${A} + fi + + cd "${S}" + + # Concurrent PHP Apache2 modules support + if useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + if useq 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 useq 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_1-sapi_src_unpack +} + src_compile() { if useq fastbuild && [[ -n "${FASTBUILD_PATCH}" ]] ; then src_compile_fastbuild @@ -113,7 +173,9 @@ src_compile_fastbuild() { build_cli=0 build_cgi=0 - build_apache=0 + build_apache1=0 + build_apache2=0 + my_conf="" for x in ${PHPSAPIS} ; do case ${x} in @@ -123,8 +185,11 @@ src_compile_fastbuild() { cgi) build_cgi=1 ;; - apache*) - build_apache=1 + apache1) + build_apache1=1 + ;; + apache2) + build_apache2=1 ;; esac done @@ -143,14 +208,29 @@ src_compile_fastbuild() { my_conf="${my_conf} --disable-cgi" fi - if [[ ${build_apache} = 1 ]] ; then - my_conf="${my_conf} --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + if [[ ${build_apache1} = 1 ]] ; then + my_conf="${my_conf} --with-apxs=/usr/sbin/apxs" + fi + + if [[ ${build_apache2} = 1 ]] ; then + my_conf="${my_conf} --with-apxs2=/usr/sbin/apxs2" + + # Threaded Apache2 support + if useq threads ; then + my_conf="${my_conf} --enable-maintainer-zts" + ewarn "Enabling ZTS for Apache2 MPM" + fi + + # Concurrent PHP Apache2 modules support + if useq concurrentmodphp ; then + append-ldflags "-Wl,--version-script=${FILESDIR}/php5-ldvs" + fi fi - # now we know what we are building, build it + # Now we know what we are building, build it php5_1-sapi_src_compile - # to keep the separate php.ini files for each SAPI, we change the + # To keep the separate php.ini files for each SAPI, we change the # build-defs.h and recompile if [[ ${build_cli} = 1 ]] ; then @@ -181,9 +261,9 @@ src_compile_fastbuild() { cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" fi - if [[ ${build_apache} = 1 ]] ; then + if [[ ${build_apache1} = 1 ]] || [[ ${build_apache2} = 1 ]] ; then einfo - einfo "Building apache${USE_APACHE2} SAPI" + 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 @@ -191,7 +271,7 @@ src_compile_fastbuild() { 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 build mod_php" + make || die "Unable to make apache${APACHE_VERSION} SAPI" fi } @@ -199,34 +279,63 @@ 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Concurrent PHP Apache2 modules support + if useq 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 useq apache2 ; then + if [[ "${APACHE_VERSION}" != "0" ]] ; then + # Threaded Apache2 support + if useq 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} + PHPSAPI="${x}" case ${x} in cli) - my_conf="--enable-cli --disable-cgi" + my_conf="${my_conf} --enable-cli --disable-cgi" php5_1-sapi_src_compile - cp sapi/cli/php php-cli + cp sapi/cli/php php-cli || die "Unable to copy CLI SAPI" ;; cgi) - my_conf="--disable-cli --enable-cgi --enable-fastcgi" + 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_1-sapi_src_compile - cp sapi/cgi/php php-cgi + cp sapi/cgi/php php-cgi || die "Unable to copy CGI SAPI" ;; - apache*) - my_conf="--disable-cli --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}" + apache1) + my_conf="${my_conf} --disable-cli --with-apxs=/usr/sbin/apxs" + php5_1-sapi_src_compile + ;; + apache2) + my_conf="${my_conf} --disable-cli --with-apxs2=/usr/sbin/apxs2" php5_1-sapi_src_compile ;; esac CLEAN_REQUIRED=1 + my_conf="" done } @@ -235,7 +344,7 @@ src_install() { destdir=/usr/$(get_libdir)/php5 - # let the eclass do the heavy lifting + # Let the eclass do the common work php5_1-sapi_src_install einfo @@ -243,7 +352,9 @@ src_install() { einfo for x in ${PHPSAPIS} ; do - PHPSAPI=${x} + + PHPSAPI="${x}" + case ${x} in cli) einfo "Installing CLI SAPI" @@ -257,17 +368,32 @@ src_install() { dobin php-cgi || die "Unable to install ${x} sapi" php5_1-sapi_install_ini ;; - apache*) - einfo "Installing apache${USE_APACHE2} SAPI" + apache1) + einfo "Installing Apache${APACHE_VERSION} SAPI" + make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" + einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" + insinto ${APACHE_MODULES_CONFDIR} + newins "${FILESDIR}/70_mod_php5.conf-apache1" "70_mod_php5.conf" + php5_1-sapi_install_ini + ;; + apache2) + einfo "Installing Apache${APACHE_VERSION} SAPI" make INSTALL_ROOT="${D}" install-sapi || die "Unable to install ${x} SAPI" - if [[ -n "${USE_APACHE2}" ]] ; then - einfo "Installing Apache2 config file for PHP5 (70_mod_php5.conf)" + if useq 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.conf-apache2" "70_mod_php5.conf" + 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 config file for PHP5 (70_mod_php5.conf)" + einfo "Installing Apache${APACHE_VERSION} config file for PHP5 (70_mod_php5.conf)" insinto ${APACHE_MODULES_CONFDIR} - newins "${FILESDIR}/70_mod_php5.conf-apache1" "70_mod_php5.conf" + newins "${FILESDIR}/70_mod_php5.conf-apache2" "70_mod_php5.conf" fi php5_1-sapi_install_ini ;; @@ -281,8 +407,92 @@ pkg_postinst() { APACHE1_MOD_DEFINE="PHP5" APACHE1_MOD_CONF="70_mod_php5" APACHE2_MOD_DEFINE="PHP5" - APACHE2_MOD_CONF="70_mod_php5" + if useq concurrentmodphp ; then + APACHE2_MOD_CONF="70_mod_php5_concurr" + else + APACHE2_MOD_CONF="70_mod_php5" + fi apache-module_pkg_postinst fi + + # Update Apache1 to use mod_php + if useq apache ; then + "${ROOT}/usr/sbin/php-select" -t apache1 php5 > /dev/null 2>&1 + exitStatus=$? + if [[ ${exitStatus} == 2 ]] ; then + php-select apache1 php5 + elif [[ ${exitStatus} == 4 ]] ; then + ewarn + ewarn "Apache1 is configured to load a different version of PHP." + ewarn "To make Apache1 use PHP v5, use php-select:" + ewarn + ewarn " php-select apache1 php5" + ewarn + fi + fi + + # Update Apache2 to use mod_php + if useq 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 useq 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 useq 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_1-sapi_pkg_postinst } |