about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/mapnik
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mapnik')
-rw-r--r--nixpkgs/pkgs/development/libraries/mapnik/catch2-src.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/mapnik/cmake-harfbuzz.patch26
-rw-r--r--nixpkgs/pkgs/development/libraries/mapnik/default.nix110
-rw-r--r--nixpkgs/pkgs/development/libraries/mapnik/include.patch11
4 files changed, 161 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mapnik/catch2-src.patch b/nixpkgs/pkgs/development/libraries/mapnik/catch2-src.patch
new file mode 100644
index 000000000000..04c6f7add217
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mapnik/catch2-src.patch
@@ -0,0 +1,14 @@
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 0705ddce1..771291b88 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -7,8 +7,7 @@ include(FetchContent)
+ 
+ FetchContent_Declare(
+   Catch2
+-  GIT_REPOSITORY https://github.com/catchorg/Catch2.git
+-  GIT_TAG        v2.13.7)
++  SOURCE_DIR @catch2_src@)
+ FetchContent_MakeAvailable(Catch2)
+ 
+ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0") 
diff --git a/nixpkgs/pkgs/development/libraries/mapnik/cmake-harfbuzz.patch b/nixpkgs/pkgs/development/libraries/mapnik/cmake-harfbuzz.patch
new file mode 100644
index 000000000000..1d5ca6903d0b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mapnik/cmake-harfbuzz.patch
@@ -0,0 +1,26 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d87a7052d..837867551 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -153,19 +153,8 @@ endif()
+ 
+ mapnik_find_package(Freetype REQUIRED)
+ 
+-# try to find harfbuzz with the native configuration and fallback to our "own" FindHarfBuzz
+-mapnik_find_package(harfbuzz CONFIG QUIET)
+-if(harfbuzz_FOUND)
+-    message(STATUS "Found harfbuzz native cmake")
+-    list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz)
+-else()
+-    # Use pkg-config when harfbuzz is not found.
+-    # It might be possible that in future version harfbuzz could only be found via pkg-config.
+-    # harfbuzz related discussion: https://github.com/harfbuzz/harfbuzz/issues/2653
+-    message(STATUS "harfbuzz not found via cmake. Searching via pkg-config...")
+-    pkg_check_modules(harfbuzz REQUIRED IMPORTED_TARGET harfbuzz>=${HARFBUZZ_MIN_VERSION})
+-    list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::harfbuzz)
+-endif()
++pkg_check_modules(harfbuzz REQUIRED IMPORTED_TARGET harfbuzz)
++list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::harfbuzz)
+ 
+ if(USE_EXTERNAL_MAPBOX_GEOMETRY)
+     # this is used to provide a way to specify include dirs with CACHE VARIABLES
diff --git a/nixpkgs/pkgs/development/libraries/mapnik/default.nix b/nixpkgs/pkgs/development/libraries/mapnik/default.nix
new file mode 100644
index 000000000000..8d0f5565947b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mapnik/default.nix
@@ -0,0 +1,110 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, buildPackages
+, cmake
+, pkg-config
+, substituteAll
+, boost
+, cairo
+, freetype
+, gdal
+, harfbuzz
+, icu
+, libjpeg
+, libpng
+, libtiff
+, libwebp
+, libxml2
+, proj
+, python3
+, sqlite
+, zlib
+, catch2
+, postgresql
+}:
+
+stdenv.mkDerivation rec {
+  pname = "mapnik";
+  version = "unstable-2022-10-18";
+
+  src = fetchFromGitHub {
+    owner = "mapnik";
+    repo = "mapnik";
+    rev = "05661e54392bcbb3367747f97a3ef6e468c105ba";
+    hash = "sha256-96AneLPH1gbh/u880Pdc9OdFq2MniSdaTJoKYqId7sw=";
+    fetchSubmodules = true;
+  };
+
+  postPatch = ''
+    substituteInPlace configure \
+      --replace '$PYTHON scons/scons.py' ${buildPackages.scons}/bin/scons
+    rm -r scons
+  '';
+
+  # a distinct dev output makes python-mapnik fail
+  outputs = [ "out" ];
+
+  patches = [
+    # The lib/cmake/harfbuzz/harfbuzz-config.cmake file in harfbuzz.dev is faulty,
+    # as it provides the wrong libdir. The workaround is to just rely on
+    # pkg-config to locate harfbuzz shared object files.
+    # Upstream HarfBuzz wants to drop CMake support anyway.
+    # See discussion: https://github.com/mapnik/mapnik/issues/4265
+    ./cmake-harfbuzz.patch
+    # prevent CMake from trying to get libraries on the Internet
+    (substituteAll {
+      src = ./catch2-src.patch;
+      catch2_src = catch2.src;
+    })
+    ./include.patch
+  ];
+
+  nativeBuildInputs = [ cmake pkg-config ];
+
+  buildInputs = [
+    boost
+    cairo
+    freetype
+    gdal
+    harfbuzz
+    icu
+    libjpeg
+    libpng
+    libtiff
+    libwebp
+    proj
+    python3
+    sqlite
+    zlib
+    libxml2
+    postgresql
+  ];
+
+  cmakeFlags = [
+    # Would require qt otherwise.
+    "-DBUILD_DEMO_VIEWER=OFF"
+  ];
+
+  # 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.
+  preBuild = ''
+    cd ..
+    ${buildPackages.scons}/bin/scons utils/mapnik-config
+    cd build
+  '';
+
+  preInstall = ''
+    mkdir -p $out/bin
+    cp ../utils/mapnik-config/mapnik-config $out/bin/mapnik-config
+  '';
+
+  meta = with lib; {
+    description = "An open source toolkit for developing mapping applications";
+    homepage = "https://mapnik.org";
+    maintainers = with maintainers; [ hrdinka ];
+    license = licenses.lgpl21Plus;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/mapnik/include.patch b/nixpkgs/pkgs/development/libraries/mapnik/include.patch
new file mode 100644
index 000000000000..e13f4a43cbcb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mapnik/include.patch
@@ -0,0 +1,11 @@
+diff --git a/benchmark/src/test_png_encoding2.cpp b/benchmark/src/test_png_encoding2.cpp
+index 19897d180..5791b139c 100644
+--- a/benchmark/src/test_png_encoding2.cpp
++++ b/benchmark/src/test_png_encoding2.cpp
+@@ -1,5 +1,6 @@
+ #include "bench_framework.hpp"
+ #include "compare_images.hpp"
++#include <memory>
+ 
+ class test : public benchmark::test_case
+ {