This page explains how to build from source:

This source can be retrieved in two forms:

Note that if you use the SVN version, you will need to install more tools (see below).

The first section of this page gives general instructions, which apply to all platforms. Then some specific platforms are discussed:

For Windows users, there is no pareto-optimum between MinGW and Cygwin, it depends on what you want to do:

General instructions

Prerequisites

A number of tools and libraries are needed in order to recompile everything. You don't necessarily need to install everything, depending on what you want to compile.