summaryrefslogtreecommitdiffstats
path: root/package/python/python-2.7-002-cross-compile-variable.patch
blob: f91ee7122c7dc9a97f59ce66bbe3d86e708c29c2 (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
Pass a CROSS_COMPILING variable to setup.py

The setup.py script in the Python source code plays a significant role
in the Python build process. It is responsible for building all the
modules and extensions, and due to this, does various checks that need
to be adjusted when we are cross-compiling.

For that reason, this patch makes sure that a CROSS_COMPILING variable
is passed in the environment of the setup.py script. Later patches in
the stack make use of this variable.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Makefile.pre.in |    6 +++---
 configure.in    |    3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

Index: Python-2.7.2/Makefile.pre.in
===================================================================
--- Python-2.7.2.orig/Makefile.pre.in
+++ Python-2.7.2/Makefile.pre.in
@@ -409,8 +409,8 @@
 # Build the shared modules
 sharedmods: $(BUILDPYTHON)
 	@case $$MAKEFLAGS in \
-	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
-	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
+	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
+	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
 	esac
 
 # Build static library
@@ -1051,7 +1051,7 @@
 # Install the dynamically loadable modules
 # This goes into $(exec_prefix)
 sharedinstall: sharedmods
-	$(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
+	$(RUNSHARED) CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
 	   	--prefix=$(prefix) \
 		--install-scripts=$(BINDIR) \
 		--install-platlib=$(DESTSHARED) \
Index: Python-2.7.2/configure.in
===================================================================
--- Python-2.7.2.orig/configure.in
+++ Python-2.7.2/configure.in
@@ -4322,6 +4322,9 @@
 AC_ARG_VAR(PYTHON_FOR_BUILD,[build system Python])
 AC_ARG_VAR(PGEN_FOR_BUILD,[build system Python pgen])
 
+CROSS_COMPILING=$cross_compiling
+AC_SUBST(CROSS_COMPILING)
+
 # 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])