libtool-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 5/7] Convert POSIX file names to toolchain format for MSVC


From: Peter Rosin
Subject: Re: [PATCH 5/7] Convert POSIX file names to toolchain format for MSVC
Date: Tue, 07 Sep 2010 07:15:33 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2

Den 2010-09-06 22:18 skrev Ralf Wildenhues:
> * Peter Rosin wrote on Mon, Sep 06, 2010 at 09:34:02PM CEST:
>> Den 2010-09-06 20:42 skrev Ralf Wildenhues:
>>> * Peter Rosin wrote on Mon, Sep 06, 2010 at 08:38:31PM CEST:
>>>> I think I want to do
>>>>
>>>> +    func_to_tool_file "$output_objdir/"
>>>> +    tool_output_objdir=$func_to_tool_file_result
>>>>
>>>> and
>>>>
>>>> +    $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs 
>>>> "@$tool_output_objdir$soname.exp" -Wl,-DLL~
>>>
>>> I'm not sure why you replace the second $output_objdir/ instance but not
>>> the first one in this line?
>>
>> I'm not sure it's a good reason, but there is zero chance of this
>> code path in libtool working without 'compile'. The first conversion
>> is handled by 'compile' and as a rule of thumb I have converted as
>> late as possible.
> 
> I think as a general rule that is fine, but here ...
> 
>> Maybe libtool is faster at converting though,
>> since it doesn't need to look up what conversion to perform?
> 
> ... not just that: it has already converted the exact same string
> before, namely $tool_output_objdir.  Adding this:
> 
>> From a correctness POV, it doesn't matter.
> 
> I think you should just reuse the result you already have, here.

Ok, I'm going that way. The testsuite behaved well, so pushing as
below.

Cheers,
Peter

>From 25d44a7ae02548f1cc834e5a251fa3611643cf7d Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Tue, 7 Sep 2010 07:04:49 +0200
Subject: Convert POSIX file names to toolchain format for MSVC

* libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG)
[cygwin, mingw, pw32, cegcc] <cl*, postlink_cmds>: Make
sure the -outputresource: file name for the manifest tool is
in w32 format.
<cl*, archive_expsym_cmds>: Likewise for the MSVC command file
containing the exports and the output file name.
* libltdl/config/ltmain.m4sh (func_mode_link): Precalculate the
toolchain format of the output_objdir file name and store it in
the tool_output_objdir variable. Also replace any occurrence of
@TOOL_OUTPUT@ in postlink_cmds with the toolchain version of the
@OUTPUT@ content.
* doc/libtool.texi (libtool script content): Update description
of postlink_cmds to mention @address@hidden

Signed-off-by: Peter Rosin <address@hidden>
---
 ChangeLog                  |   17 +++++++++++++++++
 doc/libtool.texi           |    9 +++++----
 libltdl/config/ltmain.m4sh |   11 ++++++++---
 libltdl/m4/libtool.m4      |   21 +++++++++++++++------
 4 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f177fdc..5af41fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-07  Peter Rosin  <address@hidden>
+
+       Convert POSIX file names to toolchain format for MSVC
+       * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG)
+       [cygwin, mingw, pw32, cegcc] <cl*, postlink_cmds>: Make
+       sure the -outputresource: file name for the manifest tool is
+       in w32 format.
+       <cl*, archive_expsym_cmds>: Likewise for the MSVC command file
+       containing the exports and the output file name.
+       * libltdl/config/ltmain.m4sh (func_mode_link): Precalculate the
+       toolchain format of the output_objdir file name and store it in
+       the tool_output_objdir variable. Also replace any occurrence of
+       @TOOL_OUTPUT@ in postlink_cmds with the toolchain version of the
+       @OUTPUT@ content.
+       * doc/libtool.texi (libtool script content): Update description
+       of postlink_cmds to mention @address@hidden
+
 2010-09-06  Peter Rosin  <address@hidden>
 
        Use func_to_tool_file instead of fix_srcfile_path.
diff --git a/doc/libtool.texi b/doc/libtool.texi
index 5a76e26..7d7eb76 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -6747,11 +6747,12 @@ Commands run after uninstalling a shared or static 
library, respectively.
 
 @defvar postlink_cmds
 Commands necessary for finishing linking programs. @code{postlink_cmds}
-are executed immediately after the program is linked. Any occurance of
+are executed immediately after the program is linked.  Any occurrence of
 the string @code{@@OUTPUT@@} in @code{postlink_cmds} is replaced by the
