Hello ports@,

This diff moves phar to its own subpackage, which requires quite a bit
of changes:
- Since -phar breaks sparc64, allow it to be disabled
- For specifying what package doesn't build on a certain architecture I
use NOT_FOR_ARCHS-phar (BROKEN- doesn't work on subpackages)
- To determine if a package is built I require BUILD_PACKAGES, which in
turn requires bsd.port.arch.mk to be loaded earlier.
- MULTI_PACKAGES (and by extend PHP_EXTENSIONS) need to be defined
before bsd.port.arch.mk is loaded to have the full list.

I don't know on what component HPPA fails, but this platform might also
benefit from this trick. I don't have the machine to test it though.

As for the other changes:
- Install phar-${PV} similar to php-config-${PV}
- Install the phar manpage
- Move the phar headers to the phar subpackage

This also requires the addition of the phar module as a runtime
dependency on icinga-web, drush, nextcloud, owncloud and composer.
I'm just not sure (except for composer) how optional the use of the
phar extension is. If people who are more familiar with these tools
could shed some light on this it'd be welcome.

Comments, thoughts, scoldings, testings on sparc64, other ways to set
this up, OKs?

martijn@

Index: lang/php/Makefile.inc
===================================================================
RCS file: /cvs/ports/lang/php/Makefile.inc,v
retrieving revision 1.103
diff -u -p -a -u -r1.103 Makefile.inc
--- lang/php/Makefile.inc       8 May 2018 12:04:55 -0000       1.103
+++ lang/php/Makefile.inc       8 May 2018 15:26:51 -0000
@@ -110,6 +110,10 @@ TEST_TARGET=               test
 TEST_FLAGS=            NO_INTERACTION=1
 
 SAPI+=                 -main -cgi
+PHP_EXTENSIONS+=       -bz2 -curl -dba -gd -gmp -intl -imap -ldap -mcrypt \
+                       -mysqli -odbc -pcntl -pdo_mysql -pdo_pgsql -pgsql \
+                       -phar -pspell -shmop -soap -snmp -pdo_dblib -tidy \
+                       -xmlrpc -xsl -zip
 ZEND_EXTENSIONS+=      -opcache
 MULTI_PACKAGES+=       ${SAPI} ${PHP_EXTENSIONS}
 
@@ -122,34 +126,36 @@ LIB_DEPENDS$i+=           devel/gettext \
                        textproc/libxml
 .endfor
 
+#
+# Broken section
+# Use *_FOR_ARCHS, since BROKEN doesn't work for subpackages
+#
+
+.include <bsd.port.arch.mk>
 
 #
 # Loadable php extensions by name that are included in all versions
 #
 
 # bz2
-PHP_EXTENSIONS+=       -bz2
 COMMENT-bz2=           bzip2 compression extensions for php
 CONFIGURE_ARGS+=       --with-bz2=shared,${LOCALBASE}
 LIB_DEPENDS-bz2=       archivers/bzip2
 WANTLIB-bz2=           bz2>=10 pthread
 
 # curl
-PHP_EXTENSIONS+=       -curl
 COMMENT-curl=          curl URL library extensions for php
 CONFIGURE_ARGS+=       --with-curl=shared,${LOCALBASE}
 LIB_DEPENDS-curl=      net/curl
 WANTLIB-curl=          pthread crypto nghttp2 ssl z curl>=2
 
 # dba
-PHP_EXTENSIONS+=       -dba
 COMMENT-dba=           dba GDBM access extensions for php
 CONFIGURE_ARGS+=       --enable-dba=shared --with-gdbm=${LOCALBASE}
 LIB_DEPENDS-dba=       databases/gdbm
 WANTLIB-dba=           gdbm>=2 pthread
 
 # gd
-PHP_EXTENSIONS+=       -gd
 COMMENT-gd=            image manipulation extensions for php
 LIB_DEPENDS-gd=                graphics/jpeg \
                        graphics/png
@@ -167,14 +173,12 @@ CONFIGURE_ARGS+=  --with-gd=shared \
                        --with-xpm-dir=${X11BASE}
 
 # gmp
-PHP_EXTENSIONS+=       -gmp
 COMMENT-gmp=           gmp math library support for php
 CONFIGURE_ARGS+=       --with-gmp=shared,${LOCALBASE}
 LIB_DEPENDS-gmp=       devel/gmp
 WANTLIB-gmp=           gmp>=4 pthread
 
 # intl
-PHP_EXTENSIONS+=       -intl
 COMMENT-intl=          intl library support for php
 CONFIGURE_ARGS+=       --enable-intl=shared \
                        --with-icu-dir=${LOCALBASE}
@@ -185,7 +189,6 @@ WANTLIB-intl=               icudata icui18n icuio icu
 WANTLIB-intl+=         ${COMPILER_LIBCXX} m
 
 # imap
-PHP_EXTENSIONS+=       -imap
 COMMENT-imap=          imap, pop3 and nntp extensions for php
 CONFIGURE_ARGS+=       --with-imap=shared,${LOCALBASE} \
                        --with-imap-ssl
@@ -193,119 +196,110 @@ LIB_DEPENDS-imap=       mail/alpine,-c-client
 WANTLIB-imap=          pthread crypto ssl c-client>=5
 
 # ldap
-PHP_EXTENSIONS+=       -ldap
 COMMENT-ldap=          ldap protocol extensions for php
 CONFIGURE_ARGS+=       --with-ldap=shared,${LOCALBASE}
 LIB_DEPENDS-ldap=      databases/openldap
 WANTLIB-ldap=          pthread ldap>=2 lber
 
 # mcrypt
-PHP_EXTENSIONS+=       -mcrypt
 COMMENT-mcrypt=                mcrypt encryption/decryption extensions for php
 CONFIGURE_ARGS+=       --with-mcrypt=shared,${LOCALBASE}
 LIB_DEPENDS-mcrypt=    security/libmcrypt devel/libtool,-ltdl
 WANTLIB-mcrypt=                mcrypt ltdl>=1 pthread
 
 # mysqli
-PHP_EXTENSIONS+=       -mysqli
 COMMENT-mysqli=                mysql database access extensions for php
 CONFIGURE_ARGS+=       --with-mysqli=shared,${LOCALBASE}/bin/mysql_config
 LIB_DEPENDS-mysqli=    databases/mariadb
 WANTLIB-mysqli=                crypto m pthread ssl z lib/mysql/mysqlclient
 
 # odbc
-PHP_EXTENSIONS+=       -odbc
 COMMENT-odbc=          odbc database access extensions for php
 CONFIGURE_ARGS+=        --with-iodbc=shared,${LOCALBASE}
 LIB_DEPENDS-odbc=      databases/iodbc
 WANTLIB-odbc=          iodbc>=2 pthread iodbcinst
 
 # pcntl
-PHP_EXTENSIONS+=       -pcntl
 COMMENT-pcntl=         PCNTL extensions for php
 CONFIGURE_ARGS+=       --enable-pcntl=shared
 LIB_DEPENDS-pcntl=
 WANTLIB-pcntl=         pthread
 
 # pdo-mysql
-PHP_EXTENSIONS+=       -pdo_mysql
 COMMENT-pdo_mysql=     PDO mysql database access extensions for php
 CONFIGURE_ARGS+=       --with-pdo-mysql=shared,${LOCALBASE}
 LIB_DEPENDS-pdo_mysql= databases/mariadb
 WANTLIB-pdo_mysql=     crypto m pthread ssl z lib/mysql/mysqlclient
 
 # pdo-pgsql
-PHP_EXTENSIONS+=       -pdo_pgsql
 COMMENT-pdo_pgsql=     PDO database access extensions for php
 CONFIGURE_ARGS+=        --with-pdo-pgsql=shared,${LOCALBASE}
 LIB_DEPENDS-pdo_pgsql= databases/postgresql
 WANTLIB-pdo_pgsql=     pq>=2 pthread
 
 # pgsql
-PHP_EXTENSIONS+=       -pgsql
 COMMENT-pgsql=         pgsql database access extensions for php
 CONFIGURE_ARGS+=       --with-pgsql=shared,${LOCALBASE}
 LIB_DEPENDS-pgsql=     databases/postgresql
 WANTLIB-pgsql=         pq>=2 pthread
 
+# phar
+COMMENT-phar=           phar archive abstraction extensions for php
+.if ${BUILD_PACKAGES:M-phar}
+CONFIGURE_ARGS+=        --enable-phar=shared
+.else
+CONFIGURE_ARGS+=        --disable-phar
+.endif
+
 # pspell
-PHP_EXTENSIONS+=       -pspell
 COMMENT-pspell=                pspell library extensions for php
 CONFIGURE_ARGS+=       --with-pspell=shared,${LOCALBASE}
 LIB_DEPENDS-pspell=    textproc/aspell/core
 WANTLIB-pspell=                aspell>=16 pspell>=16 pthread
 
 # shmop
-PHP_EXTENSIONS+=       -shmop
 COMMENT-shmop=         shared memory extensions for php
 CONFIGURE_ARGS+=       --enable-shmop=shared,${LOCALBASE}
 LIB_DEPENDS-shmop=
 WANTLIB-shmop=         pthread
 
 # soap
-PHP_EXTENSIONS+=       -soap
 COMMENT-soap=          SOAP functions for php
 CONFIGURE_ARGS+=       --enable-soap=shared,${LOCALBASE}
 LIB_DEPENDS-soap=      textproc/libxml
 WANTLIB-soap=          iconv m pthread z xml2>=8 lzma
 
 # snmp
-PHP_EXTENSIONS+=       -snmp
 COMMENT-snmp=          snmp protocol extensions for php
 CONFIGURE_ARGS+=       --with-snmp=shared,${LOCALBASE}
 LIB_DEPENDS-snmp=      net/net-snmp
 WANTLIB-snmp=          crypto m netsnmp>=6.2 pthread
 
 # pdo-dblib
-PHP_EXTENSIONS+=       -pdo_dblib
 COMMENT-pdo_dblib=     PDO DB-LIB support for php
 CONFIGURE_ARGS+=        --with-pdo-dblib=shared,${LOCALBASE}
 LIB_DEPENDS-pdo_dblib= databases/freetds
 WANTLIB-pdo_dblib=     sybdb>=6 pthread
 
 # tidy
-PHP_EXTENSIONS+=       -tidy
 COMMENT-tidy=          tidy HTML cleaner bindings
 CONFIGURE_ARGS+=       --with-tidy=shared,${LOCALBASE}
 LIB_DEPENDS-tidy=      www/tidyp
 WANTLIB-tidy=          tidyp pthread
 
 # xml-rpc
-PHP_EXTENSIONS+=       -xmlrpc
 COMMENT-xmlrpc=                XML RPC functions for php
 CONFIGURE_ARGS+=       --with-xmlrpc=shared
 LIB_DEPENDS-xmlrpc=    textproc/libxml
 WANTLIB-xmlrpc=                iconv m z xml2>=8 pthread lzma
 
 # xsl
-PHP_EXTENSIONS+=       -xsl
 COMMENT-xsl=           XSL functions for php
 CONFIGURE_ARGS+=       --with-xsl=shared --enable-dom
 LIB_DEPENDS-xsl=       textproc/libxslt
 WANTLIB-xsl=           m xml2 xslt>=3 exslt pthread
 
 # zip
-PHP_EXTENSIONS+=       -zip
 COMMENT-zip=           zip functions for php
 CONFIGURE_ARGS+=       --enable-zip=shared,${LOCALBASE}
 LIB_DEPENDS-zip=
@@ -353,6 +347,10 @@ post-install:
                ${PREFIX}/${APACHE_MODULE_SUBDIR}/
        ${INSTALL_DATA_DIR} ${WRKINST}/${CHROOT_DIR}/conf/php-${PV}.sample
        ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/php-${PV}
+.if ${BUILD_PACKAGES:M-phar}
+       ${INSTALL_PROGRAM} ${WRKBUILD}/ext/phar/phar.phar 
${PREFIX}/bin/phar-${PV}
+       ${INSTALL_MAN} ${WRKBUILD}/ext/phar/phar.1 
${PREFIX}/man/man1/phar-${PV}.1
+.endif
        ${INSTALL_PROGRAM} ${WRKBUILD}/sapi/cli/php ${PREFIX}/bin/php-${PV}
        ${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.
@@ -372,10 +370,12 @@ post-install:
                ${PREFIX}/share/examples/php-${PV}/php.conf
 
 .for m in ${PHP_EXTENSIONS:S/-//g}
+.if ${BUILD_PACKAGES:M-${m}}
        ${INSTALL_DATA} ${WRKBUILD}/modules/${m}.so \
                ${PREFIX}/${MODULES_SUBDIR}/${m}.so
        echo "extension=${m}.so" > \
                ${PREFIX}/share/examples/php-${PV}/${m}.ini
+.endif
 .endfor
 .for m in ${ZEND_EXTENSIONS:S/-//g}
        ${INSTALL_DATA} ${WRKBUILD}/modules/${m}.so \
Index: lang/php/5.6/Makefile
===================================================================
RCS file: /cvs/ports/lang/php/5.6/Makefile,v
retrieving revision 1.62
diff -u -p -a -u -r1.62 Makefile
--- lang/php/5.6/Makefile       8 May 2018 12:04:55 -0000       1.62
+++ lang/php/5.6/Makefile       8 May 2018 15:26:51 -0000
@@ -4,7 +4,7 @@ BROKEN-alpha=   pcre_jit_compile.c:65:2: e
 
 PV=            5.6
 V=             ${PV}.35
-REVISION-main= 0
+REVISION=      1
 
 MASTER_SITES0= https://download.suhosin.org/
 
Index: lang/php/5.6/pkg/PLIST-phar
===================================================================
RCS file: lang/php/5.6/pkg/PLIST-phar
diff -N lang/php/5.6/pkg/PLIST-phar
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lang/php/5.6/pkg/PLIST-phar 8 May 2018 15:26:51 -0000
@@ -0,0 +1,11 @@
+@comment $OpenBSD$
+@option no-default-conflict
+@option is-branch
+@conflict php-phar->=5.6,<5.7
+bin/phar-${PV}
+@man man/man1/phar-${PV}.1
+lib/php-${PV}/modules/phar.so
+share/examples/php-${PV}/phar.ini
+@sample ${SYSCONFDIR}/php-${PV}.sample/phar.ini
+share/php-${PV}/include/ext/phar/
+share/php-${PV}/include/ext/phar/php_phar.h
Index: lang/php/7.0/Makefile
===================================================================
RCS file: /cvs/ports/lang/php/7.0/Makefile,v
retrieving revision 1.46
diff -u -p -a -u -r1.46 Makefile
--- lang/php/7.0/Makefile       8 May 2018 12:17:32 -0000       1.46
+++ lang/php/7.0/Makefile       8 May 2018 15:26:51 -0000
@@ -1,10 +1,11 @@
 # $OpenBSD: Makefile,v 1.46 2018/05/08 12:17:32 martijn Exp $
 
-BROKEN-sparc64=        SIGBUS during phar generation
+# SIGBUS during phar generation
+NOT_FOR_ARCHS-phar=     sparc64
 
 PV=            7.0
 V=             ${PV}.29
-REVISION=      1
+REVISION=      2
 
 BUILD_DEPENDS+=        devel/bison
 
Index: lang/php/7.0/pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/lang/php/7.0/pkg/PLIST-main,v
retrieving revision 1.6
diff -u -p -a -u -r1.6 PLIST-main
--- lang/php/7.0/pkg/PLIST-main 25 Apr 2017 11:21:14 -0000      1.6
+++ lang/php/7.0/pkg/PLIST-main 8 May 2018 15:26:51 -0000
@@ -253,8 +253,6 @@ share/php-${PV}/include/ext/pdo/
 share/php-${PV}/include/ext/pdo/php_pdo.h
 share/php-${PV}/include/ext/pdo/php_pdo_driver.h
 share/php-${PV}/include/ext/pdo/php_pdo_error.h
-share/php-${PV}/include/ext/phar/
-share/php-${PV}/include/ext/phar/php_phar.h
 share/php-${PV}/include/ext/session/
 share/php-${PV}/include/ext/session/mod_files.h
 share/php-${PV}/include/ext/session/mod_user.h
Index: lang/php/7.0/pkg/PLIST-phar
===================================================================
RCS file: lang/php/7.0/pkg/PLIST-phar
diff -N lang/php/7.0/pkg/PLIST-phar
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lang/php/7.0/pkg/PLIST-phar 8 May 2018 15:26:51 -0000
@@ -0,0 +1,11 @@
+@comment $OpenBSD$
+@option no-default-conflict
+@option is-branch
+@conflict php-phar->=7.0,<7.1
+bin/phar-${PV}
+@man man/man1/phar-${PV}.1
+lib/php-${PV}/modules/phar.so
+share/examples/php-${PV}/phar.ini
+@sample ${SYSCONFDIR}/php-${PV}.sample/phar.ini
+share/php-${PV}/include/ext/phar/
+share/php-${PV}/include/ext/phar/php_phar.h
Index: lang/php/files/DESCR-phar
===================================================================
RCS file: lang/php/files/DESCR-phar
diff -N lang/php/files/DESCR-phar
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lang/php/files/DESCR-phar   8 May 2018 15:26:51 -0000
@@ -0,0 +1,9 @@
+The phar extension provides a way to put entire PHP applications into
+a single file called a "phar" (PHP Archive) for easy distribution and
+installation. In addition to providing this service, the phar
+extension also provides a file-format abstraction method for creating
+and manipulating tar and zip files through the PharData class, much as
+PDO provides a unified interface for accessing different databases.
+Unlike PDO, which cannot convert between different databases, Phar
+also can convert between tar, zip and phar file formats with a single
+line of code. see Phar::convertToExecutable() for one example.
Index: net/icinga/web/Makefile
===================================================================
RCS file: /cvs/ports/net/icinga/web/Makefile,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile
--- net/icinga/web/Makefile     20 Dec 2017 15:11:20 -0000      1.36
+++ net/icinga/web/Makefile     8 May 2018 15:44:57 -0000
@@ -5,6 +5,7 @@ COMMENT =       web UI for icinga
 GH_ACCOUNT =   Icinga
 GH_PROJECT =   icinga-web
 GH_TAGNAME =   v1.14.1
+REVISION=      0
 
 MODULES=       lang/php
 
@@ -13,6 +14,7 @@ COMMON =      www/pear \
 
 RUN_DEPENDS =  ${COMMON_DEPENDS} \
                lang/php/${MODPHP_VERSION},-gd \
+               lang/php/${MODPHP_VERSION},-phar \
                lang/php/${MODPHP_VERSION},-xsl \
                
php-pdo_mysql-${MODPHP_VSPEC}|php-pdo_pgsql-${MODPHP_VSPEC}:lang/php/${MODPHP_VERSION},-pdo_mysql
 \
                net/icinga/core \
Index: www/drush//Makefile
===================================================================
RCS file: /cvs/ports/www/drush/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- www/drush//Makefile 27 Feb 2016 17:15:24 -0000      1.11
+++ www/drush//Makefile 8 May 2018 15:45:21 -0000
@@ -7,6 +7,7 @@ CATEGORIES =    www devel
 V=             8.0.3
 DISTNAME=      drush-$V
 EXTRACT_SUFX=  -deps.tar.xz
+REVISION=      0
 
 HOMEPAGE=      http://www.drush.org/
 
@@ -19,7 +20,8 @@ MODULES=      lang/php
 PERMIT_PACKAGE_CDROM= Yes
 
 NO_BUILD=      Yes
-RUN_DEPENDS=   archivers/gtar
+RUN_DEPENDS=   archivers/gtar \
+               lang/php/${MODPHP_VERSION},-phar
 SUBST_VARS=    MODPHP_BIN
 
 do-install:
Index: www/nextcloud//Makefile
===================================================================
RCS file: /cvs/ports/www/nextcloud/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- www/nextcloud//Makefile     27 Apr 2018 09:15:07 -0000      1.12
+++ www/nextcloud//Makefile     8 May 2018 15:45:51 -0000
@@ -5,6 +5,7 @@ COMMENT=                easy and universal access to s
 V=                     13.0.2
 DISTNAME=              nextcloud-${V}
 EXTRACT_SUFX=          .tar.bz2
+REVISION=              0
 
 CATEGORIES=            www
 
@@ -39,6 +40,7 @@ MAJOR=                        ${VR:R}
 SUBST_VARS=            INSTDIR TINSTDIR MODPHP_BIN VR MAJOR
 
 RUN_DEPENDS=           lang/php/${MODPHP_VERSION},-gd \
+                       lang/php/${MODPHP_VERSION},-phar \
                        lang/php/${MODPHP_VERSION},-zip
 
 # http user authentication
Index: www/owncloud//Makefile
===================================================================
RCS file: /cvs/ports/www/owncloud/Makefile,v
retrieving revision 1.123
diff -u -p -r1.123 Makefile
--- www/owncloud//Makefile      28 Apr 2018 09:07:06 -0000      1.123
+++ www/owncloud//Makefile      8 May 2018 15:46:04 -0000
@@ -5,6 +5,7 @@ COMMENT=                easy and universal access to s
 V=                     10.0.8
 DISTNAME=              owncloud-${V}
 EXTRACT_SUFX=          .tar.bz2
+REVISION=              0
 
 CATEGORIES=            www
 
@@ -38,6 +39,7 @@ VR=                   ${V:R}
 SUBST_VARS=            INSTDIR TINSTDIR MODPHP_BIN VR
 
 RUN_DEPENDS=           lang/php/${MODPHP_VERSION},-gd \
+                       lang/php/${MODPHP_VERSION},-phar \
                        lang/php/${MODPHP_VERSION},-zip
 
 # http user authentication
Index: www/composer//Makefile
===================================================================
RCS file: /cvs/ports/www/composer/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- www/composer//Makefile      2 Mar 2018 17:24:55 -0000       1.5
+++ www/composer//Makefile      8 May 2018 15:46:15 -0000
@@ -6,11 +6,14 @@ CATEGORIES=   www devel
 
 V=             1.6.3
 EPOCH=         0
+REVISION=      0
 MASTER_SITES=  https://getcomposer.org/download/$V/
 DISTNAME=      composer-$V
 DISTFILES=     composer-$V{composer}.phar
 EXTRACT_SUFX=  .phar
 EXTRACT_ONLY=
+
+RUN_DEPENDS=   lang/php/${MODPHP_VERSION},-phar
 
 HOMEPAGE=      https://getcomposer.org/
 

Reply via email to