nixpkgs/pkgs/development/python-modules/python-mapnik/default.nix
Bruce Toll 12d4e7567c python-mapnik: fix pycairo support
Fully enable pycairo support by exporting PYCAIRO=true and using
pkg-config to locate the pycairo library (with included patch).

The patch restores the use of pkg-config to find pycairo. This code was
present upstream, but commented out; it has been re-enabled and
modified to support both pycairo and py3cairo (the python3 version
of pycairo).
2021-05-11 13:49:58 -04:00

73 lines
1.4 KiB
Nix

{ lib
, buildPythonPackage
, isPyPy
, python
, pkgs
, pillow
, pycairo
}:
let
boost = pkgs.boost.override {
enablePython = true;
inherit python;
};
mapnik = pkgs.mapnik.override {
inherit python boost;
};
in buildPythonPackage rec {
pname = "python-mapnik";
version = "unstable-2020-02-24";
src = pkgs.fetchFromGitHub {
owner = "mapnik";
repo = "python-mapnik";
rev = "7da019cf9eb12af8f8aa88b7d75789dfcd1e901b";
sha256 = "0snn7q7w1ab90311q8wgd1z64kw1svm5w831q0xd6glqhah86qc8";
};
disabled = isPyPy;
doCheck = false; # doesn't find needed test data files
preBuild = let
pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
in ''
export BOOST_PYTHON_LIB="boost_python${pythonVersion}"
export BOOST_THREAD_LIB="boost_thread"
export BOOST_SYSTEM_LIB="boost_system"
export PYCAIRO=true
'';
nativeBuildInputs = [
mapnik # for mapnik_config
pkgs.pkgconfig
];
patches = [
./find-pycairo-with-pkg-config.patch
];
buildInputs = [
mapnik
boost
] ++ (with pkgs; [
cairo
harfbuzz
icu
libjpeg
libpng
libtiff
libwebp
proj
zlib
]);
propagatedBuildInputs = [ pillow pycairo ];
meta = with lib; {
description = "Python bindings for Mapnik";
homepage = "https://mapnik.org";
license = licenses.lgpl21;
};
}