Hello ports@,

Here's the first real tricky patch for PHP.
Right now we have the -fastcgi package, which is nothing more than PHP's
cgi SAPI under a different name and is actually confusing considering
there's the fpm SAPI in -main. It originally took me quite some time to
figure out to what SAPI this package actually maps to, especially
considering it doesn't include the manpage.

So I've addressed the following topics in this diff:
1) Rename the package from -fastcgi to -cgi
2) Rename the binary from php-fastcgi to php-cgi (or more precisely
   preserve the name from build-time)
3) Add the php-cgi manpage. This is nothing more than a source of the
   php-cli manpage. Maybe we should copy the php-cli manpage to php-cgi
   instead of sourcing it?
4) enable -cgi explicitly (we're packaging it, so be explicit about
   building it)
5) Adjust COMMENT and DESCR. These probably need some love, but suffice
   for me.
6) Add RUN_DEPENDS on -main. This is required for this patch's version
   of the manpage and adds the php.ini.

This also leaves me with the question: what do we want to do with the
other SAPI modules? apxs2, cli, fpm, phpdbg (not build yet). Do we want
them all in separate packages, or maybe a subset? It would be my
personal preference to split them all and leave -main with just the
essentials (php.ini, phpize, SAPI-shared headers, etc).

Thoughts, opinions, OKs?

martijn@

Index: Makefile.inc
===================================================================
RCS file: /cvs/ports/lang/php/Makefile.inc,v
retrieving revision 1.100
diff -u -p -a -u -r1.100 Makefile.inc
--- Makefile.inc        23 Nov 2017 18:57:13 -0000      1.100
+++ Makefile.inc        23 Nov 2017 20:38:55 -0000
@@ -3,10 +3,10 @@
 BROKEN-hppa=   no __sync_bool_compare_and_swap support nor asm fallback
 
 COMMENT-main=          server-side HTML-embedded scripting language
-COMMENT-fastcgi=       stand-alone FastCGI version of PHP
+COMMENT-cgi=           cgi sapi for php
 
 PKGNAME-main?=         php-${V}
-PKGNAME-fastcgi?=      php-fastcgi-${V}
+PKGNAME-cgi?=          php-cgi-${V}
 
 DISTFILES+=            php-${V}.tar.bz2
 
@@ -97,6 +97,7 @@ CONFIGURE_ARGS+=      --with-openssl \
                        --enable-sysvshm \
                        --enable-mbstring \
                        --enable-exif \
+                       --enable-cgi \
                        --enable-fpm \
                        --with-fpm-user=www \
                        --with-fpm-group=www
@@ -104,7 +105,7 @@ CONFIGURE_ARGS+=    --with-openssl \
 TEST_TARGET=           test
 TEST_FLAGS=            NO_INTERACTION=1
 
-MULTI_PACKAGES+=       -main -fastcgi
+MULTI_PACKAGES+=       -main -cgi
 
 #
 # Loadable php extensions by name that are included in all versions
@@ -304,12 +305,12 @@ PHPXS_SUBST+= -e 's,${i},${${i}},'
 WANTLIB-main+=         c crypto iconv intl lzma m pthread ssl xml2>=8 z
 WANTLIB-main+=         ncurses readline ${COMPILER_LIBCXX}
 
-WANTLIB-fastcgi=       ${WANTLIB-main}
+WANTLIB-cgi=           ${WANTLIB-main}
 LIB_DEPENDS-main=      devel/gettext \
                        textproc/libxml
 RUN_DEPENDS-main=      mail/femail,-chroot
-LIB_DEPENDS-fastcgi=   ${LIB_DEPENDS-main}
-RUN_DEPENDS-fastcgi=
+LIB_DEPENDS-cgi=       ${LIB_DEPENDS-main}
+RUN_DEPENDS-cgi=       php-${V}:lang/php/${PV}
 
 pre-fake:
        ${INSTALL_DATA_DIR} ${PREFIX}/${APACHE_MODULE_SUBDIR}/modules
@@ -324,7 +325,7 @@ pre-configure:
                ${WRKSRC}/scripts/phpize.in \
                ${WRKSRC}/scripts/php-config.in
 
