summaryrefslogtreecommitdiff
path: root/lang/perl5
diff options
context:
space:
mode:
authorjlam <jlam>2001-11-24 04:40:31 +0000
committerjlam <jlam>2001-11-24 04:40:31 +0000
commit0c1134cdc4b95de667298f4b8ec431ee6ae95620 (patch)
tree53704cc1a57370436cc97b4b1843f2792c23f3ee /lang/perl5
parentc1980559c57ae65c74b336fdf1df5fc788de46a7 (diff)
downloadpkgsrc-0c1134cdc4b95de667298f4b8ec431ee6ae95620.tar.gz
Add buildlink.mk file for use by perl5 module package Makefiles. This
buildlink.mk file can replace the use of USE_PERL5: it defines all of the same perl variables as bsd.pkg.mk, adds a dependency on perl>=${PERL5_REQD} and conditionally includes bsd.perl.mk. It also creates a buildlinkified Config.pm that makes the local include/library search path include ${BUILDLINK_DIR} instead of hard-coding ${LOCALBASE}. There's more to be done to make this more useful in strongly buildlinkifying a package, but it's useful now as-is in weakly buildlinkifying a package.
Diffstat (limited to 'lang/perl5')
-rw-r--r--lang/perl5/buildlink.mk61
1 files changed, 61 insertions, 0 deletions
diff --git a/lang/perl5/buildlink.mk b/lang/perl5/buildlink.mk
new file mode 100644
index 00000000000..ba01628ee7c
--- /dev/null
+++ b/lang/perl5/buildlink.mk
@@ -0,0 +1,61 @@
+# $NetBSD: buildlink.mk,v 1.1 2001/11/24 04:40:31 jlam Exp $
+#
+# This Makefile fragment is included by packages that use perl.
+#
+# To use this Makefile fragment, simply:
+#
+# (1) Optionally define BUILDLINK_DEPENDS.perl to the dependency pattern
+# for the version of perl desired.
+# (2) Include this Makefile fragment in the package Makefile,
+
+.include "../../mk/bsd.buildlink.mk"
+
+BUILDLINK_DEPENDS.perl?= perl>=${PERL5_REQD}
+DEPENDS+= ${BUILDLINK_DEPENDS.perl}:../../lang/perl5
+
+PERL5?= ${BUILDLINK_PREFIX.perl}/bin/perl
+PERL5_REQD?= 5.0
+
+BUILDLINK_PREFIX.perl?= ${LOCALBASE}
+
+BUILDLINK_TARGETS.perl= perl-buildlink
+BUILDLINK_TARGETS+= ${BUILDLINK_TARGETS.perl}
+
+_CONFIG_PM= ${PERL5_ARCHLIB}/Config.pm
+_BUILDLINK_CONFIG_PM= ${_CONFIG_PM:S/${BUILDLINK_PREFIX.perl}\//${BUILDLINK_DIR}\//}
+
+_CONFIG_PM_SED= \
+ -e "s|-I${LOCALBASE}/include|-I${BUILDLINK_DIR}/include|g" \
+ -e "s|-L${LOCALBASE}/lib|-L${BUILDLINK_DIR}/lib|g"
+
+.if exists(${PERL5})
+. if exists(${BUILDLINK_PREFIX.perl}/share/mk/bsd.perl.mk)
+. include "${BUILDLINK_PREFIX.perl}/share/mk/bsd.perl.mk"
+. elif !defined(PERL5_SITELIB) || !defined(PERL5_SITEARCH) || !defined(PERL5_ARCHLIB)
+PERL5_SITELIB!= eval `${PERL5} -V:installsitelib 2>/dev/null`; \
+ ${ECHO} $${installsitelib}
+PERL5_SITEARCH!= eval `${PERL5} -V:installsitearch 2>/dev/null`; \
+ ${ECHO} $${installsitearch}
+PERL5_ARCHLIB!= eval `${PERL5} -V:installarchlib 2>/dev/null`; \
+ ${ECHO} $${installarchlib}
+MAKEFLAGS+= PERL5_SITELIB=${PERL5_SITELIB}
+MAKEFLAGS+= PERL5_SITEARCH=${PERL5_SITEARCH}
+MAKEFLAGS+= PERL5_ARCHLIB=${PERL5_ARCHLIB}
+. endif # !exists(bsd.perl.mk) && !defined(PERL5_*)
+.endif # exists($PERL5)
+
+PERL5OPT+= -I${PERL5_ARCHLIB:S/${BUILDLINK_PREFIX.perl}\//${BUILDLINK_DIR}\//}
+MAKE_ENV+= PERL5OPT="${PERL5OPT}"
+
+pre-configure: perl-buildlink
+
+perl-buildlink:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cookie=${BUILDLINK_DIR}/.perl_buildlink_done; \
+ if [ ! -f $${cookie} ]; then \
+ ${ECHO_MSG} "Creating ${_BUILDLINK_CONFIG_PM}."; \
+ ${MKDIR} ${_BUILDLINK_CONFIG_PM:H}; \
+ ${SED} ${_CONFIG_PM_SED} ${_CONFIG_PM} \
+ > ${_BUILDLINK_CONFIG_PM}; \
+ ${ECHO} ${_BUILDLINK_CONFIG_PM} >> $${cookie}; \
+ fi