Revision bump.
authorLuca Longinotti <chtekk@gentoo.org>
Tue, 20 Jun 2006 20:38:58 +0000 (20:38 +0000)
committerLuca Longinotti <chtekk@gentoo.org>
Tue, 20 Jun 2006 20:38:58 +0000 (20:38 +0000)
Package-Manager: portage-2.1

dev-lang/php/ChangeLog
dev-lang/php/files/digest-php-4.4.2-r5 [new file with mode: 0644]
dev-lang/php/files/digest-php-5.1.4-r3 [new file with mode: 0644]
dev-lang/php/php-4.4.2-r5.ebuild [new file with mode: 0644]
dev-lang/php/php-5.1.4-r3.ebuild [new file with mode: 0644]

index 1819492600a1547148f34e179b90a853a88231df..13fdc636c95eb271e5938c935e4cc4eb6cb28f0f 100644 (file)
@@ -1,6 +1,14 @@
 # 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.100 2006/06/18 19:42:05 kloeri Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.101 2006/06/20 20:38:58 chtekk Exp $
+
+*php-5.1.4-r3 (20 Jun 2006)
+*php-4.4.2-r5 (20 Jun 2006)
+
+  20 Jun 2006; Luca Longinotti <chtekk@gentoo.org> -php-4.4.2-r3.ebuild,
+  +php-4.4.2-r5.ebuild, -php-5.1.4-r1.ebuild, +php-5.1.4-r3.ebuild:
+  Revision bumps. Fix bug #105489 and add a couple of other fixes for various
+  bugs.
 
   18 Jun 2006; Bryan Ã˜stergaard <kloeri@gentoo.org> php-4.4.2-r2.ebuild,
   php-5.1.4.ebuild:
