Subject: [alpine-devel] [PATCH] main/php: update to compile fpm support

From: Cameron Banta <[email-masked]>
Date: Wed, 8 Dec 2010 16:44:59 +0000

---
 main/php/APKBUILD     |   20 ++++++++++++++++----
 main/php/php-fpm.init |   22 ++++++++++++++++++++++
 2 files changed, 38 insertions(+), 4 deletions(-)
 create mode 100755 main/php/php-fpm.init

diff --git a/main/php/APKBUILD b/main/php/APKBUILD
index 1980f66..cc66599 100644
--- a/main/php/APKBUILD
+++ b/main/php/APKBUILD
@@ -3,7 +3,7 @@
 pkgname=php
 pkgver=5.3.3
 _suhosinver=${pkgver}-0.9.10
-pkgrel=4
+pkgrel=5
 pkgdesc="The PHP language runtime engine"
 url="http://www.php.net/"
 license="PHP-3"
@@ -14,8 +14,8 @@ makedepends="pcre-dev libxml2-dev libiconv-dev openssl-dev zlib-dev bzip2-dev
 	sqlite-dev libtool libltdl postgresql-dev db-dev unixodbc-dev icu-dev
 	gd-dev gmp-dev gettext-dev imap-dev aspell-dev
 	net-snmp-dev libxslt-dev cyrus-sasl-dev openldap-dev pkgconfig
-	libgcrypt-dev apache2-dev apr-dev apr-util-dev"
-subpackages="$pkgname-dev $pkgname-doc $pkgname-cli $pkgname-pear
+	libgcrypt-dev apache2-dev apr-dev apr-util-dev libevent-dev"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-cli $pkgname-fpm $pkgname-pear
 	$pkgname-apache2
 	$pkgname-bcmath
 	$pkgname-bz2
@@ -66,6 +66,7 @@ source="http://www.php.net/distributions/${pkgname}-${pkgver}.tar.bz2
         http://download.suhosin.org/suhosin-patch-${_suhosinver}.patch.gz
 	php-install-pear-xml.patch
 	php-uclibc.patch
+	php-fpm.init
 	"
 
 _extdir="/usr/lib/php/20090626"
@@ -228,6 +229,7 @@ build() {
 		--enable-fastcgi \
 		--enable-cgi \
 		--enable-cli \
+		--enable-fpm \
 		--enable-discard-path \
 		--enable-force-cgi-redirect \
 		--with-pic \
@@ -289,6 +291,15 @@ cli() {
 	mv "$pkgdir"/usr/bin/php "$subpkgdir"/usr/bin/
 }
 
+fpm() {
+	pkgdesc="PHP Fast Process Manager (FPM) interface"
+	mkdir -p "$subpkgdir"/usr/bin
+	mkdir -p "$subpkgdir"/etc/php
+	mv "$pkgdir"/usr/sbin/php-fpm "$subpkgdir"/usr/bin/php-fpm
+	mv "$pkgdir"/etc/php/php-fpm.conf.default "$subpkgdir"/etc/php/php-fpm.conf
+	install -D -m755 "$srcdir"/php-fpm.init "$subpkgdir"/etc/init.d/php-fpm
+}
+
 pear() {
 	depends="php php-cli"
 	mkdir -p "$subpkgdir"/usr/bin
@@ -366,4 +377,5 @@ dev() {
 md5sums="21ceeeb232813c10283a5ca1b4c87b48  php-5.3.3.tar.bz2
 b66b27c43b1332400ef8982944c3b95b  suhosin-patch-5.3.3-0.9.10.patch.gz
 5111e3be06d391f8772587c675240fab  php-install-pear-xml.patch
-26adfe0e744ec05fa9e368bbdee83176  php-uclibc.patch"
+26adfe0e744ec05fa9e368bbdee83176  php-uclibc.patch
+8f2bb2b744a2de50025842cb51fb6a3a  php-fpm.init"
diff --git a/main/php/php-fpm.init b/main/php/php-fpm.init
new file mode 100755
index 0000000..6b8337e
--- /dev/null
+++ b/main/php/php-fpm.init
@@ -0,0 +1,22 @@
+#!/sbin/runscript
+
+PHP_FPM_CONF="/etc/php/php-fpm.conf"
+
+opts="depend start stop reload"
+
+depend() {
+	need net
+	use apache2 lighttpd nginx
+}
+
+start() {
+	ebegin "Starting PHP FastCGI server"
+	start-stop-daemon --start --exec /usr/bin/php-fpm -- -y "${PHP_FPM_CONF}"
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping PHP FastCGI server"
+	start-stop-daemon --stop --name php-fpm
+	eend $?
+}
-- 
1.7.3.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---