about summary refs log tree commit diff
path: root/pkgs/development/libraries/mapnik/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/mapnik/default.nix')
-rw-r--r--pkgs/development/libraries/mapnik/default.nix33
1 files changed, 23 insertions, 10 deletions
diff --git a/pkgs/development/libraries/mapnik/default.nix b/pkgs/development/libraries/mapnik/default.nix
index 301b7946d2bce..0428dd585c661 100644
--- a/pkgs/development/libraries/mapnik/default.nix
+++ b/pkgs/development/libraries/mapnik/default.nix
@@ -22,17 +22,19 @@
 , zlib
 , catch2
 , postgresql
+, protozero
+, sparsehash
 }:
 
 stdenv.mkDerivation rec {
   pname = "mapnik";
-  version = "unstable-2023-11-28";
+  version = "4.0.0";
 
   src = fetchFromGitHub {
     owner = "mapnik";
     repo = "mapnik";
-    rev = "2e1b32512b1f8b52331994f2a809d8a383c0c984";
-    hash = "sha256-qGdUfu6gFWum/Id/W3ICeGZroMQ3Tz9PQf1tt+gaaXM=";
+    rev = "v${version}";
+    hash = "sha256-CNFNGMJU3kzkRrOGsf8/uv5ebHPEQ0tkA+5OubRVEjs=";
     fetchSubmodules = true;
   };
 
@@ -40,6 +42,8 @@ stdenv.mkDerivation rec {
     substituteInPlace configure \
       --replace '$PYTHON scons/scons.py' ${buildPackages.scons}/bin/scons
     rm -r scons
+    # Remove bundled 'sparsehash' directory in favor of 'sparsehash' package
+    rm -r deps/mapnik/sparsehash
   '';
 
   # a distinct dev output makes python-mapnik fail
@@ -57,11 +61,10 @@ stdenv.mkDerivation rec {
       src = ./catch2-src.patch;
       catch2_src = catch2.src;
     })
-    # Disable broken test
-    # See discussion: https://github.com/mapnik/mapnik/issues/4329#issuecomment-1248778398
-    ./datasource-ogr-test-should-fail.patch
     # Account for full paths when generating libmapnik.pc
     ./export-pkg-config-full-paths.patch
+    # Use 'sparsehash' package.
+    ./use-sparsehash-package.patch
   ];
 
   nativeBuildInputs = [ cmake pkg-config ];
@@ -83,21 +86,31 @@ stdenv.mkDerivation rec {
     zlib
     libxml2
     postgresql
+    protozero
+    sparsehash
   ];
 
   cmakeFlags = [
-    # Would require qt otherwise.
-    "-DBUILD_DEMO_VIEWER:BOOL=OFF"
+    # Save time by not building some development-related code.
+    (lib.cmakeBool "BUILD_BENCHMARK" false)
+    (lib.cmakeBool "BUILD_DEMO_CPP" false)
+    ## Would require QT otherwise.
+    (lib.cmakeBool "BUILD_DEMO_VIEWER" false)
+    # Use 'protozero' package.
+    (lib.cmakeBool "USE_EXTERNAL_MAPBOX_PROTOZERO" true)
+    # macOS builds fail when using memory mapped file cache.
+    (lib.cmakeBool "USE_MEMORY_MAPPED_FILE" (!stdenv.isDarwin))
   ];
 
   doCheck = true;
 
   # mapnik-config is currently not build with CMake. So we use the SCons for
   # this one. We can't add SCons to nativeBuildInputs though, as stdenv would
-  # then try to build everything with scons.
+  # then try to build everything with scons. C++17 is the minimum supported
+  # C++ version.
   preBuild = ''
     cd ..
-    ${buildPackages.scons}/bin/scons utils/mapnik-config
+    env CXX_STD=17 ${buildPackages.scons}/bin/scons utils/mapnik-config
     cd build
   '';