nixpkgs/pkgs/development/libraries/mapnik/default.nix

101 lines
3.3 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchzip
2015-12-02 20:27:32 +00:00
, boost, cairo, freetype, gdal, harfbuzz, icu, libjpeg, libpng, libtiff
, libwebp, libxml2, proj, python3, python ? python3, sqlite, zlib
# supply a postgresql package to enable the PostGIS input plugin
, postgresql ? null
2015-12-02 20:27:32 +00:00
}:
stdenv.mkDerivation rec {
pname = "mapnik";
2021-01-20 07:19:03 +00:00
version = "3.1.0";
2015-12-02 20:27:32 +00:00
2016-09-27 13:17:28 +00:00
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";
2021-01-20 07:19:03 +00:00
sha256 = "sha256-qqPqN4vs3ZsqKgnx21yQhX8OzHca/0O+3mvQ/vnC5EY=";
2015-12-02 20:27:32 +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
nativeBuildInputs = [ python3 ];
2015-12-02 20:27:32 +00:00
buildInputs = [
boost cairo freetype gdal harfbuzz icu libjpeg libpng libtiff
libwebp proj python sqlite zlib
# optional inputs
postgresql
];
2015-12-02 20:27:32 +00:00
mapnik: fix missing proj and libxml2 support This commit provides three minor improvements: 1. Fix missing proj support. Fixes #91889. 2. Fix missing libxml2 support. 3. Improve build time with parallel build. Fix missing proj support: ------------------------- The 2019-07-09 update to proj version 6.1.1 in nixpkgs commit d55cba68ff3 caused two problems for mapnik: 1. The separation of the dev output was not reflected in the mapnik expression. Since proj support is optional in the mapnik build, the build succeeded but no longer included proj support. See build log for: https://hydra.nixos.org/build/96274475. 2. Even if the mapnik expression was updated to use the separate dev output, it would still have dropped proj support because mapnik has not been updated for the proj 6 API. This commit fixes the PROJ_INCLUDES to use the correct dev output and also makes the PROJ_LIBS output explicit. In addition, it defines ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 since mapnik still does not have a tagged release that supports the proj 6 api. Looking to the future, it appears that the mapnik master branch includes proj 6 support, so some checks were included to help insure that this workaround gets removed once it is no longer required. Fix missing libxml2 support: ---------------------------- Configure with "XMLPARSER=libxml2" to get libxml2 support. This has been needed since mapnik 3.0.2. Remove XML2_INCLUDES and XML2_LIBS which trigger a bug in the supplied SConstruct script (when used with "XMLPARSER=libxml2. In addition, libxml2 needs to be a propagatedBuildInput to avoid errors building apacheHttpdPackages.mod_tile, python-mapnik, and possibly other packages. Enable parallel build: ---------------------- Setting enableParallelBuild does not result in a parallel build with mapnik. However, setting JOBS=$(NIX_BUILD_CORES) in buildFlags works and significantly reduces the build time.
2021-05-06 20:49:40 +00:00
propagatedBuildInputs = [ libxml2 ];
prefixKey = "PREFIX=";
2015-12-02 20:27:32 +00:00
2019-03-04 20:41:53 +00:00
preConfigure = ''
patchShebangs ./configure
'';
mapnik: fix missing proj and libxml2 support This commit provides three minor improvements: 1. Fix missing proj support. Fixes #91889. 2. Fix missing libxml2 support. 3. Improve build time with parallel build. Fix missing proj support: ------------------------- The 2019-07-09 update to proj version 6.1.1 in nixpkgs commit d55cba68ff3 caused two problems for mapnik: 1. The separation of the dev output was not reflected in the mapnik expression. Since proj support is optional in the mapnik build, the build succeeded but no longer included proj support. See build log for: https://hydra.nixos.org/build/96274475. 2. Even if the mapnik expression was updated to use the separate dev output, it would still have dropped proj support because mapnik has not been updated for the proj 6 API. This commit fixes the PROJ_INCLUDES to use the correct dev output and also makes the PROJ_LIBS output explicit. In addition, it defines ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 since mapnik still does not have a tagged release that supports the proj 6 api. Looking to the future, it appears that the mapnik master branch includes proj 6 support, so some checks were included to help insure that this workaround gets removed once it is no longer required. Fix missing libxml2 support: ---------------------------- Configure with "XMLPARSER=libxml2" to get libxml2 support. This has been needed since mapnik 3.0.2. Remove XML2_INCLUDES and XML2_LIBS which trigger a bug in the supplied SConstruct script (when used with "XMLPARSER=libxml2. In addition, libxml2 needs to be a propagatedBuildInput to avoid errors building apacheHttpdPackages.mod_tile, python-mapnik, and possibly other packages. Enable parallel build: ---------------------- Setting enableParallelBuild does not result in a parallel build with mapnik. However, setting JOBS=$(NIX_BUILD_CORES) in buildFlags works and significantly reduces the build time.
2021-05-06 20:49:40 +00:00
# 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"
mapnik: fix missing proj and libxml2 support This commit provides three minor improvements: 1. Fix missing proj support. Fixes #91889. 2. Fix missing libxml2 support. 3. Improve build time with parallel build. Fix missing proj support: ------------------------- The 2019-07-09 update to proj version 6.1.1 in nixpkgs commit d55cba68ff3 caused two problems for mapnik: 1. The separation of the dev output was not reflected in the mapnik expression. Since proj support is optional in the mapnik build, the build succeeded but no longer included proj support. See build log for: https://hydra.nixos.org/build/96274475. 2. Even if the mapnik expression was updated to use the separate dev output, it would still have dropped proj support because mapnik has not been updated for the proj 6 API. This commit fixes the PROJ_INCLUDES to use the correct dev output and also makes the PROJ_LIBS output explicit. In addition, it defines ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 since mapnik still does not have a tagged release that supports the proj 6 api. Looking to the future, it appears that the mapnik master branch includes proj 6 support, so some checks were included to help insure that this workaround gets removed once it is no longer required. Fix missing libxml2 support: ---------------------------- Configure with "XMLPARSER=libxml2" to get libxml2 support. This has been needed since mapnik 3.0.2. Remove XML2_INCLUDES and XML2_LIBS which trigger a bug in the supplied SConstruct script (when used with "XMLPARSER=libxml2. In addition, libxml2 needs to be a propagatedBuildInput to avoid errors building apacheHttpdPackages.mod_tile, python-mapnik, and possibly other packages. Enable parallel build: ---------------------- Setting enableParallelBuild does not result in a parallel build with mapnik. However, setting JOBS=$(NIX_BUILD_CORES) in buildFlags works and significantly reduces the build time.
2021-05-06 20:49:40 +00:00
"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"
mapnik: fix missing proj and libxml2 support This commit provides three minor improvements: 1. Fix missing proj support. Fixes #91889. 2. Fix missing libxml2 support. 3. Improve build time with parallel build. Fix missing proj support: ------------------------- The 2019-07-09 update to proj version 6.1.1 in nixpkgs commit d55cba68ff3 caused two problems for mapnik: 1. The separation of the dev output was not reflected in the mapnik expression. Since proj support is optional in the mapnik build, the build succeeded but no longer included proj support. See build log for: https://hydra.nixos.org/build/96274475. 2. Even if the mapnik expression was updated to use the separate dev output, it would still have dropped proj support because mapnik has not been updated for the proj 6 API. This commit fixes the PROJ_INCLUDES to use the correct dev output and also makes the PROJ_LIBS output explicit. In addition, it defines ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 since mapnik still does not have a tagged release that supports the proj 6 api. Looking to the future, it appears that the mapnik master branch includes proj 6 support, so some checks were included to help insure that this workaround gets removed once it is no longer required. Fix missing libxml2 support: ---------------------------- Configure with "XMLPARSER=libxml2" to get libxml2 support. This has been needed since mapnik 3.0.2. Remove XML2_INCLUDES and XML2_LIBS which trigger a bug in the supplied SConstruct script (when used with "XMLPARSER=libxml2. In addition, libxml2 needs to be a propagatedBuildInput to avoid errors building apacheHttpdPackages.mod_tile, python-mapnik, and possibly other packages. Enable parallel build: ---------------------- Setting enableParallelBuild does not result in a parallel build with mapnik. However, setting JOBS=$(NIX_BUILD_CORES) in buildFlags works and significantly reduces the build time.
2021-05-06 20:49:40 +00:00
"XMLPARSER=libxml2"
];
buildFlags = [
"JOBS=$(NIX_BUILD_CORES)"
];
2015-12-02 20:27:32 +00:00
meta = with lib; {
2015-12-02 20:27:32 +00:00
description = "An open source toolkit for developing mapping applications";
homepage = "https://mapnik.org";
2015-12-02 20:27:32 +00:00
maintainers = with maintainers; [ hrdinka ];
license = licenses.lgpl21;
platforms = platforms.all;
};
}