summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorKerstin Humm <kerstin@erictapen.name>2021-11-13 22:27:29 +0100
committerRobert Schütz <nix@dotlambda.de>2022-10-29 10:36:50 -0700
commitd35077ae8bfeba5004438046bffd9515fef33214 (patch)
tree687a81ec5331c1f28b6c2b74651a25baaeafea36 /pkgs/development/libraries
parent7c224b3e127ad37b27f31aaa71ae5959320bd492 (diff)
downloadnixpkgs-d35077ae8bfeba5004438046bffd9515fef33214.tar
nixpkgs-d35077ae8bfeba5004438046bffd9515fef33214.tar.gz
nixpkgs-d35077ae8bfeba5004438046bffd9515fef33214.tar.bz2
nixpkgs-d35077ae8bfeba5004438046bffd9515fef33214.tar.lz
nixpkgs-d35077ae8bfeba5004438046bffd9515fef33214.tar.xz
nixpkgs-d35077ae8bfeba5004438046bffd9515fef33214.tar.zst
nixpkgs-d35077ae8bfeba5004438046bffd9515fef33214.zip
mapnik: 3.1.0 -> unstable-2022-04-14
- use CMake. I just didn't got it to work with SCons.
- patch cmake to find harfbuzz
- prefetch catch2 for enabling tests
- add erictapen as maintainer
- build mapnik-config with scons, as it isn't build by cmake
- use python3 exclusively
- build with harfbuzz-icu
- change license to lgpl21Plus
- use PROJ 8
- use latest scons, but use cmake for everything but mapnik-config
- don't make postgresql optional

