summaryrefslogtreecommitdiffstats
path: root/package/python/python-2.7-015-distutils-cross-compilation-support.patch
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2011-09-18 18:05:22 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2011-09-18 21:05:01 +0200
commita21642c7eb06eeffe621e7eaef1a85cb9b4589f8 (patch)
tree7ad88cac4838dc3968401f6657f7e6cf8f362630 /package/python/python-2.7-015-distutils-cross-compilation-support.patch
parent16d6e9b3420e78a89960b8b68202ea46a618810d (diff)
downloadbuildroot-novena-a21642c7eb06eeffe621e7eaef1a85cb9b4589f8.tar.gz
buildroot-novena-a21642c7eb06eeffe621e7eaef1a85cb9b4589f8.zip
python: fix build by adding some more patches
The removal of -L flags from TARGET_LDFLAGS in 7e3e8ec040b06d6e2fb69e55c004f1ebc02c76d0 has trigerred some more issues with Python, requiring some more hacky fixes. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package/python/python-2.7-015-distutils-cross-compilation-support.patch')
-rw-r--r--package/python/python-2.7-015-distutils-cross-compilation-support.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/package/python/python-2.7-015-distutils-cross-compilation-support.patch b/package/python/python-2.7-015-distutils-cross-compilation-support.patch
new file mode 100644
index 000000000..16cfd7f5a
--- /dev/null
+++ b/package/python/python-2.7-015-distutils-cross-compilation-support.patch
@@ -0,0 +1,84 @@
+Add some cross-compilation fixes to distutils
+
+Inspired by work done by Marc Kleine-Budde <mkl@pengutronix.de> in
+PTXdist.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ Lib/distutils/sysconfig.py | 7 ++++---
+ 1 files changed, 4 insertions(+), 3 deletions(-)
+
+Index: Python-2.7.1/Lib/distutils/sysconfig.py
+===================================================================
+--- Python-2.7.1.orig/Lib/distutils/sysconfig.py
++++ Python-2.7.1/Lib/distutils/sysconfig.py
+@@ -19,13 +19,22 @@
+ from distutils.errors import DistutilsPlatformError
+
+ # These are needed in a couple of spots, so just compute them once.
+-PREFIX = os.path.normpath(sys.prefix)
+-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
++EXECUTABLE_DIRNAME = os.path.dirname(os.path.realpath(sys.executable))
++if os.environ.get('CROSS_COMPILING') == 'yes':
++ _sysroot=os.environ.get('_python_sysroot')
++ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix'))
++ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix'))
++ if '_python_srcdir' in os.environ:
++ EXECUTABLE_DIRNAME = os.path.normpath(os.environ['_python_srcdir'])
++else:
++ PREFIX = os.path.normpath(sys.prefix)
++ EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
++
+
+ # Path to the base directory of the project. On Windows the binary may
+ # live in project/PCBuild9. If we're dealing with an x64 Windows build,
+ # it'll live in project/PCbuild/amd64.
+-project_base = os.path.dirname(os.path.abspath(sys.executable))
++project_base = EXECUTABLE_DIRNAME
+ if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
+ project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
+ # PC/VS7.1
+@@ -74,7 +83,7 @@
+
+ if os.name == "posix":
+ if python_build:
+- buildir = os.path.dirname(sys.executable)
++ buildir = EXECUTABLE_DIRNAME
+ if plat_specific:
+ # python.h is located in the buildir
+ inc_dir = buildir
+@@ -206,7 +215,7 @@
+ def get_makefile_filename():
+ """Return full pathname of installed Makefile from the Python build."""
+ if python_build:
+- return os.path.join(os.path.dirname(sys.executable), "Makefile")
++ return os.path.join(EXECUTABLE_DIRNAME, "Makefile")
+ lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
+ return os.path.join(lib_dir, "config", "Makefile")
+
+Index: Python-2.7.1/configure.in
+===================================================================
+--- Python-2.7.1.orig/configure.in
++++ Python-2.7.1/configure.in
+@@ -4424,6 +4424,21 @@
+ CROSS_COMPILING=$cross_compiling
+ AC_SUBST(CROSS_COMPILING)
+
++#
++# Cross compiling
++#
++# special RUNSHARED
++if test "$cross_compiling" = "yes"; then
++ RUNSHARED="\
++ CROSS_COMPILING=yes \
++ _python_cross_host=${ac_cv_host} \
++ _python_sysroot=\"\$(sysroot)\" \
++ _python_srcdir=\"\$(srcdir)\" \
++ _python_prefix=\"\$(prefix)\" \
++ _python_exec_prefix=\"\$(exec_prefix)\""
++fi
++
++
+ # generate output files
+ AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
+ AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])