Hello ports@,

Last couple of months I've been busy getting to know the OpenBSD ports 
system and the php build environment.
The main reason being my need for functionality at my $DAYJOB which 
isn't offered by the default php install on OpenBSD. Most notably php 
7.1 and chroot (the php function).

During my quest I ended up touching about every part of the port and 
I'm currently quite happy with the result, although there's still some 
things I want to touch later on.

Some of the highlights I've done:
- Remove PHP 5.5. It's dead upstream for almost a year, so there's no 
need to keep it on OpenBSD.
- Clean up the CONFIGURE_ARGS. There were some arguments there that 
were simply not in PHP anymore.
- Move some deprecated modules into the PHP 5.6 Makefile. This keeps 
the Makefile.inc cleaner of if/else bloat.
- Replace the -fastcgi port with -cgi. -cgi is the official name and 
for fastcgi needs -fpm is recommended. This avoids confusion.
- Move modules to their own subpackage where possible. I don't like my 
clean php install having ftp or wddx. Let people make up their own mind.
- Remove unused dependencies (e.g. mariadb isn't needed when building 
with mysqlnd)
- Move every SAPI to their own subpackage. People running -fpm don't 
need mod_php or -cgi.
- Move the extension headers to their corresponding subpackage.
- Clean up the build environment. YACC=, USE_LIBTOOL, etc don't seem to 
be needed (anymore).
- Clean up patches. Some are unneeded, redundant, superfluous so keep 
it to a minimum for maintainability.
- Subpackages requiring another module have those dependencies. (e.g. 
installing -pdo_mysql also pulls in -pdo and -mysqlnd)
- Install phar and disable it on sparc64. This should allow us to have 
php on sparc64, without phar support. Untested for lack of hardware.
- Enable the chroot function by default. This function normally gets 
disabled if any SAPI other than -cli, -cgi, or -embed is compiled.
I reckon that if the chroot function is usable the code is running as 
root and you have bigger problems than a php server locking itself out 
of your main filesystem.
- Allow phpize to work without --with-php-config.
- Try to rely on other packages where code would be otherwise compiled 
in. E.g. devel/pcre for the pcre module and textproc/oniguruma for 
mbstring. These libraries are also packaged inside PHP if not available
on the main system.
- Miscellaneous cleanup