Co-Authored-by: Robert Schütz <nix@dotlambda.de>
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/mapnik/catch2-src.patch14
-rw-r--r--pkgs/development/libraries/mapnik/cmake-harfbuzz.patch26
-rw-r--r--pkgs/development/libraries/mapnik/default.nix163
-rw-r--r--pkgs/development/libraries/mapnik/include.patch11
4 files changed, 132 insertions, 82 deletions
diff --git a/pkgs/development/libraries/mapnik/catch2-src.patch b/pkgs/development/libraries/mapnik/catch2-src.patch
new file mode 100644
index 00000000000..04c6f7add21
--- /dev/null
+++ b/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/pkgs/development/libraries/mapnik/cmake-harfbuzz.patch b/pkgs/development/libraries/mapnik/cmake-harfbuzz.patch
new file mode 100644
index 00000000000..f44b879b592
--- /dev/null
+++ b/pkgs/development/libraries/mapnik/cmake-harfbuzz.patch
@@ -0,0 +1,26 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f2dc1f02d..739b8ae99 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/pkgs/development/libraries/mapnik/default.nix b/pkgs/development/libraries/mapnik/default.nix
index 13e34bebee6..d9ae74ed44a 100644
--- a/pkgs/development/libraries/mapnik/default.nix
+++ b/pkgs/development/libraries/mapnik/default.nix
@@ -1,111 +1,110 @@
-{ lib, stdenv, fetchzip
-, boost, cairo, freetype, gdal, harfbuzz, icu, libjpeg, libpng, libtiff
-, libwebp, libxml2, proj, python3, python ? python3, sqlite, zlib
-, sconsPackages
-
-# supply a postgresql package to enable the PostGIS input plugin
-, postgresql ? null
+{ 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
 }:
 
-let
-  scons = sconsPackages.scons_3_0_1;
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   pname = "mapnik";
-  version = "3.1.0";
-
-  src = fetchzip {
-    # this one contains all git submodules and is cheaper than fetchgit
-    url = "https://github.com/mapnik/mapnik/releases/download/v${version}/mapnik-v${version}.tar.bz2";
-    sha256 = "sha256-qqPqN4vs3ZsqKgnx21yQhX8OzHca/0O+3mvQ/vnC5EY=";
+  version = "unstable-2022-04-14";
+
+  src = fetchFromGitHub {
+    owner = "mapnik";
+    repo = "mapnik";
+    rev = "1ba1278b4227ccd887a95880d1c75aa6446132fc";
+    sha256 = "sha256-dtu+PKpK/crO5cZje0aj+vB9beG0eU6fyT9GNtvvtbM=";
+    fetchSubmodules = true;
   };
 
   postPatch = ''
     substituteInPlace configure \
-      --replace '$PYTHON scons/scons.py' ${scons}/bin/scons
+      --replace '$PYTHON scons/scons.py' ${buildPackages.scons}/bin/scons
     rm -r scons
   '';
 
   # a distinct dev output makes python-mapnik fail
   outputs = [ "out" ];
 
-  nativeBuildInputs = [ scons ];
+  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
+  ];
 
-  buildInputs = [
-    boost cairo freetype gdal harfbuzz icu libjpeg libpng libtiff
-    libwebp proj python sqlite zlib
+  nativeBuildInputs = [ cmake pkg-config ];
 
-    # optional inputs
+  buildInputs = [
+    boost
+    cairo
+    freetype
+    gdal
+    harfbuzz
+    icu
+    libjpeg
+    libpng
+    libtiff
+    libwebp
+    proj
+    python3
+    sqlite
+    zlib
+    libxml2
     postgresql
   ];
 
-  propagatedBuildInputs = [ libxml2 ];
-
-  prefixKey = "PREFIX=";
+  cmakeFlags = [
+    # Would require qt otherwise.
+    "-DBUILD_DEMO_VIEWER=OFF"
+  ];
 
-  preConfigure = ''
-    patchShebangs ./configure
+  # 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
   '';
 
-  # NOTE: 2021-05-06:
-  # Add -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 for backwards compatibility
-  # with major versions 6 and 7 of proj which are otherwise not compatible
-  # with mapnik 3.1.0. Note that:
-  #
-  # 1. Starting with proj version 8, this workaround will no longer be
-  #    supported by the upstream proj project.
-  #
-  # 2. Without the workaround, mapnik configures itself without proj support.
-  #
-  # 3. The master branch of mapnik (after 3.1.0) appears to add native support
-  #    for the proj 6 api, so this workaround is not likely to be needed in
-  #    subsequent mapnik releases. At that point, this block comment and the
-  #    NIX_CFLAGS_COMPILE expression can be removed.
-
-  NIX_CFLAGS_COMPILE =
-    if version != "3.1.0" && lib.versionAtLeast version "3.1.0"
-    then throw "The mapnik compatibility workaround for proj 6 may no longer be required. Remove workaround after checking."
-    else if lib.versionAtLeast (lib.getVersion proj) "8"
-    then throw ("mapnik currently requires a version of proj less than 8, but proj version is: " + (lib.getVersion proj))
-    else "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1";
-
-  configureFlags = [
-    "BOOST_INCLUDES=${boost.dev}/include"
-    "BOOST_LIBS=${boost.out}/lib"
-    "CAIRO_INCLUDES=${cairo.dev}/include"
-    "CAIRO_LIBS=${cairo.out}/lib"
-    "FREETYPE_INCLUDES=${freetype.dev}/include"
-    "FREETYPE_LIBS=${freetype.out}/lib"
-    "GDAL_CONFIG=${gdal}/bin/gdal-config"
-    "HB_INCLUDES=${harfbuzz.dev}/include"
-    "HB_LIBS=${harfbuzz.out}/lib"
-    "ICU_INCLUDES=${icu.dev}/include"
-    "ICU_LIBS=${icu.out}/lib"
-    "JPEG_INCLUDES=${libjpeg.dev}/include"
-    "JPEG_LIBS=${libjpeg.out}/lib"
-    "PNG_INCLUDES=${libpng.dev}/include"
-    "PNG_LIBS=${libpng.out}/lib"
-    "PROJ_INCLUDES=${proj.dev}/include"
-    "PROJ_LIBS=${proj.out}/lib"
-    "SQLITE_INCLUDES=${sqlite.dev}/include"
-    "SQLITE_LIBS=${sqlite.out}/lib"
-    "TIFF_INCLUDES=${libtiff.dev}/include"
-    "TIFF_LIBS=${libtiff.out}/lib"
-    "WEBP_INCLUDES=${libwebp}/include"
-    "WEBP_LIBS=${libwebp}/lib"
-    "XMLPARSER=libxml2"
-  ];
-
-  buildFlags = [
-    "JOBS=$(NIX_BUILD_CORES)"
-  ];
+  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 erictapen ];
-    license = licenses.lgpl21;
+    license = licenses.lgpl21Plus;
     platforms = platforms.all;
-    # https://github.com/mapnik/mapnik/issues/4232
-    broken = lib.versionAtLeast proj.version "8.0.0";
   };
 }
diff --git a/pkgs/development/libraries/mapnik/include.patch b/pkgs/development/libraries/mapnik/include.patch
new file mode 100644
index 00000000000..e13f4a43cbc
--- /dev/null
+++ b/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
+ {