Msys (mingw) support!

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Mon Sep 24 06:19:07 PDT 2012


Now we almost have complete msys support in build-infra! The only thing 
left is a proper implementation of replace_cygdrive_msys() in 
uncygdrive.c. I've successfully build on msys using the hack below. If 
you are eager to try it out, modify it to fit your system (basically, 
you need to locate the start of the paths to your visual studio tools 
installation and your hg forest, in unix-style). I'll be continue 
working on a more general solution. (Most likely, I'll do something 
similar but autodiscover the suitable prefixes in configure.) Also, the 
functions for mangling paths to and from different formats will need 
some more work to be not full of code duplication and redundant work.

Here is the snippet:

char* LOOKFOR = "/c/localdata";
char* LOOKFOR2 = "/c/progra~2/";
char* LOOKFOR3 = "/c/progra~1/";

char *replace_cygdrive_msys(char *in)
{
   char* orig=in;
   char* p = in;

   while ((p = strstr(p, LOOKFOR))) {
     char* drive_letter = p+1;
     *p = *drive_letter;
     *drive_letter = ':';
     p++;
   }
   
   p=orig;
   while ((p = strstr(p, LOOKFOR2))) {
     char* drive_letter = p+1;
     *p = *drive_letter;
     *drive_letter = ':';
     p++;
   }
   
   p=orig;
   while ((p = strstr(p, LOOKFOR3))) {
     char* drive_letter = p+1;
     *p = *drive_letter;
     *drive_letter = ':';
     p++;
   }
   
   
   // a bit weird but users expect a malloced string
   return strdup(orig);
}


And to use msys, do the following:
1) Get the msys/mingw installer (pick the latest one in 
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/). 
Install the msys environment. Optionally, you can install mingw as well 
(that is, the GNU toolchain ported to Windows), but that is not used by 
build-infra.
2) Install extra msys packages: run "mingw-get install msys-mktemp 
msys-unzip msys-zip"
3) If you have a previous working environment with cygwin, you're good 
to go, otherwise you'll need a boot jdk, the Microsoft toolchain and 
freetype.
4) Start the msys bash ("MinGW Shell")
5) configure / make

Unfortunately, it seems that the hopes that msys should be faster than 
cygwin was somewhat unfounded. On my system, it seems actually slower 
than cygwin (although I have not yet gathered very reliable data). I 
have noticed that "find" is noticeably slower, and that might be part of 
the explanation.

On the upside, however, is stability. While I had several mysterious 
cygwin hangs when trying to get comparable performance numbers, msys 
built rock solid every time!

/Magnus



More information about the build-infra-dev mailing list