summaryrefslogtreecommitdiffstats
path: root/patches/Python-2.7.16/0005-add-cross-compilation-support.patch
blob: 79efeba4e60fc6cb9913117d0649f2181fda016d (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
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Mon, 4 May 2009 14:39:18 +0200
Subject: [PATCH] add cross compilation support

This patch adds preliminary cross compilation support to python.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 Makefile.pre.in | 12 ++++++++----
 configure.ac    |  7 +++++++
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Makefile.pre.in b/Makefile.pre.in
index 9297e7fc89c4..1400c8ca6f97 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -88,6 +88,10 @@ CFLAGSFORSHARED=@CFLAGSFORSHARED@
 # C flags used for building the interpreter object files
 PY_CFLAGS=	$(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
 
+# cross compiler options
+ifndef DESTDIR
+sysroot=	@SYSROOT@
+endif
 
 # Machine-dependent subdirectories
 MACHDEP=	@MACHDEP@
@@ -106,11 +110,11 @@ datarootdir=    @datarootdir@
 
 # Expanded directories
 BINDIR=		@bindir@
-LIBDIR=		@libdir@
+LIBDIR=		$(sysroot)@libdir@
 MANDIR=		@mandir@
-INCLUDEDIR=	@includedir@
-CONFINCLUDEDIR=	$(exec_prefix)/include
-SCRIPTDIR=	$(prefix)/lib
+INCLUDEDIR=	$(sysroot)@includedir@
+CONFINCLUDEDIR=	$(sysroot)$(exec_prefix)/include
+SCRIPTDIR=	$(sysroot)$(prefix)/lib
 
 # Detailed destination directories
 BINLIBDEST=	$(LIBDIR)/python$(VERSION)
diff --git a/configure.ac b/configure.ac
index c89e4a601cf1..863d7929507b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -980,6 +980,13 @@ if test "$cross_compiling" = yes; then
 	RUNSHARED=
 fi
 
+# sysroot
+AC_SUBST(SYSROOT)
+if test "$cross_compiling" = yes; then
+    AC_MSG_CHECKING([for SYSROOT])
+    AC_MSG_RESULT([$SYSROOT])
+fi
+
 AC_MSG_RESULT($LDLIBRARY)
 
 AC_PROG_RANLIB