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 --- Makefile.pre.in | 6 +++--- configure.in | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) Index: Python-2.7.1/Makefile.pre.in =================================================================== --- Python-2.7.1.orig/Makefile.pre.in +++ Python-2.7.1/Makefile.pre.in @@ -406,8 +406,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 @@ -1046,7 +1046,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.1/configure.in =================================================================== --- Python-2.7.1.orig/configure.in +++ Python-2.7.1/configure.in @@ -4308,6 +4308,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])