Skip to contentSkip to conversation

php: enable php-fpm

PATCH New Eric Bénard 1 participant 1 message Nov 26, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 php: enable php-fpm

- php-fpm is an alternative PHP FastCGI implementation which seems to be now prefered to php-fcgi
- this patch enable the build of php-fpm and packages it in its own package
- it's tested with hiawatha on an armv5te target

---
 meta-oe/recipes-devtools/php/php.inc               |   21 +-
 .../php/php/fix-fpm-cross-compile.patch            |   38 ++
 meta-oe/recipes-devtools/php/php/php-fpm.conf      |  510 ++++++++++++++++++++
 meta-oe/recipes-devtools/php/php_5.3.19.bb         |    2 +
 4 files changed, 567 insertions(+), 4 deletions(-)
 create mode 100644 meta-oe/recipes-devtools/php/php/fix-fpm-cross-compile.patch
 create mode 100644 meta-oe/recipes-devtools/php/php/php-fpm.conf
meta-oe/recipes-devtools/php/php.inc +17 -4
index 10dc154..7850c1e 100644
@@ -7,7 +7,7 @@ DEPENDS = "zlib libxml2 virtual/libiconv php-native lemon-native mysql5 \
            libc-client openssl sqlite3"
 DEPENDS_virtclass-native = "zlib-native libxml2-native"
 
-INC_PR = "r1"
+INC_PR = "r2"
 
 SRC_URI = "http://www.php.net/distributions/php-${PV}.tar.bz2"
 
@@ -20,7 +20,7 @@ SSTATE_SCAN_FILES += "build-defs.h"
 # Common EXTRA_OECONF
 COMMON_EXTRA_OECONF = "--enable-sockets --enable-pcntl --enable-shared"
 EXTRA_OECONF = "--enable-mbstring --enable-discard-path --enable-wddx \
-                --enable-magic-quotes --enable-fastcgi \
+                --enable-magic-quotes --enable-fastcgi --enable-fpm \
                 --with-imap=${STAGING_DIR_HOST} \
                 --with-gettext=${STAGING_LIBDIR}/.. \
                 --with-imap-ssl=${STAGING_DIR_HOST} \
@@ -57,25 +57,38 @@ do_install  () {
 
 # fixme
 do_install_append_pn-php() {
-    mv ${D}/${STAGING_DIR_NATIVE}/${sysconfdir} ${D}/${sysconfdir}
+    install -d ${D}/${sysconfdir}/
+    mv ${D}/${STAGING_DIR_NATIVE}/${sysconfdir}/* ${D}/${sysconfdir}/
     rm -rf ${D}/${STAGING_DIR_NATIVE}
     rm -rf ${D}/.registry
     rm -rf ${D}/.channels
     rm -rf ${D}/.[a-z]*
     sed -i 's:${STAGING_DIR_NATIVE}::g' ${D}/${sysconfdir}/pear.conf
+    install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf
+    install -d ${D}${sysconfdir}/init.d
+    sed -i 's:=/usr/sbin:=${sbindir}:g' ${S}/sapi/fpm/init.d.php-fpm
+    sed -i 's:=/etc:=${sysconfdir}:g' ${S}/sapi/fpm/init.d.php-fpm
+    sed -i 's:=/var:=${localstatedir}:g' ${S}/sapi/fpm/init.d.php-fpm
+    install -m 0755 ${S}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm
 }
 
-PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-cgi ${PN}-pear ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}"
+PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-cgi ${PN}-fpm ${PN}-pear ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}"
 
 RDEPENDS_${PN}-pear = "${PN}"
 RDEPENDS_${PN}-cli = "${PN}"
 RDEPENDS_${PN}-dev = "${PN}"
 
+INITSCRIPT_PACKAGES = "${PN}-fpm"
+inherit update-rc.d
 
 FILES_${PN}-dbg =+ "${bindir}/.debug"
 FILES_${PN}-doc += "${libdir}/php/doc"
 FILES_${PN}-cli = "${bindir}/php"
 FILES_${PN}-cgi = "${bindir}/php-cgi"
+FILES_${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm"
+CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf"
+INITSCRIPT_NAME_${PN}-fpm = "php-fpm"
+INITSCRIPT_PARAMS_${PN}-fpm = "defaults 60"
 FILES_${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${libdir}/php/PEAR \
                 ${libdir}/php/PEAR.php ${libdir}/php/System.php \
                 ${libdir}php/peclcmd.php ${libdir}/php/pearcmd.php \
meta-oe/recipes-devtools/php/php/fix-fpm-cross-compile.patch new file +38 -0
new file mode 100644
index 0000000..b009347
@@ -0,0 +1,38 @@
+From 0b44f16ea2f18a08eb1249db6621840527eab5e0 Mon Sep 17 00:00:00 2001
+From: Jerome Loyet <[email protected]>
+Date: Wed, 23 May 2012 11:40:22 +0200
+Subject: [PATCH] - Fixed bug #61839 (Unable to cross-compile PHP with
+ --enable-fpm)
+
+---
+Upstream-Status: Applied 
+http://git.php.net/?p=php-src.git;a=commit;h=0b44f16ea2f18a08eb1249db6621840527eab5e0
+
+ NEWS               | 1 +
+ sapi/fpm/config.m4 | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
+index 8962810..6c860c9 100644
+--- a/sapi/fpm/config.m4
++++ b/sapi/fpm/config.m4
+@@ -192,6 +192,8 @@ AC_DEFUN([AC_FPM_TRACE],
+       have_ptrace=no
+       have_broken_ptrace=yes
+       AC_MSG_RESULT([no])
++    ], [
++      AC_MSG_RESULT([skipped (cross compiling)])
+     ])
+   fi
+ 
+@@ -264,6 +266,8 @@ AC_DEFUN([AC_FPM_TRACE],
+     ], [
+       proc_mem_file=""
+       AC_MSG_RESULT([no])
++    ], [
++      AC_MSG_RESULT([skipped (cross compiling)])
+     ])
+   fi
+   
+-- 
+1.7.11.5
meta-oe/recipes-devtools/php/php/php-fpm.conf new file +510 -0

510 lines not on this page · raw message

meta-oe/recipes-devtools/php/php_5.3.19.bb +2 -0
index e96b760..27baa1d 100644
@@ -13,6 +13,8 @@ SRC_URI_append_pn-php += "file://iconv.patch \
             file://pear-makefile.patch \
             file://phar-makefile.patch \
             file://php_exec_native.patch \
+            file://fix-fpm-cross-compile.patch \
+            file://php-fpm.conf \
             "
 
 SRC_URI[md5sum] = "e1d2a3ec7849d4b3032bd1abf1916aa4"
Signature · 1 line
1.7.10.4