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: Sat, 31 May 2008 15:40:02 +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:
Roumen Petrov wrote:

 # 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.

The problem with that is, bash puts the following on stdout -- NOT stderr -- if it cannot find winepath:
bash: winepath: command not found

So, at the very least, we have failure if either
  stdout is empty
or
  exit code is nonzero

Try replacing the section above with:

          * )
            # Unfortunately, winepath does not exit with a non-zero
            # error code, so we are forced to check the contents of
            # stdout. On the other hand, if the command is not
            # found, the shell will set an exit code of 127 and print
            # *an error message* to stdout. So we must check for both
            # error code of zero AND non-empty stdout, which explains
            # the odd construction:
            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
            func_to_host_path_winepath_exitcode=$?
            if test "$func_to_host_path_winepath_exitcode" -eq 0 &&\
               test -n "${func_to_host_path_tmp1}" ; then
              func_to_host_path_result=`echo "$func_to_host_path_tmp1"|\
                $SED -e "$lt_sed_naive_backslashify"`
            fi
            ;;

And let me know if that works better for you.
[SNIP]


--
Chuck

It seems to me that the patch work with one addition:
--------------------------------
func_to_host_path ()
{
  func_to_host_path_result="$1"
  if test -n "$1" ; then
    case $host in
      *mingw* )
        func_to_host_path_result="" # <---- clean result
        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
        case $build in
          *mingw* ) # actually, msys
.....
--------------------------------
Without to clean result we cannot get warning in cross-compilation case it winepath fail.


Or maybe to clean only in default build case if winepath fail since if build is mingw/cygwin code always assign value to func_to_host_path_result:
--------------------------------
.....
          func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
          func_to_host_path_winepath_exitcode=$?
          if test "$func_to_host_path_winepath_exitcode" -eq 0 &&\
             test -n "${func_to_host_path_tmp1}" ; then
            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
              $SED -e "$lt_sed_naive_backslashify"`
          else
            func_to_host_path_result="" # <---- clean result
          fi
          ;;
.....
--------------------------------


Roumen




reply via email to

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