summaryrefslogtreecommitdiff
path: root/lang/python33/files/patch-Misc_python-config.in
blob: 75fe152e619b5ab6490bcc2e9347f02b60b2a753 (plain) (blame)
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
# pythonx.y-config --ldflags out of /usr and missing -L<install_lib_dir>
# https://bugs.python.org/issue7352

# Fix library order returned by python-config. [#18096]
# bugs.python.org/18096

--- Misc/python-config.in.orig	2015-10-18 09:00:25 UTC
+++ Misc/python-config.in
@@ -22,6 +22,7 @@ except getopt.error:
 if not opts:
     exit_with_usage()
 
+libdir = sysconfig.get_config_var('exec_prefix') + '/lib'
 pyver = sysconfig.get_config_var('VERSION')
 getvar = sysconfig.get_config_var
 
@@ -45,11 +46,13 @@ for opt in opt_flags:
         print(' '.join(flags))
 
     elif opt in ('--libs', '--ldflags'):
-        libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
-        libs.append('-lpython' + pyver + sys.abiflags)
+        libs = ['-lpython' + pyver + sys.abiflags]
+        libs += getvar('LIBS').split()
+        libs += getvar('SYSLIBS').split()
         # add the prefix/lib/pythonX.Y/config dir, but only if there is no
         # shared library in prefix/lib/.
         if opt == '--ldflags':
+            libs.insert(0, '-L' + libdir)
             if not getvar('Py_ENABLE_SHARED'):
                 libs.insert(0, '-L' + getvar('LIBPL'))
             if not getvar('PYTHONFRAMEWORK'):