-.for i in ${MULTI_PACKAGES:N-main:N-fastcgi:S/-//g}
+.for i in ${MULTI_PACKAGES:N-main:N-cgi:S/-//g}
 MODULE_NAME-${i}=      ${i}
 DESCR-${i}=            ${.CURDIR}/../files/DESCR-${i}
 PKGNAME-${i}=          php-${i}-${V}
@@ -337,7 +338,7 @@ RUN_DEPENDS-${i}+=  php-${V}:lang/php/${P
 .endfor
 
 DESCR-main=            ${.CURDIR}/../files/DESCR-main
-DESCR-fastcgi=         ${.CURDIR}/../files/DESCR-fastcgi
+DESCR-cgi=             ${.CURDIR}/../files/DESCR-cgi
 
 post-install:
        ${SUBST_DATA} ${.CURDIR}/../files/README-main \
@@ -347,7 +348,8 @@ post-install:
        ${INSTALL_DATA_DIR} ${WRKINST}/${CHROOT_DIR}/conf/php-${PV}.sample
        ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/php-${PV}
        ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/cli/php ${PREFIX}/bin/php-${PV}
-       ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/cgi/php-cgi 
${PREFIX}/bin/php-fastcgi-${PV}
+       ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/cgi/php-cgi 
${PREFIX}/bin/php-cgi-${PV}
+       ${INSTALL_MAN} ${WRKSRC}/sapi/cgi/php-cgi.1 
${PREFIX}/man/man1/php-cgi-${PV}.1
        ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/fpm/php-fpm 
${PREFIX}/sbin/php-fpm-${PV}
        ${INSTALL_MAN} ${WRKBUILD}/sapi/fpm/php-fpm.8 
${PREFIX}/man/man8/php-fpm-${PV}.8
        ${INSTALL_DATA} ${WRKBUILD}/sapi/fpm/php-fpm.conf \
@@ -362,7 +364,7 @@ post-install:
        @perl -pi -e 
"s,!!PREFIX!!,${TRUEPREFIX},g;s,!!PV!!,${PV},g;s,!!MV!!,${PV:R},g" \
                ${PREFIX}/share/examples/php-${PV}/php.conf
 
-.for m in ${MULTI_PACKAGES:N-main:N-fastcgi:S/-//g}
+.for m in ${MULTI_PACKAGES:N-main:N-cgi:S/-//g}
        ${INSTALL_DATA} ${WRKBUILD}/modules/${m}.so \
                ${PREFIX}/${MODULES_SUBDIR}/${m}.so
        echo "extension=${m}.so" > \
Index: 5.6/Makefile
===================================================================
RCS file: /cvs/ports/lang/php/5.6/Makefile,v
retrieving revision 1.55
diff -u -p -a -u -r1.55 Makefile
--- 5.6/Makefile        17 Nov 2017 06:47:17 -0000      1.55
+++ 5.6/Makefile        23 Nov 2017 20:38:55 -0000
@@ -4,7 +4,7 @@ BROKEN-alpha=   pcre_jit_compile.c:65:2: e
 
 PV=            5.6
 V=             ${PV}.31
-REVISION=      0
+REVISION=      1
 
 MASTER_SITES0= https://download.suhosin.org/
 
Index: 5.6/patches/patch-sapi_cgi_php-cgi_1_in
===================================================================
RCS file: 5.6/patches/patch-sapi_cgi_php-cgi_1_in
diff -N 5.6/patches/patch-sapi_cgi_php-cgi_1_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 5.6/patches/patch-sapi_cgi_php-cgi_1_in     23 Nov 2017 20:38:55 -0000
@@ -0,0 +1,8 @@
+$OpenBSD$
+
+Index: sapi/cgi/php-cgi.1.in
+--- sapi/cgi/php-cgi.1.in.orig
++++ sapi/cgi/php-cgi.1.in
+@@ -1 +1 @@
+-.so man1/php.1
++.so man1/php-5.6.1
Index: 5.6/pkg/PLIST-cgi
===================================================================
RCS file: 5.6/pkg/PLIST-cgi
diff -N 5.6/pkg/PLIST-cgi
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 5.6/pkg/PLIST-cgi   23 Nov 2017 20:38:55 -0000
@@ -0,0 +1,6 @@
+@comment $OpenBSD: PLIST-fastcgi,v 1.2 2016/06/29 16:14:42 espie Exp $
+@option no-default-conflict
+@option is-branch
+@conflict php-cgi->=5.6,<5.7
+@bin bin/php-cgi-${PV}
+@man man/man1/php-cgi-${PV}.1
Index: 5.6/pkg/PLIST-fastcgi
===================================================================
RCS file: 5.6/pkg/PLIST-fastcgi
diff -N 5.6/pkg/PLIST-fastcgi
--- 5.6/pkg/PLIST-fastcgi       29 Jun 2016 16:14:42 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,5 +0,0 @@
-@comment $OpenBSD: PLIST-fastcgi,v 1.2 2016/06/29 16:14:42 espie Exp $
-@option no-default-conflict
-@option is-branch
-@conflict php-fastcgi->=5.6,<5.7
-@bin bin/php-fastcgi-${PV}
Index: 7.0/Makefile
===================================================================
RCS file: /cvs/ports/lang/php/7.0/Makefile,v
retrieving revision 1.38
diff -u -p -a -u -r1.38 Makefile
--- 7.0/Makefile        17 Nov 2017 06:47:17 -0000      1.38
+++ 7.0/Makefile        23 Nov 2017 20:38:55 -0000
@@ -4,7 +4,7 @@ BROKEN-sparc64= SIGBUS during phar gener
 
 PV=            7.0
 V=             ${PV}.23
-REVISION=      0
+REVISION=      1
 
 BUILD_DEPENDS+=        devel/bison
 
Index: 7.0/patches/patch-sapi_cgi_php-cgi_1_in
===================================================================
RCS file: 7.0/patches/patch-sapi_cgi_php-cgi_1_in
diff -N 7.0/patches/patch-sapi_cgi_php-cgi_1_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 7.0/patches/patch-sapi_cgi_php-cgi_1_in     23 Nov 2017 20:38:55 -0000
@@ -0,0 +1,8 @@
+$OpenBSD$
+
+Index: sapi/cgi/php-cgi.1.in
+--- sapi/cgi/php-cgi.1.in.orig
++++ sapi/cgi/php-cgi.1.in
+@@ -1 +1 @@
+-.so man1/php.1
++.so man1/php-5.6.1
Index: 7.0/pkg/PLIST-cgi
===================================================================
RCS file: 7.0/pkg/PLIST-cgi
diff -N 7.0/pkg/PLIST-cgi
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 7.0/pkg/PLIST-cgi   23 Nov 2017 20:38:55 -0000
@@ -0,0 +1,6 @@
+@comment $OpenBSD: PLIST-fastcgi,v 1.2 2016/06/29 16:14:42 espie Exp $
+@option no-default-conflict
+@option is-branch
+@conflict php-cgi->=7.0,<7.1
+@bin bin/php-cgi-${PV}
+@man man/man1/php-cgi-${PV}.1
Index: 7.0/pkg/PLIST-fastcgi
===================================================================
RCS file: 7.0/pkg/PLIST-fastcgi
diff -N 7.0/pkg/PLIST-fastcgi
--- 7.0/pkg/PLIST-fastcgi       29 Jun 2016 16:14:42 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,5 +0,0 @@
-@comment $OpenBSD: PLIST-fastcgi,v 1.2 2016/06/29 16:14:42 espie Exp $
-@option no-default-conflict
-@option is-branch
-@conflict php-fastcgi->=7.0,<7.1
-@bin bin/php-fastcgi-${PV}
Index: files/DESCR-cgi
===================================================================
RCS file: files/DESCR-cgi
diff -N files/DESCR-cgi
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/DESCR-cgi     23 Nov 2017 20:38:55 -0000
@@ -0,0 +1 @@
+PHP's CGI and FastCGI SAPI
Index: files/DESCR-fastcgi
===================================================================
RCS file: files/DESCR-fastcgi
diff -N files/DESCR-fastcgi
--- files/DESCR-fastcgi 27 Jun 2010 20:28:45 -0000      1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-This is the core PHP binary compiled with FastCGI support
-(www.fastcgi.com). FastCGI deployments are generally faster than
-using PHP as a CGI, since the processes stay resident in memory
-between requests.

Reply via email to