Installing MinGW and Msys


This guide describes how to install the MinGW/Msys system required for building the Windows version of LinRadiant. BTW, MinGW is a port of the GNU gcc compiler suite, while Msys is a minimal command line environment similar to the Unix command line system.

MinGW and Msys can be found at the MinGW WEB site. The standard way of installing MinGW and Msys is the use of the install program mingw-get-inst. We strongly recommend to use this utility, because it will install the stuff using the 'official' directory structure on which the build process of LinRadiant depends.

Download the latest version and run it. Click 'Next' repeatedly until you get this window:



Insert the name of install directory. It should have the format X:\mingw where 'X' is the drive letter. (We assume that you install it to c:\mingw. If not then substitute the correct drive letter in the directory names below.) Click 'Next' repeatedly until you get this window:



Mark in the list at least the items 'C Compiler', 'C++ Compiler', 'Msys Basic System' and 'Mingw Developer Toolkit' and click 'Install'. You may mark more packages if you e.g. wish to have the Fortran or Objective-C compilers as well for your other projects. The program downloads the required packages and installs them to the directory specified. The installed directory tree should look like this:



The next step is to tailor Msys to our requirements. Download the file linradiant_msys_files.zip and uncompress it to a temporary location (we assume that it is c:\tmp). Carry out the following steps:

a) Copy the files c:\tmp\fstab and c:\tmp\profile to c:\mingw\msys\1.0\etc (they will overwrite existing files, but that is OK).

b) Copy the file c:\tmp\pkg-config.exe to c:\mingw\bin.

c) Copy the file c:\tmp\winpwd.exe to c:\mingw\msys\1.0\bin.

Next you have to adjust the drive letters in the file c:\mingw\msys\1.0\etc\fstab. Open the file in a text editor (DO NOT USE MS WORD, use Notepad or equivalent). Replace the drive letters at the beginning of the lines to the correct value (i.e. the drive where you installed the system).

The MinGW/Msys system is almost ready for use now. Change to the directory c:\mingw\msys\1.0 and start the system by running the batch file msys.bat. This will create a home directory for you (c:\mingw\msys\1.0\your-name).

That's it! Your system is ready. Its usage is outside the scope of this guide. Study the documentation on the Mingw WEB site.

Technical notes

I have modified the Msys system files to aid software building as follows:

a) modified etc/fstab so the file system now has a usr/local subdirectory to store external stuff (in our case the libraries required by LinRadiant)

b) modified the PATH variable in etc/profile to include usr/local/bin

c) added commands to etc/profile to set and export the following environmental variables useful in Makefiles:


  MSYS_HOME         the absolute Windows path (including the drive
                    letter) to directory mingw/msys/1.0 (1)

  PKG_CONFIG        path to pkg-config.exe (/mingw/bin)

  PKG_CONFIG_PATH   path to the package config files (.pc)
                    (/usr/local/lib/pkgconfig)




(1) The value of MSYS_HOME is obtained by the utility winpwd.exe that I wrote for this purpose. It prints the absolute Windows path of the current directory to 'stdout'.