summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2003-09-09 09:11:42 +0000
committerjlam <jlam>2003-09-09 09:11:42 +0000
commit6bb7eff9da1191f2434844dac7e8178428b55c5e (patch)
tree2efb3f2525d6cce7670f46cc19e9000b8523d534 /mk
parentaf85bbd4e025c06359f04d05c5ea1074b738ab34 (diff)
downloadpkgsrc-6bb7eff9da1191f2434844dac7e8178428b55c5e.tar.gz
Document this file, and do the command length reduction by suppressing
repeated options as is done in in revision 1.3 of wrapper.sh.
Diffstat (limited to 'mk')
-rw-r--r--mk/buildlink3/libtool.sh50
1 files changed, 48 insertions, 2 deletions
diff --git a/mk/buildlink3/libtool.sh b/mk/buildlink3/libtool.sh
index 149833b602e..2dc4bc265b5 100644
--- a/mk/buildlink3/libtool.sh
+++ b/mk/buildlink3/libtool.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: libtool.sh,v 1.2 2003/09/02 06:59:59 jlam Exp $
+# $NetBSD: libtool.sh,v 1.3 2003/09/09 09:11:42 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
@@ -69,17 +69,63 @@ case "$1" in
*)
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.
+ #
. $private_cache
+ #
+ # Check the common cache shared by all of the other
+ # wrappers.
+ #
case $skipcache,$cachehit in
no,no) . $cache ;;
esac
+ #
+ # If the cache doesn't cover the arg we're
+ # examining, then run it through the
+ # transformations and cache the result.
+ #
case $cachehit in
no) . $logic ;;
esac
;;
esac
- cmd="$cmd $arg"
+ #
+ # Reduce command length by not appending options that we've
+ # already seen to the command.
+ #
+ case $arg in
+ -[DILR]*|-Wl,-R*|-Wl,-*,/*)
+ #
+ # These options are only ever useful the first time
+ # they're given. All other instances are redundant.
+ #
+ case "$cmd" in
+ *" "$arg|*" "$arg" "*) ;;
+ *) cmd="$cmd $arg" ;;
+ esac
+ ;;
+ -l*)
+ #
+ # Extra libraries are suppressed only if they're
+ # repeated, e.g. "-lm -lm -lm -lm" -> "-lm".
+ #
+ case "$cmd" in
+ *" "$arg) ;;
+ *) cmd="$cmd $arg" ;;
+ esac
+ ;;
+ *)
+ cmd="$cmd $arg"
+ ;;
+ esac
done
;;
esac