2024-09-21 23:16:55 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
2024-09-26 09:58:04 +00:00
|
|
|
gitUpdater,
|
2024-09-21 23:16:55 +00:00
|
|
|
buildPackages,
|
|
|
|
cmake,
|
|
|
|
pkg-config,
|
|
|
|
boost,
|
|
|
|
cairo,
|
|
|
|
freetype,
|
|
|
|
gdal,
|
|
|
|
harfbuzz,
|
|
|
|
icu,
|
|
|
|
libjpeg,
|
|
|
|
libpng,
|
|
|
|
libtiff,
|
|
|
|
libwebp,
|
|
|
|
libxml2,
|
|
|
|
proj,
|
|
|
|
python3,
|
|
|
|
sqlite,
|
|
|
|
zlib,
|
|
|
|
catch2,
|
|
|
|
postgresql,
|
|
|
|
protozero,
|
|
|
|
sparsehash,
|
2015-12-02 20:27:32 +00:00
|
|
|
}:
|
|
|
|
|
2021-11-13 21:27:29 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "mapnik";
|
2024-10-30 12:07:52 +00:00
|
|
|
version = "4.0.3";
|
2021-11-13 21:27:29 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mapnik";
|
|
|
|
repo = "mapnik";
|
2024-01-13 05:36:08 +00:00
|
|
|
rev = "v${version}";
|
2024-10-30 12:07:52 +00:00
|
|
|
hash = "sha256-BDddxaMgUv1q3zceiAOorSpT7GH1xt3PotrdJg4/j+E=";
|
2021-11-13 21:27:29 +00:00
|
|
|
fetchSubmodules = true;
|
2015-12-02 20:27:32 +00:00
|
|
|
};
|
|
|
|
|
2024-09-26 09:58:04 +00:00
|
|
|
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
|
|
|
|
|
2022-06-05 21:58:36 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace configure \
|
2021-11-13 21:27:29 +00:00
|
|
|
--replace '$PYTHON scons/scons.py' ${buildPackages.scons}/bin/scons
|
2022-06-05 21:58:36 +00:00
|
|
|
rm -r scons
|
2024-01-13 05:36:08 +00:00
|
|
|
# Remove bundled 'sparsehash' directory in favor of 'sparsehash' package
|
|
|
|
rm -r deps/mapnik/sparsehash
|
2022-06-05 21:58:36 +00:00
|
|
|
'';
|
|
|
|
|
2016-09-27 13:17:28 +00:00
|
|
|
# a distinct dev output makes python-mapnik fail
|
|
|
|
outputs = [ "out" ];
|
2016-06-13 09:59:04 +00:00
|
|
|
|
2021-11-13 21:27:29 +00:00
|
|
|
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
|
2023-12-26 19:48:47 +00:00
|
|
|
# Account for full paths when generating libmapnik.pc
|
|
|
|
./export-pkg-config-full-paths.patch
|
2024-01-13 05:36:08 +00:00
|
|
|
# Use 'sparsehash' package.
|
|
|
|
./use-sparsehash-package.patch
|
2021-11-13 21:27:29 +00:00
|
|
|
];
|
2015-12-02 20:27:32 +00:00
|
|
|
|
2024-09-21 23:16:55 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
];
|
2017-04-20 18:31:37 +00:00
|
|
|
|
2021-11-13 21:27:29 +00:00
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
cairo
|
|
|
|
freetype
|
|
|
|
gdal
|
|
|
|
harfbuzz
|
|
|
|
icu
|
|
|
|
libjpeg
|
|
|
|
libpng
|
|
|
|
libtiff
|
|
|
|
libwebp
|
|
|
|
proj
|
|
|
|
python3
|
|
|
|
sqlite
|
|
|
|
zlib
|
2024-07-28 09:05:21 +00:00
|
|
|
(libxml2.override { enableHttp = true; })
|
2021-07-27 12:00:18 +00:00
|
|
|
postgresql
|
2024-01-13 05:36:08 +00:00
|
|
|
protozero
|
|
|
|
sparsehash
|
2021-07-27 12:00:18 +00:00
|
|
|
];
|
2015-12-02 20:27:32 +00:00
|
|
|
|
2021-11-13 21:27:29 +00:00
|
|
|
cmakeFlags = [
|
2024-01-13 05:36:08 +00:00
|
|
|
# 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.
|
2024-04-17 19:14:53 +00:00
|
|
|
(lib.cmakeBool "USE_MEMORY_MAPPED_FILE" (!stdenv.hostPlatform.isDarwin))
|
2024-09-21 23:16:55 +00:00
|
|
|
# don't try to download sources for catch2, use our own
|
|
|
|
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CATCH2" "${catch2.src}")
|
2021-11-13 21:27:29 +00:00
|
|
|
];
|
2015-12-02 20:27:32 +00:00
|
|
|
|
2023-12-26 19:48:47 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2021-11-13 21:27:29 +00:00
|
|
|
# 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
|
2024-01-13 05:36:08 +00:00
|
|
|
# then try to build everything with scons. C++17 is the minimum supported
|
|
|
|
# C++ version.
|
2021-11-13 21:27:29 +00:00
|
|
|
preBuild = ''
|
|
|
|
cd ..
|
2024-01-13 05:36:08 +00:00
|
|
|
env CXX_STD=17 ${buildPackages.scons}/bin/scons utils/mapnik-config
|
2021-11-13 21:27:29 +00:00
|
|
|
cd build
|
2019-03-04 20:41:53 +00:00
|
|
|
'';
|
|
|
|
|
2021-11-13 21:27:29 +00:00
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp ../utils/mapnik-config/mapnik-config $out/bin/mapnik-config
|
|
|
|
'';
|
2015-12-02 20:27:32 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2015-12-02 20:27:32 +00:00
|
|
|
description = "Open source toolkit for developing mapping applications";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://mapnik.org";
|
2024-09-26 09:43:17 +00:00
|
|
|
maintainers =
|
|
|
|
with maintainers;
|
|
|
|
teams.geospatial.members
|
|
|
|
++ [
|
|
|
|
hrdinka
|
|
|
|
hummeltech
|
|
|
|
];
|
2021-11-13 21:27:29 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
2015-12-02 20:27:32 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|