pkgsrc/www/php3/Makefile.module
agc cb0e38446b Apply patches from Lubomir Sedlacik <salo@Xtrmntr.org> in PR 18115 to
generalise the linker flags used to export symbols by setting them on
a per-OS basis.

> many packages force -Wl,-export-dynamic which is not portable outside GNU ld
> and cause problems e.g. on Solaris.  some of these packages use if
> conditionals either only for NetBSD or except SunOS, but the state is not
> coherent and it may complicate later when support for new OS is added to
> pkgsrc (e.g. ongoing work on HP-UX support).
>
> jlam proposed the following framework in discussion on tech-pkg:
>
>   http://mail-index.netbsd.org/tech-pkg/2002/06/21/0009.html
>
> now, ${EXPORT_SYMBOLS_LDFLAGS} is used instead of directly defining
> -Wl,-export-dynamic which is set in appropriate defs.*.mk to reasonable
> values.  packages should be converted to this framework by:
>
> 1) replacing LDFLAGS+= -Wl,-export-dynamic and LIBS+= -export-dynamic with:
>
>    LDFLAGS+= ${EXPORT_SYMBOLS_LDFLAGS}
>
> 2) for use in patchfiles, add this variable to MAKE_ENV if needed:
>
>    MAKE_ENV+= EXPORT_SYMBOLS_LDFLAGS=${EXPORT_SYMBOLS_LDFLAGS}
>
> 3) replace occurances of -Wl,-export-dynamic and -export-dynamic in patch
>    files with:
>
>    $(EXPORT_SYMBOLS_LDFLAGS)
2002-09-04 14:47:32 +00:00

50 lines
1.3 KiB
Text

# $NetBSD: Makefile.module,v 1.4 2002/09/04 14:47:41 agc Exp $
.include "../../www/php3/Makefile.common"
PKGNAME= php-${MODNAME}-${BASE_VERS}
PKGREVISION?= # empty
DEPENDS+= php-${BASE_VERS}*:../../www/php3
USE_PERL5= build
PKGMODNAME= ${MODNAME:S/-/_/}
MODULESDIR= ${WRKSRC}/functions
PLIST_SUBST+= MODNAME=${PKGMODNAME}
.include "../../mk/bsd.prefs.mk"
# LD_SHAREABLE_FLAG is the flag to pass to "ld" to create a shared library
# module.
#
.if ${OPSYS} == "SunOS"
LD_SHAREABLE_FLAG= -G
.else
LD_SHAREABLE_FLAG= -Bshareable
.endif
# Ensure we export symbols in the linked shared object.
LDFLAGS+= ${EXPORT_SYMBOLS_LDFLAGS}
MOD_CPPFLAGS+= -I${WRKSRC} -I${MODULESDIR} -fPIC -DPIC -DCOMPILE_DL
MOD_LDFLAGS+= ${LDFLAGS:S/-Wl,//g}
MOD_LIBS+= # empty
PLIST_SRC= ${.CURDIR}/../../www/php3/PLIST.module
MESSAGE_SRC= ${.CURDIR}/../../www/php3/MESSAGE.module
MESSAGE_SUBST+= MODNAME=${PKGMODNAME}
MESSAGE_SUBST+= PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
do-build:
cd ${MODULESDIR}; \
${COMPILE.c} ${MOD_CPPFLAGS} ${PKGMODNAME}.c; \
${LD} ${LD_SHAREABLE_FLAG} -o ${PKGMODNAME}.so ${PKGMODNAME}.o \
${MOD_LDFLAGS} ${MOD_LIBS}
do-install: do-module-install
do-module-install:
${INSTALL_DATA_DIR} ${PREFIX}/${PHP_EXTENSION_DIR}
${INSTALL_DATA} ${MODULESDIR}/${PKGMODNAME}.so \
${PREFIX}/${PHP_EXTENSION_DIR}