Merge pull request #122619 from tollb/fix/python-mapnik-pycairo-support-20210511a

python-mapnik: fix pycairo support
This commit is contained in:
Christoph Hrdinka 2021-05-12 09:12:09 +02:00 committed by GitHub
commit 00a6b1fa8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -35,10 +35,16 @@ in buildPythonPackage rec {
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 = [

View File

@ -0,0 +1,18 @@
diff --git a/setup.py b/setup.py
index 82a31d733..1c876a553 100755
--- a/setup.py
+++ b/setup.py
@@ -228,10 +228,9 @@ extra_comp_args = list(filter(lambda arg: arg != "-fvisibility=hidden", extra_co
if os.environ.get("PYCAIRO", "false") == "true":
try:
extra_comp_args.append('-DHAVE_PYCAIRO')
- print("-I%s/include/pycairo".format(sys.exec_prefix))
- extra_comp_args.append("-I{0}/include/pycairo".format(sys.exec_prefix))
- #extra_comp_args.extend(check_output(["pkg-config", '--cflags', 'pycairo']).strip().split(' '))
- #linkflags.extend(check_output(["pkg-config", '--libs', 'pycairo']).strip().split(' '))
+ pycairo_name = 'py3cairo' if PYTHON3 else 'pycairo'
+ extra_comp_args.extend(check_output(["pkg-config", '--cflags', pycairo_name]).strip().split(' '))
+ linkflags.extend(check_output(["pkg-config", '--libs', pycairo_name]).strip().split(' '))
except:
raise Exception("Failed to find compiler options for pycairo")