summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-01-30 13:44:52 +0000
committerjlam <jlam@pkgsrc.org>2004-01-30 13:44:52 +0000
commitda09d28be683a6014a86aa8319914949a5470e3c (patch)
tree0fcfc51058b52cc4b0fdde27eddd73fbcdcca885
parent4d57bcc846a5d87b60e6aec6f59567b8ece19b99 (diff)
downloadpkgsrc-da09d28be683a6014a86aa8319914949a5470e3c.tar.gz
Use the stack in a smarter way. Take an argument (perhaps marshalling
several arguments together) from the command line and push it onto the stack. Pop the top off the stack, process, and push replacement arguments onto the stack. Repeat the last step until no more processing is done, and we have our final argument to be passed on through to the rest of the wrapper script.
-rw-r--r--mk/buildlink3/buffer57
1 files changed, 30 insertions, 27 deletions
diff --git a/mk/buildlink3/buffer b/mk/buildlink3/buffer
index a4bcca51883..4d6d743790e 100644
--- a/mk/buildlink3/buffer
+++ b/mk/buildlink3/buffer
@@ -1,4 +1,4 @@
-# $NetBSD: buffer,v 1.6 2004/01/29 07:19:00 jlam Exp $
+# $NetBSD: buffer,v 1.7 2004/01/30 13:44:52 jlam Exp $
#
# Push arguments onto the argument stack and shift the arguments. The
# next argument checked by the cache and logic files is take from the
@@ -12,17 +12,30 @@ if $test -z "$depth"; then
#
. $marshall
#
- # Fill the buffers from $arg.
+ # Push the argument onto the stack.
#
+ depth=${depth}0
+ eval stack${depth}="\$arg"
+fi
+
+argok=no
+while $test "$argok" = "no"; do
+ #
+ # Take $arg from the top of the stack.
+ #
+ eval arg="\$stack${depth}"
+ depth=${depth%0}
+ argok=yes
+
case $arg in
+ #
+ # Change "-<rpath_flag>/path1:/path2" into
+ # "-<rpath_flag>/path1 -<rpath_flag>/path2" so that
+ # they can be checked correctly in the cache and logic
+ # files.
+ #
-R*:*|-Wl,-R*:*|-Wl,-rpath,*:*|-Wl,-rpath-link,*:*|\
-Wl,--rpath,*:*|-Wl,--rpath-link,*:*)
- #
- # Change "-<rpath_flag>/path1:/path2" into
- # "-<rpath_flag>/path1 -<rpath_flag>/path2" so that
- # they can be checked correctly in the cache and logic
- # files.
- #
case $arg in
-R*) R="-R" ;;
-Wl,-R*) R="-Wl,-R" ;;
@@ -32,27 +45,17 @@ if $test -z "$depth"; then
-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
- depth=${depth}0
- eval stack${depth}="\$R\$1"
- shift
+ revarg=
+ for dir in $arg; do
+ revarg="$dir $revarg"
done
IFS="${save_IFS}"
- if $test -n "$allargs"; then
- set -- $allargs
- fi
- ;;
- *)
- depth=${depth}0
- eval stack${depth}="\$arg"
+ for dir in $revarg; do
+ depth=${depth}0
+ eval stack${depth}="\$R\$dir"
+ done
+ argok=no
;;
esac
-fi
-#
-# Re-fetch $arg from the top of the stack.
-#
-eval arg="\$stack${depth}"
-depth=${depth%0}
+done