aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-pyclipper/10-system-libs.patch
blob: 0e88d4d3b5ec1090d9c7dfa0f1e5627a2b9b3a58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Upstream comes with its own copy of the Clipper C++ polygon clipping
library, which they compile into a static library that gets included
into the Python wheel. On Alpine Linux, we prefer to use the shared
library from package `clipper` so that the exact same implementation
gets called across the system. Also, linking to a system-wide shared
library reduces total installation size when Clipper gets called
from both Python and non-Python code.

--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@
     from Cython.Distutils import build_ext
 
     print('Development mode: Compiling Cython modules from .pyx sources.')
-    sources = ["pyclipper/pyclipper.pyx", "pyclipper/clipper.cpp"]
+    sources = ["pyclipper/pyclipper.pyx"]
 
     from setuptools.command.sdist import sdist as _sdist
 
@@ -40,7 +40,7 @@
 
 else:
     print('Distribution mode: Compiling Cython generated .cpp sources.')
-    sources = ["pyclipper/pyclipper.cpp", "pyclipper/clipper.cpp"]
+    sources = ["pyclipper/pyclipper.cpp"]
     cmdclass = {}
 
 
@@ -51,6 +51,9 @@
 ext = Extension("pyclipper",
                 sources=sources,
                 language="c++",
+                include_dirs=['/usr/include/polyclipping'],
+                libraries=['polyclipping'],
+                library_dirs=['/usr/lib'],
                 # define extra macro definitions that are used by clipper
                 # Available definitions that can be used with pyclipper:
                 # use_lines, use_int32