Den 2010-09-05 23:27 skrev Ralf Wildenhues: > * Peter Rosin wrote on Sun, Sep 05, 2010 at 10:01:42PM CEST: >> From 449723f9bdcad6946e098d7acf0f215f3a4c18a2 Mon Sep 17 00:00:00 2001 >> From: Peter Rosin <p...@lysator.liu.se> >> Date: Sun, 5 Sep 2010 17:53:35 +0200 >> Subject: [PATCH 5/7] Convert POSIX file names to toolchain format for MSVC >> >> * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG) > > I usually stick <archive_cmds, archive_expsyms_cmds> in here somewhere.
Is the below ChangeLog ok? <cl*, postlink_cmds> seems a bit odd since cl* and postlink_cmds are not of the same class... >> [mingw] <cl>: Make sure the -outputresource: file name for the >> manifest tool is in Win32 format. Same for the MSVC command file >> containing the exports. > > Actually, I think this is a wee bit ugly. The *_cmds variables are > echoed back to the user, who ideally is supposed to be able to cut and > paste them for debugging purposes (at least after running the mode=link > with RM="echo " or so). That won't work with internal function names. Ah, indeed. > Would it easily be possible to do the name conversions inside ltmain > before invoking the commands? Easily? Is this something like this what you had in mind? (untested) Cheers, Peter >From 057fc5e004b15ff034d3e80cc3801292aa84b52d Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Mon, 6 Sep 2010 11:09:59 +0200 Subject: [PATCH 5/7] 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 Win32 format. <cl*, archive_expsym_cmds>: Likewise for the MSVC command file containing the exports. * 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 occurance 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 @tool_out...@. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 17 +++++++++++++++++ doc/libtool.texi | 5 +++-- libltdl/config/ltmain.m4sh | 11 ++++++++--- libltdl/m4/libtool.m4 | 21 +++++++++++++++------ 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index f177fdc..d4d0c24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2010-09-06 Peter Rosin <p...@lysator.liu.se> + 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 Win32 format. + <cl*, archive_expsym_cmds>: Likewise for the MSVC command file + containing the exports. + * 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 occurance 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 @tool_out...@. + +2010-09-06 Peter Rosin <p...@lysator.liu.se> + Use func_to_tool_file instead of fix_srcfile_path. * libltdl/config/ltmain.m4sh (func_mode_compile): Replace the fix_srcfile_path hook with a call to func_to_tool_file. diff --git a/doc/libtool.texi b/doc/libtool.texi index 5a76e26..d473730 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -6750,8 +6750,9 @@ Commands necessary for finishing linking programs. @code{postlink_cmds} are executed immediately after the program is linked. Any occurance 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. -...@code{postlink_cmds} empty). +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..cd15140 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 's...@output@%'"$output"'%g'` + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's...@output@%'"$output"'%g' -e 's...@tool_output@%'"$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 's...@output@%'"$output"'%g'` + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's...@output@%'"$output"'%g' -e 's...@tool_output@%'"$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 's...@output@%'"$output_objdir/$outputname"'%g'` + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's...@output@%'"$output_objdir/$outputname"'%g' -e 's...@tool_output@%'"$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..e54ae3d 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 $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 $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