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