Browse Source

python: add patches to disable runtime lib dirs

When cross-compiling, we do not need to add runtime lib dirs.
Also, the cross compilers that are used on OpenWRT do not support
the '-R' option, which causes build failures.

These build failures existed before, but were not noticed,
because it fails only on some setups.
This is because Python's `setup.py` does a lot of voo-doo
automagic that needs handling for some cross-compilation cases.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Alexandru Ardelean 10 years ago
parent
commit
c8c509bdad

+ 34
- 0
lang/python/patches/009-do-not-use-dblib_dir-when-cross-compiling.patch View File

@@ -0,0 +1,34 @@
1
+diff --git a/setup.py b/setup.py
2
+index 7868b7b..10ec68f 100644
3
+--- a/setup.py
4
++++ b/setup.py
5
+@@ -1067,6 +1067,7 @@ class PyBuildExt(build_ext):
6
+                         if db_setup_debug: print "db lib: ", dblib, "not found"
7
+ 
8
+         except db_found:
9
++            rt_dblib_dir = None if cross_compiling else dblib_dir
10
+             if db_setup_debug:
11
+                 print "bsddb using BerkeleyDB lib:", db_ver, dblib
12
+                 print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir
13
+@@ -1081,7 +1082,7 @@ class PyBuildExt(build_ext):
14
+             exts.append(Extension('_bsddb', ['_bsddb.c'],
15
+                                   depends = ['bsddb.h'],
16
+                                   library_dirs=dblib_dir,
17
+-                                  runtime_library_dirs=dblib_dir,
18
++                                  runtime_library_dirs=rt_dblib_dir,
19
+                                   include_dirs=db_incs,
20
+                                   libraries=dblibs))
21
+         else:
22
+@@ -1292,10 +1293,11 @@ class PyBuildExt(build_ext):
23
+                             break
24
+                 elif cand == "bdb":
25
+                     if db_incs is not None:
26
++                        rt_dblib_dir = None if cross_compiling else dblib_dir
27
+                         print "building dbm using bdb"
28
+                         dbmext = Extension('dbm', ['dbmmodule.c'],
29
+                                            library_dirs=dblib_dir,
30
+-                                           runtime_library_dirs=dblib_dir,
31
++                                           runtime_library_dirs=rt_dblib_dir,
32
+                                            include_dirs=db_incs,
33
+                                            define_macros=[
34
+                                                ('HAVE_BERKDB_H', None),

+ 15
- 0
lang/python/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch View File

@@ -0,0 +1,15 @@
1
+diff --git a/setup.py b/setup.py
2
+index 7868b7b..544fa7e 100644
3
+--- a/setup.py
4
++++ b/setup.py
5
+@@ -452,8 +452,9 @@ class PyBuildExt(build_ext):
6
+         # directly since an inconsistently reproducible issue comes up where
7
+         # the environment variable is not set even though the value were passed
8
+         # into configure and stored in the Makefile (issue found on OS X 10.3).
9
++        rt_lib_dirs = [] if cross_compiling else self.compiler.runtime_library_dirs
10
+         for env_var, arg_name, dir_list in (
11
+-                ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
12
++                ('LDFLAGS', '-R', rt_lib_dirs),
13
+                 ('LDFLAGS', '-L', self.compiler.library_dirs),
14
+                 ('CPPFLAGS', '-I', self.compiler.include_dirs)):
15
+             env_val = sysconfig.get_config_var(env_var)