]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
add libtool --mode=finish mode for sysroot
authorPaolo Bonzini <bonzini@gnu.org>
Wed, 11 Aug 2010 19:35:54 +0000 (15:35 -0400)
committerPaolo Bonzini <bonzini@gnu.org>
Sun, 15 Aug 2010 16:45:39 +0000 (18:45 +0200)
* doc/libtool.texi (Finish mode): Document behavior when *.la files
are passed.
* libltdl/config/ltmain.m4sh (func_mode_finish): Eliminate sysroot
or `=' signs representing it from files in $libs.
* tests/sysroot.at (SYSROOT_TESTS): Test for presence of sysroot
references before running libtool --mode=finish, and for absence
afterwards.

doc/libtool.texi
libltdl/config/ltmain.m4sh
tests/sysroot.at

index 914bd1d8222e51246d267401d3b801af085e6d80..4b256bf03f2159536b5f8e460ca96aa367347c56 100644 (file)
@@ -1721,12 +1721,18 @@ commands are also completed.
 @cindex finish mode
 @cindex mode, finish
 
-@dfn{Finish} mode helps system administrators install libtool libraries
-so that they can be located and linked into user programs.
-
-Each @var{mode-arg} is interpreted as the name of a library directory.
-Running this command may require superuser privileges, so the
-@option{--dry-run} option may be useful.
+@dfn{Finish} mode has two functions.  One is to help system administrators
+install libtool libraries so that they can be located and linked into
+user programs.  To invoke this functionality, pass the name of a library
+directory as @var{mode-arg}.  Running this command may require superuser
+privileges, and the @option{--dry-run} option may be useful.
+
+The second is to facilitate transferring libtool libraries to a native
+compilation environment after they were built in a cross-compilation
+environment.  Cross-compilation environments may rely on recent libtool
+features, and running libtool in finish mode will make it easier to
+work with older versions of libtool.  This task is performed whenever
+the @var{mode-arg} is a @samp{.la} file.
 
 @node Uninstall mode
 @section Uninstall mode
index f9d62bee4779657f02680c4e2fee0f6250c1b7a7..d29fd5d81f11e7de59a71ff081e13a0676d704d5 100644 (file)
@@ -1418,6 +1418,27 @@ func_mode_finish ()
       fi
     done
 
+    if test -n "$libs"; then
+      tmpdir=`func_mktempdir`
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED 's/[].[^$\\*|]/\\\\&/g'`
+        sysroot_cmd="s|\([ ']\)$sysroot_regex|\1|g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      for lib in $libs; do
+       $opt_dry_run || {
+         sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+           > $tmpdir/tmp-la
+         mv -f $tmpdir/tmp-la $lib
+       }
+       file="$outputname"
+      done
+      $opt_dry_run || ${RM}r "$tmpdir"
+    fi
+
     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
       for libdir in $libdirs; do
        if test -n "$finish_cmds"; then
index 869c9c49e29a67e30bd7fbeb15eed7a9f0f3fcf9..c0ac6d166bd1a789c5b60b46bfa0a12e0459b527 100644 (file)
@@ -186,6 +186,9 @@ LT_AT_BOOTSTRAP([], [-I $abs_top_srcdir/libltdl/m4], [ignore],
 AT_CHECK([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
 AT_CHECK([test -f $sysroot/$prefix/bin/prog$EXEEXT])
 AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"], [1])
+AT_CHECK([grep "'.*=" $sysroot/$prefix/lib/lib2.la], [0], [ignore])
+AT_CHECK([./libtool --mode=finish $sysroot/$prefix/lib/lib@<:@12@:>@.la], [0], [ignore])
+AT_CHECK([grep "'.*=" $sysroot/$prefix/lib/lib@<:@12@:>@.la], [1])
 
 # missing tests
 # 1) pass absolute .la files