To get PostGIS going on Darwin:
1. Add libiconv, as is often required.
2. Expand platforms to `platforms.all`.
3. Deal with PostGIS' quirky build system.
PostGIS' configure.ac has the following gem:
AC_MSG_RESULT([------------------------------------------------------------------------])
AC_MSG_RESULT([ WARNING: You have set the --prefix to '$prefix'. But we mostly ])
AC_MSG_RESULT([ ignore the --prefix. For your info, using the values determined from ])
AC_MSG_RESULT([ $PG_CONFIG we will be installing: ])
AC_MSG_RESULT([ * postgis shared library in $PGSQL_LIBDIR ])
AC_MSG_RESULT([ * postgis SQL files in $PGSQL_SHAREDIR/contrib/postgis-$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION ])
AC_MSG_RESULT([ * postgis executables in $PGSQL_BINDIR ])
AC_MSG_RESULT([------------------------------------------------------------------------])
This is suggestive of some assumptions in the build system, which are
revealed when building in Nix on Darwin: the build fails because the
postgres binary cannot be found in the install prefix specified for
postgis; vis.
cc x -bundle_loader $POSTGIS_PREFIX/bin/postgres
This bundle_loader parameter is only available on Darwin, and this
problem doesn't appear to affect Linux systems.
The solution presented here is to symlink the postgres binary where
PostGIS expects it to be, and then remove it after the build completes.
This is needed because some PostgreSQL plugins don't have a bin
directory. If only these plugins are listed in cfg.extraPlugins buildEnv
will turn $out/bin into a symbolic link to ${pg}/bin. Lateron we try to
rm $out/bin/{pg_config,postgres,pg_ctl} which will then fail because
$out/bin will be read-only.
postgis: cleanup
Another part of https://github.com/NixOS/nixpkgs/pull/38698, though I did cleanup even more.
Moving docs to separate output should save another 30MB.
I did pin poppler to 0.61 just to be sure GDAL doesn't break again next
time poppler changes internal APIs.
This is a backwards compatible change; it mostly puts all the extensions
for postgresql in a common directory to keep them isolated.
It also moves a few things that /were not/ extensions out into other parts of
the filesystem namespace; namely the postgresql_jdbc and psqlodbc libraries
were moved under development/java-modules and development/libraries,
respectively. Because these libraries use the libpq postgresql client drivers,
they're less sensitive to underlying version changes anyway (since the protocol
is relatively stable).
No attributes were renamed or harmed in the creation of this patch.
Signed-off-by: Austin Seipp <aseipp@pobox.com>