Building the MySQL and PostgreSQL libraries on Windows

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

PostgreSQL

XXX WIP (previous version worked fine for shared libraries, trying to get static libraries working)

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.

Then configure:

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

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/port all
$ make -C src/backend utils/fmgroids.h
$ make -C src/backend ../../src/include/utils/fmgroids.h
$ make -C src/include all install
$ make -C src/interfaces/libpq all install
$ make -C src/bin/pg_config all 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 --disable-shared
$ make all install