node-gdal
node-gdal copied to clipboard
Adding libpq.a support to bundled gdal gyp build
Have discussed with @brianreavis that is reasonable to compile your own libpq.a and statically link it to be able to support talking to postgres servers on various systems. At least this has worked for me for shipping Mapnik's postgis.input plugin without external shared library dependencies.
The things I've learned along the way:
- Ubuntu has patched postgres so that the default unix socket is different. This means that users must connect via tcp by providing
host=localhost
and unix sockets don't work unless this patch is applied (which I recommend): Details at https://github.com/mapnik/mapnik-packaging/issues/130. - ~~I've not found a way (yet) to use postgres's main build scripts to build only libpq. So, instead I just build everything and accept failures for some parts of postgres that don't compile because
libpq.a
still builds fine. This is why I use the-i -k
here.~~ Figured this out: https://github.com/mapnik/mapnik-packaging/commit/c3c5bb9c6e48e8bcc23febeac8e4b4a23dd3832d - I've not looked into what it would take to gyp'ify just libpq. We could dodge this problem if we said only builds done with #19 would support postgres connections. But that would be limiting.