Building the MySQL and PostgreSQL libraries on Windows

MySQL does not support gcc on Windows, only MSVC. Moved to a separate page.

PostgreSQL

http://www.postgresql.org/ftp/source/v8.3.9/

There is a bug in src/template/win32: it sets LDFLAGS unconditionally. Change this line:

LDFLAGS="-Wl,--allow-multiple-definition"

to this:

LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"

Next, open src/Makefile.global.in, search for -lws2_32 and add -lsecur32 at the end of that line so it looks like this:

ifeq ($(PORTNAME),win32)
LIBS += -lws2_32 -lshfolder -lsecur32
endif

Take care to edit src/Makefile.global.in and not src/Makefile.global, as the latter will be automatically regenerated from the former.

XXX this is not required when building with --enable-shared; I have no idea why.

Then configure and build:

$ LDFLAGS=-L/c/met.no/lib CPPFLAGS=-I/c/met.no/include ./configure --prefix=/c/met.no --disable-shared
$ make

We don't want to install the entire package (server and all); we'll just install the library and headers and the pg_config tool which is used by other packages (such as libpqxx) that link against libpq.

$ make -C src/include install
$ make -C src/interfaces/libpq install
$ make -C src/bin/pg_config install

''libpqxx'' (C++ interface)

http://pqxx.org/development/libpqxx/wiki/DownloadPage

$ LDFLAGS=-L/c/met.no/lib CPPFLAGS=-I/c/met.no/include PG_CONFIG=/c/met.no/bin/pg_config.exe ./configure --prefix=/c/met.no
$ make all install