python3-001-support-for-build.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Add support in Python build system to specify host pgen
  2. Python needs a "pgen" program to build itself. Unfortunately, the
  3. Python build system assumes that it can use the pgen program it has
  4. just built to build itself. Obviously, this cannot work in
  5. cross-compilation mode since the pgen program have been built for the
  6. target.
  7. Therefore, this patch adds support in the Python build system for the
  8. new PGEN_FOR_BUILD variable, so that we can point Python ./configure
  9. script to the pgen program that have been previously built for the
  10. host.
  11. Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
  12. later significantly reworked by Thomas Petazzoni
  13. <thomas.petazzoni@free-electrons.com>, with some inspiration taken
  14. from the Python patches of the PTXdist project, and then ported to
  15. python3.3 by Maxime Ripard <maxime.ripard@free-electrons.com>
  16. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  17. ---
  18. Makefile.pre.in | 5 +++--
  19. configure.ac | 5 +++++
  20. 2 files changed, 8 insertions(+), 2 deletions(-)
  21. Index: Python-3.3.0/Makefile.pre.in
  22. ===================================================================
  23. --- Python-3.3.0.orig/Makefile.pre.in
  24. +++ Python-3.3.0/Makefile.pre.in
  25. @@ -239,6 +239,7 @@
  26. ##########################################################################
  27. # Parser
  28. PGEN= Parser/pgen$(EXE)
  29. +PGEN_FOR_BUILD=@PGEN_FOR_BUILD@
  30. PSRCS= \
  31. Parser/acceler.c \
  32. @@ -639,8 +640,8 @@
  33. $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
  34. @$(MKDIR_P) Include
  35. - $(MAKE) $(PGEN)
  36. - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  37. + $(MAKE) $(PGEN_FOR_BUILD)
  38. + $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  39. $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
  40. $(MAKE) $(GRAMMAR_H)
  41. touch $(GRAMMAR_C)
  42. Index: Python-3.3.0/configure.ac
  43. ===================================================================
  44. --- Python-3.3.0.orig/configure.ac
  45. +++ Python-3.3.0/configure.ac
  46. @@ -51,10 +51,15 @@
  47. AC_MSG_RESULT($interp)
  48. PYTHON_FOR_BUILD="_PYTHON_PROJECT_BASE=$srcdir"' _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
  49. fi
  50. + AC_MSG_CHECKING(pgen for build)
  51. + PGEN_FOR_BUILD="${PGEN_FOR_BUILD}"
  52. + AC_MSG_RESULT($PGEN_FOR_BUILD)
  53. else
  54. PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
  55. + PGEN_FOR_BUILD='./$(PGEN)'
  56. fi
  57. AC_SUBST(PYTHON_FOR_BUILD)
  58. +AC_SUBST(PGEN_FOR_BUILD)
  59. dnl Ensure that if prefix is specified, it does not end in a slash. If
  60. dnl it does, we get path names containing '//' which is both ugly and