@@ -35,16 +35,16 @@ stdenv.mkDerivation rec {
3535 nativeBuildInputs = [ perl pkg-config ] ;
3636 dontDisableStatic = true ;
3737
38- # postgis config directory assumes /include /lib from the same root for json-c library
39- env . NIX_LDFLAGS = "-L${ lib . getLib json_c } /lib" ;
4038
39+ env . NIX_LDFLAGS = "-L${ lib . getLib json_c } /lib" ;
4140
4241 preConfigure = ''
4342 sed -i 's@/usr/bin/file@${ file } /bin/file@' configure
4443 configureFlags="--datadir=$out/share/postgresql --datarootdir=$out/share/postgresql --bindir=$out/bin --docdir=$doc/share/doc/${ pname } --with-gdalconfig=${ gdal } /bin/gdal-config --with-jsondir=${ json_c . dev } --disable-extension-upgrades-install --with-sfcgal"
4544
4645 makeFlags="PERL=${ perl } /bin/perl datadir=$out/share/postgresql pkglibdir=$out/lib bindir=$out/bin docdir=$doc/share/doc/${ pname } "
4746 '' ;
47+
4848 postConfigure = ''
4949 sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
5050 s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
@@ -54,28 +54,25 @@ stdenv.mkDerivation rec {
5454 " \
5555 "raster/scripts/python/Makefile";
5656 mkdir -p $out/bin
57-
58- # postgis' build system assumes it is being installed to the same place as postgresql, and looks
59- # for the postgres binary relative to $PREFIX. We gently support this system using an illusion.
6057 ln -s ${ postgresql } /bin/postgres $out/bin/postgres
6158 '' ;
6259
63- # create aliases for all commands adding version information
64- postInstall = ''
65- # Teardown the illusory postgres used for building; see postConfigure.
66- rm $out/bin/postgres
67-
68- for prog in $out/bin/*; do # */
69- ln -s $prog $prog- ${ version }
70- done
71-
72- for file in $out/share/postgresql/extension/postgis_topology*-- ${ version } .sql; do
73- sed -i "/SELECT topology.AddToSearchPath('topology');/i SELECT topology.AddToSearchPath('extensions');" "$file"
74- done
75-
76- mkdir -p $doc/share/doc/postgis
77- mv doc/* $doc/share/doc/postgis/
78- '';
60+ postInstall = ''
61+ rm $out/bin/postgres
62+ for prog in $out/bin/*; do # */
63+ ln -s $prog $prog- ${ version }
64+ done
65+ # Add function definition and usage to tiger geocoder files
66+ for file in $out/share/postgresql/extension/postgis_tiger_geocoder*-- ${ version } .sql; do
67+ sed -i "/SELECT postgis_extension_AddToSearchPath('tiger');/a SELECT postgis_extension_AddToSearchPath('extensions');" "$file"
68+ done
69+ # Original topology patching
70+ for file in $out/share/postgresql/extension/postgis_topology*-- ${ version } .sql; do
71+ sed -i "/SELECT topology.AddToSearchPath('topology');/i SELECT topology.AddToSearchPath('extensions');" "$file"
72+ done
73+ mkdir -p $doc/share/doc/postgis
74+ mv doc/* $doc/share/doc/postgis/
75+ '' ;
7976
8077 passthru . tests . postgis = nixosTests . postgis ;
8178
0 commit comments