pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/php Automatically enable PHP module or Zend exten...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2ef69565f05a
branches:  trunk
changeset: 349873:2ef69565f05a
user:      jdolecek <jdolecek%pkgsrc.org@localhost>
date:      Sun Jul 17 15:49:44 2016 +0000

description:
Automatically enable PHP module or Zend extension when it's installed instead of requiring manual configuration of ${PKG_SYSCONFDIR}/php.ini - put a module-specific .ini file for this into 
${PKG_SYSCONFDIR}/php.d

diffstat:

 lang/php/MESSAGE.module |  13 +++++++------
 lang/php/PLIST.module   |   5 +++--
 lang/php/ext.ini        |   2 ++
 lang/php/ext.mk         |  37 ++++++++++++++++++++++++++++++++-----
 4 files changed, 44 insertions(+), 13 deletions(-)

diffs (120 lines):

diff -r 9920133fbaec -r 2ef69565f05a lang/php/MESSAGE.module
--- a/lang/php/MESSAGE.module   Sun Jul 17 14:28:13 2016 +0000
+++ b/lang/php/MESSAGE.module   Sun Jul 17 15:49:44 2016 +0000
@@ -1,11 +1,12 @@
 ===========================================================================
-$NetBSD: MESSAGE.module,v 1.3 2015/02/15 09:00:33 taca Exp $
+$NetBSD: MESSAGE.module,v 1.4 2016/07/17 15:49:44 jdolecek Exp $
 
-To enable this module, add the following to ${PKG_SYSCONFDIR}/php.ini:
+Module configuration file was created and module should be autoloaded:
+${EXT_CONF_DIR}/${MODNAME}.ini
 
-    ${EXTENSION_DIRECTIVE}=${MODNAME}.so
+Make sure to update your ${PKG_SYSCONFDIR}/php.ini to not load this
+extension explicitely, remove:
+${EXTENSION_DIRECTIVE}=${EXTENSION_FILE}
 
-and make sure extension_dir points to the dir where ${MODNAME}.so is.
-
-Then restart your ${PKG_PHP}-enabled HTTP server to load this module.
+Restart your ${PKG_PHP}-enabled HTTP server to load this module.
 ===========================================================================
diff -r 9920133fbaec -r 2ef69565f05a lang/php/PLIST.module
--- a/lang/php/PLIST.module     Sun Jul 17 14:28:13 2016 +0000
+++ b/lang/php/PLIST.module     Sun Jul 17 15:49:44 2016 +0000
@@ -1,2 +1,3 @@
-@comment $NetBSD: PLIST.module,v 1.1 2004/11/05 21:40:25 jdolecek Exp $
-${PHP_EXTENSION_DIR}/${MODNAME}.so
+@comment $NetBSD: PLIST.module,v 1.2 2016/07/17 15:49:44 jdolecek Exp $
+share/examples/php/${MODNAME}.ini
+${PHP_EXTENSION_DIR}/${MODNAME}.${SHLIB_SUFFIX}
diff -r 9920133fbaec -r 2ef69565f05a lang/php/ext.ini
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/php/ext.ini  Sun Jul 17 15:49:44 2016 +0000
@@ -0,0 +1,2 @@
+;; enable @MODNAME@
+@EXTENSION_DIRECTIVE@= @EXTENSION_FILE@
diff -r 9920133fbaec -r 2ef69565f05a lang/php/ext.mk
--- a/lang/php/ext.mk   Sun Jul 17 14:28:13 2016 +0000
+++ b/lang/php/ext.mk   Sun Jul 17 15:49:44 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ext.mk,v 1.39 2015/03/16 09:21:11 taca Exp $
+# $NetBSD: ext.mk,v 1.40 2016/07/17 15:49:44 jdolecek Exp $
 #
 # PHP extension package framework, for both PECL and bundled PHP extensions.
 #
@@ -29,6 +29,8 @@
 PHPSETUPSUBDIR?=       #empty
 MODULESDIR?=           ${WRKSRC}/modules
 PLIST_SUBST+=          MODNAME=${PKGMODNAME}
+PLIST_SUBST+=       SHLIB_SUFFIX=${SHLIB_SUFFIX}
+PLIST_SUBST+=       PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
 
 .if !defined(PECL_VERSION)
 # bundled extension
