The scripts provided by the MinGW-builds project[1][2] are designed
for building the dual-target(i686/x86_64) MinGW compiler for i686/x86_64 hosts.

The scripts are distributed under the 'BSD 3' license[3].

In order to use the scripts provided by the MinGW-builds project it is needed:

1. Windows-64bit or Linux + Wine-64bit

2. Install MSYS:
  http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/

3. Get the scripts into '<msys root>/home/<user>/mingw-builds':
  "cd && git clone git://github.com/niXman/mingw-builds.git"

4. In the MSYS file structure delete the '/MinGW' directory.

5. Delete the paths pointing to any preinstalled MinGW from the 'PATH'
  environment variable.

6. Go into the MinGW-builds root directory.
  "cd && cd mingw-builds"

7.
  The '--buildroot=<path>' option specifies to the script to use '<path>' as build directory.
    By default used MSYS user home directory.
  The '--preload' option specifies to the script to pre-download all the sources
    and only after that, to begin the building. This allows to build different
    versions of GCC simultaneously.
  The '--download' option specifies to the script to download only the sources.
  The '--exceptions=model' option specifies to the script using exceptions handling
    model. Available models are: dwarf, seh(for gcc>=4.8.0 only), sjlj.
  The '--use-lto' option specifies to the script to build with using LTO.
  The '--no-strip' option specifies to the script to install without striping.
  The '--no-multilib' option specifies to the script to build without multilib support.
  The '--dyn-deps' option specifies to the script to build GCC with dynamically dependencies.
  The '--rev=N' option specifies to the script the number of the build revision.
  The '--threads=model' option specifies to the script the used threads model.
  For more options please run: "./build --help"

8. Run:
  "./build gcc-4.6.3 x32" for building i686-MinGW
  "./build gcc-4.6.3 x64" for building x86_64-MinGW
  "./build gcc-4.6.3 x32 x64" for building i686-MinGW and x86_64-MinGW
  "./build gcc-4.6.3 --preload x32 x64" for building i686-MinGW and x86_64-MinGW
  "./build gcc-4.6.3 --exceptions=dwarf" for building i686-MinGW with DWARF exception handling

For example, during the process of building of the i686-gcc-4.7.2 will
  be created the following directories:
  <buildroot>/x32-4.7.2-release-posix-sjlj-rev1/build
  <buildroot>/x32-4.7.2-release-posix-sjlj-rev1/libs
  <buildroot>/x32-4.7.2-release-posix-sjlj-rev1/logs
  <buildroot>/x32-4.7.2-release-posix-sjlj-rev1/prefix

For x86_64:
  <buildroot>/x64-4.7.2-release-posix-sjlj-rev1/build
  <buildroot>/x64-4.7.2-release-posix-sjlj-rev1/libs
  <buildroot>/x64-4.7.2-release-posix-sjlj-rev1/logs
  <buildroot>/x64-4.7.2-release-posix-sjlj-rev1/prefix

And the sources directory:
  <buildroot>/mingw-sources


The archives with the built MinGW will be created in '<buildroot>/mingw-archives/'

At the moment, successfully building the following versions:
  gcc-4.6.2
  gcc-4.6.3
  gcc-4.7.0
  gcc-4.7.1
  gcc-4.7.2
  gcc-4_6-branch (currently 4.6.4 prerelease)
  gcc-4_7-branch (currently 4.7.3 prerelease)
  gcc-trunk (currently 4.8.0 snapshot)

Builds also contains patches for building Python 2.7.3 and 3.3.0 versions for support gdb pretty printers.
Big thanks for these patches to:
  2010-2012 Roumen Petrov, Руслан Ижбулатов
  2012 Ray Donnelly
 
[1] http://code.google.com/p/mingw-builds/
[2] http://sourceforge.net/projects/mingwbuilds/
[3] http://www.opensource.org/licenses/BSD-3-Clause
