pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/buildlink3 Change the way in which arguments are pr...
details: https://anonhg.NetBSD.org/pkgsrc/rev/dfb0c91f4226
branches: trunk
changeset: 462696:dfb0c91f4226
user: jlam <jlam%pkgsrc.org@localhost>
date: Thu Oct 09 12:15:15 2003 +0000
description:
Change the way in which arguments are processed by the wrappers. We
know read the arguments by first placing them in a buffer and taking
the argument in the first non-empty buffer as the argument to process.
The buffer is there to allow "splitting" an argument into multiple
arguments (currently up to five arguments), e.g. "-Wl,-R/path1:/path2"
is split into "-Wl,-R/path1" and "-Wl,-R/path2". Each split argument
is placed into a buffer. Using a buffer lets us read and process all
of the arguments in a single pass despite "pushing" more arguments
onto the front of the argument array.
diffstat:
mk/buildlink3/bsd.buildlink3.mk | 13 ++++++-
mk/buildlink3/buffer | 71 +++++++++++++++++++++++++++++++++++++++++
mk/buildlink3/libtool.sh | 20 ++++++-----
mk/buildlink3/wrapper.sh | 14 ++++---
4 files changed, 102 insertions(+), 16 deletions(-)
diffs (229 lines):
diff -r 92cc5296fad4 -r dfb0c91f4226 mk/buildlink3/bsd.buildlink3.mk
--- a/mk/buildlink3/bsd.buildlink3.mk Thu Oct 09 08:19:47 2003 +0000
+++ b/mk/buildlink3/bsd.buildlink3.mk Thu Oct 09 12:15:15 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.26 2003/10/08 09:11:33 jlam Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.27 2003/10/09 12:15:15 jlam Exp $
#
# An example package buildlink3.mk file:
#
@@ -829,6 +829,7 @@
_BLNK_WRAP_ENV?= ${BUILDLINK_WRAPPER_ENV}
_BLNK_WRAP_BUILDCMD= ${BUILDLINK_DIR}/bin/.buildcmd
_BLNK_WRAP_QUOTEARG= ${BUILDLINK_DIR}/bin/.quotearg
+_BLNK_WRAP_BUFFER= ${BUILDLINK_DIR}/bin/.buffer
_BLNK_WRAP_MARSHALL= ${BUILDLINK_DIR}/bin/.marshall
_BLNK_WRAP_PRE_CACHE= ${BUILDLINK_DIR}/bin/.pre-cache
_BLNK_WRAP_CACHE_ADD= ${BUILDLINK_DIR}/bin/.cache-add
@@ -857,6 +858,7 @@
_BLNK_WRAP_ENV.${_wrappee_}= ${_BLNK_WRAP_ENV}
_BLNK_WRAP_BUILDCMD.${_wrappee_}= ${_BLNK_WRAP_BUILDCMD}
_BLNK_WRAP_QUOTEARG.${_wrappee_}= ${_BLNK_WRAP_QUOTEARG}
+_BLNK_WRAP_BUFFER.${_wrappee_}= ${_BLNK_WRAP_BUFFER}
_BLNK_WRAP_MARSHALL.${_wrappee_}= ${_BLNK_WRAP_MARSHALL}
_BLNK_WRAP_PRIVATE_PRE_CACHE.${_wrappee_}= ${_BLNK_EMPTY_FILE}
_BLNK_WRAP_PRIVATE_CACHE_ADD.${_wrappee_}= ${_BLNK_EMPTY_FILE}
@@ -993,6 +995,7 @@
-e "s|@_BLNK_WRAP_EXTRA_FLAGS@|${_BLNK_WRAP_EXTRA_FLAGS.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_BUILDCMD@|${_BLNK_WRAP_BUILDCMD.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_QUOTEARG@|${_BLNK_WRAP_QUOTEARG.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_BUFFER@|${_BLNK_WRAP_BUFFER.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_MARSHALL@|${_BLNK_WRAP_MARSHALL.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_PRIVATE_PRE_CACHE@|${_BLNK_WRAP_PRIVATE_PRE_CACHE.${_wrappee_}:Q}|g" \
-e "s|@_BLNK_WRAP_PRIVATE_CACHE_ADD@|${_BLNK_WRAP_PRIVATE_CACHE_ADD.${_wrappee_}:Q}|g" \
@@ -1013,6 +1016,7 @@
${_BLNK_WRAPPER_SH.${_wrappee_}} \
${_BLNK_WRAP_BUILDCMD.${_wrappee_}} \
${_BLNK_WRAP_QUOTEARG.${_wrappee_}} \
+ ${_BLNK_WRAP_BUFFER.${_wrappee_}} \
${_BLNK_WRAP_MARSHALL.${_wrappee_}} \
${_BLNK_WRAP_PRIVATE_CACHE.${_wrappee_}} \
${_BLNK_WRAP_CACHE.${_wrappee_}} \
@@ -1128,6 +1132,13 @@
| ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
.endif
+.if !target(${_BLNK_WRAP_BUFFER})
+${_BLNK_WRAP_BUFFER}: ${.CURDIR}/../../mk/buildlink3/buffer
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+.endif
+
.if !target(${_BLNK_WRAP_MARSHALL})
${_BLNK_WRAP_MARSHALL}: ${.CURDIR}/../../mk/buildlink3/marshall
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
diff -r 92cc5296fad4 -r dfb0c91f4226 mk/buildlink3/buffer
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/buildlink3/buffer Thu Oct 09 12:15:15 2003 +0000
@@ -0,0 +1,71 @@
+# $NetBSD: buffer,v 1.1 2003/10/09 12:15:15 jlam Exp $
+#
+# Fill the buffer if it's empty, and shift the arguments. The next
+# argument checked by the cache and logic files is taken from the
+# first non-empty buffer. We avoid using "eval" so that we can skip
+# having to specially quote the argument using "sed".
+#
+case ${buf1}${buf2}${buf3}${buf4}${buf5} in
+"")
+ arg="$1"; shift
+ #
+ # Marshall any group of consecutive arguments into a single
+ # $arg to be checked in the cache and logic files.
+ #
+ . $marshall
+ #
+ # Fill the buffers from $arg.
+ #
+ case $arg in
+ -Wl,-R*:*|-Wl,-rpath,*:*|-Wl,-rpath-link,*:*|\
+ -Wl,--rpath,*:*|-Wl,--rpath-link,*:*)
+ #
+ # Change "-Wl,-R/path1:/path2:/path3" into
+ # "-Wl,-R/path1 -Wl,-R/path2 -Wl,-R/path3" so that
+ # they can be checked correctly in the cache and logic
+ # files.
+ #
+ case $arg in
+ -Wl,-R*) R="-Wl,-R" ;;
+ -Wl,-rpath,*) R="-Wl,-rpath," ;;
+ -Wl,-rpath-link,*) R="-Wl,-rpath-link," ;;
+ -Wl,--rpath,*) R="-Wl,--rpath," ;;
+ -Wl,--rpath-link,*) R="-Wl,--rpath-link," ;;
+ esac
+ arg=`$echo "X$arg" | $Xsed -e "s|^"$R"||g"`
+ allargs="$@"
+ save_IFS="${IFS}"; IFS=":"
+ set -- $arg
+ while $test $# -gt 0; do
+ if $test -z "$buf1"; then buf1="$R$1"; shift
+ elif $test -z "$buf2"; then buf2="$R$1"; shift
+ elif $test -z "$buf3"; then buf3="$R$1"; shift
+ elif $test -z "$buf4"; then buf4="$R$1"; shift
+ elif $test -z "$buf5"; then buf5="$R$1"; shift
+ fi
+ done
+ IFS="${save_IFS}"
+ if $test -n "$allargs"; then
+ set -- $allargs
+ fi
+ ;;
+ *)
+ if $test -z "$buf1"; then buf1="$arg"
+ elif $test -z "$buf2"; then buf2="$arg"
+ elif $test -z "$buf3"; then buf3="$arg"
+ elif $test -z "$buf4"; then buf4="$arg"
+ elif $test -z "$buf5"; then buf5="$arg"
+ fi
+ ;;
+ esac
+ ;;
+esac
+#
+# Re-fetch $arg from the first non-empty buffer.
+#
+if $test -n "$buf1"; then arg="$buf1"; buf1=
+elif $test -n "$buf2"; then arg="$buf2"; buf2=
+elif $test -n "$buf3"; then arg="$buf3"; buf3=
+elif $test -n "$buf4"; then arg="$buf4"; buf4=
+elif $test -n "$buf5"; then arg="$buf5"; buf5=
+fi
diff -r 92cc5296fad4 -r dfb0c91f4226 mk/buildlink3/libtool.sh
--- a/mk/buildlink3/libtool.sh Thu Oct 09 08:19:47 2003 +0000
+++ b/mk/buildlink3/libtool.sh Thu Oct 09 12:15:15 2003 +0000
@@ -1,12 +1,13 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: libtool.sh,v 1.5 2003/10/03 19:39:19 jlam Exp $
+# $NetBSD: libtool.sh,v 1.6 2003/10/09 12:15:15 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
buildcmd="@_BLNK_WRAP_BUILDCMD@"
quotearg="@_BLNK_WRAP_QUOTEARG@"
+buffer="@_BLNK_WRAP_BUFFER@"
marshall="@_BLNK_WRAP_MARSHALL@"
private_pre_cache="@_BLNK_WRAP_PRIVATE_PRE_CACHE@"
private_cache_add="@_BLNK_WRAP_PRIVATE_CACHE_ADD@"
@@ -35,6 +36,9 @@
WRKDIR="@WRKDIR@"
WRKSRC="@WRKSRC@"
+# Argument buffers
+buf1=; buf2=; buf3=; buf4=; buf5=
+
mode=link
prevopt=
nonopt=
@@ -101,9 +105,13 @@
done
;;
*)
- while $test $# -gt 0; do
- arg="$1"; shift
+ while $test $# -gt 0 -o -n "${buf1}${buf2}${buf3}${buf4}${buf5}"; do
skipargs=0
+ #
+ # Get the next argument from the buffer.
+ #
+ . $buffer
+
case $arg in
--fix-la)
. $libtool_fix_la
@@ -121,12 +129,6 @@
cachehit=no
skipcache=no
#
- # Marshall any group of consecutive arguments into
- # a single $arg to be checked in the cache and
- # logic files.
- #
- . $marshall
- #
# Check the private cache, and possibly set
# skipcache=yes.
#
diff -r 92cc5296fad4 -r dfb0c91f4226 mk/buildlink3/wrapper.sh
--- a/mk/buildlink3/wrapper.sh Thu Oct 09 08:19:47 2003 +0000
+++ b/mk/buildlink3/wrapper.sh Thu Oct 09 12:15:15 2003 +0000
@@ -1,12 +1,13 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: wrapper.sh,v 1.4 2003/10/03 19:39:19 jlam Exp $
+# $NetBSD: wrapper.sh,v 1.5 2003/10/09 12:15:15 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
buildcmd="@_BLNK_WRAP_BUILDCMD@"
quotearg="@_BLNK_WRAP_QUOTEARG@"
+buffer="@_BLNK_WRAP_BUFFER@"
marshall="@_BLNK_WRAP_MARSHALL@"
private_pre_cache="@_BLNK_WRAP_PRIVATE_PRE_CACHE@"
private_cache_add="@_BLNK_WRAP_PRIVATE_CACHE_ADD@"
@@ -33,17 +34,18 @@
WRKDIR="@WRKDIR@"
WRKSRC="@WRKSRC@"
+# Argument buffers
+buf1=; buf2=; buf3=; buf4=; buf5=
+
cmd="@WRAPPEE@ @_BLNK_WRAP_EXTRA_FLAGS@"
-while $test $# -gt 0; do
- arg="$1"; shift
+while $test $# -gt 0 -o -n "${buf1}${buf2}${buf3}${buf4}${buf5}"; do
cachehit=no
skipcache=no
skipargs=0
#
- # Marshall any group of consecutive arguments into a single
- # $arg to be checked in the cache and logic files.
+ # Get the next argument from the buffer.
#
- . $marshall
+ . $buffer
#
# Check the private cache, and possibly set skipcache=yes.
#
Home |
Main Index |
Thread Index |
Old Index