1{ stdenv, fetchzip, fetchpatch
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 patches = [(fetchpatch {
20 name = "icu-59.diff";
21 url = https://github.com/mapnik/mapnik/commit/9e58c890430d.diff;
22 sha256 = "0h546qq8g19gw9s4979hla9vkq5kcwh3q45ryajyjhmlr2z9fi6p";
23 })];
24
25 # a distinct dev output makes python-mapnik fail
26 outputs = [ "out" ];
27
28 nativeBuildInputs = [ python2 scons ];
29
30 buildInputs =
31 [ boost cairo freetype gdal harfbuzz icu libjpeg libpng libtiff
32 libwebp libxml2 proj python2 sqlite zlib
33
34 # optional inputs
35 postgresql
36 ];
37
38 configurePhase = ''
39 scons configure PREFIX="$out" BOOST_INCLUDES="${boost.dev}/include" \
40 BOOST_LIBS="${boost.out}/lib" \
41 CAIRO_INCLUDES="${cairo.dev}/include" \
42 CAIRO_LIBS="${cairo.out}/lib" \
43 FREETYPE_INCLUDES="${freetype.dev}/include" \
44 FREETYPE_LIBS="${freetype.out}/lib" \
45 GDAL_CONFIG="${gdal}/bin/gdal-config" \
46 HB_INCLUDES="${harfbuzz.dev}/include" \
47 HB_LIBS="${harfbuzz.out}/lib" \
48 ICU_INCLUDES="${icu.dev}/include" \
49 ICU_LIBS="${icu.out}/lib" \
50 JPEG_INCLUDES="${libjpeg.dev}/include" \
51 JPEG_LIBS="${libjpeg.out}/lib" \
52 PNG_INCLUDES="${libpng.dev}/include" \
53 PNG_LIBS="${libpng.out}/lib" \
54 PROJ_INCLUDES="${proj}/include" \
55 PROJ_LIBS="${proj}/lib" \
56 SQLITE_INCLUDES="${sqlite.dev}/include" \
57 SQLITE_LIBS="${sqlite.out}/lib" \
58 TIFF_INCLUDES="${libtiff.dev}/include" \
59 TIFF_LIBS="${libtiff.out}/lib" \
60 WEBP_INCLUDES="${libwebp}/include" \
61 WEBP_LIBS="${libwebp}/lib" \
62 XML2_INCLUDES="${libxml2.dev}/include" \
63 XML2_LIBS="${libxml2.out}/lib"
64 '';
65
66 buildPhase = false;
67
68 installPhase = ''
69 mkdir -p "$out"
70 scons install
71 '';
72
73 meta = with stdenv.lib; {
74 description = "An open source toolkit for developing mapping applications";
75 homepage = http://mapnik.org;
76 maintainers = with maintainers; [ hrdinka ];
77 license = licenses.lgpl21;
78 platforms = platforms.all;
79 };
80}