Merge #65460: postgis: allow on Darwin

This commit is contained in:
Vladimír Čunát 2019-08-03 16:45:43 +02:00
commit f3952fc50c
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -10,6 +10,7 @@
, pkgconfig
, file
, protobufc
, libiconv
}:
stdenv.mkDerivation rec {
name = "postgis-${version}";
@ -22,7 +23,8 @@ stdenv.mkDerivation rec {
sha256 = "0pnva72f2w4jcgnl1y7nw5rdly4ipx3hji4c9yc9s0hna1n2ijxn";
};
buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc ];
buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc ]
++ stdenv.lib.optional stdenv.isDarwin libiconv;
nativeBuildInputs = [ perl pkgconfig ];
dontDisableStatic = true;
@ -43,14 +45,18 @@ stdenv.mkDerivation rec {
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
" \
"raster/scripts/python/Makefile";
'';
preInstall = ''
mkdir -p $out/bin
# postgis' build system assumes it is being installed to the same place as postgresql, and looks
# for the postgres binary relative to $PREFIX. We gently support this system using an illusion.
ln -s ${postgresql}/bin/postgres $out/bin/postgres
'';
# create aliases for all commands adding version information
postInstall = ''
# Teardown the illusory postgres used for building; see postConfigure.
rm $out/bin/postgres
for prog in $out/bin/*; do # */
ln -s $prog $prog-${version}
done
@ -64,6 +70,6 @@ stdenv.mkDerivation rec {
homepage = https://postgis.net/;
license = licenses.gpl2;
maintainers = [ maintainers.marcweber ];
platforms = platforms.linux;
inherit (postgresql.meta) platforms;
};
}