Web lists-archives.com

Re: [Mingw-msys] How to find MSYS




Many of the GNU toolchain executables (gcc, binutils) accept "response
file" arguments:

	ar cru lib1.a @list-of-objects.txt

where the specified file is parsed, one line at a time, to generate
additional command line arguments. This way, the tools can work around
limitations in command line length.  However, the following currently
doesn't work, if 'ar' is the MinGW version, and the command is executed
in an MSYS shell:

$ /mingw/bin/ar cru lib1.a @/home/me/fnlist.txt
C:\MinGW\bin\ar.exe: @/home/me/fnlist.txt: No such file or directory

Because the native ar.exe has no idea where "/home/me/fnlist.txt" is.
The attached patch teaches msys to translate arguments that start with
'@' from unix to w32 when launching native applications (just like it
currently translates -L/a/unix/path)

2010.09.04  Charles Wilson  <...>

       * path.cc (msys_p2w): Support conversion of @file
       arguments.

OK to commit?

--
Chuck
Index: winsup/cygwin/path.cc
===================================================================
RCS file: /cvsroot/mingw/msys/rt/src/winsup/cygwin/path.cc,v
retrieving revision 1.52
diff -u -p -r1.52 path.cc
--- winsup/cygwin/path.cc	18 Mar 2010 01:16:34 -0000	1.52
+++ winsup/cygwin/path.cc	5 Sep 2010 01:59:11 -0000
@@ -3138,10 +3138,10 @@ msys_p2w (char const * const path)
       if ((sspath > 0)
 	   && (strchr (spath, '/') > 0)
 	   // 
-	   // Prevent strings beginning with -, ", or ' from being processed,
+	   // Prevent strings beginning with -, ", ', or @ from being processed,
 	   // remember that this is a recursive routine.
 	   // 
-	   && (strchr ("-\"\'", spath[0]) == 0)
+	   && (strchr ("-\"\'@", spath[0]) == 0)
 	   // 
 	   // Prevent ``foo:echo /bar/baz'' from being considered a path list.
 	   // 
@@ -3276,6 +3276,42 @@ msys_p2w (char const * const path)
 		}
 	    }
 	  break;
+	case '@':
+	  //
+	  // here we check for POSIX paths as attributes to a response
+	  // file argument (@file). This is specifically to support
+	  // MinGW binutils and gcc.
+	  //
+	  sspath = spath + 1;
+	  if (IsAbsWin32Path (sspath))
+	    {
+	      debug_printf("returning: %s", path);
+	      return (char *)path;
+	    }
+	  if (spath[1] == '/')
+	    {
+	      debug_printf("spath = %s", spath);
+	      char *swin32_path = msys_p2w (sspath);
+	      if (swin32_path == sspath)
+		{
+		  debug_printf("returning: %s", path);
+		  return ((char *)path);
+		}
+	      sspath = (char *)spath;
+	      sspath++;
+	      *sspath = '\0';
+	      retpathcpy (spath);
+	      *sspath = '/';
+	      retpathcat (swin32_path);
+	      free (swin32_path);
+	      return ScrubRetpath (retpath);
+	    }
+	  else
+	    {
+	      debug_printf("returning: %s", path);
+	      return ((char *)path);
+	    }
+	  break;
 	case '"':
 	  //
 	  // Handle a double quote case.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys