summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam>2004-01-29 07:14:30 +0000
committerjlam <jlam>2004-01-29 07:14:30 +0000
commitdbd17fb68bf493fba37599fd27e7ae3f8890c8ca (patch)
tree904d21bf9c8a684849ff07c81e1f63ce6eaeb1e4
parent5ec859c4070010eb38f8767ff577e29be00fe6d5 (diff)
downloadpkgsrc-dbd17fb68bf493fba37599fd27e7ae3f8890c8ca.tar.gz
Use a stack instead of the broken implementation of a circular list for the
argument buffer.
-rw-r--r--mk/buildlink3/buffer50
-rw-r--r--mk/buildlink3/libtool.sh8
-rw-r--r--mk/buildlink3/wrapper.sh8
3 files changed, 25 insertions, 41 deletions
diff --git a/mk/buildlink3/buffer b/mk/buildlink3/buffer
index 65e562f16d6..52df6f4d8b4 100644
--- a/mk/buildlink3/buffer
+++ b/mk/buildlink3/buffer
@@ -1,12 +1,10 @@
-# $NetBSD: buffer,v 1.4 2004/01/27 08:23:45 jlam Exp $
+# $NetBSD: buffer,v 1.5 2004/01/29 07:14:30 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".
+# Push arguments onto the argument stack and shift the arguments. The
+# next argument checked by the cache and logic files is take from the
+# the top of the stack.
#
-case ${buf1}${buf2}${buf3}${buf4}${buf5} in
-"")
+if $test -z "$depth"; then
arg="$1"; shift
#
# Marshall any group of consecutive arguments into a single
@@ -41,16 +39,8 @@ case ${buf1}${buf2}${buf3}${buf4}${buf5} in
while $test $# -gt 0; do
case "$dirlist" in
"$1"|"$1 "*) ;;
- *" $1 "*|*" $1") ;;
- *) dirlist="$dirlist $1"
- if $test -z "$buf1"; then buf1="$R$1"
- elif $test -z "$buf2"; then buf2="$R$1"
- elif $test -z "$buf3"; then buf3="$R$1"
- elif $test -z "$buf4"; then buf4="$R$1"
- elif $test -z "$buf5"; then buf5="$R$1"
- else exit 2
- fi
- ;;
+ *" $1 "*|*" $1") ;;
+ *) dirlist="$1 $dirlist" ;;
esac
shift
done
@@ -58,25 +48,19 @@ case ${buf1}${buf2}${buf3}${buf4}${buf5} in
if $test -n "$allargs"; then
set -- $allargs
fi
+ for dir in $dirlist; do
+ depth=${depth}0
+ eval stack${depth}="\$R\$dir"
+ done
;;
*)
- 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"
- else exit 2
- fi
+ depth=${depth}0
+ eval stack${depth}="\$arg"
;;
esac
- ;;
-esac
+fi
#
-# Re-fetch $arg from the first non-empty buffer.
+# Re-fetch $arg from the top of the stack.
#
-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
+eval arg="\$stack${depth}"
+depth=${depth%0}
diff --git a/mk/buildlink3/libtool.sh b/mk/buildlink3/libtool.sh
index 261a2d4cf85..d4e1247a003 100644
--- a/mk/buildlink3/libtool.sh
+++ b/mk/buildlink3/libtool.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: libtool.sh,v 1.12 2004/01/29 06:06:41 jlam Exp $
+# $NetBSD: libtool.sh,v 1.13 2004/01/29 07:14:30 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
@@ -37,8 +37,8 @@ BUILDLINK_DIR="@BUILDLINK_DIR@"
WRKDIR="@WRKDIR@"
WRKSRC="@WRKSRC@"
-# Argument buffers
-buf1=; buf2=; buf3=; buf4=; buf5=
+# Argument stack depth
+depth=
original_cmd="$0 $@"
$echo [*] $original_cmd >> $wrapperlog
@@ -112,7 +112,7 @@ install)
done
;;
*)
- while $test $# -gt 0 -o -n "${buf1}${buf2}${buf3}${buf4}${buf5}"; do
+ while $test $# -gt 0 -o -n "$depth"; do
skipargs=0
#
# Get the next argument from the buffer.
diff --git a/mk/buildlink3/wrapper.sh b/mk/buildlink3/wrapper.sh
index 06f96ec3acc..730e2057a9d 100644
--- a/mk/buildlink3/wrapper.sh
+++ b/mk/buildlink3/wrapper.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: wrapper.sh,v 1.8 2004/01/29 06:06:41 jlam Exp $
+# $NetBSD: wrapper.sh,v 1.9 2004/01/29 07:14:30 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
@@ -34,8 +34,8 @@ BUILDLINK_DIR="@BUILDLINK_DIR@"
WRKDIR="@WRKDIR@"
WRKSRC="@WRKSRC@"
-# Argument buffers
-buf1=; buf2=; buf3=; buf4=; buf5=
+# Argument stack depth
+depth=
original_cmd="$0 $@"
$echo [*] $original_cmd >> $wrapperlog
@@ -44,7 +44,7 @@ cmd="@WRAPPEE@"
ldflags=
libs=
set -- "$@" @_BLNK_WRAP_EXTRA_FLAGS@
-while $test $# -gt 0 -o -n "${buf1}${buf2}${buf3}${buf4}${buf5}"; do
+while $test $# -gt 0 -o -n "$depth"; do
cachehit=no
skipcache=no
skipargs=0