pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/buildlink3 Reduce length of command lines executed ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/280d8857827c
branches:  trunk
changeset: 460980:280d8857827c
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Mon Sep 08 21:10:26 2003 +0000

description:
Reduce length of command lines executed by not appending some options that
we've already seen:

-[DILR]*|-Wl,-R*|-Wl,-*,/*
        These are all only useful the first time we see them.  All other
        instances are redundant.

-l*
        Extra libraries are suppressed if they're repeated, e.g.,
        "-lm -lm -lm -lX11 -lX11 -lm -lm" -> "-lm -lX11 -lm".

The screen output is still likely to be very verbose, but you can check
in work/.work.log to see the actual commands executed.

diffstat:

 mk/buildlink3/wrapper.sh |  32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r 4e3e3e630aa3 -r 280d8857827c mk/buildlink3/wrapper.sh
--- a/mk/buildlink3/wrapper.sh  Mon Sep 08 20:06:55 2003 +0000
+++ b/mk/buildlink3/wrapper.sh  Mon Sep 08 21:10:26 2003 +0000
@@ -1,6 +1,6 @@
 #!@BUILDLINK_SHELL@
 #
-# $NetBSD: wrapper.sh,v 1.2 2003/09/02 07:00:03 jlam Exp $
+# $NetBSD: wrapper.sh,v 1.3 2003/09/08 21:10:26 jlam Exp $
 
 Xsed='@SED@ -e 1s/^X//'
 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
@@ -57,7 +57,35 @@
        case $cachehit in
        no)     . $logic ;;
        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
 
 @_BLNK_WRAP_ENV@



Home | Main Index | Thread Index | Old Index