-name of the created executable (i.e. not the wrapper, if a wrapper is
-generated) prior to execution. Normally disabled (i.e.
address@hidden empty).
+name of the created executable (i.e.@: not the wrapper, if a wrapper is
+generated) prior to execution.  Similarly, @code{@@TOOL_OUTPUT@@} is
+replaced by the toolchain format of @{@@OUTPUT@@}.  Normally disabled
+(i.e.@: @code{postlink_cmds} empty).
 @end defvar
 
 @defvar reload_cmds
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index e5867b6..1a7bd96 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -5196,6 +5196,8 @@ func_mode_link ()
 
     func_dirname "$output" "/" ""
     output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
     func_mkdir_p "$output_objdir"
 
@@ -8051,7 +8053,8 @@ EOF
        func_show_eval "$link_command" 'exit_status=$?'
 
        if test -n "$postlink_cmds"; then
-         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 
'address@hidden@%'"$output"'%g'`
+         func_to_tool_file "$output"
+         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 
'address@hidden@%'"$output"'%g' -e 
'address@hidden@%'"$func_to_tool_file_result"'%g'`
          func_execute_cmds "$postlink_cmds" 'exit $?'
        fi
 
@@ -8102,7 +8105,8 @@ EOF
        func_show_eval "$link_command" 'exit $?'
 
        if test -n "$postlink_cmds"; then
-         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 
'address@hidden@%'"$output"'%g'`
+         func_to_tool_file "$output"
+         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 
'address@hidden@%'"$output"'%g' -e 
'address@hidden@%'"$func_to_tool_file_result"'%g'`
          func_execute_cmds "$postlink_cmds" 'exit $?'
        fi
 
@@ -8140,7 +8144,8 @@ EOF
       func_show_eval "$link_command" 'exit $?'
 
       if test -n "$postlink_cmds"; then
-       postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 
'address@hidden@%'"$output_objdir/$outputname"'%g'`
+       func_to_tool_file "$output_objdir/$outputname"
+       postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 
'address@hidden@%'"$output_objdir/$outputname"'%g' -e 
'address@hidden@%'"$func_to_tool_file_result"'%g'`
        func_execute_cmds "$postlink_cmds" 'exit $?'
       fi
 
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 132dd2c..ba48ce3 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -5004,7 +5004,7 @@ _LT_EOF
          else
            sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < 
$export_symbols > $output_objdir/$soname.exp;
          fi~
-         $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs 
@$output_objdir/$soname.exp -Wl,-DLL~
+         $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs 
"@$tool_output_objdir$soname.exp" -Wl,-DLL~
          linknames='
        # The linker will not automatically build a static lib if we build a 
DLL.
        # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
@@ -5013,12 +5013,16 @@ _LT_EOF
        # Don't use ranlib
        _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
        _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+         lt_tool_outputfile="@TOOL_OUTPUT@"~
          case $lt_outputfile in
            *.exe|*.EXE) ;;
-           *) lt_outputfile="$lt_outputfile.exe" ;;
+           *)
+             lt_outputfile="$lt_outputfile.exe"
+             lt_tool_outputfile="$lt_tool_outputfile.exe"
+             ;;
          esac~
          if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; 
then
-           $MANIFEST_TOOL -manifest "$lt_outputfile.manifest" 
-outputresource:"$lt_outputfile" || exit 1;
+           $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" 
-outputresource:"$lt_tool_outputfile" || exit 1;
            $RM "$lt_outputfile.manifest";
          fi'
        ;;
@@ -5999,7 +6003,7 @@ if test "$_lt_caught_CXX_error" != yes; then
            else
              $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < 
$export_symbols > $output_objdir/$soname.exp;
            fi~
-           $CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs 
@$output_objdir/$soname.exp -Wl,-DLL~
+           $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs 
"@$tool_output_objdir$soname.exp" -Wl,-DLL~
            linknames='
          # The linker will not automatically build a static lib if we build a 
DLL.
          # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
@@ -6007,12 +6011,17 @@ if test "$_lt_caught_CXX_error" != yes; then
          # Don't use ranlib
          _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
          _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+           lt_tool_outputfile="@TOOL_OUTPUT@"~
            case $lt_outputfile in
              *.exe|*.EXE) ;;
-             *) lt_outputfile="$lt_outputfile.exe" ;;
+             *)
+               lt_outputfile="$lt_outputfile.exe"
+               lt_tool_outputfile="$lt_tool_outputfile.exe"
+               ;;
            esac~
+           func_to_tool_file "$lt_outputfile"~
            if test "$MANIFEST_TOOL" != ":" && test -f 
"$lt_outputfile.manifest"; then
-             $MANIFEST_TOOL -manifest "$lt_outputfile.manifest" 
-outputresource:"$lt_outputfile" || exit 1;
+             $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" 
-outputresource:"$lt_tool_outputfile" || exit 1;
              $RM "$lt_outputfile.manifest";
            fi'
          ;;
-- 
1.7.1




reply via email to

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