nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchzip
2, boost, cairo, freetype, gdal, harfbuzz, icu, libjpeg, libpng, libtiff
3, libwebp, libxml2, proj, python2, scons, sqlite, zlib
4
5# supply a postgresql package to enable the PostGIS input plugin
6, postgresql ? null
7}:
8
9stdenv.mkDerivation rec {
10 name = "mapnik-${version}";
11 version = "3.0.13";
12
13 src = fetchzip {
14 # this one contains all git submodules and is cheaper than fetchgit
15 url = "https://github.com/mapnik/mapnik/releases/download/v${version}/mapnik-v${version}.tar.bz2";
16 sha256 = "189wsd6l6awblkiha666l1sdyp7ifmnfsa87y0j37rvym6w4r065";
17 };
18
19 # a distinct dev output makes python-mapnik fail
20 outputs = [ "out" ];
21
22 nativeBuildInputs = [ python2 scons ];
23
24 buildInputs =
25 [ boost cairo freetype gdal harfbuzz icu libjpeg libpng libtiff
26 libwebp libxml2 proj python2 sqlite zlib
27
28 # optional inputs
29 postgresql
30 ];
31
32 configurePhase = ''
33 scons configure PREFIX="$out" BOOST_INCLUDES="${boost.dev}/include" \
34 BOOST_LIBS="${boost.out}/lib" \
35 CAIRO_INCLUDES="${cairo.dev}/include" \
36 CAIRO_LIBS="${cairo.out}/lib" \
37 FREETYPE_INCLUDES="${freetype.dev}/include" \
38 FREETYPE_LIBS="${freetype.out}/lib" \
39 GDAL_CONFIG="${gdal}/bin/gdal-config" \
40 HB_INCLUDES="${harfbuzz.dev}/include" \
41 HB_LIBS="${harfbuzz.out}/lib" \
42 ICU_INCLUDES="${icu.dev}/include" \
43 ICU_LIBS="${icu.out}/lib" \
44 JPEG_INCLUDES="${libjpeg.dev}/include" \
45 JPEG_LIBS="${libjpeg.out}/lib" \
46 PNG_INCLUDES="${libpng.dev}/include" \
47 PNG_LIBS="${libpng.out}/lib" \
48 PROJ_INCLUDES="${proj}/include" \
49 PROJ_LIBS="${proj}/lib" \
50 SQLITE_INCLUDES="${sqlite.dev}/include" \
51 SQLITE_LIBS="${sqlite.out}/lib" \
52 TIFF_INCLUDES="${libtiff.dev}/include" \
53 TIFF_LIBS="${libtiff.out}/lib" \
54 WEBP_INCLUDES="${libwebp}/include" \
55 WEBP_LIBS="${libwebp}/lib" \
56 XML2_INCLUDES="${libxml2.dev}/include" \
57 XML2_LIBS="${libxml2.out}/lib"
58 '';
59
60 buildPhase = false;
61
62 installPhase = ''
63 mkdir -p "$out"
64 scons install
65 '';
66
67 meta = with stdenv.lib; {
68 description = "An open source toolkit for developing mapping applications";
69 homepage = http://mapnik.org;
70 maintainers = with maintainers; [ hrdinka ];
71 license = licenses.lgpl21;
72 platforms = platforms.all;
73 };
74}