summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2002-09-23 01:11:39 +0000
committerjlam <jlam>2002-09-23 01:11:39 +0000
commit10afe54eb9e015de94808e920d4d57361f26808e (patch)
tree251de24d034f04c03bc1701e5572d0107f3ee7a1 /mk
parent273ce6c5194af5e08ff7ef8132933b7adc9b97c3 (diff)
downloadpkgsrc-10afe54eb9e015de94808e920d4d57361f26808e.tar.gz
Allow for wrapper-specific transformations of arguments that occur after
the main transformations have been performed. The ld wrapper can now accept "-Wl,*" arguments and transform them appropriately by stripping of the -Wl and the commas. This will obiviate the need for logic in pkgsrc that strips away the "-Wl," depending on whether the platform was a.out or ELF, and whether the individual package chose to link using "cc" or "ld".
Diffstat (limited to 'mk')
-rw-r--r--mk/buildlink2/README13
-rw-r--r--mk/buildlink2/bsd.buildlink2.mk22
-rw-r--r--mk/buildlink2/ld-logic10
-rw-r--r--mk/buildlink2/libtool.sh4
-rw-r--r--mk/buildlink2/wrapper.sh4
5 files changed, 46 insertions, 7 deletions
diff --git a/mk/buildlink2/README b/mk/buildlink2/README
index 732c1ce599e..f869b959bcb 100644
--- a/mk/buildlink2/README
+++ b/mk/buildlink2/README
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.2 2002/08/22 08:21:28 jlam Exp $
+$NetBSD: README,v 1.3 2002/09/23 01:11:39 jlam Exp $
0 buildlink2 Wrapper Script System
==================================
@@ -8,8 +8,8 @@ compiler tool with scripts that tranlate any arguments into their buildlink
equivalents, then invoke the actual compiler tools with the translated
arguments. The pkgsrc/mk/buildlink2 directory contains bits of the wrapper
script system for the buildlink2 framework. The wrapper script system is
-composed of three parts: the main wrapper script, the "cache", and the
-"logic" script generated from the cache.
+composed of four parts: the main wrapper script, the "cache", the "logic"
+script generated from the cache, and a wrapper-specific "logic" script.
0.1 Main wrapper script
=======================
@@ -36,3 +36,10 @@ described above. The pre- and post-cache files simply complete the "case"
statement. The post-cache also contains the final case that performs the
actual argument translation and, as an optimization, saves the result into
the cache.
+
+ 0.4 Wrapper-specifc logic script
+ ================================
+
+The wrapper-specific logic script contains extra shell commands that
+typically perform an extra uncached translation of an argument after the
+main translation has been performed by the logic script.
diff --git a/mk/buildlink2/bsd.buildlink2.mk b/mk/buildlink2/bsd.buildlink2.mk
index a3d8e7db9f5..51a1b62461b 100644
--- a/mk/buildlink2/bsd.buildlink2.mk
+++ b/mk/buildlink2/bsd.buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink2.mk,v 1.27 2002/09/21 23:31:41 jlam Exp $
+# $NetBSD: bsd.buildlink2.mk,v 1.28 2002/09/23 01:11:39 jlam Exp $
#
# An example package buildlink2.mk file:
#
@@ -577,6 +577,7 @@ _BLNK_WRAP_LOGIC= ${BUILDLINK_DIR}/bin/.logic
_BLNK_WRAP_POST_CACHE_TRANSFORM= ${BUILDLINK_DIR}/bin/.post-cache-trans
_BLNK_WRAP_CACHE_TRANSFORM= ${BUILDLINK_DIR}/bin/.cache-trans
_BLNK_WRAP_LOGIC_TRANSFORM= ${BUILDLINK_DIR}/bin/.logic-trans
+_BLNK_WRAP_SPECIFIC_LOGIC= ${BUILDLINK_DIR}/bin/.std-logic
_BLNK_WRAP_LOG= ${BUILDLINK_DIR}/.wrapper.log
_BLNK_LIBTOOL_FIX_LA= ${BUILDLINK_DIR}/bin/.libtool-fix-la
_BLNK_FAKE_LA= ${BUILDLINK_DIR}/bin/.fake-la
@@ -593,6 +594,7 @@ _BLNK_WRAP_PRE_CACHE.${_wrappee_}= ${_BLNK_WRAP_PRE_CACHE}
_BLNK_WRAP_POST_CACHE.${_wrappee_}= ${_BLNK_WRAP_POST_CACHE_TRANSFORM}
_BLNK_WRAP_CACHE.${_wrappee_}= ${_BLNK_WRAP_CACHE_TRANSFORM}
_BLNK_WRAP_LOGIC.${_wrappee_}= ${_BLNK_WRAP_LOGIC_TRANSFORM}
+_BLNK_WRAP_SPECIFIC_LOGIC.${_wrappee_}= ${_BLNK_WRAP_SPECIFIC_LOGIC}
.endfor
# Don't bother adding AS, CPP to the configure or make environments as
@@ -617,6 +619,9 @@ _BLNK_WRAP_SANITIZE_PATH.LIBTOOL= # empty
# We need to "unbuildlinkify" any libtool archives.
_BLNK_WRAP_LT_UNTRANSFORM_SED= ${_REPLACE_BUILDLINK_SED}
+# The ld wrapper script accepts "-Wl,*" arguments.
+_BLNK_WRAP_SPECIFIC_LOGIC.LD= ${BUILDLINK_DIR}/bin/.ld-logic
+
# Don't transform the arguments for imake, which uses the C preprocessor
# to generate Makefiles, so that imake will find its config files.
#
@@ -654,6 +659,7 @@ _BLNK_WRAPPER_TRANSFORM_SED.${_wrappee_}= \
-e "s|@_BLNK_WRAP_POST_CACHE@|${_BLNK_WRAP_POST_CACHE.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_CACHE@|${_BLNK_WRAP_CACHE.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_LOGIC@|${_BLNK_WRAP_LOGIC.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_SPECIFIC_LOGIC@|${_BLNK_WRAP_SPECIFIC_LOGIC.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_SANITIZE_PATH@|${_BLNK_WRAP_SANITIZE_PATH.${_wrappee_}:Q}|g"
buildlink-wrappers: ${BUILDLINK_${_wrappee_}}
@@ -661,7 +667,8 @@ buildlink-wrappers: ${BUILDLINK_${_wrappee_}}
${BUILDLINK_${_wrappee_}}: \
${_BLNK_WRAPPER_SH.${_wrappee_}} \
${_BLNK_WRAP_PRE_CACHE.${_wrappee_}} \
- ${_BLNK_WRAP_POST_CACHE.${_wrappee_}}
+ ${_BLNK_WRAP_POST_CACHE.${_wrappee_}} \
+ ${_BLNK_WRAP_SPECIFIC_LOGIC.${_wrappee_}}
${_PKG_SILENT}${_PKG_DEBUG}${ECHO_BUILDLINK_MSG} \
"Creating wrapper: ${.TARGET}"
${_PKG_SILENT}${_PKG_DEBUG} \
@@ -792,6 +799,17 @@ ${_BLNK_WRAP_LOGIC_TRANSFORM}: \
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} > ${.TARGET}
+${_BLNK_WRAP_SPECIFIC_LOGIC}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
+
+${_BLNK_WRAP_SPECIFIC_LOGIC.LD}: ${.CURDIR}/../../mk/buildlink2/ld-logic
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@ECHO@|${ECHO:Q}|g" \
+ ${.ALLSRC} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
${_BLNK_LIBTOOL_FIX_LA}: ${.CURDIR}/../../mk/buildlink2/libtool-fix-la
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${SED} \
diff --git a/mk/buildlink2/ld-logic b/mk/buildlink2/ld-logic
new file mode 100644
index 00000000000..1ebab74863e
--- /dev/null
+++ b/mk/buildlink2/ld-logic
@@ -0,0 +1,10 @@
+# $NetBSD: ld-logic,v 1.1 2002/09/23 01:11:39 jlam Exp $
+
+case $arg in
+-Wl,*)
+ newarg=`@ECHO@ "X$arg" | $Xsed \
+ -e "s|^-Wl,||g" -e "s|,| |g" \
+ `
+ arg="$newarg"
+ ;;
+esac
diff --git a/mk/buildlink2/libtool.sh b/mk/buildlink2/libtool.sh
index a788f8f2dac..1177c8c8e3c 100644
--- a/mk/buildlink2/libtool.sh
+++ b/mk/buildlink2/libtool.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: libtool.sh,v 1.3 2002/09/16 19:06:41 jlam Exp $
+# $NetBSD: libtool.sh,v 1.4 2002/09/23 01:11:39 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
@@ -9,6 +9,7 @@ pre_cache="@_BLNK_WRAP_PRE_CACHE@"
cache="@_BLNK_WRAP_CACHE@"
post_cache="@_BLNK_WRAP_POST_CACHE@"
logic="@_BLNK_WRAP_LOGIC@"
+specificlogic="@_BLNK_WRAP_SPECIFIC_LOGIC@"
libtool_fix_la="@_BLNK_LIBTOOL_FIX_LA@"
wrapperlog="@_BLNK_WRAP_LOG@"
updatecache=${BUILDLINK_UPDATE_CACHE-yes}
@@ -63,6 +64,7 @@ while [ $# -gt 0 ]; do
esac
;;
esac
+ . $specificlogic
args="$args $arg"
done
cmd="$cmd $args"
diff --git a/mk/buildlink2/wrapper.sh b/mk/buildlink2/wrapper.sh
index b023a904a9f..c732d5bb866 100644
--- a/mk/buildlink2/wrapper.sh
+++ b/mk/buildlink2/wrapper.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: wrapper.sh,v 1.2 2002/08/22 08:21:30 jlam Exp $
+# $NetBSD: wrapper.sh,v 1.3 2002/09/23 01:11:39 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
@@ -9,6 +9,7 @@ pre_cache="@_BLNK_WRAP_PRE_CACHE@"
cache="@_BLNK_WRAP_CACHE@"
post_cache="@_BLNK_WRAP_POST_CACHE@"
logic="@_BLNK_WRAP_LOGIC@"
+specificlogic="@_BLNK_WRAP_SPECIFIC_LOGIC@"
wrapperlog="@_BLNK_WRAP_LOG@"
updatecache=${BUILDLINK_UPDATE_CACHE-yes}
@@ -19,6 +20,7 @@ for arg; do
case "$cacheupdated" in
yes) @CAT@ $pre_cache $cache $post_cache > $logic ;;
esac
+ . $specificlogic
args="$args $arg"
done
cmd="$cmd $args"