about summary refs log tree commit diff
path: root/pkgs/servers/sql
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2019-08-03 16:45:43 +0200
committerVladimír Čunát <v@cunat.cz>2019-08-03 16:47:58 +0200
commitf3952fc50c53dcb09a27113c377f96fe62c676fb (patch)
tree7dabf151c7c3140a907ea7547b9251e87db15ddd /pkgs/servers/sql
parent8251b83e6a2078b89cc32d53dbf0fbd44239fac0 (diff)
parentc1da476a8815bb9c618e78bd85d54f8825f788b7 (diff)
downloadnixlib-f3952fc50c53dcb09a27113c377f96fe62c676fb.tar
nixlib-f3952fc50c53dcb09a27113c377f96fe62c676fb.tar.gz
nixlib-f3952fc50c53dcb09a27113c377f96fe62c676fb.tar.bz2
nixlib-f3952fc50c53dcb09a27113c377f96fe62c676fb.tar.lz
nixlib-f3952fc50c53dcb09a27113c377f96fe62c676fb.tar.xz
nixlib-f3952fc50c53dcb09a27113c377f96fe62c676fb.tar.zst
nixlib-f3952fc50c53dcb09a27113c377f96fe62c676fb.zip
Merge #65460: postgis: allow on Darwin
Diffstat (limited to 'pkgs/servers/sql')
-rw-r--r--pkgs/servers/sql/postgresql/ext/postgis.nix16
1 files changed, 11 insertions, 5 deletions
diff --git a/pkgs/servers/sql/postgresql/ext/postgis.nix b/pkgs/servers/sql/postgresql/ext/postgis.nix
index de9d7eb1305b..63b8a39b0e27 100644
--- a/pkgs/servers/sql/postgresql/ext/postgis.nix
+++ b/pkgs/servers/sql/postgresql/ext/postgis.nix
@@ -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;
   };
 }