blob: 57dc1bdaa7ef81e8511af833a8c441bda6c7e029 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{ fetchurl
, stdenv
, perl
, libxml2
, postgresql
, geos
, proj
, gdal
, json_c
, pkgconfig
, file
}:
stdenv.mkDerivation rec {
name = "postgis-${version}";
version = "2.5.2";
outputs = [ "out" "doc" ];
src = fetchurl {
url = "https://download.osgeo.org/postgis/source/postgis-${version}.tar.gz";
sha256 = "0pnva72f2w4jcgnl1y7nw5rdly4ipx3hji4c9yc9s0hna1n2ijxn";
};
buildInputs = [ libxml2 postgresql geos proj perl gdal json_c pkgconfig ];
dontDisableStatic = true;
# postgis config directory assumes /include /lib from the same root for json-c library
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
preConfigure = ''
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
configureFlags="--datadir=$out/share --datarootdir=$out/share --bindir=$out/bin --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin"
'';
postConfigure = ''
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
" \
"raster/loader/Makefile";
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
" \
"raster/scripts/python/Makefile";
'';
preInstall = ''
mkdir -p $out/bin
'';
# create aliases for all commands adding version information
postInstall = ''
for prog in $out/bin/*; do # */
ln -s $prog $prog-${version}
done
mkdir -p $doc/share/doc/postgis
mv doc/* $doc/share/doc/postgis/
'';
meta = with stdenv.lib; {
description = "Geographic Objects for PostgreSQL";
homepage = http://postgis.refractions.net;
license = licenses.gpl2;
maintainers = [ maintainers.marcweber ];
platforms = platforms.linux;
};
}
|