pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/46019: Add FPM option to PHP



>Number:         46019
>Category:       pkg
>Synopsis:       Add FPM option to PHP
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 13 19:55:00 +0000 2012
>Originator:     Ty Sarna
>Release:        NetBSD 5.1.2
>Organization:
>Environment:
System: NetBSD xxx 5.1.2 NetBSD 5.1.2 (PANIX-VC) #0: Fri Feb 10 00:26:43 EST 
2012 
root%juggler.panix.com@localhost:/misc/obj/misc/devel/netbsd/5.1.2/src/sys/arch/amd64/compile/PANIX-VC
 amd64
Architecture: x86_64
Machine: amd64
>Description:
        Add support for PHP-FPM (improved FastCGI support) tp php53.
        This is important for the ability to run PHP in a chroot jail,
        among other features.

        I am so very rusty at pkgsrc work, so I am submitting this as
        a PR instead of committing, so it can be reviewed, and also in
        the hope that the minor issue below will be easy for someone
        in the know to address.

        The attached diff is tested and works, except that the
        RCD_SCRIPTS seems not to be picked up, so the new rc.d script
        is not installed.

>How-To-Repeat:
        N/A
>Fix:
RCS file: /cvsroot/pkgsrc/lang/php53/Makefile,v
retrieving revision 1.23
diff -u -r1.23 Makefile
--- Makefile    3 Feb 2012 03:10:33 -0000       1.23
+++ Makefile    13 Feb 2012 19:46:03 -0000
@@ -28,6 +28,10 @@
 CONF_FILES=            ${EGDIR}/php.ini-production ${PKG_SYSCONFDIR}/php.ini
 OWN_DIRS=              ${PREFIX}/${PHP_EXTENSION_DIR}
 
+.if !empty(PKG_OPTIONS:Mfpm)
+CONF_FILES+=           ${EGDIR}/php-fpm.conf ${PKG_SYSCONFDIR}/php-fpm.conf
+.endif
+
 SUBST_CLASSES+=                path
 SUBST_MESSAGE.path=    Fixing common paths.
 SUBST_STAGE.path=      pre-configure
@@ -51,7 +55,11 @@
        ${INSTALL_PROGRAM} ${WRKSRC}/sapi/cli/php ${DESTDIR}${PREFIX}/bin/php
        ${INSTALL_DATA} ${WRKSRC}/sapi/cli/php.1 \
                ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/php.1
+.if !empty(PKG_OPTIONS:Mfpm)
+       ${INSTALL_DATA} ${WRKSRC}/sapi/fpm/php-fpm.conf ${DESTDIR}${EGDIR}
+.else
        ${INSTALL_PROGRAM} ${WRKSRC}/sapi/cgi/php-cgi ${DESTDIR}${CGIDIR}/php
+.endif
        cd ${WRKSRC}; ${INSTALL_DATA} php.ini-development php.ini-production \
                ${DESTDIR}${EGDIR}
        ${INSTALL_DATA} ${WRKSRC}/php.gif ${DESTDIR}${PREFIX}/share/php
Index: Makefile.php
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php53/Makefile.php,v
retrieving revision 1.13
diff -u -r1.13 Makefile.php
--- Makefile.php        3 Feb 2012 03:10:34 -0000       1.13
+++ Makefile.php        13 Feb 2012 19:46:03 -0000
@@ -11,7 +11,7 @@
 USE_LANGUAGES=         c c++
 GNU_CONFIGURE=         YES
 BUILD_DEFS+=           VARBASE
-PLIST_VARS+=           suhosin
+PLIST_VARS+=           suhosin cgi fpm
 
 CONFIGURE_ENV+=                EXTENSION_DIR="${PREFIX}/${PHP_EXTENSION_DIR}"
 
@@ -39,7 +39,6 @@
 CONFIGURE_ARGS+=       --disable-pdo
 CONFIGURE_ARGS+=       --disable-json
 
-CONFIGURE_ARGS+=       --enable-cgi
 CONFIGURE_ARGS+=       --enable-xml
 CONFIGURE_ARGS+=       --with-libxml-dir=${PREFIX}
 .include "../../textproc/libxml2/buildlink3.mk"
