python-2.7-002-cross-compile-variable.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Pass a CROSS_COMPILING variable to setup.py
  2. The setup.py script in the Python source code plays a significant role
  3. in the Python build process. It is responsible for building all the
  4. modules and extensions, and due to this, does various checks that need
  5. to be adjusted when we are cross-compiling.
  6. For that reason, this patch makes sure that a CROSS_COMPILING variable
  7. is passed in the environment of the setup.py script. Later patches in
  8. the stack make use of this variable.
  9. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  10. ---
  11. Makefile.pre.in | 6 +++---
  12. configure.in | 3 +++
  13. 2 files changed, 6 insertions(+), 3 deletions(-)
  14. Index: Python-2.7.2/Makefile.pre.in
  15. ===================================================================
  16. --- Python-2.7.2.orig/Makefile.pre.in
  17. +++ Python-2.7.2/Makefile.pre.in
  18. @@ -409,8 +409,8 @@
  19. # Build the shared modules
  20. sharedmods: $(BUILDPYTHON)
  21. @case $$MAKEFLAGS in \
  22. - *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
  23. - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
  24. + *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
  25. + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
  26. esac
  27. # Build static library
  28. @@ -1051,7 +1051,7 @@
  29. # Install the dynamically loadable modules
  30. # This goes into $(exec_prefix)
  31. sharedinstall: sharedmods
  32. - $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
  33. + $(RUNSHARED) CROSS_COMPILING=@CROSS_COMPILING@ $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
  34. --prefix=$(prefix) \
  35. --install-scripts=$(BINDIR) \
  36. --install-platlib=$(DESTSHARED) \
  37. Index: Python-2.7.2/configure.in
  38. ===================================================================
  39. --- Python-2.7.2.orig/configure.in
  40. +++ Python-2.7.2/configure.in
  41. @@ -4322,6 +4322,9 @@
  42. AC_ARG_VAR(PYTHON_FOR_BUILD,[build system Python])
  43. AC_ARG_VAR(PGEN_FOR_BUILD,[build system Python pgen])
  44. +CROSS_COMPILING=$cross_compiling
  45. +AC_SUBST(CROSS_COMPILING)
  46. +
  47. # generate output files
  48. AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
  49. AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])