Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 134 lines 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 gitUpdater, 6 buildPackages, 7 cmake, 8 pkg-config, 9 boost, 10 cairo, 11 freetype, 12 gdal, 13 harfbuzz, 14 icu, 15 libjpeg, 16 libpng, 17 libtiff, 18 libwebp, 19 libxml2, 20 proj, 21 python3, 22 sqlite, 23 zlib, 24 catch2, 25 libpq, 26 protozero, 27 sparsehash, 28}: 29 30stdenv.mkDerivation (finalAttrs: { 31 pname = "mapnik"; 32 version = "4.1.1"; 33 34 src = fetchFromGitHub { 35 owner = "mapnik"; 36 repo = "mapnik"; 37 tag = "v${finalAttrs.version}"; 38 hash = "sha256-+PCN3bjLGqfK4MF6fWApnSua4Pn/mKo2m9CY8/c5xC4="; 39 fetchSubmodules = true; 40 }; 41 42 passthru.updateScript = gitUpdater { rev-prefix = "v"; }; 43 44 postPatch = '' 45 substituteInPlace configure \ 46 --replace-fail '$PYTHON scons/scons.py' ${buildPackages.scons}/bin/scons 47 rm -r scons 48 # Remove bundled 'sparsehash' directory in favor of 'sparsehash' package 49 rm -r deps/mapnik/sparsehash 50 # Remove bundled 'protozero' directory in favor of 'protozero' package 51 rm -r deps/mapbox/protozero 52 ''; 53 54 # a distinct dev output makes python-mapnik fail 55 outputs = [ "out" ]; 56 57 patches = [ 58 # Account for full paths when generating libmapnik.pc 59 ./export-pkg-config-full-paths.patch 60 # Use 'sparsehash' package. 61 ./use-sparsehash-package.patch 62 ]; 63 64 nativeBuildInputs = [ 65 cmake 66 pkg-config 67 ]; 68 69 buildInputs = [ 70 boost 71 cairo 72 freetype 73 gdal 74 (harfbuzz.override { withIcu = true; }) 75 icu 76 libjpeg 77 libpng 78 libtiff 79 libwebp 80 proj 81 python3 82 sqlite 83 zlib 84 libxml2 85 libpq 86 protozero 87 sparsehash 88 ]; 89 90 cmakeFlags = [ 91 # Save time by not building some development-related code. 92 (lib.cmakeBool "BUILD_BENCHMARK" false) 93 (lib.cmakeBool "BUILD_DEMO_CPP" false) 94 ## Would require QT otherwise. 95 (lib.cmakeBool "BUILD_DEMO_VIEWER" false) 96 # disable the find_package call and force pkg-config, see https://github.com/mapnik/mapnik/pull/4270 97 (lib.cmakeBool "CMAKE_DISABLE_FIND_PACKAGE_harfbuzz" true) 98 # Use 'protozero' package. 99 (lib.cmakeBool "USE_EXTERNAL_MAPBOX_PROTOZERO" true) 100 # macOS builds fail when using memory mapped file cache. 101 (lib.cmakeBool "USE_MEMORY_MAPPED_FILE" (!stdenv.hostPlatform.isDarwin)) 102 # don't try to download sources for catch2, use our own 103 (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CATCH2" "${catch2.src}") 104 ]; 105 106 doCheck = true; 107 108 # mapnik-config is currently not build with CMake. So we use the SCons for 109 # this one. We can't add SCons to nativeBuildInputs though, as stdenv would 110 # then try to build everything with scons. C++17 is the minimum supported 111 # C++ version. 112 preBuild = '' 113 cd .. 114 env CXX_STD=17 ${buildPackages.scons}/bin/scons utils/mapnik-config 115 cd build 116 ''; 117 118 preInstall = '' 119 install -Dm755 ../utils/mapnik-config/mapnik-config -t $out/bin 120 ''; 121 122 meta = { 123 description = "Open source toolkit for developing mapping applications"; 124 homepage = "https://mapnik.org"; 125 changelog = "https://github.com/mapnik/mapnik/blob/${finalAttrs.src.tag}/CHANGELOG.md"; 126 maintainers = with lib.maintainers; [ 127 hrdinka 128 hummeltech 129 ]; 130 teams = [ lib.teams.geospatial ]; 131 license = lib.licenses.lgpl21Plus; 132 platforms = lib.platforms.all; 133 }; 134})