blob: 0a51400bf51992c835a70d5cb781779ffdbd4fa8 (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
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 | 17 +++++++++++++----
configure.ac | 8 +++++++-
2 files changed, 20 insertions(+), 5 deletions(-)
Index: Python-3.3.0/Lib/distutils/sysconfig.py
===================================================================
--- Python-3.3.0.orig/Lib/distutils/sysconfig.py
+++ Python-3.3.0/Lib/distutils/sysconfig.py
@@ -16,15 +16,24 @@
from .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)
+
BASE_PREFIX = os.path.normpath(sys.base_prefix)
BASE_EXEC_PREFIX = os.path.normpath(sys.base_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
@@ -98,7 +107,7 @@
# the build directory may not be the source directory, we
# must use "srcdir" from the makefile to find the "Include"
# directory.
- base = _sys_home or os.path.dirname(os.path.abspath(sys.executable))
+ base = _sys_home or EXECUTABLE_DIRNAME
if plat_specific:
return base
if _sys_home:
Index: Python-3.3.0/configure.ac
===================================================================
--- Python-3.3.0.orig/configure.ac
+++ Python-3.3.0/configure.ac
@@ -963,7 +963,13 @@
fi
if test "$cross_compiling" = yes; then
- RUNSHARED=
+ 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
AC_MSG_RESULT($LDLIBRARY)
|