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 1df64216d20b..000000000000 --- 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 - #include - --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 301b7946d2bc..a16db9ae75ab 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,32 @@ 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) + ] ++ lib.optionals stdenv.isDarwin [ + # macOS builds fail when using memory mapped file cache. + (lib.cmakeBool "USE_MEMORY_MAPPED_FILE" false) ]; 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 000000000000..3bb5d3e996cf --- /dev/null +++ b/pkgs/development/libraries/mapnik/use-sparsehash-package.patch @@ -0,0 +1,19 @@ +commit c1cea9e10ffec54d0f675478e541ee4a6e87f653 +Author: Tom Hughes +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 + #ifdef USE_DENSE_HASH_MAP +-#include ++#include + using rgba_hash_table = google::dense_hash_map; + #else + #include