aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-pyclipper/10-system-libs.patch
blob: d8f6cb717a8ea2a55b483f7afb71e04840c04db4 (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
39
40
41
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.

diff --git a/setup.py b/setup.py
index b102124..6a8f43c 100755
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ if dev_mode:
     from Cython.Distutils import build_ext
 
     print('Development mode: Compiling Cython modules from .pyx sources.')
-    sources = ["src/pyclipper/_pyclipper.pyx", "src/clipper.cpp"]
+    sources = ["src/pyclipper/_pyclipper.pyx"]
 
     from setuptools.command.sdist import sdist as _sdist
 
@@ -40,7 +40,7 @@ if dev_mode:
 
 else:
     print('Distribution mode: Compiling Cython generated .cpp sources.')
-    sources = ["src/pyclipper/_pyclipper.cpp", "src/clipper.cpp"]
+    sources = ["src/pyclipper/_pyclipper.cpp"]
     cmdclass = {}
 
 
@@ -51,7 +51,9 @@ pytest_runner = ['pytest_runner'] if needs_pytest else []
 ext = Extension("pyclipper._pyclipper",
                 sources=sources,
                 language="c++",
-                include_dirs=["src"],
+                include_dirs=["src", "/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