As part of some internal continuous integration and testing work, I’ve put together some scripts to simplify the compilation of PostgreSQL on Windows.
PostgreSQL its self is pretty easy to compile on Windows. You download and install ActiveState Perl and Visual Studio or the Microsoft Windows SDK, unpack a PostgreSQL source tree, copy config_default.pl to src\tools\msvc\config.pl, edit it to reflect your environment, open an SDK command prompt for your Windows SDK version / Visual Studio version, cd to the PostgreSQL directory, and run src\tools\msvc\build.pl. Not too bad.
The trouble is getting the dependencies built, and that’s what I’m working on improving. The scripts I’ve published at http://github.com/2ndQuadrant/pg_build_win are a step toward that. I’ve written some NMake files and a wrapper Perl script that will download dependencies, compile them, and create a config.pl that points the PostgreSQL build at them. It can build a source tree you’ve checked out yourself, or it can automatically handle checking your specified PostgreSQL version(s) out from git.
At present the scripts are known to work with the Microsoft Windows SDK 7.1, Microsoft’s free stand-alone SDK. They do not yet work with Visual Studio, but that should be along shortly.
Currently the tools document the unattended installation procedure for the required 3rd party tools and libraries (Perl, Python, TCL, Windows SDK, etc), and it’ll download and compile zlib for you. I want to add support for more of PostgreSQL’s optional dependencies, automating their installation to prevent everyone from having to suffer through the “fun” of compiling open source libraries like gettext on Windows.
These scripts are primarily intended to satisfy internal requirements for compiling a variety of PostgreSQL versions and configurations under a Jenkins CI server, but I’d value any use reports or feedback.