@@ -35,16 +35,16 @@ stdenv.mkDerivation rec {
35
35
nativeBuildInputs = [ perl pkg-config ] ;
36
36
dontDisableStatic = true ;
37
37
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" ;
40
38
39
+ env . NIX_LDFLAGS = "-L${ lib . getLib json_c } /lib" ;
41
40
42
41
preConfigure = ''
43
42
sed -i 's@/usr/bin/file@${ file } /bin/file@' configure
44
43
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"
45
44
46
45
makeFlags="PERL=${ perl } /bin/perl datadir=$out/share/postgresql pkglibdir=$out/lib bindir=$out/bin docdir=$doc/share/doc/${ pname } "
47
46
'' ;
47
+
48
48
postConfigure = ''
49
49
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
50
50
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
@@ -54,28 +54,25 @@ stdenv.mkDerivation rec {
54
54
" \
55
55
"raster/scripts/python/Makefile";
56
56
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.
60
57
ln -s ${ postgresql } /bin/postgres $out/bin/postgres
61
58
'' ;
62
59
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
+ '' ;
79
76
80
77
passthru . tests . postgis = nixosTests . postgis ;
81
78
0 commit comments