This diff enables the phpdbg SAPI. It's not perfect, but helped me out a
couple of times in the past.

OK?

martijn@

Index: Makefile.inc
===================================================================
RCS file: /cvs/ports/lang/php/Makefile.inc,v
retrieving revision 1.107
diff -u -p -r1.107 Makefile.inc
--- Makefile.inc        25 May 2018 22:43:41 -0000      1.107
+++ Makefile.inc        27 May 2018 06:51:32 -0000
@@ -4,6 +4,7 @@ BROKEN-hppa=    no __sync_bool_compare_and_
 
 COMMENT-main=          server-side HTML-embedded scripting language
 COMMENT-cgi=           cgi sapi for php
+COMMENT-dbg=           debug sapi for php
 
 PKGNAME-main?=         php-${V}
 
@@ -72,7 +73,11 @@ CONFIGURE_ARGS+=     --enable-shared \
 CONFIGURE_ARGS+=       --with-mysql-sock=${LOCALSTATEDIR}/run/mysql/mysql.sock
 
 # sapi
+# cgi
 CONFIGURE_ARGS+=       --enable-cgi
+# phpdbg
+CONFIGURE_ARGS+=       --enable-phpdbg
+WANTLIB-dbg=           readline 
 
 CONFIGURE_ARGS+=       --with-apxs2=${LOCALBASE}/sbin/apxs2
 BUILD_DEPENDS+=                www/apache-httpd
@@ -109,7 +114,7 @@ CONFIGURE_ARGS+=    --with-openssl \
 TEST_TARGET=           test
 TEST_FLAGS=            NO_INTERACTION=1
 
-SAPI+=                 -main -cgi
+SAPI+=                 -main -cgi -dbg
 ZEND_EXTENSIONS+=      -opcache
 MULTI_PACKAGES+=       ${SAPI} ${PHP_EXTENSIONS}
 
@@ -378,6 +383,8 @@ post-install:
        ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/cgi/php-cgi 
${PREFIX}/bin/php-cgi-${PV}
 # Make sure that php-cgi.1 still just sources php.1 when importing a new major 
version.
        ${INSTALL_MAN} ${WRKSRC}/sapi/cli/php.1 
${PREFIX}/man/man1/php-cgi-${PV}.1
+       ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/phpdbg/phpdbg 
${PREFIX}/bin/phpdbg-${PV}
+       ${INSTALL_MAN} ${WRKBUILD}/sapi/phpdbg/phpdbg.1 
${PREFIX}/man/man1/phpdbg-${PV}.1
        ${INSTALL_PROGRAM} ${WRKBUILD}/ext/phar/phar.phar 
${PREFIX}/bin/phar-${PV}
        ${INSTALL_MAN} ${WRKBUILD}/ext/phar/phar.1 
${PREFIX}/man/man1/phar-${PV}.1
        ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/fpm/php-fpm 
${PREFIX}/sbin/php-fpm-${PV}
Index: 5.6/patches/patch-sapi_phpdbg_phpdbg_h
===================================================================
RCS file: 5.6/patches/patch-sapi_phpdbg_phpdbg_h
diff -N 5.6/patches/patch-sapi_phpdbg_phpdbg_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 5.6/patches/patch-sapi_phpdbg_phpdbg_h      27 May 2018 06:51:32 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: sapi/phpdbg/phpdbg.h
+--- sapi/phpdbg/phpdbg.h.orig
++++ sapi/phpdbg/phpdbg.h
+@@ -64,7 +64,7 @@
+ # include "TSRM.h"
+ #endif
+ 
+-#ifdef LIBREADLINE
++#ifdef HAVE_LIBREADLINE
+ #   include <readline/readline.h>
+ #   include <readline/history.h>
+ #endif
Index: 5.6/pkg/PLIST-dbg
===================================================================
RCS file: 5.6/pkg/PLIST-dbg
diff -N 5.6/pkg/PLIST-dbg
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 5.6/pkg/PLIST-dbg   27 May 2018 06:51:32 -0000
@@ -0,0 +1,6 @@
+@comment $OpenBSD$
+@option no-default-conflict
+@option is-branch
+@conflict php-dbg->=5.6,<5.7
+@bin bin/phpdbg-${PV}
+@man man/man1/phpdbg-${PV}.1
Index: 7.0/pkg/PLIST-dbg
===================================================================
RCS file: 7.0/pkg/PLIST-dbg
diff -N 7.0/pkg/PLIST-dbg
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 7.0/pkg/PLIST-dbg   27 May 2018 06:51:32 -0000
@@ -0,0 +1,6 @@
+@comment $OpenBSD$
+@option no-default-conflict
+@option is-branch
+@conflict php-dbg->=7.0,<7.1
+@bin bin/phpdbg-${PV}
+@man man/man1/phpdbg-${PV}.1
Index: files/DESCR-dbg
===================================================================
RCS file: files/DESCR-dbg
diff -N files/DESCR-dbg
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/DESCR-dbg     27 May 2018 06:51:32 -0000
@@ -0,0 +1,6 @@
+Implemented as a SAPI module, phpdbg can excert complete control over
+the environment without impacting the functionality or performance of
+your code.
+
+phpdbg aims to be a lightweight, powerful, easy to use debugging
+platform for PHP5.4+.

Reply via email to