diff options
author | jdolecek <jdolecek@pkgsrc.org> | 2016-07-17 15:49:44 +0000 |
---|---|---|
committer | jdolecek <jdolecek@pkgsrc.org> | 2016-07-17 15:49:44 +0000 |
commit | d7d447329395d339233cd41e482babd6be2cabf2 (patch) | |
tree | c411ad769dbd19d72345eafa4b29ae06bf88c7fa /lang/php | |
parent | f4a62a0b6285db08c6d30f592e7e72ef79954e14 (diff) | |
download | pkgsrc-d7d447329395d339233cd41e482babd6be2cabf2.tar.gz |
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 (limited to 'lang/php')
-rw-r--r-- | lang/php/MESSAGE.module | 13 | ||||
-rw-r--r-- | lang/php/PLIST.module | 5 | ||||
-rw-r--r-- | lang/php/ext.ini | 2 | ||||
-rw-r--r-- | lang/php/ext.mk | 37 |
4 files changed, 44 insertions, 13 deletions
diff --git a/lang/php/MESSAGE.module b/lang/php/MESSAGE.module index d6e79f29aac..c161596b650 100644 --- a/lang/php/MESSAGE.module +++ b/lang/php/MESSAGE.module @@ -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 --git a/lang/php/PLIST.module b/lang/php/PLIST.module index 7a79f615f9d..693012c7675 100644 --- a/lang/php/PLIST.module +++ b/lang/php/PLIST.module @@ -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 --git a/lang/php/ext.ini b/lang/php/ext.ini new file mode 100644 index 00000000000..cd39a48cc4b --- /dev/null +++ b/lang/php/ext.ini @@ -0,0 +1,2 @@ +;; enable @MODNAME@ +@EXTENSION_DIRECTIVE@= @EXTENSION_FILE@ diff --git a/lang/php/ext.mk b/lang/php/ext.mk index 34b37d6855e..f7cc07f14df 100644 --- a/lang/php/ext.mk +++ b/lang/php/ext.mk @@ -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 @@ PKGMODNAME?= ${MODNAME:S/-/_/} 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 @@ DIST_SUBDIR?= php-${MODNAME} 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 @@ LDFLAGS+= ${EXPORT_SYMBOLS_LDFLAGS} 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 @@ phpize-module: ${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 @@ do-module-install: ${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: |