libtool-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] [mingw] Add cross-compile support to cwrapper


From: Roumen Petrov
Subject: Re: [PATCH] [mingw] Add cross-compile support to cwrapper
Date: Tue, 27 May 2008 00:26:16 +0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080329 SeaMonkey/1.1.9

Charles Wilson wrote:
* libltdl/config/ltmain.m4sh (func_to_host_path) [$host=mingw]:
If present, use winepath to convert from $build to $host
if $build is neither mingw (msys) nor cygwin.  Use unconverted
path as fallback when conversion fails. Also update comments.
(func_to_host_pathlist) [$host=mingw]: Ditto. For fallback case,
use simplistic ':' to ';' path separator translation.
---
As pushed. This flushes my patch queue, with the exception of the (not yet written) 'add cross-to-cygwin support' for the cwrapper, and fixing the (apparently longstanding) bug just reported to bug-libtool:
http://article.gmane.org/gmane.comp.gnu.libtool.bugs/6362

But if Gary is planning a 2.2.6 release around the beginning of June, I don't think those two issues will be solved by then...but that's okay; current state is a significant improvement IMO over 2.2.2/2.2.4.


libltdl/config/ltmain.m4sh | 121 +++++++++++++++++++++++++++++++------------
 1 files changed, 87 insertions(+), 34 deletions(-)

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 888b74b..cfdfdf9 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2513,14 +2513,21 @@ func_emit_wrapper ()

 # func_to_host_path arg
[SNIP]


 # ARG is the path (on $build) that should be converted to
 # the proper representation for $host. The result is stored
@@ -2546,11 +2553,28 @@ func_to_host_path ()
             func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
               $SED -e "$lt_sed_naive_backslashify"`
             ;;
+          * )
+            # Unfortunately, winepath does not exit with a non-zero
+            # error code, so we are forced to check stderr for an
+            # error message. On the other hand, if the command is not
+            # found, the shell will set an exit code of 127. So we
+            # must check for both, which explains the odd construction:
+ func_to_host_path_winepath_stderr=`winepath -w "$1" >/dev/null 2>&1`
+            func_to_host_path_winepath_exitcode=$?
+            if test "$func_to_host_path_winepath_exitcode" -eq 0 &&\
+               test -z "${func_to_host_path_winepath_stderr}" ; then
+              func_to_host_path_tmp1=`winepath -w "$1"`
+              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+                $SED -e "$lt_sed_naive_backslashify"`
+            fi
+            ;;
[SNIP]

So it winepath fail to convert a build-system path it output only LF on standard output(stdout). I cannot confirm that exists relation: 'non-empty' stderr output and path-translation failure.

My point of view is that check for 'empty' stdout is enough as indication for translation-failure.

Let my show by example a project:
- let project build directory is /usr/local/src/test/myproject
- existing wine mapping ($WINEPREFIX/dosdevices):
c: -> #not-important
m: -> /opt/mingw
- project non-installed shared library in subdirectory lib1;
- project application (executable) in subdirectory appl;
- executable depend from non-installed library and an installed library;

in this case:
a) winepath -w /usr/local/src/test/myproject/{lib1|appl} will output:
stdout: empty (exactly only LF(0x10))
stderr: Warning: could not find DOS drive for current working directory ...
b) winepath -w /opt/mingw/{bin|lib}
stdout: m:\bin or m:\lib
stderr: Warning: could not find DOS drive for current working directory ....

So in the example exist translation failure only in case a) but in both cases stderr is not empty.
As result with the new check for stderr we may get false error-indication.



Fine with the fail-back change in func_to_host_path .
But I would like to note that this addition always lead to non-empty func_to_host_pathlist_result in func_to_host_pathlist. So I think that the then clause in check "if test -z "$func_to_host_pathlist_result" ; then" is reachable only if function argument $1 if empty.


About "# Now, add the leading and trailing path separators back" from func_to_host_pathlist: By default wine search in current directory and path-list like ";m:\..." is equal to "m:\...". Same for trailing separator.
In this case the new code simplify script and it is fine with me.


Roumen




reply via email to

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