alliedmodders/sourcemod — pull request #32 by peace-maker (2014-06-07 14:25:42+00:00)
Title: Add PostgreSQL database driver

This is regarding [bug 3849](https://bugs.alliedmods.net/show_bug.cgi?id=3849).
Adds a "pgsql" driver to the dbi system.

See https://forums.alliedmods.net/showthread.php?t=236415

The AMBuild changes are very likely wrong. I don't know how to use it ;)

Here are some instructions on how to create static libs of the libpq out of the [source](http://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.gz)

Get the latest postgresql source.
extract it.

=============
Windows:

In a VS-commandline, navigate to src/tools/msvc and run
perl mkvcbuild.pl
to generate the VS solution in the root.

1. Open the pgsql.sln in VS2010
2. change the configuration type of the libpq project from "Dynamic library (.dll)" to "Static library (.lib)"
3. under C/C++ -> codegeneration change runtimelibrary from "Multithreaded-Debug-DLL (/MDd)" to "Multithreaded-Debug (/MTd)" for the libpq and libpgport projects
4. compile the libpq project
5. the static .lib will be in Release/libpq/libpq.lib and Release/libpgport/libpgport.lib

==================
Linux:

in the extracted postgresql source run
./configure LDFLAGS='-static -m32' CFLAGS='-m32' --prefix=`pwd`/build
You might need to add --without-readline. This is not needed for the libpq library.
cd src/interfaces/libpq
make install
rm libpq.a
make install enable_shared=no
The library will be in the build/lib directory.

About that double linking to get a good static library: http://www.postgresql.org/message-id/1902207738.20070920111734@comodo.com