diff --git a/dev-lang/php/files/digest-php-4.4.2-r5 b/dev-lang/php/files/digest-php-4.4.2-r5
new file mode 100644 (file)
index 0000000..6911486
--- /dev/null
@@ -0,0 +1,9 @@
+MD5 e9c07b67ddd1f068aa1bbe8021f2a83d hardening-patch-4.4.2-0.4.11-gentoo.patch.gz 59715
+RMD160 bc1131fbb8d9e53fe8ced94ff32aa3f7399bcfd0 hardening-patch-4.4.2-0.4.11-gentoo.patch.gz 59715
+SHA256 c3b440478724e2798e18c4082d95c0b2b48203c7ebe2fd483cf2f24f9317d1b7 hardening-patch-4.4.2-0.4.11-gentoo.patch.gz 59715
+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 a0919ddd76f6d7e7b05639755125af82 php-patchset-4.4.2-r6.tar.bz2 20884
+RMD160 c8376d9736edb3a59a525022eee9c0a7a5f2a359 php-patchset-4.4.2-r6.tar.bz2 20884
+SHA256 4a422da2b609819a8d95b11e2245e9bfa1440d25e481d4808bfc7d270382480e php-patchset-4.4.2-r6.tar.bz2 20884
diff --git a/dev-lang/php/files/digest-php-5.1.4-r3 b/dev-lang/php/files/digest-php-5.1.4-r3
new file mode 100644 (file)
index 0000000..ed82c02
--- /dev/null
@@ -0,0 +1,9 @@
+MD5 aad3814b698d1e2ade853fe5c68db7e5 hardening-patch-5.1.4-0.4.11-gentoo.patch.gz 58174
+RMD160 afabbf21c5d82a9ead56b1718b4e7e6eda5eb6b6 hardening-patch-5.1.4-0.4.11-gentoo.patch.gz 58174
+SHA256 4f0bdc6de6b00333c7678b4bebeb1a9de7f6987413707956b6a7e099ebe1089e hardening-patch-5.1.4-0.4.11-gentoo.patch.gz 58174
+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 2c4239724b3875f7629d54650e775aac php-patchset-5.1.4-r4.tar.bz2 13600
+RMD160 2e47fb1a0d587c3b70f30d44f00ca122a58e1bb9 php-patchset-5.1.4-r4.tar.bz2 13600
+SHA256 4aa7df8cec6067a42a595600f3cef5b82e2bc1c7ab5999f9bca65d37ea1934a9 php-patchset-5.1.4-r4.tar.bz2 13600
diff --git a/dev-lang/php/php-4.4.2-r5.ebuild b/dev-lang/php/php-4.4.2-r5.ebuild
new file mode 100644 (file)
index 0000000..1d45db4
--- /dev/null
@@ -0,0 +1,290 @@
+# 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-r5.ebuild,v 1.1 2006/06/20 20:38:58 chtekk Exp $
+
+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
+#              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
+PHP_PATCHSET_REV="6"
+HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.11-gentoo.patch.gz"
+MULTILIB_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-multilib-search-path.patch"
+FASTBUILD_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-fastbuild.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"
+
+# Hardened-PHP patch
+[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )"
+
+pkg_setup() {
+       PHPCONFUTILS_AUTO_USE=""
+
+       # make sure the user has specified a SAPI
+       einfo "Determining SAPI(s) to build"
+       phpconfutils_require_any "  Enabled  SAPI:" "  Disabled SAPI:" cli cgi apache apache2
+
+       if useq apache2 ; then
+               if [[ "${APACHE_VERSION}" != "0" ]] ; then
+                       if ! useq threads ; then
+                               APACHE2_SAFE_MPMS="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
+
+       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_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_apache=0
+
+       for x in ${PHPSAPIS} ; do
+               case ${x} in
+                       cli)
+                               build_cli=1
+                               ;;
+                       cgi)
+                               build_cgi=1
+                               ;;
+                       apache*)
+                               build_apache=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_apache} = 1 ]] ; then
+               my_conf="${my_conf} --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}"
+       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_apache} = 1 ]] ; then
+               einfo
+               einfo "Building apache${USE_APACHE2} 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 build mod_php"
+       fi
+}
+
+src_compile_normal() {
+       php_determine_sapis
+
+       CLEAN_REQUIRED=0
+
+       for x in ${PHPSAPIS} ; do
+               if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then
+                       make clean
+               fi
+
+               PHPSAPI=${x}
+
+               case ${x} in
+                       cli)
+                               my_conf="--enable-cli --disable-cgi"
+                               php4_4-sapi_src_compile
+                               cp sapi/cli/php php-cli
+                               ;;
+                       cgi)
+                               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
+                               ;;
+                       apache*)
+                               my_conf="--disable-cli --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}"
+                               php4_4-sapi_src_compile
+                               ;;
+               esac
+
+               CLEAN_REQUIRED=1
+       done
+}
+
+src_install() {
+       php_determine_sapis
+
+       destdir=/usr/$(get_libdir)/php4
+
+       # let the eclass do the heavy lifting
+       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
+                               ;;
+                       apache*)
+                               einfo "Installing apache${USE_APACHE2} 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)"
+                                       insinto ${APACHE_MODULES_CONFDIR}
+                                       newins "${FILESDIR}/70_mod_php.conf-apache2" "70_mod_php.conf"
+                               else
+                                       einfo "Installing Apache config file for PHP4 (70_mod_php.conf)"
+                                       insinto ${APACHE_MODULES_CONFDIR}
+                                       newins "${FILESDIR}/70_mod_php.conf-apache1" "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"
+               APACHE2_MOD_CONF="70_mod_php"
+               apache-module_pkg_postinst
+       fi
+       php4_4-sapi_pkg_postinst
+}
diff --git a/dev-lang/php/php-5.1.4-r3.ebuild b/dev-lang/php/php-5.1.4-r3.ebuild
new file mode 100644 (file)
index 0000000..77a29cd
--- /dev/null
@@ -0,0 +1,290 @@
+# 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-r3.ebuild,v 1.1 2006/06/20 20:38:58 chtekk Exp $
+
+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
+#              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
+PHP_PATCHSET_REV="4"
+HARDENEDPHP_PATCH="hardening-patch-${MY_PHP_PV}-0.4.11-gentoo.patch.gz"
+MULTILIB_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-multilib-search-path.patch"
+FASTBUILD_PATCH="${MY_PHP_PV}/opt/php${MY_PHP_PV}-fastbuild.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"
+
+# Hardened-PHP patch
+[[ -n "${HARDENEDPHP_PATCH}" ]] && SRC_URI="${SRC_URI} hardenedphp? ( http://gentoo.longitekk.com/${HARDENEDPHP_PATCH} )"
+
+pkg_setup() {
+       PHPCONFUTILS_AUTO_USE=""
+
+       # make sure the user has specified a SAPI
+       einfo "Determining SAPI(s) to build"
+       phpconfutils_require_any "  Enabled  SAPI:" "  Disabled SAPI:" cli cgi apache apache2
+
+       if useq apache2 ; then
+               if [[ "${APACHE_VERSION}" != "0" ]] ; then
+                       if ! useq threads ; then
+                               APACHE2_SAFE_MPMS="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
+
+       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_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_apache=0
+
+       for x in ${PHPSAPIS} ; do
+               case ${x} in
+                       cli)
+                               build_cli=1
+                               ;;
+                       cgi)
+                               build_cgi=1
+                               ;;
+                       apache*)
+                               build_apache=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_apache} = 1 ]] ; then
+               my_conf="${my_conf} --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}"
+       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_apache} = 1 ]] ; then
+               einfo
+               einfo "Building apache${USE_APACHE2} 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 build mod_php"
+       fi
+}
+
+src_compile_normal() {
+       php_determine_sapis
+
+       CLEAN_REQUIRED=0
+
+       for x in ${PHPSAPIS} ; do
+               if [[ "${CLEAN_REQUIRED}" = 1 ]] ; then
+                       make clean
+               fi
+
+               PHPSAPI=${x}
+
+               case ${x} in
+                       cli)
+                               my_conf="--enable-cli --disable-cgi"
+                               php5_1-sapi_src_compile
+                               cp sapi/cli/php php-cli
+                               ;;
+                       cgi)
+                               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
+                               ;;
+                       apache*)
+                               my_conf="--disable-cli --with-apxs${USE_APACHE2}=/usr/sbin/apxs${USE_APACHE2}"
+                               php5_1-sapi_src_compile
+                               ;;
+               esac
+
+               CLEAN_REQUIRED=1
+       done
+}
+
+src_install() {
+       php_determine_sapis
+
+       destdir=/usr/$(get_libdir)/php5
+
+       # let the eclass do the heavy lifting
+       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
+                               ;;
+                       apache*)
+                               einfo "Installing apache${USE_APACHE2} 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)"
+                                       insinto ${APACHE_MODULES_CONFDIR}
+                                       newins "${FILESDIR}/70_mod_php5.conf-apache2" "70_mod_php5.conf"
+                               else
+                                       einfo "Installing Apache config file for PHP5 (70_mod_php5.conf)"
+                                       insinto ${APACHE_MODULES_CONFDIR}
+                                       newins "${FILESDIR}/70_mod_php5.conf-apache1" "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"
+               APACHE2_MOD_CONF="70_mod_php5"
+               apache-module_pkg_postinst
+       fi
+       php5_1-sapi_pkg_postinst
+}