summaryrefslogtreecommitdiff
path: root/mk/bsd.buildlink.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2001-06-16 14:58:56 +0000
committerjlam <jlam@pkgsrc.org>2001-06-16 14:58:56 +0000
commit455f8ec7652d10732bfa4d98b206cba83c4cf636 (patch)
treee28c3cb9f55a280e59cce0e0a21929b3f9b7ca92 /mk/bsd.buildlink.mk
parent6c8cbaa76f863b044dac2d85f380505bad3cf064 (diff)
downloadpkgsrc-455f8ec7652d10732bfa4d98b206cba83c4cf636.tar.gz
Add code to handle GTK-style config scripts (gtk-config --cflags/--libs)
by wrapping them in another script that converts references to ${LOCALBASE} to ${BUILDLINK_DIR}.
Diffstat (limited to 'mk/bsd.buildlink.mk')
-rw-r--r--mk/bsd.buildlink.mk38
1 files changed, 36 insertions, 2 deletions
diff --git a/mk/bsd.buildlink.mk b/mk/bsd.buildlink.mk
index 12520d1a790..2d874566bcd 100644
--- a/mk/bsd.buildlink.mk
+++ b/mk/bsd.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink.mk,v 1.6 2001/06/15 08:35:34 jlam Exp $
+# $NetBSD: bsd.buildlink.mk,v 1.7 2001/06/16 14:58:56 jlam Exp $
#
# This Makefile fragment is included by package buildlink.mk files. This
# file does the following things:
@@ -10,6 +10,10 @@
# respectively.
# (3) Prepends ${BUILDLINK_CPPFLAGS} to CPPFLAGS, CFLAGS, and CXXFLAGS;
# (4) Prepends ${BUILDLINK_LDFLAGS} to LDFLAGS.
+# (5) Defines a macro target, _BUILDLINK_CONFIG_WRAPPER_USE, that generates
+# a wrapper script around GTK+-style config scripts that replaces
+# -I${LOCALBASE}/... and -L${LOCALBASE}/... with references into
+# ${BUILDLINK_DIR}.
#
# The variables required to be defined prior to including this file are
# listed below. <pkgname> refers to the name of the package and should be
@@ -30,16 +34,30 @@
# the source filename into a destination
# filename
#
+# BUILDLINK_CONFIG.<pkgname> absolute path to GTK+-style config script
+#
+# BUILDLINK_CONFIG_WRAPPER.<pkgname>
+# absolute path for generated wrapper script;
+# this should be under ${BUILDLINK_DIR}/bin
+#
# The targets required to be defined prior to including this file are
# listed below.
#
# pre-configure this target should have as dependencies any
-# targets to be invoked; this is just usually # <pkgname>-buildlink
+# targets to be invoked; this is just usually # <pkgname>-buildlink and possibly
+# <pkgname>-buildlink-config-wrapper
#
# <pkgname>-buildlink this target should just invoke the
# _BUILDLINK_USE macro target defined in this
# file
#
+# The targets that may optionally be defined are:
+#
+# <pkgname>-buildlink-config-wrapper
+# this target should just invoke the
+# _BUILDLINK_CONFIG_WRAPPER_USE macro target
+# defined in this file
+#
# Example package buildlink.mk file:
#
# BUILDLINK_PREFIX.foo= ${LOCALBASE}
@@ -97,4 +115,20 @@ _BUILDLINK_USE: .USE
${TOUCH} ${TOUCH_FLAGS} $${cookie}; \
fi
+_BUILDLINK_CONFIG_WRAPPER_USE: .USE
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cookie=${BUILDLINK_DIR}/.${.TARGET:S/-buildlink-config-wrapper//}_buildlink_config_wrapper_done; \
+ if [ ! -f $${cookie} ]; then \
+ ${ECHO_MSG} "Creating wrapper script ${BUILDLINK_CONFIG_WRAPPER.${.TARGET:S/-buildlink-config-wrapper//}}."; \
+ ${MKDIR} ${BUILDLINK_CONFIG_WRAPPER.${.TARGET:S/-buildlink-config-wrapper//}:H}; \
+ (${ECHO} '#!/bin/sh'; \
+ ${ECHO} ''; \
+ ${ECHO} '${ECHO} "`${BUILDLINK_CONFIG.${.TARGET:S/-buildlink-config-wrapper//}} $$*`" | ${SED} \'; \
+ ${ECHO} ' -e "s|-I${LOCALBASE}/|-I${BUILDLINK_DIR}/|g" \'; \
+ ${ECHO} ' -e "s|-L${LOCALBASE}/|-L${BUILDLINK_DIR}/|g"'; \
+ ) > ${BUILDLINK_CONFIG_WRAPPER.${.TARGET:S/-buildlink-config-wrapper//}}; \
+ ${CHMOD} +x ${BUILDLINK_CONFIG_WRAPPER.${.TARGET:S/-buildlink-config-wrapper//}}; \
+ ${TOUCH} ${TOUCH_FLAGS} $${cookie}; \
+ fi
+
.endif # _BSD_BUILDLINK_MK