about summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorStig <stig@stig.io>2024-06-18 18:13:12 +0200
committerGitHub <noreply@github.com>2024-06-18 18:13:12 +0200
commit6263d23ea4e04f86272325b113bee8133c09d50a (patch)
treee35ba247187ec8c60ae8c451af7aed62ad955e04 /pkgs/development/libraries
parent6d8d21411efd864784b575ea0798d4a8c0863a0b (diff)
parent425aa3c3d19126bab033ce897b82a08975b0fc2b (diff)
Merge pull request #304866 from hummeltech/MapnikDarwinFix
mapnik: unstable-2023-11-28 -> 4.0.0
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/mapnik/datasource-ogr-test-should-fail.patch13
-rw-r--r--pkgs/development/libraries/mapnik/default.nix33
-rw-r--r--pkgs/development/libraries/mapnik/use-sparsehash-package.patch19
3 files changed, 42 insertions, 23 deletions
diff --git a/pkgs/development/libraries/mapnik/datasource-ogr-test-should-fail.patch b/pkgs/development/libraries/mapnik/datasource-ogr-test-should-fail.patch
deleted file mode 100644
index 1df64216d20b3..0000000000000
--- a/pkgs/development/libraries/mapnik/datasource-ogr-test-should-fail.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/test/unit/datasource/ogr.cpp b/test/unit/datasource/ogr.cpp
-index 8441ecc55..8dabc67b0 100644
---- a/test/unit/datasource/ogr.cpp
-+++ b/test/unit/datasource/ogr.cpp
-@@ -30,7 +30,7 @@
- #include <mapnik/image_util.hpp>
- #include <mapnik/datasource_cache.hpp>
- 
--TEST_CASE("ogr")
-+TEST_CASE("ogr", "[!shouldfail]")
- {
-     const bool have_ogr_plugin = mapnik::datasource_cache::instance().plugin_registered("ogr");
-     if (have_ogr_plugin)
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
   '';
 
diff --git a/pkgs/development/libraries/mapnik/use-sparsehash-package.patch b/pkgs/development/libraries/mapnik/use-sparsehash-package.patch
new file mode 100644
index 0000000000000..3bb5d3e996cfc
--- /dev/null
+++ b/pkgs/development/libraries/mapnik/use-sparsehash-package.patch
@@ -0,0 +1,19 @@
+commit c1cea9e10ffec54d0f675478e541ee4a6e87f653
+Author: Tom Hughes <tom@compton.nu>
+Date:   Wed Jun 5 18:45:57 2013 +0100
+
+    Use system sparsehash
+
+diff --git a/include/mapnik/palette.hpp b/include/mapnik/palette.hpp
+index 5f96272..44d06aa 100644
+--- a/include/mapnik/palette.hpp
++++ b/include/mapnik/palette.hpp
+@@ -33,7 +33,7 @@
+ #pragma GCC diagnostic push
+ #include <mapnik/warning_ignore.hpp>
+ #ifdef USE_DENSE_HASH_MAP
+-#include <mapnik/sparsehash/dense_hash_map>
++#include <google/dense_hash_map>
+ using rgba_hash_table = google::dense_hash_map<unsigned int, unsigned char>;
+ #else
+ #include <unordered_map>