@@ -46,6 +48,21 @@
 EXTRACT_SUFX?=         .tgz
 .endif
 
+EGDIR=      ${PREFIX}/share/examples/php
+CONF_FILES= ${EGDIR}/${MODNAME}.ini ${EXT_CONF_DIR}/${MODNAME}.ini
+
+EXT_CONF_DIR=   ${PKG_SYSCONFDIR}/php.d
+MAKE_DIRS+=     ${EXT_CONF_DIR}
+MAKE_DIRS+=     ${EGDIR}
+
+SUBST_CLASSES+=     ext-ini
+SUBST_FILES.ext-ini=  ${MODNAME}.ini
+SUBST_MESSAGE.ext-ini=Creating module ini file 
+SUBST_SED.ext-ini+=    -e 's,@MODNAME@,${MODNAME},g'
+SUBST_SED.ext-ini+=    -e 's,@EXTENSION_FILE@,${EXTENSION_FILE},g'
+SUBST_SED.ext-ini+=    -e 's,@EXTENSION_DIRECTIVE@,${EXTENSION_DIRECTIVE},g'
+SUBST_STAGE.ext-ini=  post-build
+
 PHPIZE?=               ${BUILDLINK_PREFIX.php}/bin/phpize
 PHP_CONFIG?=           ${BUILDLINK_PREFIX.php}/bin/php-config
 
@@ -62,14 +79,18 @@
 MAKE_ENV+=             EXPORT_SYMBOLS_LDFLAGS="${EXPORT_SYMBOLS_LDFLAGS}"
 
 PLIST_SRC+=            ${.CURDIR}/../../lang/php/PLIST.module
-MESSAGE_SRC=           ${.CURDIR}/../../lang/php/MESSAGE.module
+MESSAGE_SRC+=          ${.CURDIR}/../../lang/php/MESSAGE.module
 MESSAGE_SUBST+=                MODNAME=${PKGMODNAME}
-MESSAGE_SUBST+=                PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
+MESSAGE_SUBST+=                EXT_CONF_DIR=${EXT_CONF_DIR}
 .if !empty(PHP_ZEND_EXTENSION:U:M[Yy][Ye][Ss])
-MESSAGE_SUBST+=                EXTENSION_DIRECTIVE=zend_extension
+EXTENSION_DIRECTIVE=    zend_extension
+EXTENSION_FILE=         ${PREFIX}/${PHP_EXTENSION_DIR}/${MODNAME}.${SHLIB_SUFFIX}
 .else
-MESSAGE_SUBST+=                EXTENSION_DIRECTIVE=extension
+EXTENSION_DIRECTIVE=    extension
+EXTENSION_FILE=         ${MODNAME}.${SHLIB_SUFFIX}
 .endif
+MESSAGE_SUBST+=                EXTENSION_DIRECTIVE=${EXTENSION_DIRECTIVE}
+MESSAGE_SUBST+=                EXTENSION_FILE=${EXTENSION_FILE}
 
 # Also include extension-specific message
 .if exists(${.CURDIR}/MESSAGE)
@@ -97,6 +118,9 @@
                ${TOUCH} ${TOUCH_FLAGS} $${cookie};                     \
        fi
 
+pre-build:
+       ${CP} ${.CURDIR}/../../lang/php/ext.ini ${WRKSRC}/${MODNAME}.ini
+
 do-install: do-module-install
 
 do-module-install:
@@ -104,6 +128,9 @@
        ${INSTALL_LIB} ${MODULESDIR}/${PKGMODNAME}.${SHLIB_SUFFIX} \
                ${DESTDIR}${PREFIX}/${PHP_EXTENSION_DIR}
 
+       ${INSTALL_DATA_DIR} ${DESTDIR}${EGDIR}
+       ${INSTALL_DATA} ${WRKSRC}/${MODNAME}.ini ${DESTDIR}${EGDIR}
+
 .if defined(USE_PHP_EXT_PATCHES)
 PATCHDIR=              ${.CURDIR}/${PHPPKGSRCDIR}/patches
 do-patch:



Home | Main Index | Thread Index | Old Index