Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / lang / php / ext.mk
blob0cf0ca367d958f67425ea8dd46677bf216c6d970
1 # $NetBSD: ext.mk,v 1.28 2012/06/16 02:47:51 taca Exp $
3 # PHP extension package framework, for both PECL and bundled PHP extensions.
5 # Just include this file, define MODNAME, define PKGREVISION if necessary,
6 # add dependencies, and add the appropriate --with-configure-arg, then include
7 # bsd.pkg.mk.
9 .if !defined(PHPEXT_MK)
10 PHPEXT_MK= defined
12 _VARGROUPS+= phpext
13 _USER_VARS.phpext= # none
14 _PKG_VARS.phpext= MODNAME PECL_VERSION PKGMODNAME MODULESDIR \
15 USE_PHP_EXT_PATCHES
16 _SYS_VARS.phpext= DISTINFO_FILE PATCHDIR
18 .if defined(PECL_VERSION)
19 HOMEPAGE?= http://pecl.php.net/package/${MODNAME}
20 .endif
22 .include "../../lang/php/phpversion.mk"
24 .include "${PHPPKGSRCDIR}/Makefile.common"
26 PKGMODNAME?= ${MODNAME:S/-/_/}
27 PHPSETUPSUBDIR?= #empty
28 MODULESDIR?= ${WRKSRC}/modules
29 PLIST_SUBST+= MODNAME=${PKGMODNAME}
31 .if !defined(PECL_VERSION)
32 # bundled extension
33 PKGNAME?= ${PHP_PKG_PREFIX}-${MODNAME}-${PHP_BASE_VERS}
34 EXTRACT_ELEMENTS?= ${DISTNAME}/ext/${PKGMODNAME}
35 WRKSRC?= ${WRKDIR}/${EXTRACT_ELEMENTS}
36 DISTINFO_FILE= ${.CURDIR}/${PHPPKGSRCDIR}/distinfo
37 .else
38 # PECL extension
39 # WARINING: following fixed version number for PHP 5.3.x must not be bumped!
40 .if defined(PECL_LEGACY_VERSION_SCHEME) && ${PKG_PHP_VERSION} == "53"
41 PKGNAME?= ${PHP_PKG_PREFIX}-${MODNAME}-5.3.9.${PECL_VERSION}
42 .else
43 PKGNAME?= ${PHP_PKG_PREFIX}-${MODNAME}-${PECL_VERSION}
44 .endif
45 MASTER_SITES?= http://pecl.php.net/get/
46 PECL_DISTNAME?= ${MODNAME}-${PECL_VERSION}
47 DISTNAME= ${PECL_DISTNAME}
48 DIST_SUBDIR?= php-${MODNAME}
49 EXTRACT_SUFX?= .tgz
50 .endif
52 PHPIZE?= ${BUILDLINK_PREFIX.php}/bin/phpize
53 PHP_CONFIG?= ${BUILDLINK_PREFIX.php}/bin/php-config
55 GNU_CONFIGURE= YES
56 CONFIGURE_ARGS+= --with-php-config=${PHP_CONFIG}
58 USE_CONFIG_WRAPPER= YES
59 USE_LIBTOOL= YES
60 LIBTOOL_OVERRIDE= YES
61 USE_TOOLS+= automake
63 # Ensure we export symbols in the linked shared object.
64 LDFLAGS+= ${EXPORT_SYMBOLS_LDFLAGS}
65 MAKE_ENV+= EXPORT_SYMBOLS_LDFLAGS="${EXPORT_SYMBOLS_LDFLAGS}"
67 PLIST_SRC+= ${.CURDIR}/../../lang/php/PLIST.module
68 MESSAGE_SRC= ${.CURDIR}/../../lang/php/MESSAGE.module
69 MESSAGE_SUBST+= MODNAME=${PKGMODNAME}
70 MESSAGE_SUBST+= PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
72 # Also include extension-specific message
73 .if exists(${.CURDIR}/MESSAGE)
74 MESSAGE_SRC+= ${.CURDIR}/MESSAGE
75 .endif
77 .if ${OBJECT_FMT} == "SOM"
78 SHLIB_SUFFIX= sl
79 .else
80 SHLIB_SUFFIX= so
81 .endif
83 pre-configure: phpize-module
85 phpize-module:
86 @cookie=${WRKDIR}/.phpize_module_done; \
87 if [ ! -f $${cookie} ]; then \
88 cd ${WRKSRC}/${PHPSETUPSUBDIR} && \
89 ${SETENV} \
90 AUTOCONF=${TOOLS_DIR:Q}/bin/autoconf \
91 AUTOHEADER=${TOOLS_DIR:Q}/bin/autoheader \
92 ACLOCAL=${TOOLS_DIR:Q}/bin/aclocal \
93 LIBTOOLIZE=${LOCALBASE:Q}/bin/libtoolize \
94 ${PHPIZE} && \
95 ${TOUCH} ${TOUCH_FLAGS} $${cookie}; \
98 do-install: do-module-install
100 do-module-install:
101 ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/${PHP_EXTENSION_DIR}
102 ${INSTALL_LIB} ${MODULESDIR}/${PKGMODNAME}.${SHLIB_SUFFIX} \
103 ${DESTDIR}${PREFIX}/${PHP_EXTENSION_DIR}
105 .if defined(USE_PHP_EXT_PATCHES)
106 PATCHDIR= ${.CURDIR}/${PHPPKGSRCDIR}/patches
107 do-patch:
108 ${_PKG_SILENT}${_PKG_DEBUG} \
109 cd ${WRKSRC}; \
110 for p in `${EGREP} -l '^\+\+\+ ext/${MODNAME}/' ${PATCHDIR}/patch-*`;do\
111 ${SED} -e 's,^+++ ext/${MODNAME}/,+++ ,' $$p | ${PATCH} ${PATCH_ARGS}; \
112 done || ${TRUE}
113 .endif
115 .include "${PHPPKGSRCDIR}/buildlink3.mk"
117 .endif # PHPEXT_MK