libtool-patches
[Top][All Lists]
Advanced

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

[PATCH-2.0] 51-peter-func_extract_an_archive-2.0.patch


From: Peter O'Gorman
Subject: [PATCH-2.0] 51-peter-func_extract_an_archive-2.0.patch
Date: Mon, 03 Jan 2005 23:07:42 +0000
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This is pretty much the same as HEAD but it lacks the tests. Okay to apply?

Peter
- --
Peter O'Gorman - http://www.pogma.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (Darwin)

iQCVAwUBQdnQPbiDAg3OZTLPAQKcVgQAl9bGqUkRA4BMWBdunyr09/2yAboi1Nvg
wydkAaZ20FmnGctGnCUwgI72DKGuBy0FON9bZ34NUF/oYdb+1n/NbsQcXEDQRm87
iALafRB1CgIzeylNLYuN4ONMZS+n/VAaoMg8RhsQI5YZoPgPRVYmY9UDFWHgPn8q
Z2ut/3BdmrQ=
=pxU0
-----END PGP SIGNATURE-----
Index: ChangeLog
2005-1-1  Peter O'Gorman  <address@hidden>

        * config/ltmain.m4sh (func_extract_archives,func_extract_an_archive): 
        On darwin, uniq can not take the flags -cd together, thanks to Ralf
        for the fix, also ar does not accept N, so we use the fact that
        ar x libfoo.a foo.o will always extract the first foo.o in the
        archive and we then delete foo.o from the archive, which will also
        delete only the first foo.o, then rinse and repeat.

from  Ralf Wildenhues  <address@hidden>
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.1.2.29
diff -u -3 -p -u -r1.1.2.29 ltmain.m4sh
--- config/ltmain.m4sh 28 Dec 2004 13:50:57 -0000 1.1.2.29
+++ config/ltmain.m4sh 1 Jan 2005 21:05:44 -0000
@@ -917,6 +917,46 @@ static const void *lt_preloaded_setup() 
     fi
 }
 
+# func_extract_an_archive dir oldlib
+func_extract_an_archive () {
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      f_ex_an_ar_lib=`$ECHO "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'`
+      func_warning "$modename: warning: object name conflicts; renaming object 
files" 1>&2
+      func_warning "$modename: warning: to ensure that they will not 
overwrite" 1>&2
+      $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib"
+      $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
+      $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c | while read count name
+      do
+       # We don't want to do anything to objects with unique names
+        test "$count" -eq 1 && continue
+       i=1
+       while test "$i" -le "$count"
+         do
+         # Put our $i before any first dot (extension)
+         # Never overwrite any file
+         name_to="$name"
+         while test "X$name_to" = "X$name" || test -f 
"$f_ex_an_ar_dir/$name_to"
+           do
+           name_to=`$ECHO "X$name_to" | $Xsed -e "s/\([[^.]]*\)/\1-$i/"`
+         done
+         $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $MV 
'$name' '$name_to' && $AR d $f_ex_an_ar_lib '$name')"
+         $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && 
$MV '$name' '$name_to' && $AR d \$f_ex_an_ar_lib '$name')" || exit $?
+         i=`expr $i + 1`
+       done
+      done
+      $show "$RM $f_ex_an_ar_dir/$f_ex_an_ar_lib"
+      $run eval "$RM \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
+    fi
+}
+
+
 # func_extract_archives gentop oldlib ...
 func_extract_archives () {
     $opt_debug
@@ -935,6 +975,7 @@ func_extract_archives () {
       esac
       my_xlib=`$ECHO "X$my_xlib" | $Xsed -e 's%^.*/%%'`
       my_xdir="$my_gentop/$my_xlib"
+      my_xdir="$my_gentop/$my_xlib"
 
       func_mkdir_p "$my_xdir"
 
@@ -948,7 +989,7 @@ func_extract_archives () {
          darwin_archive=$my_xabs
          darwin_curdir=`pwd`
          darwin_base_archive=`basename $darwin_archive`
-         darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP 
Architectures 2>/dev/null`
+         darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP 
Architectures 2>/dev/null || true`
          if test -n "$darwin_arches"; then
            darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
            darwin_arch=
@@ -957,12 +998,10 @@ func_extract_archives () {
              func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
              lipo -thin $darwin_arch -output 
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 
"${darwin_archive}"
              # Remove the table of contents from the thin files.
-             $AR -d 
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 
__.SYMDEF 2>/dev/null || true
-             $AR -d 
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 
__.SYMDEF\ SORTED 2>/dev/null || true
-             cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-             $AR -xo "${darwin_base_archive}"
-             $RM "${darwin_base_archive}"
-             cd "$darwin_curdir"
+             $AR d 
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 
__.SYMDEF 2>/dev/null || true
+             $AR d 
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 
__.SYMDEF\ SORTED 2>/dev/null || true
+             func_extract_an_archive 
"unfat-$$/${darwin_base_archive}-${darwin_arch}" "${darwin_base_archive}"
+             $RM 
"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
            done # $darwin_arches
             ## Okay now we've a bunch of thin objects, gotta fatten them up :)
            darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | 
$NL2SP`
@@ -976,39 +1015,12 @@ func_extract_archives () {
            cd "$darwin_orig_dir"
          else
            cd $darwin_orig_dir
-           (cd $my_xdir && $AR x $my_xabs) || exit $?
+           func_extract_an_archive "$my_xdir" "$my_xabs"
          fi # $darwin_arches
        fi # $run
       ;;
       *)
-       # We will extract separately just the conflicting names and we will
-       # no longer touch any unique names. It is faster to leave these
-       # extract automatically by $AR in one run.
-       $show "(cd $my_xdir && $AR x $my_xabs)"
-       $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
-       if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
-         :
-       else
-         func_warning "object name conflicts; renaming object files"
-         func_warning "to ensure that they will not overwrite"
-         $AR t "$my_xabs" | sort | uniq -cd | while read count name
-         do
-           i=1
-           while test "$i" -le "$count"
-           do
-             # Put our $i before any first dot (extension)
-             # Never overwrite any file
-             name_to="$name"
-             while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
-             do
-               name_to=`$ECHO "X$name_to" | $Xsed -e "s/\([[^.]]*\)/\1-$i/"`
-             done
-             $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $MV '$name' 
'$name_to')"
-             $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $MV 
'$name' '$name_to')" || exit $?
-             i=`expr $i + 1`
-           done
-         done
-       fi
+        func_extract_an_archive "$my_xdir" "$my_xabs"
        ;;
       esac
       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name 
\*.lo -print | $NL2SP`

reply via email to

[Prev in Thread] Current Thread [Next in Thread]