@@ -47,7 +46,7 @@
 # Note: This expression is the same as ${PKGBASE}, but the latter is
 # not defined yet, so we cannot use it here.
 PKG_OPTIONS_VAR=       PKG_OPTIONS.${PKGNAME:C/-[0-9].*//}
-PKG_SUPPORTED_OPTIONS+=        inet6 ssl maintainer-zts suhosin
+PKG_SUPPORTED_OPTIONS+=        inet6 ssl maintainer-zts suhosin fpm
 PKG_SUGGESTED_OPTIONS+=        inet6 ssl
 
 #SUBST_CLASSES+=               ini
@@ -76,6 +75,15 @@
 .  endif
 .endif
 
+.if !empty(PKG_OPTIONS:Mfpm)
+RCD_SCRIPTS=            php_fpm
+CONFIGURE_ARGS+=       --disable-cgi --enable-fpm
+PLIST.fpm=yes
+.else
+CONFIGURE_ARGS+=       --enable-cgi --disable-fpm
+PLIST.cgi=yes
+.endif
+
 .if !empty(PKG_OPTIONS:Minet6)
 CONFIGURE_ARGS+=       --enable-ipv6
 .else
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php53/PLIST,v
retrieving revision 1.2
diff -u -r1.2 PLIST
--- PLIST       20 Aug 2011 13:55:09 -0000      1.2
+++ PLIST       13 Feb 2012 19:46:03 -0000
@@ -228,11 +228,15 @@
 lib/php/build/run-tests.php
 lib/php/build/scan_makefile_in.awk
 lib/php/build/shtool
-libexec/cgi-bin/php
+${PLIST.cgi}libexec/cgi-bin/php
+${PLIST.fpm}share/php/fpm/status.html
+${PLIST.fpm}man/man8/php-fpm.8
+${PLIST.fpm}sbin/php-fpm
 man/man1/php-config.1
 man/man1/php.1
 man/man1/phpize.1
 share/examples/php/php.ini-development
 share/examples/php/php.ini-production
+${PLIST.fpm}share/examples/php/php-fpm.conf
 share/php/php.gif
 @pkgdir include/php/include
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php53/distinfo,v
retrieving revision 1.35
diff -u -r1.35 distinfo
--- distinfo    3 Feb 2012 03:10:34 -0000       1.35
+++ distinfo    13 Feb 2012 19:46:03 -0000
@@ -17,5 +17,6 @@
 SHA1 (patch-ai) = d4766893a2c47a4e4a744248dda265b0a9a66a1f
 SHA1 (patch-aj) = d611d13fcc28c5d2b9e9586832ce4b8ae5707b48
 SHA1 (patch-al) = fbbee5502e0cd1c47c6e7c15e0d54746414ec32e
+SHA1 (patch-fpm-pid) = 6575e9e5f1494947bc95cf8a957fd4197ef48b5a
 SHA1 (patch-main_streams_cast.c) = c169ccb73dc660e40eff9f9e168374f35eedadad
 SHA1 (patch-php__mssql.c) = b46c688ff2d8da33ca2f9beb0eb9182b6edf7e23
--- /dev/null   2012-02-13 14:22:05.000000000 -0500
+++ files/php_fpm.sh    2012-02-13 13:44:37.000000000 -0500
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# $NetBSD$
+#
+# PROVIDE: php_fpm
+# REQUIRE: DAEMON
+
+. /etc/rc.subr
+
+name="php_fpm"
+cmdname="php-fpm"
+rcvar=${name}
+command="@PREFIX@/sbin/${cmdname}"
+required_files="@PKG_SYSCONFDIR@/${cmdname}.conf"
+pidfile="@VARBASE@/run/${cmdname}.pid"
+extra_commands="reload"
+sig_stop=QUIT
+sig_reload=USR2
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null   2012-02-13 14:22:05.000000000 -0500
+++ patches/patch-fpm-pid       2012-02-13 13:24:48.000000000 -0500
@@ -0,0 +1,15 @@
+$NetBSD$
+
+The pidfile really needs to be enabled by default for the rc.d script
+
+--- sapi/fpm/php-fpm.conf.in.orig      2012-02-13 13:23:22.000000000 -0500
++++ sapi/fpm/php-fpm.conf.in   2012-02-13 13:23:33.000000000 -0500
+@@ -22,7 +22,7 @@
+ ; Pid file
+ ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
+ ; Default Value: none
+-;pid = run/php-fpm.pid
++pid = run/php-fpm.pid
+ 
+ ; Error log file
+ ; If it's set to "syslog", log is sent to syslogd instead of being written



Home | Main Index | Thread Index | Old Index