For the packages this means the following:
Removed:
- php-fastcgi
Added:
- php-apxs2
- php-bcmath
- php-calendar
- php-cgi
- php-cli
- php-ctype
- php-dom
- php-enchant
- php-exif
- php-fileinfo
- php-fpm
- php-ftp
- php-gettext
- php-iconv
- php-json
- php-mbstring
- php-mysqlnd
- php-opcache
- php-pdo
- php-pdo_sqlite
- php-phar
- php-posix
- php-readline
- php-simplexml
- php-sockets
- php-sqlite3
- php-sysvmsg
- php-sysvsem
- php-sysvshm
- php-tokenizer
- php-wddx
- php-xmlreader
- php-xmlwriter
Modules moved to shared components:
- bcmath
- calendar
- ctype
- dom
- exif
- fileinfo
- ftp
- gettext
- iconv
- json
- mbstring
- mysqlnd
- PDO
- pdo_sqlite
- Phar
- posix
- readline
- SimpleXML
- sockets
- sqlite3
- sysvmsg
- sysvsem
- sysvshm
- tokenizer
- wddx
- xmlreader
- xmlwriter
Modules kept compiled in:
- Core (for obvious reasons)
- date (can't be build stand-alone)
- ereg (removed in php 7.0, not worth the effort, also pcre is in 
default install)
- filter (can't be build stand-alone)
- hash (required to be built-in for phar hash-checking)
- libxml (can't be build stand-alone)
- openssl (allow tls as a Stream Socket Transport in a default install)
- pcre (can't be build stand-alone)
- Reflection (can't be build stand-alone)
- session (what's a webserver without sessions?)
- SPL (can't be build stand-alone)
- standard (for obvious reasons)
- xml (required for pear building. Should be turned into a module once 
something like phpctl is in place)
- zlib (required for phar)

When updating to the new packages I didn't encounter any problems, 
except for the expected behaviour that some modules or SAPIs are now in 
other packages, which could easily be covered with a current.html entry.

Some things that I would like to realize once this gets accepted are:
- Allow easier module manipulation via an external tool. E.g. 
"phpctl-5.6 enable pdo_mysql", or "phpctl-5.6 list | phpctl-7.1 load".
I'm not sure of the semantics and haven't started on this yet. But it
would solve some issues, like migration or automatic module enabling
during package building (-xml).
- Allow pecl modules to be built with multiple PHP versions. Right now 
all pecl modules are only available for 5.6, but I could use some of 
those on my 7.1 install, which I now have to built custom with my 
revamped phpize, which is not ideal.

The new layout requires a few tweaks in the pecl and pear department, 
but nothing too fancy. See patch down below.

Also, arguments can be made to move some packages back together. E.g. 
-cli into -main. I'm not against it, but it seems better to me to start
from maximum subdivision and combine them where needed.

As might be expected, I've been running with the 7.1 version of this
patch now for over 2 months without any issues (at least, that are
still left in this version).

Finally some thanks are due to jasper@ and sthen@ for some handholding.

Comments, questions, scoldings, OKs?

martijn@

Index: www/pear/Makefile
===================================================================
RCS file: /cvs/ports/www/pear/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- www/pear/Makefile   1 Apr 2016 18:46:06 -0000       1.24
+++ www/pear/Makefile   2 Jul 2017 10:52:35 -0000
@@ -23,8 +23,10 @@ PERMIT_PACKAGE_CDROM=        Yes
 MULTI_PACKAGES=                -main -utils
 
 MODULES=               lang/php
-BUILD_DEPENDS=         ${_MODPHP_BUILD_DEPENDS}
-RUN_DEPENDS-main=      www/pear,-utils
+BUILD_DEPENDS=         ${_MODPHP_BUILD_DEPENDS} \
+                       lang/php/${MODPHP_VERSION},-cli
+RUN_DEPENDS-main=      www/pear,-utils \
+                       lang/php/${MODPHP_VERSION},-cli
 
 # Most of pear have to live in /var/www where apache is chroot'ed to.
 PREFIX-main=   ${VARBASE}/www
@@ -32,7 +34,7 @@ PREFIX-utils= /usr/local
 
 NO_TEST=       Yes
 
-BUILD_DEPENDS= devel/p5-Expect
+BUILD_DEPENDS+=        devel/p5-Expect
 SUBST_VARS=    MODPHP_BIN
 
 do-extract:
Index: mail/pecl-mailparse/Makefile
===================================================================
RCS file: /cvs/ports/mail/pecl-mailparse/Makefile,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile
--- mail/pecl-mailparse/Makefile        19 Mar 2016 21:18:38 -0000      1.19
+++ mail/pecl-mailparse/Makefile        2 Jul 2017 10:52:57 -0000
@@ -16,6 +16,9 @@ WANTLIB =             c
 AUTOCONF_VERSION =     2.52
 AUTOMAKE_VERSION =     1.4
 
+RUN_DEPENDS=   lang/php/${MODPHP_VERSION},-mbstring
+BUILD_DEPENDS= lang/php/${MODPHP_VERSION},-mbstring
+
 MODULES =      lang/php/pecl
 
 CONFIGURE_STYLE = gnu
Index: www/pecl-http/Makefile
===================================================================
RCS file: /cvs/ports/www/./pecl-http/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- www/pecl-http/Makefile      8 Nov 2016 14:38:55 -0000       1.13
+++ www/pecl-http/Makefile      2 Jul 2017 10:52:57 -0000
@@ -20,12 +20,14 @@ MODULES=    lang/php/pecl
 CONFIGURE_STYLE= gnu
 
 RUN_DEPENDS+=  www/pecl-raphf \
-               www/pecl-propro
+               www/pecl-propro \
+               lang/php/${MODPHP_VERSION},-iconv
 TEST_DEPENDS+= ${RUN_DEPENDS}
-BUILD_DEPENDS+=        ${RUN_DEPENDS}
+BUILD_DEPENDS+=        ${RUN_DEPENDS} \
+               lang/php/${MODPHP_VERSION},-iconv
 LIB_DEPENDS=   devel/gettext \
                devel/libidn \
-               net/curl
+               net/curl \
 
 TEST_EXTS+=    -d extension_dir=${LOCALBASE}/lib/php-${MODPHP_VERSION}/modules
 TEST_EXTS+=    -d extension=raphf.so
Index: www/pecl-http/pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/./pecl-http/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST
--- www/pecl-http/pkg/PLIST     1 Feb 2016 21:55:38 -0000       1.3
+++ www/pecl-http/pkg/PLIST     2 Jul 2017 10:52:58 -0000
@@ -1,37 +1,7 @@
 @comment $OpenBSD: PLIST,v 1.3 2016/02/01 21:55:38 sthen Exp $
-@extra ${SYSCONFDIR}/php-${MODPHP_VERSION}/${MODULE_NAME}.ini 
+@extra ${SYSCONFDIR}/php-${MODPHP_VERSION}/${MODULE_NAME}.ini
 lib/php-${MODPHP_VERSION}/modules/${MODULE_NAME}.so
 share/examples/php-${MODPHP_VERSION}/${MODULE_NAME}.ini
 @sample ${SYSCONFDIR}/php-${MODPHP_VERSION}.sample/${MODULE_NAME}.ini
 share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/
 share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_api.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_buffer.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_client.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_client_request.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_client_response.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_cookie.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_curl.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_encoding.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_env.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_env_request.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_env_response.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_etag.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_exception.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_filter.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_header.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_header_parser.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_info.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_message.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_message_body.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_message_parser.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_misc.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_negotiate.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_object.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_options.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_params.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_querystring.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_response_codes.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_url.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_utf8.h
-share/php-${MODPHP_VERSION}/include/ext/${MODULE_NAME}/php_${MODULE_NAME}_version.h

Attachment: php.tar.bz2
Description: Binary data

Reply via email to