add libtool --mode=finish mode for sysroot

* 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.
This commit is contained in:
Paolo Bonzini 2010-08-11 15:35:54 -04:00
parent 55e986b8b4
commit d32c96ccd6
3 changed files with 35 additions and 5 deletions

View File

@ -1721,12 +1721,18 @@ commands are also completed.
@cindex finish mode @cindex finish mode
@cindex mode, finish @cindex mode, finish
@dfn{Finish} mode helps system administrators install libtool libraries @dfn{Finish} mode has two functions. One is to help system administrators
so that they can be located and linked into user programs. 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.
Each @var{mode-arg} is interpreted as the name of a library directory. The second is to facilitate transferring libtool libraries to a native
Running this command may require superuser privileges, so the compilation environment after they were built in a cross-compilation
@option{--dry-run} option may be useful. 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 @node Uninstall mode
@section Uninstall mode @section Uninstall mode

View File

@ -1418,6 +1418,27 @@ func_mode_finish ()
fi fi
done 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 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
for libdir in $libdirs; do for libdir in $libdirs; do
if test -n "$finish_cmds"; then if test -n "$finish_cmds"; then

View 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([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
AT_CHECK([test -f $sysroot/$prefix/bin/prog$EXEEXT]) AT_CHECK([test -f $sysroot/$prefix/bin/prog$EXEEXT])
AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"], [1]) 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 # missing tests
# 1) pass absolute .la files # 1) pass absolute .la files