Files
buildroot/package/python/python-012-support-library-path-old-compilers.patch
Thomas Petazzoni 9badea2d05 python: bump to 2.7.9
In addition to doing the bump, this commit also:

 - Refreshes all the patches
 - Removes python-003-properly-detect-if-python-build.patch, which has
   been applied upstream.
 - Passes the --without-ensurepip option, like is done in Python 3, to
   avoid having Python use PIP to automatically download stuff when it
   is being built.
 - PYTHON_LIBTOOL_PATH = NO is added to prevent Buildroot from trying
   to patch a version of libtool for which we don't have matching
   patches, which isn't a problem since we're anyway not using the
   part of the Python sources that uses libtool (it's the built-in
   copy of libffi, and we use the external libffi).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-01-02 19:30:25 +01:00

55 lines
2.2 KiB
Diff

python: do not rely only on LIBRARY_PATH for old compilers
The cross-compilation improvements integrated in Python rely on the
compiler exposing a line starting with LIBRARY_PATH when called with
-E -v. This is used by Python setup.py to find the installation
locations of libraries.
However, this LIBRARY_PATH line is not shown by very old compilers,
such as the gcc 4.2.x compiler used on the AVR32 architecture. This
causes libraries installed in the sysroot, such as libffi, to not be
detected by the setup.py script.
To fix this problem, this patch adds addtional logic to setup.py,
which consists in deriving the library paths from the sysroot
location, if no LIBRARY_PATH field was found.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Index: b/setup.py
===================================================================
--- a/setup.py
+++ b/setup.py
@@ -418,6 +418,7 @@
in_incdirs = False
inc_dirs = []
lib_dirs = []
+ compiler_has_library_path = False
try:
if ret >> 8 == 0:
with open(tmpfile) as fp:
@@ -429,6 +430,7 @@
elif line.startswith("End of search list"):
in_incdirs = False
elif is_gcc and line.startswith("LIBRARY_PATH"):
+ compiler_has_library_path = True
for d in line.strip().split("=")[1].split(":"):
d = os.path.normpath(d)
if '/gcc/' not in d:
@@ -440,6 +442,15 @@
finally:
os.unlink(tmpfile)
+ if not compiler_has_library_path:
+ ret = os.system("%s -print-file-name=libc.a | sed -r -e 's:(usr/)?lib(32|64)?/([^/]*/)?libc\.a::' >%s" % (gcc, tmpfile))
+ with open(tmpfile) as fp:
+ line = fp.readline().strip()
+ add_dir_to_list(self.compiler.library_dirs,
+ os.path.join(line, "usr", "lib"))
+ add_dir_to_list(self.compiler.library_dirs,
+ os.path.join(line, "lib"))
+
def detect_modules(self):
# Ensure that /usr/local is always used
if not cross_compiling: