about summary refs log tree commit diff
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
parent6d8d21411efd864784b575ea0798d4a8c0863a0b (diff)
parent425aa3c3d19126bab033ce897b82a08975b0fc2b (diff)
Merge pull request #304866 from hummeltech/MapnikDarwinFix
mapnik: unstable-2023-11-28 -> 4.0.0
-rw-r--r--maintainers/maintainer-list.nix2
-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
-rw-r--r--pkgs/development/perl-modules/Tirex/default.nix11
-rw-r--r--pkgs/development/python-modules/python-mapnik/default.nix34
-rw-r--r--pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch176
-rw-r--r--pkgs/servers/http/apache-modules/mod_tile/default.nix7
-rw-r--r--pkgs/servers/http/apache-modules/mod_tile/mod_tile-std_optional.patch26
9 files changed, 284 insertions, 37 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 6b4951c41f6ad..8835e8c91403e 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -8228,7 +8228,7 @@
     name = "Akshat Agarwal";
   };
   hummeltech = {
-    email = "hummeltech2024@gmail.com";
+    email = "hummeltech@sherpaguru.com";
     github = "hummeltech";
     githubId = 6109326;
     name = "David Hummel";
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>
diff --git a/pkgs/development/perl-modules/Tirex/default.nix b/pkgs/development/perl-modules/Tirex/default.nix
index 655610e898f27..48e63bb5932c4 100644
--- a/pkgs/development/perl-modules/Tirex/default.nix
+++ b/pkgs/development/perl-modules/Tirex/default.nix
@@ -7,6 +7,7 @@
 , JSON
 , LWP
 , mapnik
+, boost
 , nix-update-script
 }:
 
@@ -22,11 +23,18 @@ buildPerlPackage rec {
   };
 
   patches = [
+    # Support Mapnik >= v4.0.0 (`mapnik/box2d.hpp` -> `mapnik/geometry/box2d.hpp`)
     # https://github.com/openstreetmap/tirex/pull/54
     (fetchpatch {
-      url = "https://github.com/openstreetmap/tirex/commit/da0c5db926bc0939c53dd902a969b689ccf9edde.patch";
+      url = "https://github.com/openstreetmap/tirex/commit/5f131231c9c12e88793afba471b150ca8af8d587.patch";
       hash = "sha256-bnL1ZGy8ZNSZuCRbZn59qRVLg3TL0GjFYnhRKroeVO0=";
     })
+    # Support Mapnik >= v4.0.0 (boost:filesystem no longer indirectly linked)
+    # https://github.com/openstreetmap/tirex/pull/59
+    (fetchpatch {
+      url = "https://github.com/openstreetmap/tirex/commit/137903be9b7b35dde4c7010e65faa16bcf6ad476.patch";
+      hash = "sha256-JDqwWVnzExPwLpzv4LbSmGYah956uko+Zdicahua9oQ=";
+    })
   ];
 
   buildInputs = [
@@ -35,6 +43,7 @@ buildPerlPackage rec {
     JSON
     LWP
     mapnik
+    boost
   ] ++ mapnik.buildInputs;
 
   installPhase = ''
diff --git a/pkgs/development/python-modules/python-mapnik/default.nix b/pkgs/development/python-modules/python-mapnik/default.nix
index c93adc9f09db8..d2d0ae00f08cd 100644
--- a/pkgs/development/python-modules/python-mapnik/default.nix
+++ b/pkgs/development/python-modules/python-mapnik/default.nix
@@ -23,21 +23,20 @@
   sqlite,
   nose,
   pytestCheckHook,
-  stdenv,
+  darwin,
+  sparsehash,
 }:
 
 buildPythonPackage rec {
   pname = "python-mapnik";
-  version = "unstable-2023-02-23";
+  version = "3.0.16-unstable-2024-02-22";
   format = "setuptools";
 
   src = fetchFromGitHub {
     owner = "mapnik";
     repo = "python-mapnik";
-    # Use proj6 branch in order to support Proj >= 6 (excluding commits after 2023-02-23)
-    # https://github.com/mapnik/python-mapnik/compare/master...proj6
-    rev = "687b2c72a24c59d701d62e4458c380f8c54f0549";
-    hash = "sha256-q3Snd3K/JndckwAVwSKU+kFK5E1uph78ty7mwVo/7Ik=";
+    rev = "5ab32f0209909cc98c26e1d86ce0c8ef29a9bf3d";
+    hash = "sha256-OqijA1WcyBcyWO8gntqp+xNIaV1Jqa0n1eMDip2OCvY=";
     # Only needed for test data
     fetchSubmodules = true;
   };
@@ -49,8 +48,13 @@ buildPythonPackage rec {
       src = ./find-libmapnik.patch;
       libmapnik = "${mapnik}/lib";
     })
