2005-07-13 20:01:18 +02:00
|
|
|
# $NetBSD: module.mk,v 1.47 2005/07/13 18:01:31 jlam Exp $
|
2002-09-23 10:56:13 +02:00
|
|
|
#
|
|
|
|
# This Makefile fragment is intended to be included by packages that build
|
|
|
|
# and install perl5 modules.
|
|
|
|
#
|
|
|
|
# The following targets are provided by this file:
|
|
|
|
#
|
2002-09-26 14:31:28 +02:00
|
|
|
# perl5-configure runs the standard perl configuration in
|
2002-09-23 10:56:13 +02:00
|
|
|
# each of the directories specified in
|
|
|
|
# ${PERL5_CONFIGURE_DIRS}.
|
|
|
|
#
|
2002-09-26 14:31:28 +02:00
|
|
|
# do-configure runs the perl5-configure target; if PERL5_CONFIGURE
|
|
|
|
# is set to "YES", then this target overrides the
|
|
|
|
# default do-configure provided by bsd.pkg.mk.
|
|
|
|
#
|
2002-09-23 10:56:13 +02:00
|
|
|
# The following variables may be set prior to including this file:
|
|
|
|
#
|
2002-09-26 14:31:28 +02:00
|
|
|
# PERL5_CONFIGURE if "YES", then for do-configure, run the standard
|
|
|
|
# perl configuration assuming Makefile.PL exists;
|
2002-09-23 10:56:13 +02:00
|
|
|
# defaults to "YES".
|
|
|
|
#
|
|
|
|
# PERL5_CONFIGURE_DIRS list of directories in which to run the
|
|
|
|
# standard perl configuration; defaults to
|
|
|
|
# ${CONFIGURE_DIRS}.
|
|
|
|
#
|
|
|
|
# PERL5_LDFLAGS extra linker flags to pass on to the build
|
|
|
|
# process.
|
2005-02-21 13:08:45 +01:00
|
|
|
#
|
2005-02-24 23:38:41 +01:00
|
|
|
# PERL5_MODULE_TYPE "MakeMaker" or "Module::Build" depending on which
|
|
|
|
# framework is used to build/install the module.
|
2002-09-23 10:56:13 +02:00
|
|
|
|
|
|
|
.if !defined(_PERL5_MODULE_MK)
|
|
|
|
_PERL5_MODULE_MK= # defined
|
|
|
|
|
2003-09-13 01:39:42 +02:00
|
|
|
.include "../../mk/bsd.prefs.mk"
|
|
|
|
|
2003-02-18 16:58:49 +01:00
|
|
|
BUILDLINK_DEPMETHOD.perl+= full
|
2003-02-17 21:08:46 +01:00
|
|
|
|
2005-02-24 23:38:41 +01:00
|
|
|
BUILDING_PERL5?= no
|
|
|
|
BUILDING_MODULE_BUILD?= no
|
|
|
|
PERL5_MODULE_TYPE?= MakeMaker
|
|
|
|
|
2005-02-26 01:04:48 +01:00
|
|
|
.if (${PERL5_MODULE_TYPE} != "MakeMaker") && \
|
|
|
|
(${PERL5_MODULE_TYPE} != "Module::Build")
|
|
|
|
PKG_FAIL_REASON+= "\`\`${PERL5_MODULE_TYPE}'' is not a supported PERL5_MODULE_TYPE."
|
|
|
|
.endif
|
|
|
|
|
2005-02-24 23:38:41 +01:00
|
|
|
.if empty(BUILDING_PERL5:M[yY][eE][sS])
|
2005-03-24 23:19:06 +01:00
|
|
|
. include "../../lang/perl5/buildlink3.mk"
|
2003-09-13 01:39:42 +02:00
|
|
|
.endif
|
2002-09-23 10:56:13 +02:00
|
|
|
|
2005-02-24 23:38:41 +01:00
|
|
|
.if empty(BUILDING_MODULE_BUILD:M[yY][eE][sS]) && \
|
|
|
|
(${PERL5_MODULE_TYPE} == "Module::Build")
|
2005-02-25 16:57:12 +01:00
|
|
|
BUILD_DEPENDS+= p5-Module-Build>=0.2608nb1:../../devel/p5-Module-Build
|
2005-02-21 13:08:45 +01:00
|
|
|
.endif
|
|
|
|
|
2005-02-24 23:38:41 +01:00
|
|
|
.include "../../lang/perl5/vars.mk"
|
|
|
|
|
2002-09-23 10:56:13 +02:00
|
|
|
PERL5_CONFIGURE?= YES
|
|
|
|
PERL5_CONFIGURE_DIRS?= ${CONFIGURE_DIRS}
|
|
|
|
|
2003-09-13 10:25:03 +02:00
|
|
|
# All pkgsrc-install perl modules are installed into the "site"
|
|
|
|
# directories.
|
|
|
|
#
|
|
|
|
MAKE_PARAMS+= INSTALLDIRS=site
|
|
|
|
|
2004-07-03 16:13:06 +02:00
|
|
|
.include "../../mk/compiler.mk"
|
|
|
|
|
2003-12-03 18:29:12 +01:00
|
|
|
.if ${OPSYS} == "AIX"
|
2004-07-03 16:13:06 +02:00
|
|
|
.if !empty(CC_VERSION:Mgcc*)
|
|
|
|
BROKEN= Perl does not like building with gcc on AIX, please use a different compiler
|
|
|
|
.endif
|
2003-12-03 18:29:12 +01:00
|
|
|
.endif
|
|
|
|
|
2004-05-05 10:29:44 +02:00
|
|
|
MAKE_ENV+= LC_ALL=C
|
2005-02-24 23:38:41 +01:00
|
|
|
.if ${PERL5_MODULE_TYPE} == "Module::Build"
|
2005-02-21 13:08:45 +01:00
|
|
|
_CONF_ARG= Build.PL
|
2005-02-24 23:38:41 +01:00
|
|
|
.elif ${PERL5_MODULE_TYPE} == "MakeMaker"
|
2005-02-23 11:42:07 +01:00
|
|
|
_CONF_ARG= Makefile.PL ${MAKE_PARAMS}
|
2005-02-21 13:08:45 +01:00
|
|
|
.endif
|
|
|
|
|
2003-09-14 00:50:58 +02:00
|
|
|
.PHONY: perl5-configure
|
2002-09-26 14:31:28 +02:00
|
|
|
perl5-configure:
|
2002-09-23 10:56:13 +02:00
|
|
|
${_PKG_SILENT}${_PKG_DEBUG} \
|
|
|
|
for dir in ${PERL5_CONFIGURE_DIRS}; do \
|
|
|
|
if [ -f $$dir/Makefile.PL ]; then \
|
|
|
|
( cd $$dir && ${SETENV} ${MAKE_ENV} \
|
2005-02-21 13:08:45 +01:00
|
|
|
${PERL5} ${_CONF_ARG}); \
|
2002-09-23 10:56:13 +02:00
|
|
|
fi; \
|
|
|
|
done
|
2002-09-26 14:31:28 +02:00
|
|
|
|
|
|
|
.if defined(PERL5_CONFIGURE) && !empty(PERL5_CONFIGURE:M[yY][eE][sS])
|
2003-09-13 01:39:42 +02:00
|
|
|
. if target(do-configure)
|
2003-08-03 13:47:01 +02:00
|
|
|
do-configure: perl5-configure
|
2003-09-13 01:39:42 +02:00
|
|
|
. else
|
2002-09-26 14:31:28 +02:00
|
|
|
do-configure: perl5-configure
|
|
|
|
${_PKG_SILENT}${_PKG_DEBUG}${DO_NADA}
|
2003-09-13 01:39:42 +02:00
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
|
2003-09-13 17:04:59 +02:00
|
|
|
# Repoint all of the site-specific variables to be under the perl5
|
|
|
|
# module's ${PREFIX}.
|
|
|
|
#
|
2004-01-13 01:59:14 +01:00
|
|
|
.for _var_ in ${_PERL5_SITEVARS} INSTALLSCRIPT
|
2004-01-13 08:15:41 +01:00
|
|
|
PERL5_${_var_}= ${PREFIX}/${PERL5_SUB_${_var_}}
|
|
|
|
PERL5_MAKE_FLAGS+= ${_var_}="${PERL5_${_var_}}"
|
2003-09-13 15:53:31 +02:00
|
|
|
.endfor
|
2005-02-21 13:08:45 +01:00
|
|
|
|
2005-02-24 23:38:41 +01:00
|
|
|
.if ${PERL5_MODULE_TYPE} == "MakeMaker"
|
2003-09-13 17:04:59 +02:00
|
|
|
#
|
|
|
|
# The PREFIX in the generated Makefile will point to ${_PERL5_PREFIX},
|
|
|
|
# so override its value to the module's ${PREFIX}.
|
|
|
|
#
|
2004-01-13 08:15:41 +01:00
|
|
|
PERL5_MAKE_FLAGS+= PREFIX="${PREFIX}"
|
2005-02-21 13:08:45 +01:00
|
|
|
.endif
|
|
|
|
|
2005-02-24 23:38:41 +01:00
|
|
|
.if ${PERL5_MODULE_TYPE} == "Module::Build"
|
2005-02-21 13:08:45 +01:00
|
|
|
do-build:
|
|
|
|
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build
|
|
|
|
|
|
|
|
do-test:
|
|
|
|
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build test
|
|
|
|
|
|
|
|
do-install:
|
|
|
|
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build install
|
|
|
|
.endif
|
2003-09-13 15:53:31 +02:00
|
|
|
|
2003-09-13 01:39:42 +02:00
|
|
|
.if defined(DEFAULT_VIEW.perl)
|
|
|
|
DEFAULT_VIEW.${PKGBASE}= ${DEFAULT_VIEW.perl}
|
2003-08-03 22:52:30 +02:00
|
|
|
.endif
|
2002-09-23 10:56:13 +02:00
|
|
|
|
|
|
|
.if defined(PERL5_LDFLAGS) && !empty(PERL5_LDFLAGS)
|
2003-03-14 20:37:30 +01:00
|
|
|
FIX_RPATH+= PERL5_LDFLAGS
|
2002-09-23 10:56:13 +02:00
|
|
|
LDFLAGS+= ${PERL5_LDFLAGS}
|
2003-11-25 18:45:56 +01:00
|
|
|
.endif
|
|
|
|
|
2004-01-21 10:40:49 +01:00
|
|
|
# MakeMaker provides two hooks, OPTIMIZE and OTHERLDFLAGS, to
|
2003-11-27 05:11:40 +01:00
|
|
|
# customize the arguments passed to the preprocessor and linker,
|
|
|
|
# respectively.
|
2003-11-25 18:45:56 +01:00
|
|
|
#
|
2004-01-21 10:40:49 +01:00
|
|
|
PERL5_MAKE_FLAGS+= OPTIMIZE="${CFLAGS} ${CPPFLAGS}"
|
2003-11-25 18:45:56 +01:00
|
|
|
.if ${OBJECT_FMT} == "a.out"
|
2004-01-13 08:15:41 +01:00
|
|
|
PERL5_MAKE_FLAGS+= OTHERLDFLAGS="${LDFLAGS:S/-Wl,//g}"
|
2003-11-25 18:45:56 +01:00
|
|
|
.else
|
2004-01-13 08:15:41 +01:00
|
|
|
PERL5_MAKE_FLAGS+= OTHERLDFLAGS="${LDFLAGS}"
|
2002-09-23 10:56:13 +02:00
|
|
|
.endif
|
|
|
|
|
|
|
|
# Generate the PLIST from the files listed in PERL5_PACKLIST.
|
|
|
|
.if defined(PERL5_PACKLIST)
|
2005-07-13 20:01:18 +02:00
|
|
|
PERL5_PACKLIST_DIR?= ${PERL5_SITEARCH}
|
|
|
|
_PERL5_PACKLIST= ${PERL5_PACKLIST:S/^/${PERL5_PACKLIST_DIR}\//}
|
2002-09-23 10:56:13 +02:00
|
|
|
PERL5_PLIST_COMMENT= \
|
|
|
|
( ${ECHO} "@comment The following lines are automatically generated"; \
|
|
|
|
${ECHO} "@comment from the installed .packlist files." )
|
|
|
|
PERL5_PLIST_FILES= \
|
2005-07-13 20:01:18 +02:00
|
|
|
( ${CAT} ${_PERL5_PACKLIST}; for f in ${_PERL5_PACKLIST}; do [ ! -f $$f ] || ${ECHO} $$f; done ) \
|
2002-09-23 10:56:13 +02:00
|
|
|
| ${SED} -e "s,[ ].*,," -e "s,/\./,/,g" -e "s,${PREFIX}/,," \
|
|
|
|
| ${SORT} -u
|
|
|
|
PERL5_PLIST_DIRS= \
|
2005-07-13 20:01:18 +02:00
|
|
|
( ${CAT} ${_PERL5_PACKLIST}; for f in ${_PERL5_PACKLIST}; do [ ! -f $$f ] || ${ECHO} $$f; done ) \
|
2002-09-23 10:56:13 +02:00
|
|
|
| ${SED} -e "s,[ ].*,," -e "s,/\./,/,g" -e "s,${PREFIX}/,," \
|
|
|
|
-e "s,^,@unexec \${RMDIR} -p %D/," \
|
2004-06-09 19:53:04 +02:00
|
|
|
-e "s,/[^/]*$$, 2>/dev/null || ${TRUE}," \
|
2002-09-23 10:56:13 +02:00
|
|
|
| ${SORT} -ur
|
|
|
|
PERL5_GENERATE_PLIST= ${PERL5_PLIST_COMMENT}; \
|
|
|
|
${PERL5_PLIST_FILES}; \
|
|
|
|
${PERL5_PLIST_DIRS}
|
|
|
|
GENERATE_PLIST+= ${PERL5_GENERATE_PLIST};
|
|
|
|
.endif
|
|
|
|
|
2004-01-13 08:15:41 +01:00
|
|
|
# The build and install stages require slightly different values for
|
|
|
|
# INSTALLARCHLIB. During the build, INSTALLARCHLIB refers to the
|
|
|
|
# directory where libperl.so may be found, which should point into the
|
|
|
|
# default view. During the install, INSTALLARCHLIB refers to the
|
|
|
|
# directory where the perllocal.pod file should be installed, which
|
|
|
|
# should point into the package prefix.
|
|
|
|
#
|
2005-04-02 00:37:44 +02:00
|
|
|
.if empty(BUILDING_PERL5:M[yY][eE][sS])
|
2004-01-13 08:15:41 +01:00
|
|
|
MAKE_FLAGS+= ${PERL5_MAKE_FLAGS}
|
|
|
|
BUILD_MAKE_FLAGS= ${MAKE_FLAGS}
|
|
|
|
BUILD_MAKE_FLAGS+= INSTALLARCHLIB="${VIEWBASE}/${PERL5_SUB_INSTALLARCHLIB}"
|
|
|
|
INSTALL_MAKE_FLAGS= ${MAKE_FLAGS}
|
|
|
|
INSTALL_MAKE_FLAGS+= INSTALLARCHLIB="${PREFIX}/${PERL5_SUB_INSTALLARCHLIB}"
|
|
|
|
.endif
|
|
|
|
|
2003-09-14 00:58:07 +02:00
|
|
|
# Remove the perllocal.pod file from the installation since we don't
|
|
|
|
# bother keeping the file contents up-to-date anyway.
|
|
|
|
#
|
|
|
|
.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
|
|
|
|
post-install: perl5-post-install
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.PHONY: perl5-post-install
|
|
|
|
perl5-post-install:
|
|
|
|
${_PKG_SILENT}${_PKG_DEBUG} \
|
2004-01-13 09:02:12 +01:00
|
|
|
for dir in \
|
|
|
|
${PREFIX}/${PERL5_SUB_INSTALLARCHLIB} \
|
|
|
|
${PERL5_INSTALLSITEARCH}; \
|
|
|
|
do \
|
2003-09-14 00:58:07 +02:00
|
|
|
if [ -f $$dir/perllocal.pod ]; then \
|
|
|
|
${RM} -f $$dir/perllocal.pod; \
|
|
|
|
fi; \
|
|
|
|
done
|
2003-09-13 03:56:25 +02:00
|
|
|
|
2003-03-05 17:07:44 +01:00
|
|
|
# Default test target for perl5 modules
|
|
|
|
TEST_TARGET?= test
|
|
|
|
|
2002-09-23 10:56:13 +02:00
|
|
|
.endif # _PERL5_MODULE_MK
|