python3Packages.shapely: fix build on darwin
This commit is contained in:
parent
4a75203f02
commit
c5a59b1cdd
|
@ -29,8 +29,7 @@ buildPythonPackage rec {
|
||||||
(substituteAll {
|
(substituteAll {
|
||||||
src = ./library-paths.patch;
|
src = ./library-paths.patch;
|
||||||
libgeos_c = GEOS_LIBRARY_PATH;
|
libgeos_c = GEOS_LIBRARY_PATH;
|
||||||
libc = "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}"
|
libc = stdenv.lib.optionalString (!stdenv.isDarwin) "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}.6";
|
||||||
+ stdenv.lib.optionalString (!stdenv.isDarwin) ".6";
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ diff --git a/shapely/geos.py b/shapely/geos.py
|
||||||
index d5a67d2..19b7ffc 100644
|
index d5a67d2..19b7ffc 100644
|
||||||
--- a/shapely/geos.py
|
--- a/shapely/geos.py
|
||||||
+++ b/shapely/geos.py
|
+++ b/shapely/geos.py
|
||||||
@@ -61,127 +61,10 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
|
@@ -61,127 +61,17 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
|
||||||
"Could not find lib {} or load any of its variants {}.".format(
|
"Could not find lib {} or load any of its variants {}.".format(
|
||||||
libname, fallbacks or []))
|
libname, fallbacks or []))
|
||||||
|
|
||||||
|
@ -128,7 +128,14 @@ index d5a67d2..19b7ffc 100644
|
||||||
- free.argtypes = [c_void_p]
|
- free.argtypes = [c_void_p]
|
||||||
- free.restype = None
|
- free.restype = None
|
||||||
+_lgeos = CDLL('@libgeos_c@')
|
+_lgeos = CDLL('@libgeos_c@')
|
||||||
+free = CDLL('@libc@').free
|
+if sys.platform == 'darwin':
|
||||||
|
+ # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
|
||||||
|
+ # manpage says, "If filename is NULL, then the returned handle is for the
|
||||||
|
+ # main program". This way we can let the linker do the work to figure out
|
||||||
|
+ # which libc Python is actually using.
|
||||||
|
+ free = CDLL(None).free
|
||||||
|
+else:
|
||||||
|
+ free = CDLL('@libc@').free
|
||||||
+free.argtypes = [c_void_p]
|
+free.argtypes = [c_void_p]
|
||||||
+free.restype = None
|
+free.restype = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue