aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2016-08-03 20:47:05 +0800
committermat <mat@FreeBSD.org>2016-08-03 20:47:05 +0800
commit431402e6f41b0ead2340cd5b739afd97a7750d92 (patch)
tree0ef0e6e265bc625030daf067c3dd5dc211eab79b /Mk
parent46d1315f83f80cd05d0b92861b777385d3983a73 (diff)
downloadfreebsd-ports-gnome-431402e6f41b0ead2340cd5b739afd97a7750d92.tar.gz
freebsd-ports-gnome-431402e6f41b0ead2340cd5b739afd97a7750d92.tar.zst
freebsd-ports-gnome-431402e6f41b0ead2340cd5b739afd97a7750d92.zip
Don't use extension.ini any more, and have each extension install in its
file, so the order remains the same. Every PHP (or Zend) extension now installs its own .ini file in /usr/local/etc/php. A PHP extension will be automatically activated when installed. The order into which extensions are loaded is automatically guessed. In some very rare cases, the guess will be wrong, and PHP_MOD_PRIO will need to be set. Refer to the USES=php section of the Porter's Handbook for more information. Convert ports touching etc/php/extensions.ini manually, or telling the OP to do it. And finally, bump PORTREVISION for all php extensions. PR: 210697 Submitted by: mat Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D7022
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/php.mk87
1 files changed, 50 insertions, 37 deletions
diff --git a/Mk/Uses/php.mk b/Mk/Uses/php.mk
index 48636dac9ea6..72a1766da68f 100644
--- a/Mk/Uses/php.mk
+++ b/Mk/Uses/php.mk
@@ -21,6 +21,25 @@
#
# USE_PHP= ext1 ext2 ext3
#
+# PHP and Zend extensions built with :ext and :zend are automatically enabled
+# when the port is installed. Each port creates a PHP_EXT_INI_FILE file and
+# registers the extension in it.
+#
+# The PHP_EXT_INI_FILE file has a priority number embeded into its name so that
+# extensions are loaded in the right order. The priority is defined by
+# PHP_MOD_PRIO and is a number between 00 and 99.
+#
+# For extensions that do not depend on any extension, the priority is
+# automatically set to 20, for extensions that depend on another extension, the
+# priority is automatically set to 30. Some extensions may need to be loaded
+# before everyone else (for example opcache), or after an extension with a
+# priotity of 30, in that case, add PHP_MOD_PRIO=XX in the port's Makefile.
+# For example:
+#
+# USES= php:ext
+# USE_PHP= xml wddx
+# PHP_MOD_PRIO= 40
+#
# The port can set these options in its Makefile before bsd.port.pre.mk:
#
# DEFAULT_PHP_VER=N - Use PHP version N if PHP is not yet installed.
@@ -202,13 +221,26 @@ _INCLUDE_USES_PHP_POST_MK=yes
. if ${php_ARGS:Mext} || ${php_ARGS:Mzend}
PHP_MODNAME?= ${PORTNAME}
-PHP_HEADER_DIRS?= ""
+PHP_EXT_PKGMESSAGE= ${WRKDIR}/php-ext-pkg-message
+PKGMESSAGES+= ${PHP_EXT_PKGMESSAGE}
+PHP_HEADER_DIRS+= .
+# If there is no priority defined, we wing it.
+. if !defined(PHP_MOD_PRIO)
+. if defined(USE_PHP)
+# If an extension needs another, put it after the others.
+PHP_MOD_PRIO= 30
+. else
+# Otherwise, put it where it with everybody.
+PHP_MOD_PRIO= 20
+. endif
+. endif
+PHP_EXT_INI_FILE= etc/php/ext-${PHP_MOD_PRIO}-${PHP_MODNAME}.ini
do-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/lib/php/${PHP_EXT_DIR}
@${INSTALL_LIB} ${WRKSRC}/modules/${PHP_MODNAME}.so \
${STAGEDIR}${PREFIX}/lib/php/${PHP_EXT_DIR}
-. for header in . ${PHP_HEADER_DIRS}
+. for header in ${PHP_HEADER_DIRS}
@${MKDIR} ${STAGEDIR}${PREFIX}/include/php/ext/${PHP_MODNAME}/${header}
@${INSTALL_DATA} ${WRKSRC}/${header}/*.h \
${STAGEDIR}${PREFIX}/include/php/ext/${PHP_MODNAME}/${header}
@@ -217,8 +249,13 @@ do-install:
@${GREP} "#define \(COMPILE\|HAVE\|USE\)_" ${WRKSRC}/config.h \
> ${STAGEDIR}${PREFIX}/include/php/ext/${PHP_MODNAME}/config.h
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/php
+. if ${php_ARGS:Mzend}
+ @${ECHO_CMD} "zend_extension=${PHP_MODNAME}.so" > ${STAGEDIR}${PREFIX}/${PHP_EXT_INI_FILE}
+. else
+ @${ECHO_CMD} "extension=${PHP_MODNAME}.so" > ${STAGEDIR}${PREFIX}/${PHP_EXT_INI_FILE}
+. endif
-add-plist-info: add-plist-phpext
+_USES_stage+= 899:add-plist-phpext
add-plist-phpext:
@${ECHO_CMD} "lib/php/${PHP_EXT_DIR}/${PHP_MODNAME}.so" \
>> ${TMPPLIST}
@@ -232,44 +269,20 @@ add-plist-phpext:
>> ${TMPPLIST}
@${ECHO_CMD} "@unexec rm %D/include/php/ext/php_config.h.orig" \
>> ${TMPPLIST}
- @${ECHO_CMD} "@dir etc/php" \
+ @${ECHO_CMD} "${PHP_EXT_INI_FILE}" \
>> ${TMPPLIST}
+ @${ECHO_CMD} "****************************************************************************" > ${PHP_EXT_PKGMESSAGE}
+ @${ECHO_CMD} "" >> ${PHP_EXT_PKGMESSAGE}
+ @${ECHO_CMD} "The following line has been added to your ${PREFIX}/${PHP_EXT_INI_FILE}" >> ${PHP_EXT_PKGMESSAGE}
+ @${ECHO_CMD} "configuration file to automatically load the installed extension:" >> ${PHP_EXT_PKGMESSAGE}
+ @${ECHO_CMD} "" >> ${PHP_EXT_PKGMESSAGE}
. if ${php_ARGS:Mzend}
- @${ECHO_CMD} "@exec echo zend_extension=%D/lib/php/${PHP_EXT_DIR}/${PHP_MODNAME}.so >> %D/etc/php/extensions.ini" \
- >> ${TMPPLIST}
-. else
- @${ECHO_CMD} "@exec echo extension=${PHP_MODNAME}.so >> %D/etc/php/extensions.ini" \
- >> ${TMPPLIST}
-. endif
- @${ECHO_CMD} "@unexec cp %D/etc/php/extensions.ini %D/etc/php/extensions.ini.orig" \
- >> ${TMPPLIST}
-. if ${php_ARGS:Mzend}
- @${ECHO_CMD} "@unexec grep -v zend_extension=%D/lib/php/${PHP_EXT_DIR}/${PHP_MODNAME}\\\.so %D/etc/php/extensions.ini.orig > %D/etc/php/extensions.ini || true" \
- >> ${TMPPLIST}
-. else
- @${ECHO_CMD} "@unexec grep -v extension=${PHP_MODNAME}\\\.so %D/etc/php/extensions.ini.orig > %D/etc/php/extensions.ini || true" \
- >> ${TMPPLIST}
-. endif
- @${ECHO_CMD} "@unexec rm %D/etc/php/extensions.ini.orig" \
- >> ${TMPPLIST}
- @${ECHO_CMD} "@unexec [ -s %D/etc/php/extensions.ini ] || rm %D/etc/php/extensions.ini" \
- >> ${TMPPLIST}
-
-package-message: php-ini
-
-php-ini:
- @${ECHO_CMD} "****************************************************************************"
- @${ECHO_CMD} ""
- @${ECHO_CMD} "The following line has been added to your ${PREFIX}/etc/php/extensions.ini"
- @${ECHO_CMD} "configuration file to automatically load the installed extension:"
- @${ECHO_CMD} ""
-. if ${php_ARGS:Mzend}
- @${ECHO_CMD} "zend_extension=${PREFIX}/lib/php/${PHP_EXT_DIR}/${PHP_MODNAME}.so"
+ @${ECHO_CMD} "zend_extension=${PHP_MODNAME}.so" >> ${PHP_EXT_PKGMESSAGE}
. else
- @${ECHO_CMD} "extension=${PHP_MODNAME}.so"
+ @${ECHO_CMD} "extension=${PHP_MODNAME}.so" >> ${PHP_EXT_PKGMESSAGE}
. endif
- @${ECHO_CMD} ""
- @${ECHO_CMD} "****************************************************************************"
+ @${ECHO_CMD} "" >> ${PHP_EXT_PKGMESSAGE}
+ @${ECHO_CMD} "****************************************************************************" >> ${PHP_EXT_PKGMESSAGE}
. endif
# Extensions