Line 0
Link Here
|
|
|
1 |
# Description: add missing library directory to python-config --ldflags |
2 |
# PR: 197757 |
3 |
# Upstream bug and patch obtained from: https://bugs.python.org/issue7352 |
4 |
|
5 |
--- Misc/python-config.in.orig 2014-12-10 15:59:51 UTC |
6 |
+++ Misc/python-config.in |
7 |
@@ -50,8 +50,21 @@ for opt in opt_flags: |
8 |
# add the prefix/lib/pythonX.Y/config dir, but only if there is no |
9 |
# shared library in prefix/lib/. |
10 |
if opt == '--ldflags': |
11 |
+ # Provide the location where the Python library is installed. |
12 |
+ # We always provide it, because Python may have been installed |
13 |
+ # at a non-standard location. |
14 |
if not getvar('Py_ENABLE_SHARED'): |
15 |
- libs.insert(0, '-L' + getvar('LIBPL')) |
16 |
+ # There is no shared library in prefix/lib. The static |
17 |
+ # library is in prefix/lib/pythonX.Y/config. |
18 |
+ # |
19 |
+ # Note that we cannot use getvar('LIBPL') like we used to, |
20 |
+ # because it provides the location at build time, which might |
21 |
+ # be different from the actual location at runtime. |
22 |
+ libdir = sysconfig.get_python_lib(standard_lib=True) + '/config' |
23 |
+ else: |
24 |
+ # The Python shared library is installed in prefix/lib. |
25 |
+ libdir = sysconfig.PREFIX + '/lib' |
26 |
+ libs.insert(0, '-L' + libdir) |
27 |
if not getvar('PYTHONFRAMEWORK'): |
28 |
libs.extend(getvar('LINKFORSHARED').split()) |
29 |
print ' '.join(libs) |