libtool-patches
[Top][All Lists]
Advanced

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

patch for building fat libraries on darwin


From: Peter O'Gorman
Subject: patch for building fat libraries on darwin
Date: Tue, 20 Jan 2004 09:22:53 +0900
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4

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

Hi,
This has been sitting on my system for a month or so, better do someting
with it :)
Ranlibed fat archives are no longer usable by ar on darwin, and ld -r when
given a fat object as input will happily create a thin output object.

~       * ltmain.in (darwin): When building a fat convenience library,
~       make a copy that is not ranlibed. Use the non-ranlibed copy when
~       we need to ar -x the archive.
~       * m4/libtool.m4 (AC_PROG_LD_RELOAD_FLAG): On darwin change the
~       reload_cmds to use $CC, otherwise ld will thin out any fat
~       objects.

Okay to commit?

Peter
- --
Peter O'Gorman - http://www.pogma.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQCVAwUBQAx03LiDAg3OZTLPAQKspQQAr6jfO7HYvmMOeQAK9k03IT29Erbq29AX
XinehHEVdFK6N5Zs+TGGf62v8vW6Ig93B+ZjQBEw8Lc5KXpO0DO6y4UKo54VmxGl
fMr4LhbFBbOEX4YyY7oV4K0xMOLQAZjNsZzi0WnotGmm6BaGXtXi2nPAgsI6gkqb
BvpKlioUMrw=
=XKgZ
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvsroot/libtool/libtool/ChangeLog,v
retrieving revision 1.1380
diff -u -3 -p -u -r1.1380 ChangeLog
--- ChangeLog   19 Jan 2004 04:57:26 -0000      1.1380
+++ ChangeLog   19 Jan 2004 14:00:10 -0000
@@ -0,0 +1,9 @@
+2004-01-20  Peter O'Gorman  <address@hidden>
+
+       * ltmain.in (darwin): When building a fat convenience library, 
+       make a copy that is not ranlibed. Use the non-ranlibed copy when
+       we need to ar -x the archive.
+       * m4/libtool.m4 (AC_PROG_LD_RELOAD_FLAG): On darwin change the
+       reload_cmds to use $CC, otherwise ld will thin out any fat 
+       objects.
+
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.368
diff -u -3 -p -u -r1.368 ltmain.in
--- ltmain.in   19 Jan 2004 04:57:26 -0000      1.368
+++ ltmain.in   19 Jan 2004 14:00:13 -0000
@@ -3748,7 +3748,7 @@ EOF
              esac
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
              xdir="$gentop/$xlib"
-
+             test -f "${xabs}-darwin-no-ranlib.a" && 
xabs="${xabs}-darwin-no-ranlib.a"  && xlib="${xlib}-darwin-no-ranlib.a"
              $show "${rm}r $xdir"
              $run ${rm}r "$xdir"
              $show "$mkdir $xdir"
@@ -4047,7 +4047,7 @@ EOF
            esac
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
            xdir="$gentop/$xlib"
-
+           test -f "${xabs}-darwin-no-ranlib.a" && 
xabs="${xabs}-darwin-no-ranlib.a"  && xlib="${xlib}-darwin-no-ranlib.a"
            $show "${rm}r $xdir"
            $run ${rm}r "$xdir"
            $show "$mkdir $xdir"
@@ -5190,7 +5190,7 @@ fi\
          esac
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
          xdir="$gentop/$xlib"
-
+         test -f "${xabs}-darwin-no-ranlib.a" && 
xabs="${xabs}-darwin-no-ranlib.a"  && xlib="${xlib}-darwin-no-ranlib.a"
          $show "${rm}r $xdir"
          $run ${rm}r "$xdir"
          $show "$mkdir $xdir"
@@ -5305,6 +5305,30 @@ fi\
       done
       IFS="$save_ifs"
     done
+
+    case $host in
+      *-*-darwin*)
+       if test "$build_libtool_libs" = no; then
+         if lipo -info $oldlib 2> /dev/null | grep '^Architectures' 2>&1 > 
/dev/null ; then
+         # fat file, create another convenience library without RANLIBing it
+           save_oldlib=$oldlib
+           save_RANLIB=$RANLIB
+           RANLIB=:
+           oldlib="${oldlib}-darwin-no-ranlib.a"
+           save_ifs="$IFS"; IFS='~'
+           for cmd in $cmds; do
+             eval cmd=\"$cmd\"
+             IFS="$save_ifs"
+             $show "$cmd"
+             $run eval "$cmd" || exit $?
+           done
+           oldlib=$save_oldlib
+           RANLIB=$save_RANLIB
+           IFS="$save_ifs"
+         fi
+       fi
+       ;;
+    esac
 
     if test -n "$generated"; then
       $show "${rm}r$generated"
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.31
diff -u -3 -p -u -r1.31 libtool.m4
--- m4/libtool.m4       15 Jan 2004 08:36:48 -0000      1.31
+++ m4/libtool.m4       19 Jan 2004 14:00:14 -0000
@@ -2507,7 +2507,10 @@ case $reload_flag in
 *) reload_flag=" $reload_flag" ;;
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
-
+case $host_os in
+  darwin*)
+    reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs'
+esac
 _LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
 _LT_DECL([], [reload_cmds], [2])dnl
 ])# AC_PROG_LD_RELOAD_FLAG

reply via email to

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