summaryrefslogtreecommitdiff
path: root/lang/php
diff options
context:
space:
mode:
authorjdolecek <jdolecek@pkgsrc.org>2004-11-06 18:24:40 +0000
committerjdolecek <jdolecek@pkgsrc.org>2004-11-06 18:24:40 +0000
commit030aad031ab84caba3978369a894f832ae7dac3e (patch)
tree180f13711fdee70a69f46bf9648cc7eba9c063a8 /lang/php
parentf0216e8478f901d66baad0eaf3040a31ab6e0261 (diff)
downloadpkgsrc-030aad031ab84caba3978369a894f832ae7dac3e.tar.gz
merge extension module handling for PHP4 and PHP5 into lang/php/ext.mk,
g/c no longer needed Makefile.module add support for building extensions off PECL; version for PECL packages is built as ${PHP_BASE_VERS}.${PECL_VERSION}, i.e. PECL pkg version 1.0 would become php-pkg-4.3.9.1.0 or php-pkg-5.0.2.1.0 respectively
Diffstat (limited to 'lang/php')
-rw-r--r--lang/php/ext.mk80
1 files changed, 76 insertions, 4 deletions
diff --git a/lang/php/ext.mk b/lang/php/ext.mk
index d9883819eba..2618750d603 100644
--- a/lang/php/ext.mk
+++ b/lang/php/ext.mk
@@ -1,13 +1,85 @@
-# $NetBSD: ext.mk,v 1.1.1.1 2004/10/31 19:30:30 jdolecek Exp $
-# PHP wrapper, for module builds
+# $NetBSD: ext.mk,v 1.2 2004/11/06 18:24:40 jdolecek Exp $
+#
+# PHP extension package framework, for both PECL and bundled PHP extensions.
+#
+# Just include this file, define MODNAME, define PKGREVISION if necessary,
+# add dependencies, and add the appropriate --with-configure-arg, then include
+# bsd.pkg.mk.
.if !defined(PHPEXT_MK)
PHPEXT_MK= defined
.include "../../lang/php/phpversion.mk"
-.if (defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO]))
-. include "${PHPPKGSRCDIR}/Makefile.module"
+.include "${PHPPKGSRCDIR}/Makefile.common"
+
+PKGMODNAME?= ${MODNAME:S/-/_/}
+MODULESDIR?= ${WRKSRC}/modules
+PLIST_SUBST+= MODNAME=${PKGMODNAME}
+
+.if !defined(PECL_VERSION)
+# bundled extension
+PKGNAME?= php-${MODNAME}-${PHP_BASE_VERS}
+EXTRACT_ELEMENTS?= ${DISTNAME}/ext/${PKGMODNAME}
+WRKSRC?= ${WRKDIR}/${EXTRACT_ELEMENTS}
+.else
+# PECL extension
+PKGNAME?= php-${MODNAME}-${PHP_BASE_VERS}.${PECL_VERSION}
+MASTER_SITES= http://pecl.php.net/get/
+DISTNAME= ${MODNAME}-${PECL_VERSION}
+DIST_SUBDIR+= php-${MODNAME}
+DISTINFO_FILE= ${PKGDIR}/distinfo
+EXTRACT_SUFX= .tgz
+.endif
+
+PHPIZE?= ${BUILDLINK_PREFIX.php}/bin/phpize
+PHP_CONFIG?= ${BUILDLINK_PREFIX.php}/bin/php-config
+
+GNU_CONFIGURE= YES
+CONFIGURE_ARGS+= --with-php-config=${PHP_CONFIG}
+
+USE_CONFIG_WRAPPER= YES
+USE_LIBTOOL= YES
+
+# Ensure we export symbols in the linked shared object.
+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_SUBST+= MODNAME=${PKGMODNAME}
+MESSAGE_SUBST+= PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
+
+pre-configure: phpize-module
+
+phpize-module:
+ @cookie=${WRKDIR}/.phpize_module_done; \
+ if [ ! -f $${cookie} ]; then \
+ cd ${WRKSRC} && \
+ ${SETENV} AUTOCONF=${AUTOCONF} AUTOHEADER=${AUTOHEADER} \
+ ACLOCAL=${ACLOCAL} \
+ LIBTOOLIZE=${LOCALBASE}/bin/libtoolize \
+ ${PHPIZE} && \
+ ${TOUCH} ${TOUCH_FLAGS} $${cookie}; \
+ fi
+
+do-install: do-module-install
+
+do-module-install:
+ ${INSTALL_DATA_DIR} ${PREFIX}/${PHP_EXTENSION_DIR}
+ ${INSTALL_DATA} ${MODULESDIR}/${PKGMODNAME}.so \
+ ${PREFIX}/${PHP_EXTENSION_DIR}
+
+.if defined(USE_PHP_EXT_PATCHES)
+PATCHDIR= ${.CURDIR}/${PHPPKGSRCDIR}/patches
+do-patch:
+ cd ${WRKSRC}; \
+ for p in `${EGREP} -l '^\+\+\+ ext/${MODNAME}/' ${PATCHDIR}/patch-*`;do\
+ ${SED} -e 's,^+++ ext/${MODNAME}/,+++ ,' $$p | ${PATCH}; \
+ done
.endif
+.include "../../mk/automake.mk"
+.include "${PHPPKGSRCDIR}/buildlink3.mk"
+
.endif # PHPEXT_MK