diff options
author | Luca Longinotti <chtekk@gentoo.org> | 2006-04-13 20:28:58 +0000 |
---|---|---|
committer | Luca Longinotti <chtekk@gentoo.org> | 2006-04-13 20:28:58 +0000 |
commit | 994192f9edd07ad2960deed3d07da161dbe95ee8 (patch) | |
tree | 021c3f8f6e834af301d2fd384dba0b0df9d5e89b | |
parent | Cleaning up older ebuilds. (diff) | |
download | historical-994192f9edd07ad2960deed3d07da161dbe95ee8.tar.gz historical-994192f9edd07ad2960deed3d07da161dbe95ee8.tar.bz2 historical-994192f9edd07ad2960deed3d07da161dbe95ee8.zip |
Fix MySQL charset issues.
Package-Manager: portage-2.1_pre7-r5
-rw-r--r-- | dev-lang/php/ChangeLog | 10 | ||||
-rw-r--r-- | dev-lang/php/Manifest | 18 | ||||
-rw-r--r-- | dev-lang/php/files/digest-php-4.4.2-r1 | 9 | ||||
-rw-r--r-- | dev-lang/php/files/digest-php-5.1.2-r1 | 9 | ||||
-rw-r--r-- | dev-lang/php/php-4.4.2-r1.ebuild | 286 | ||||
-rw-r--r-- | dev-lang/php/php-5.1.2-r1.ebuild | 286 |
6 files changed, 614 insertions, 4 deletions
diff --git a/dev-lang/php/ChangeLog b/dev-lang/php/ChangeLog index dcbc8d409807..1e559e267ac8 100644 --- a/dev-lang/php/ChangeLog +++ b/dev-lang/php/ChangeLog @@ -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.83 2006/03/28 21:35:40 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/ChangeLog,v 1.84 2006/04/13 20:28:58 chtekk Exp $ + +*php-5.1.2-r1 (13 Apr 2006) +*php-4.4.2-r1 (13 Apr 2006) + + 13 Apr 2006; Luca Longinotti <chtekk@gentoo.org> +php-4.4.2-r1.ebuild, + +php-5.1.2-r1.ebuild: + Add new revisions to fix an issue with the MySQL charsets. + See bug #129761 about it. 28 Mar 2006; Luca Longinotti <chtekk@gentoo.org> files/70_mod_php.conf-apache1, files/70_mod_php.conf-apache2, diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest index 3c9f97e0e514..f0ef53f226a4 100644 --- a/dev-lang/php/Manifest +++ b/dev-lang/php/Manifest @@ -1,6 +1,6 @@ -MD5 bcd984f7a4990a0772e69e79317580de ChangeLog 19320 -RMD160 bdaf042cb4d75e25c6c7e04657bd912e3a48fd27 ChangeLog 19320 -SHA256 fe013e73d290bc7769a1278c2b7b4fec659a93d48e1b367c00fbc2c66a9ad6ca ChangeLog 19320 +MD5 1ed2752973a8b5f40be1da1edadade0b ChangeLog 19564 +RMD160 ca802c50df231fb43ded5de07d5ffeb6433ac38b ChangeLog 19564 +SHA256 f9f747cdaedc25faf1d0325c43bcfdaaf1840033ef45580962329bdbf51dc94b ChangeLog 19564 MD5 6171c7aa95f69b8a54b0f29bd1056d2b files/70_mod_php.conf-apache1 454 RMD160 869b5c225782690889bdfa5227a8f46c33ac71d3 files/70_mod_php.conf-apache1 454 SHA256 9e6227e508f0c297f48c667e2135c7692f7943b3d0cd2ffdbdcca0bad5220343 files/70_mod_php.conf-apache1 454 @@ -19,24 +19,36 @@ SHA256 9476ccfbeb934abc7dc1973013e0dc5f185246168dbd6d668c88eb6bb5365494 files/di MD5 a7ac0298702473c115fd1bd2410f0152 files/digest-php-4.4.2 807 RMD160 e0111c53e805340c3b9e4243edd537652a2b2b9d files/digest-php-4.4.2 807 SHA256 c6eaf4c85fa86b3254f0f61c8127956d0b8ab0c8d6292ae9cab3ebbc03f832b3 files/digest-php-4.4.2 807 +MD5 4eeacf120b26f71aff4c612bd866efe3 files/digest-php-4.4.2-r1 807 +RMD160 3e876c3c34ffd53a15ea30e3c45a6ad536062df2 files/digest-php-4.4.2-r1 807 +SHA256 9dec8fe23b8d6279141f7ae97581b13d99c828c83fcff734e8f6ed7664954234 files/digest-php-4.4.2-r1 807 MD5 deaf81609cd783b916a274c8d9e2c8d9 files/digest-php-5.0.5-r5 807 RMD160 903c019620d92706e67f94a9fa313bfcdbd0c89f files/digest-php-5.0.5-r5 807 SHA256 0581c6a261821444df13abb32b05a42a3de01bb45d8d51a4c8f12cc0f4fd0551 files/digest-php-5.0.5-r5 807 MD5 ff8e7b70d7eb49eb7b0e6cc65d9dc6f4 files/digest-php-5.1.2 804 RMD160 eb0553851c98b72a5b76c854255b42f6268cba96 files/digest-php-5.1.2 804 SHA256 c5796a8c5be891a50b66433f00df75607a22c5155bfae2527f657cc870f433e4 files/digest-php-5.1.2 804 +MD5 064423a4fffb09666150214b4c0988ee files/digest-php-5.1.2-r1 804 +RMD160 15133ef29601329f0e7ed4f213ec901fdbde5a0b files/digest-php-5.1.2-r1 804 +SHA256 3426b8d138536259ef8d1aea8e9dce2efc2fb74fbb63f7ead789ffba6a8175ff files/digest-php-5.1.2-r1 804 MD5 c58d07ca1c1235bbad9bccaec96fc062 metadata.xml 157 RMD160 a98db3a086fae3c09a903dadbc05f60443ec4b1a metadata.xml 157 SHA256 54f8878ca0228e380abbaa4b529806b5533a6b9b51b3b16c0909e906586a91a1 metadata.xml 157 MD5 8d639a24545e5cec6bbb0855461cba4e php-4.3.11-r5.ebuild 8596 RMD160 e884c2a76818ba099bc01813533a799ebbcda055 php-4.3.11-r5.ebuild 8596 SHA256 eb3bfd2a2bee65e92968219ae08565a6177f8d17b7f65edb6197f66d6725cc09 php-4.3.11-r5.ebuild 8596 +MD5 3690c266812ba4e4fab90c1eacbe957f php-4.4.2-r1.ebuild 7890 +RMD160 e7db207485518dd5f6c3e0a379a865ad02c043f0 php-4.4.2-r1.ebuild 7890 +SHA256 49a5086da1320be9d55869daa47179914c5ffae1fddde3a61fde65416c0dd324 php-4.4.2-r1.ebuild 7890 MD5 23ab9184edeac381bab4e607dc87c913 php-4.4.2.ebuild 7877 RMD160 33cb6ac393af6a647c61ba3874944296f7b08004 php-4.4.2.ebuild 7877 SHA256 3d60fd1a5c6ba285b56682e242933bf800f473880ee889a00b069930b7d818cf php-4.4.2.ebuild 7877 MD5 071fdedf08f25a01dac858c60512a7e6 php-5.0.5-r5.ebuild 4693 RMD160 37277caf9a703194491db55b2a935f8da035a238 php-5.0.5-r5.ebuild 4693 SHA256 3cb3df6f867552d0ea91e58bf14ec78b22970b8392d9279a8e967115f388641c php-5.0.5-r5.ebuild 4693 +MD5 537f4b487f6727608f16329794a033db php-5.1.2-r1.ebuild 7898 +RMD160 1422cce35682819a31f8a5d8816ea2b78a57eb16 php-5.1.2-r1.ebuild 7898 +SHA256 3acec3cdc6ddee5e6c713e405a96210522efd74dd923575cb27c158b27245b90 php-5.1.2-r1.ebuild 7898 MD5 90339398d6e2e0fd30a76454b216334c php-5.1.2.ebuild 7885 RMD160 ba6a5c308dd8910c3fdecdee7fee59eeb7b652bd php-5.1.2.ebuild 7885 SHA256 415407baa44e53a78493230f0432ca15dd26b0b1ebdc3baf708ebe846479331b php-5.1.2.ebuild 7885 diff --git a/dev-lang/php/files/digest-php-4.4.2-r1 b/dev-lang/php/files/digest-php-4.4.2-r1 new file mode 100644 index 000000000000..5a2b723bcfe2 --- /dev/null +++ b/dev-lang/php/files/digest-php-4.4.2-r1 @@ -0,0 +1,9 @@ +MD5 fa67e075f724b5cb4701ffdd0a05e03d hardening-patch-4.4.2-0.4.8-gentoo.patch.gz 59792 +RMD160 87c5234a6e70b3f24b20227e891e4f878b9e55a8 hardening-patch-4.4.2-0.4.8-gentoo.patch.gz 59792 +SHA256 31a8aec0f46cd34079179a32e1b8033891d9cb0e5cbd53ef9d56848b48c1f1f9 hardening-patch-4.4.2-0.4.8-gentoo.patch.gz 59792 +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 4aebd7939e86bc60e447b2f9bb2d4bc2 php-patchset-4.4.2-r2.tar.bz2 14555 +RMD160 491fcc0c993530f9ac4429d44a37415c2a9a0b37 php-patchset-4.4.2-r2.tar.bz2 14555 +SHA256 9c7e9ed0044d0222745b5e30584e489e9574330aeb7964a40d1d1de757fb4bf3 php-patchset-4.4.2-r2.tar.bz2 14555 diff --git a/dev-lang/php/files/digest-php-5.1.2-r1 b/dev-lang/php/files/digest-php-5.1.2-r1 new file mode 100644 index 000000000000..c798681029ba --- /dev/null +++ b/dev-lang/php/files/digest-php-5.1.2-r1 @@ -0,0 +1,9 @@ +MD5 61d534c04399b5fa1f167ec2d86351a3 hardening-patch-5.1.2-0.4.8-gentoo.patch.gz 57663 +RMD160 2b79a7a367b834fefd1c82268424bee35dd27474 hardening-patch-5.1.2-0.4.8-gentoo.patch.gz 57663 +SHA256 7e6453a9b45daf9af9d861b3907349d1d385eed7341f1c5427ab7b2a5f4794f7 hardening-patch-5.1.2-0.4.8-gentoo.patch.gz 57663 +MD5 79cee17e9db85be878000a2a4198378e php-5.1.2.tar.bz2 6319905 +RMD160 1e21b5ba280b7efc8197802c673bb5d4e9dc9f8e php-5.1.2.tar.bz2 6319905 +SHA256 a18399360e1c5dcbdfed4f7215ae8fd2a5e057c24b86392392e832216aa63202 php-5.1.2.tar.bz2 6319905 +MD5 2ba96733f6786016f367d152922d5dfb php-patchset-5.1.2-r2.tar.bz2 8278 +RMD160 320dbe43eea1025c0ec007f5eb4f1de2422cff98 php-patchset-5.1.2-r2.tar.bz2 8278 +SHA256 059b45665051b6b5434f061ec8e04ba0cc4dc15892b8572218c0cbd8c15397ab php-patchset-5.1.2-r2.tar.bz2 8278 diff --git a/dev-lang/php/php-4.4.2-r1.ebuild b/dev-lang/php/php-4.4.2-r1.ebuild new file mode 100644 index 000000000000..b827e30f7ea9 --- /dev/null +++ b/dev-lang/php/php-4.4.2-r1.ebuild @@ -0,0 +1,286 @@ +# 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-r1.ebuild,v 1.1 2006/04/13 20:28:58 chtekk Exp $ + +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 +# 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="2" +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" +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() { + # 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, 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 + fi + + php4_4-sapi_pkg_setup +} + +php_determine_sapis() { + # holds the list of sapis that we want to build + PHPSAPIS= + + if useq 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.2-r1.ebuild b/dev-lang/php/php-5.1.2-r1.ebuild new file mode 100644 index 000000000000..3b7dbb122f23 --- /dev/null +++ b/dev-lang/php/php-5.1.2-r1.ebuild @@ -0,0 +1,286 @@ +# 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.2-r1.ebuild,v 1.1 2006/04/13 20:28:58 chtekk Exp $ + +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 +# 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="2" +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" +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() { + # 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, 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 + fi + + php5_1-sapi_pkg_setup +} + +php_determine_sapis() { + # holds the list of sapis that we want to build + PHPSAPIS= + + if useq 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 +} |