Setting up the build environment on Windows

Assuming Windows XP 32.

Subversion

Doesn't really matter which one. Certified binaries of The Real McCoy are available at http://www.collab.net/downloads/subversion/ (command-line only) if you have an account (or are willing to register). There are other (non-certified) sources such as SlikSVN (http://www.sliksvn.com/en/download, command-line only) and TortoiseSVN (http://tortoisesvn.net/downloads, with Windows Explorer integration, which is really neat).

MSYS

Download the MSYS Base System installer from http://downloads.sourceforge.net/project/mingw/MSYS%20Base%20System/msys-1.0.11/MSYS-1.0.11.exe and run it. If it asks, tell it you don't have MinGW installed.

Now that MSYS is installed, you can start the “MSYS (rxvt)” shortcut it installed, and it'll be almost like you were home on the Unix farm.

MinGW

As of November 2009, the automated installer is useless; it installs gcc 3 instead of 4. You'll have to install MinGW manually using MSYS.

The following command will create and mount a directory for MinGW:

mount C:/MinGW /mingw

Next, download the packages you will need.

GCC: http://downloads.sourceforge.net/project/mingw/GCC%20Version%204/Current%20Release_%20gcc-4.4.0/gcc-full-4.4.0-mingw32-bin-2.tar.lzma

BinUtils: http://downloads.sourceforge.net/project/mingw/GNU%20Binutils/binutils-2.20/binutils-2.20-1-mingw32-bin.tar.gz

MinGW API: http://downloads.sourceforge.net/project/mingw/MinGW%20API%20for%20MS-Windows/Current%20Release_%20w32api-3.13/w32api-3.13-mingw32-dev.tar.gz

MinGW Runtime: http://downloads.sourceforge.net/project/mingw/MinGW%20Runtime/mingwrt-3.16/mingwrt-3.16-mingw32-dev.tar.gz and http://downloads.sourceforge.net/project/mingw/MinGW%20Runtime/mingwrt-3.16/mingwrt-3.16-mingw32-dll.tar.gz

Then extract everything:

$ for f in *tar.gz ; do tar zxvf $f -C /mingw ; done
$ for f in *tar.lzma ; do tar --lzma -xvf $f -C /mingw ; done

Let's see if our C compiler works:

$ which gcc
/mingw/bin/gcc.exe
$ cat >hello.c
#include <stdio.h>
int main(void) { printf("Hello, C world!\n"); return 0; }
^D
$ gcc -o hello hello.c
$ ./hello.exe
Hello, C world!

And C++:

$ which g++
/mingw/bin/g++.exe
$ cat >hello.cc
#include <iostream>
int main() { std::cout << "Hello, C++ world!" << std::endl; return 0; }
^D
$ g++ -o hello hello.cc
$ ./hello.exe
Hello, C++ world!

And Fortran 90:

$ which gfortran
/mingw/bin/gfortran.exe
$ cat >hello.f90
PROGRAM HelloWorld
PRINT *, "Hello, Fortran world!"
END PROGRAM HelloWorld
^D
$ gfortran -o hello hello.f90
$ ./hello.exe
Hello, Fortran world!

GNU Autotools

Download

Autoconf

http://downloads.sourceforge.net/project/mingw/MinGW%20autoconf/autoconf2.5/autoconf2.5-2.64-1/autoconf2.5-2.64-1-mingw32-bin.tar.lzma and http://downloads.sourceforge.net/project/mingw/MinGW%20autoconf/wrapper/autoconf-7-1/autoconf-7-1-mingw32-bin.tar.lzma

Automake

http://downloads.sourceforge.net/project/mingw/MinGW%20automake/automake1.11/automake1.11-1.11-1/automake1.11-1.11-1-mingw32-bin.tar.lzma and http://downloads.sourceforge.net/project/mingw/MinGW%20automake/wrapper/automake-4-1/automake-4-1-mingw32-bin.tar.lzma

Libtool

http://downloads.sourceforge.net/project/mingw/MinGW%20libtool/libtool-2.2.7a-1/libtool-2.2.7a-1-mingw32-bin.tar.lzma

You do not need any of the libltdl tarballs.

Install

$ for f in *tar.gz ; do tar zxvf $f -C /mingw ; done
$ for f in *tar.lzma ; do tar --lzma -xvf $f -C /mingw ; done

Boost jam

This utility is used to compile the Boost libraries. We're going to build it from source, so this is our baptism of MinGW fire...

Get the source tarball from http://downloads.sourceforge.net/project/boost/boost-jam/3.1.17/boost-jam-3.1.17.tgz; once you have it, it's a simple matter of running the build script (which will automatically detect MinGW) and installing the resulting executable:

$ tar zxf boost-jam-3.1.17.tgz
$ cd boost-jam-3.1.17
$ sh ./build.sh
$ mkdir -p /usr/local/bin
$ cp bin.ntx86/bjam.exe /usr/local/bin
$ which bjam
/usr/local/bin/bjam.exe
$ bjam -v
Boost.Jam Version 3.1.17. OS=NT.
Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
Copyright 2001 David Turner.
Copyright 2001-2004 David Abrahams.
Copyright 2002-2008 Rene Rivera.
Copyright 2003-2008 Vladimir Prus.

It's alive!

Additional Unix utilities

You may want to install other programs, such as vim (http://downloads.sourceforge.net/project/mingw/MSYS%20vim/vim-7.2-1/vim-7.2-1-msys-1.0.11-bin.tar.lzma), GNU coreutils (http://downloads.sourceforge.net/project/mingw/MSYS%20coreutils/coreutils-5.97-2/coreutils-5.97-2-msys-1.0.11-bin.tar.lzma and http://downloads.sourceforge.net/project/mingw/MSYS%20coreutils/coreutils-5.97-2/coreutils-5.97-2-msys-1.0.11-ext.tar.lzma), libarchive and bsdtar (http://downloads.sourceforge.net/project/mingw/MSYS%20libarchive/libarchive-2.7.1-1/libarchive-2.7.1-1-msys-1.0.11-dll-2.tar.lzma and http://downloads.sourceforge.net/project/mingw/MSYS%20libarchive/libarchive-2.7.1-1/bsdtar-2.7.1-1-msys-1.0.11-bin.tar.lzma), OpenSSH (http://downloads.sourceforge.net/project/mingw/MSYS%20openssh/openssh-4.7p1-2/openssh-4.7p1-2-msys-1.0.11-bin.tar.lzma) ... You'll need OpenSSL (http://downloads.sourceforge.net/project/mingw/MSYS%20openssl/openssl-0.9.8k-1/libopenssl-0.9.8k-1-msys-1.0.11-dll-098.tar.lzma and http://downloads.sourceforge.net/project/mingw/MSYS%20openssl/openssl-0.9.8k-1/openssl-0.9.8k-1-msys-1.0.11-bin.tar.lzma) for the latter two.

WiX

Microsoft's tool for creating installation packages: http://sourceforge.net/projects/wix/files/. Ironically, it does not come with its own installer.