diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest index 938cd91..1da7724 100644 --- a/dev-lang/php/Manifest +++ b/dev-lang/php/Manifest @@ -4,11 +4,14 @@ AUX 70_mod_php5.conf-apache2 490 RMD160 745bdb5db622577f473703d5ee8dc7f3c66f8f0c AUX 70_mod_php5.conf-apache2-r1 374 RMD160 ca06cdc9d1a3dc4129a60c938ee3a1b542497fbb SHA1 4733066b6324c5870e716485484c44c7c26a9ff1 SHA256 815c1ca23c9afe8479568ceaac4057eb91ea5444fbd863866b29adb4eea2c82b AUX 70_mod_php5_concurr.conf-apache2 414 RMD160 1783b6c830119f021c3fb6cb35a631f43c4fa70c SHA1 09f9076f35bc84994fc8c687b4befc0400475f1a SHA256 ccc3bc073eafc83f98049679a411801e80f84620bd51c37c36de2b9ee9492aa2 AUX 70_mod_php5_concurr.conf-apache2-r1 376 RMD160 4f7de5c0784b6191450b5c1a7de7ad941620e199 SHA1 c42a23bd7a1d3e8c7e0ac906f50f180116349f76 SHA256 c05f499d9c8927391c586b94716a9f59d63767165552ea527ec7ff63c36eaa40 +AUX php-5.2.10-fpm-0.5.13.diff-ext.patch 616 RMD160 f2c7404a06106bbea4f25c684730549f0738adf1 SHA1 dcebc68c4367caa2b62a9df460ec28f1bfdd3a8e SHA256 73097d238ae907408c4affacc5478818f3a4b877e29e7490de6ac8e7c071b4d6 AUX php-5.2.10-pdo_dblib.patch 559 RMD160 062604e291113b2bb86044b5eeffb72fad210fbc SHA1 d59d26e6557dac86e582e1a6ed7bb4795cf150c6 SHA256 0548d63d7379cd19f7ade6ca1222b1b577f684b142ff6b0e8e23742b1f7f9794 +AUX php-fpm.init 554 RMD160 6a76e3f743f6f57de721e91fe15c7dbef0f6bf28 SHA1 e7e28412128f7fe0cbd224a50634041e19e09667 SHA256 8ebfc7bb50d4374c6571121193105f3d43bcdb358949b77c2f84f2a1a0a67118 AUX php4-ldvs 22 RMD160 e70c565b3930d9d9e3253062b7c633346cb99a63 SHA1 8c66355dfb80e2ecc6ee6faae30bf7dbb1727651 SHA256 4aee18478b09cda7e925ccde157db6099ea0122b5c4efb0868e3761b65688dde AUX php5-ldvs 22 RMD160 5846dab2745b68a88175dd4e72d0b8cf4756dd46 SHA1 592398c92575adb14ec972847ce2aca28a7b9c2c SHA256 b79d0e52b1b3b4543b31ad45525ae1c2814a27ea8e676772ab10bf6fb12dfe79 +DIST php-5.2.10-fpm-0.5.13.diff.gz 202722 RMD160 c5b3bd9135b712ec62aaa49a6de1f926a02469c5 SHA1 6168ddc2806ea8403517c5ea8c8db90136d857e3 SHA256 d000bad0d09eea3a721fe001a32e3910725508dfa6ef5a33dd1b412c90e14e26 DIST php-5.2.10.tar.bz2 8808759 RMD160 9a9ec823eda9d6b3c085967e7a71f776071fc78f SHA1 9a287e2791d28928fb1ee1a1167290c5005feccd SHA256 d45fd9ed292ec429151a195541aa55b5d26c66531bdcdbc33e9c34f625f182ca DIST php-patchset-5.2.10-r1.tar.bz2 11294 RMD160 1f23bbb661f40ac44ed4e39e51abc0a8d5d2b9a0 SHA1 66841d8f64058e6fdd74fb82dc686e75f5f36f6d SHA256 e32a9f08307707476dec5ad44a6923c7827d7635c2b723d3e70cc82eee1da1e3 DIST suhosin-patch-5.2.10-0.9.7.patch.gz 23072 RMD160 18df1686a48d652f581591115b51461e9dacf5a4 SHA1 3768bbded0bb2376414322b26308342452cb927a SHA256 51d8496172b838c4bbb40f783b535162169b5e218cd6093ecc25cfcfa0c469f8 -EBUILD php-5.2.10-r2.ebuild 16837 RMD160 870d5cd011ae9ff2a3e9482b0c70995fb9ab6026 SHA1 5a568341061cdef5a9666c1dc12bcaf3b07c019e SHA256 db7c3e4a0d0c4ffafbb4c912ef001e386d6edc016b5a7b160a01ada4ff4a2569 -MISC metadata.xml 1494 RMD160 c8579965284d7e60e3bf12600eea425175e6c480 SHA1 24c24ff7bb2efb47c02f604f0896c99da87ffe67 SHA256 6a5df2911eff7c828d9da402914c08554b8c8752b0545a74af9ba6f8fa8f59a9 +EBUILD php-5.2.10-r2.ebuild 18533 RMD160 79ee2ad76c7ea346a5c15eb511ba5b753146f872 SHA1 0674b4e371c37df8d43badbb2971b43c94a782ee SHA256 4ee5a78b05bb424303f217bf8c84a4b9e7521dc268b6b15503412dbf7e5e9b1d +MISC metadata.xml 1609 RMD160 d38bf6db4068985b22b93e8d0d7f813b6598456f SHA1 c58a51a1286a0b9960ddd1511a16ca79f00b556e SHA256 949a48d14d9f2b5898c46e733b165802b52dbff9f146fe2cd7d562bc3b0075db diff --git a/dev-lang/php/files/php-5.2.10-fpm-0.5.13.diff-ext.patch b/dev-lang/php/files/php-5.2.10-fpm-0.5.13.diff-ext.patch new file mode 100644 index 0000000..c3cc0e8 --- /dev/null +++ b/dev-lang/php/files/php-5.2.10-fpm-0.5.13.diff-ext.patch @@ -0,0 +1,16 @@ +diff -ur php-5.2.10-orig/sapi/cgi/fpm/conf/php-fpm.conf.in php-5.2.10/sapi/cgi/fpm/conf/php-fpm.conf.in +--- php-5.2.10-orig/sapi/cgi/fpm/conf/php-fpm.conf.in 2009-07-22 13:31:05.000000000 +0800 ++++ php-5.2.10/sapi/cgi/fpm/conf/php-fpm.conf.in 2009-07-22 13:36:28.000000000 +0800 +@@ -60,10 +60,10 @@ + + + Unix user of processes +- ++ nobody + + Unix group of processes +- ++ @php_fpm_group@ + + Process manager settings + diff --git a/dev-lang/php/files/php-fpm.init b/dev-lang/php/files/php-fpm.init new file mode 100644 index 0000000..586b914 --- /dev/null +++ b/dev-lang/php/files/php-fpm.init @@ -0,0 +1,26 @@ +#!/sbin/runscript + +opts="depend start stop reload" + +depend() { + need net +} + +start() { + ebegin "Starting PHP FastCGI server" + start-stop-daemon --start --pidfile=/var/run/php-fpm.pid \ + --exec /usr/bin/php-cgi -- --fpm + eend $? +} + +stop() { + ebegin "Stopping PHP FastCGI server" + start-stop-daemon --stop --pidfile=/var/run/php-fpm.pid + eend $? +} + +reload() { + ebegin "Restart gracefully PHP FastCGI server" + kill -SIGUSR2 `cat /var/run/php-fpm.pid` &>/dev/null + eend $? +} diff --git a/dev-lang/php/metadata.xml b/dev-lang/php/metadata.xml index 57468d4..bcb42df 100644 --- a/dev-lang/php/metadata.xml +++ b/dev-lang/php/metadata.xml @@ -18,6 +18,7 @@ Enable the bundled PDO extensions Enable the reflection extension (Reflection API) Add Suhosin support (patch and extension from http://www.suhosin.org/) + Add php-fpm: PHP FastCGI Process Manager support (patch from http://php-fpm.anight.org/) Enable XMLReader support Enable XMLWriter support Enable ZIP file support diff --git a/dev-lang/php/php-5.2.10-r2.ebuild b/dev-lang/php/php-5.2.10-r2.ebuild index cf9677e..eea86d7 100644 --- a/dev-lang/php/php-5.2.10-r2.ebuild +++ b/dev-lang/php/php-5.2.10-r2.ebuild @@ -4,7 +4,7 @@ CGI_SAPI_USE="discard-path force-cgi-redirect" APACHE2_SAPI_USE="concurrentmodphp threads" -IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild" +IUSE="cli cgi ${CGI_SAPI_USE} ${APACHE2_SAPI_USE} fastbuild fpm" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" @@ -19,10 +19,13 @@ MY_PHP_PV="${PV}" MY_PHP_P="php-${MY_PHP_PV}" PHP_PACKAGE="1" +RESTRICT="nomirror" + # php patch settings, general PHP_PATCHSET_REV="${PR/r/}" PHP_PATCHSET_REV="${PHP_PATCHSET_REV/2/1}" SUHOSIN_PATCH="suhosin-patch-${MY_PHP_PV}-0.9.7.patch.gz" +FPM_PATCH="php-5.2.10-fpm-0.5.13.diff" MULTILIB_PATCH="${MY_PHP_PV}/opt/multilib-search-path.patch" # php patch settings, ebuild specific FASTBUILD_PATCH="${MY_PHP_PV}/opt/fastbuild.patch" @@ -36,9 +39,13 @@ inherit versionator php5_2-sapi apache-module # Suhosin patch support [[ -n "${SUHOSIN_PATCH}" ]] && SRC_URI="${SRC_URI} suhosin? ( http://gentoo.longitekk.com/${SUHOSIN_PATCH} )" +# php-fpm patch support +[[ -n "${FPM_PATCH}" ]] && SRC_URI="${SRC_URI} fpm? ( http://php-fpm.org/downloads/${FPM_PATCH}.gz )" + DESCRIPTION="The PHP language runtime engine: CLI, CGI and Apache2 SAPIs." DEPEND="app-admin/php-toolkit + fpm? ( >=dev-libs/libxml2-2.6.8 ) imap? ( >=virtual/imap-c-client-2006k ) pcre? ( >=dev-libs/libpcre-7.8 ) xml? ( >=dev-libs/libxml2-2.7.2-r2 ) @@ -60,6 +67,15 @@ pkg_setup() { einfo "Determining SAPI(s) to build" phpconfutils_require_any " Enabled SAPI:" " Disabled SAPI:" cli cgi apache2 + # php-fpm patch support + if use fpm && ! use cgi ; then + eerror + eerror "You must enable CGI SAPI for php-fpm patch to work" + eerror + ebeep 1 + die + fi + # Threaded Apache2 support if use apache2 ; then has_apache_threads @@ -135,6 +151,12 @@ src_unpack() { cd "${S}" + # enable php-fpm support + if use fpm ; then + EPATCH_OPTS="-p1 -d ${S}" epatch "${WORKDIR}/${FPM_PATCH}" + epatch "${FILESDIR}/php-5.2.10-fpm-0.5.13.diff-ext.patch" + fi + # Concurrent PHP Apache2 modules support if use apache2 ; then if use concurrentmodphp ; then @@ -260,6 +282,12 @@ src_compile_fastbuild() { if [[ ${build_cgi} = 1 ]] ; then my_conf="${my_conf} --enable-cgi --enable-fastcgi" + + # php-fpm patch support + if use fpm ; then + my_conf="${my_conf} --enable-fpm --with-fpm-conf=/etc/php/cgi-php5/php-fpm.conf --with-fpm-log=/var/log/php-fpm.log --with-fpm-pid=/var/run/php-fpm.pid" + fi + phpconfutils_extension_enable "discard-path" "discard-path" 0 phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 else @@ -379,6 +407,12 @@ src_compile_normal() { ;; cgi) my_conf="${my_conf} --disable-cli --enable-cgi --enable-fastcgi" + + # enable php-fpm support + if use fpm ; then + my_conf="${my_conf} --enable-fpm --with-fpm-conf=/etc/php/cgi-php5/php-fpm.conf --with-fpm-log=/var/log/php-fpm.log --with-fpm-pid=/var/run/php-fpm.pid" + fi + phpconfutils_extension_enable "discard-path" "discard-path" 0 phpconfutils_extension_enable "force-cgi-redirect" "force-cgi-redirect" 0 php5_2-sapi_src_compile @@ -423,6 +457,17 @@ src_install() { into ${destdir} dobin php-cgi || die "Unable to install ${x} sapi" php5_2-sapi_install_ini + + # php-fpm patch support + if use fpm ; then + einfo "Installing php-fpm config" + FPMSRCDIR="${WORKDIR}/${P}/sapi/cgi/fpm" + insinto ${PHP_INI_DIR} + doins "${FPMSRCDIR}/php-fpm.conf" + newins "${FPMSRCDIR}/php-fpm.conf" "php-fpm.conf.dist" + einfo "Installing php-fpm initscript" + newinitd "${FILESDIR}/php-fpm.init" "php-fpm" + fi ;; apache2) einfo "Installing Apache${APACHE_VERSION} SAPI" @@ -511,6 +556,20 @@ pkg_postinst() { ewarn " php-select php-cgi php5" ewarn fi + + # php-fpm patch support + if use fpm ; then + ebegin "Creating php-fpm user and group" + enewgroup php-fpm + enewuser php-fpm -1 -1 /dev/null php-fpm + eend ${?} + + einfo + einfo "php-fpm config installed to /etc/php/cgi-php5/php-fpm.conf" + #einfo "In current state php-fpm patch supports only static pm, not apache-like" + einfo + fi + fi # Create the symlinks for php-devel