Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchFromGitHub 4, buildPackages 5, cmake 6, pkg-config 7, substituteAll 8, boost 9, cairo 10, freetype 11, gdal 12, harfbuzz 13, icu 14, libjpeg 15, libpng 16, libtiff 17, libwebp 18, libxml2 19, proj 20, python3 21, sqlite 22, zlib 23, catch2 24, postgresql 25}: 26 27stdenv.mkDerivation rec { 28 pname = "mapnik"; 29 version = "unstable-2022-10-18"; 30 31 src = fetchFromGitHub { 32 owner = "mapnik"; 33 repo = "mapnik"; 34 rev = "05661e54392bcbb3367747f97a3ef6e468c105ba"; 35 hash = "sha256-96AneLPH1gbh/u880Pdc9OdFq2MniSdaTJoKYqId7sw="; 36 fetchSubmodules = true; 37 }; 38 39 postPatch = '' 40 substituteInPlace configure \ 41 --replace '$PYTHON scons/scons.py' ${buildPackages.scons}/bin/scons 42 rm -r scons 43 ''; 44 45 # a distinct dev output makes python-mapnik fail 46 outputs = [ "out" ]; 47 48 patches = [ 49 # The lib/cmake/harfbuzz/harfbuzz-config.cmake file in harfbuzz.dev is faulty, 50 # as it provides the wrong libdir. The workaround is to just rely on 51 # pkg-config to locate harfbuzz shared object files. 52 # Upstream HarfBuzz wants to drop CMake support anyway. 53 # See discussion: https://github.com/mapnik/mapnik/issues/4265 54 ./cmake-harfbuzz.patch 55 # prevent CMake from trying to get libraries on the Internet 56 (substituteAll { 57 src = ./catch2-src.patch; 58 catch2_src = catch2.src; 59 }) 60 ./include.patch 61 ]; 62 63 nativeBuildInputs = [ cmake pkg-config ]; 64 65 buildInputs = [ 66 boost 67 cairo 68 freetype 69 gdal 70 harfbuzz 71 icu 72 libjpeg 73 libpng 74 libtiff 75 libwebp 76 proj 77 python3 78 sqlite 79 zlib 80 libxml2 81 postgresql 82 ]; 83 84 cmakeFlags = [ 85 # Would require qt otherwise. 86 "-DBUILD_DEMO_VIEWER=OFF" 87 ]; 88 89 # mapnik-config is currently not build with CMake. So we use the SCons for 90 # this one. We can't add SCons to nativeBuildInputs though, as stdenv would 91 # then try to build everything with scons. 92 preBuild = '' 93 cd .. 94 ${buildPackages.scons}/bin/scons utils/mapnik-config 95 cd build 96 ''; 97 98 preInstall = '' 99 mkdir -p $out/bin 100 cp ../utils/mapnik-config/mapnik-config $out/bin/mapnik-config 101 ''; 102 103 meta = with lib; { 104 description = "An open source toolkit for developing mapping applications"; 105 homepage = "https://mapnik.org"; 106 maintainers = with maintainers; [ hrdinka ]; 107 license = licenses.lgpl21Plus; 108 platforms = platforms.all; 109 }; 110}