+    # Use `std::optional` rather than `boost::optional`
+    # https://github.com/mapnik/python-mapnik/commit/e9f88a95a03dc081826a69da67bbec3e4cccd5eb
+    ./python-mapnik_std_optional.patch
   ];
 
+  stdenv = if python.stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else python.stdenv;
+
   nativeBuildInputs = [
     mapnik # for mapnik_config
     pkg-config
@@ -70,6 +74,7 @@ buildPythonPackage rec {
     zlib
     libxml2
     sqlite
+    sparsehash
   ];
 
   propagatedBuildInputs = [
@@ -107,14 +112,19 @@ buildPythonPackage rec {
   # https://github.com/mapnik/python-mapnik/issues/255
   disabledTests = [
     "test_geometry_type"
-    "test_marker_ellipse_render1"
-    "test_marker_ellipse_render2"
-    "test_normalizing_definition"
     "test_passing_pycairo_context_pdf"
     "test_pdf_printing"
-    "test_visual_zoom_all_rendering2"
-    "test_wgs84_inverse_forward"
-  ] ++ lib.optionals stdenv.isDarwin [ "test_passing_pycairo_context_svg" ];
+    "test_render_with_scale_factor"
+  ] ++ lib.optionals stdenv.isDarwin [
+    "test_passing_pycairo_context_png"
+    "test_passing_pycairo_context_svg"
+    "test_pycairo_pdf_surface1"
+    "test_pycairo_pdf_surface2"
+    "test_pycairo_pdf_surface3"
+    "test_pycairo_svg_surface1"
+    "test_pycairo_svg_surface2"
+    "test_pycairo_svg_surface3"
+  ];
 
   pythonImportsCheck = [ "mapnik" ];
 
diff --git a/pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch b/pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch
new file mode 100644
index 0000000000000..c285e77ca57b6
--- /dev/null
+++ b/pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch
@@ -0,0 +1,176 @@
+diff --git a/src/mapnik_image.cpp b/src/mapnik_image.cpp
+index 9add692c9..488427b56 100644
+--- a/src/mapnik_image.cpp
++++ b/src/mapnik_image.cpp
+@@ -230,7 +230,7 @@ unsigned get_type(mapnik::image_any & im)
+ 
+ std::shared_ptr<image_any> open_from_file(std::string const& filename)
+ {
+-    boost::optional<std::string> type = type_from_filename(filename);
++    auto type = type_from_filename(filename);
+     if (type)
+     {
+         std::unique_ptr<image_reader> reader(get_image_reader(filename,*type));
+diff --git a/src/mapnik_layer.cpp b/src/mapnik_layer.cpp
+index 4fc7ea579..fbd277a81 100644
+--- a/src/mapnik_layer.cpp
++++ b/src/mapnik_layer.cpp
+@@ -95,7 +95,7 @@ struct layer_pickle_suite : boost::python::pickle_suite
+ 
+ std::vector<std::string> & (mapnik::layer::*_styles_)() = &mapnik::layer::styles;
+ 
+-void set_maximum_extent(mapnik::layer & l, boost::optional<mapnik::box2d<double> > const& box)
++void set_maximum_extent(mapnik::layer & l, std::optional<mapnik::box2d<double> > const& box)
+ {
+     if (box)
+     {
+@@ -107,7 +107,7 @@ void set_maximum_extent(mapnik::layer & l, boost::optional<mapnik::box2d<double>
+     }
+ }
+ 
+-void set_buffer_size(mapnik::layer & l, boost::optional<int> const& buffer_size)
++void set_buffer_size(mapnik::layer & l, std::optional<int> const& buffer_size)
+ {
+     if (buffer_size)
+     {
+@@ -121,7 +121,7 @@ void set_buffer_size(mapnik::layer & l, boost::optional<int> const& buffer_size)
+ 
+ PyObject * get_buffer_size(mapnik::layer & l)
+ {
+-    boost::optional<int> buffer_size = l.buffer_size();
++    std::optional<int> buffer_size = l.buffer_size();
+     if (buffer_size)
+     {
+ #if PY_VERSION_HEX >= 0x03000000
+diff --git a/src/mapnik_map.cpp b/src/mapnik_map.cpp
+index 3587e5d8a..cfa523b03 100644
+--- a/src/mapnik_map.cpp
++++ b/src/mapnik_map.cpp
+@@ -105,7 +105,7 @@ mapnik::featureset_ptr query_map_point(mapnik::Map const& m, int index, double x
+     return m.query_map_point(idx, x, y);
+ }
+ 
+-void set_maximum_extent(mapnik::Map & m, boost::optional<mapnik::box2d<double> > const& box)
++void set_maximum_extent(mapnik::Map & m, std::optional<mapnik::box2d<double> > const& box)
+ {
+     if (box)
+     {
+diff --git a/src/python_optional.hpp b/src/python_optional.hpp
+index d690b7c51..9d86c340e 100644
+--- a/src/python_optional.hpp
++++ b/src/python_optional.hpp
+@@ -28,7 +28,7 @@
+ #include <mapnik/util/noncopyable.hpp>
+ #pragma GCC diagnostic pop
+ 
+-// boost::optional<T> to/from converter from John Wiegley
++// std::optional<T> to/from converter from John Wiegley
+ 
+ template <typename T, typename TfromPy>
+ struct object_from_python
+@@ -54,7 +54,7 @@ struct python_optional : public mapnik::util::noncopyable
+ {
+     struct optional_to_python
+     {
+-        static PyObject * convert(const boost::optional<T>& value)
++        static PyObject * convert(const std::optional<T>& value)
+         {
+             return (value ? boost::python::to_python_value<T>()(*value) :
+                     boost::python::detail::none());
+@@ -90,9 +90,9 @@ struct python_optional : public mapnik::util::noncopyable
+                                     data)->storage.bytes;
+ 
+             if (data->convertible == source)        // == None
+-                new (storage) boost::optional<T>(); // A Boost uninitialized value
++                new (storage) std::optional<T>(); // A Boost uninitialized value
+             else
+-                new (storage) boost::optional<T>(*static_cast<T *>(data->convertible));
++                new (storage) std::optional<T>(*static_cast<T *>(data->convertible));
+ 
+             data->convertible = storage;
+         }
+@@ -100,18 +100,18 @@ struct python_optional : public mapnik::util::noncopyable
+ 
+     explicit python_optional()
+     {
+-        register_python_conversion<boost::optional<T>,
++        register_python_conversion<std::optional<T>,
+             optional_to_python, optional_from_python>();
+     }
+ };
+ 
+-// to/from boost::optional<bool>
++// to/from std::optional<bool>
+ template <>
+ struct python_optional<float> : public mapnik::util::noncopyable
+ {
+     struct optional_to_python
+     {
+-        static PyObject * convert(const boost::optional<float>& value)
++        static PyObject * convert(const std::optional<float>& value)
+         {
+             return (value ? PyFloat_FromDouble(*value) :
+                     boost::python::detail::none());
+@@ -133,30 +133,30 @@ struct python_optional<float> : public mapnik::util::noncopyable
+                               boost::python::converter::rvalue_from_python_stage1_data * data)
+         {
+             using namespace boost::python::converter;
+-            void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *)
++            void * const storage = ((rvalue_from_python_storage<std::optional<bool> > *)
+                                     data)->storage.bytes;
+             if (source == Py_None)  // == None
+-                new (storage) boost::optional<float>(); // A Boost uninitialized value
++                new (storage) std::optional<float>(); // A Boost uninitialized value
+             else
+-                new (storage) boost::optional<float>(PyFloat_AsDouble(source));
++                new (storage) std::optional<float>(PyFloat_AsDouble(source));
+             data->convertible = storage;
+         }
+     };
+ 
+     explicit python_optional()
+     {
+-        register_python_conversion<boost::optional<float>,
++        register_python_conversion<std::optional<float>,
+             optional_to_python, optional_from_python>();
+     }
+ };
+ 
+-// to/from boost::optional<float>
++// to/from std::optional<float>
+ template <>
+ struct python_optional<bool> : public mapnik::util::noncopyable
+ {
+     struct optional_to_python
+     {
+-        static PyObject * convert(const boost::optional<bool>& value)
++        static PyObject * convert(const std::optional<bool>& value)
+         {
+             if (value)
+             {
+@@ -181,13 +181,13 @@ struct python_optional<bool> : public mapnik::util::noncopyable
+                               boost::python::converter::rvalue_from_python_stage1_data * data)
+         {
+             using namespace boost::python::converter;
+-            void * const storage = ((rvalue_from_python_storage<boost::optional<bool> > *)
++            void * const storage = ((rvalue_from_python_storage<std::optional<bool> > *)
+                                     data)->storage.bytes;
+             if (source == Py_None)  // == None
+-                new (storage) boost::optional<bool>(); // A Boost uninitialized value
++                new (storage) std::optional<bool>(); // A Boost uninitialized value
+             else
+             {
+-                new (storage) boost::optional<bool>(source == Py_True ? true : false);
++                new (storage) std::optional<bool>(source == Py_True ? true : false);
+             }
+             data->convertible = storage;
+         }
+@@ -195,7 +195,7 @@ struct python_optional<bool> : public mapnik::util::noncopyable
+ 
+     explicit python_optional()
+     {
+-        register_python_conversion<boost::optional<bool>,
++        register_python_conversion<std::optional<bool>,
+             optional_to_python, optional_from_python>();
+     }
+ };
diff --git a/pkgs/servers/http/apache-modules/mod_tile/default.nix b/pkgs/servers/http/apache-modules/mod_tile/default.nix
index cd3937fe1fa62..6c64478cc1259 100644
--- a/pkgs/servers/http/apache-modules/mod_tile/default.nix
+++ b/pkgs/servers/http/apache-modules/mod_tile/default.nix
@@ -29,6 +29,11 @@ stdenv.mkDerivation rec {
     hash = "sha256-zXUwTG8cqAkY5MC1jAc2TtMgNMQPLc5nc22okVYP4ME=";
   };
 
+  patches = [
+    # Support Mapnik >= v4.0.0-rc2 (boost:optional no longer used)
+    ./mod_tile-std_optional.patch
+  ];
+
   nativeBuildInputs = [
     cmake
     pkg-config
@@ -64,6 +69,8 @@ stdenv.mkDerivation rec {
   installFlags = [ "DESTDIR=$(out)" ];
 
   doCheck = true;
+  # Do not run tests in parallel
+  enableParallelChecking = false;
 
   passthru.updateScript = nix-update-script { };
 
diff --git a/pkgs/servers/http/apache-modules/mod_tile/mod_tile-std_optional.patch b/pkgs/servers/http/apache-modules/mod_tile/mod_tile-std_optional.patch
new file mode 100644
index 0000000000000..1f63ce0bc1f1d
--- /dev/null
+++ b/pkgs/servers/http/apache-modules/mod_tile/mod_tile-std_optional.patch
@@ -0,0 +1,26 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e68d2e9..ddba150 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -48,7 +48,7 @@ find_package(LIBMEMCACHED)
+ find_package(LIBRADOS)
+ 
+ if(LIBMAPNIK_VERSION STRGREATER_EQUAL "4")
+-  set(CMAKE_CXX_STANDARD 14)
++  set(CMAKE_CXX_STANDARD 17)
+ endif()
+ 
+ # Programs
+diff --git a/src/parameterize_style.cpp b/src/parameterize_style.cpp
+index 8db7122..7100735 100644
+--- a/src/parameterize_style.cpp
++++ b/src/parameterize_style.cpp
+@@ -72,7 +74,7 @@ static void parameterize_map_language(mapnik::Map &m, char * parameter)
+ 		mapnik::parameters params = l.datasource()->params();
+ 
+ 		if (params.find("table") != params.end()) {
+-			boost::optional<std::string> table = params.get<std::string>("table");
++			auto table = params.get<std::string>("table");
+ 
+ 			if (table && table->find(",name") != std::string::npos) {
+ 				std::string str = *table;