Add support in Python build system to specify host pgen
Python needs a "pgen" program to build itself. Unfortunately, the
Python build system assumes that it can use the pgen program it has
just built to build itself. Obviously, this cannot work in
cross-compilation mode since the pgen program have been built for the
Therefore, this patch adds support in the Python build system for the
new PGEN_FOR_BUILD variable, so that we can point Python ./configure
script to the pgen program that have been previously built for the
Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
later significantly reworked by Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>, with some inspiration taken
from the Python patches of the PTXdist project, and then ported to
python3.3 by Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Makefile.pre.in | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
Index: Python-3.3.0/Makefile.pre.in
===================================================================
--- Python-3.3.0.orig/Makefile.pre.in
+++ Python-3.3.0/Makefile.pre.in
##########################################################################
+PGEN_FOR_BUILD=@PGEN_FOR_BUILD@
$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ $(MAKE) $(PGEN_FOR_BUILD)
+ $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
Index: Python-3.3.0/configure.ac
===================================================================
--- Python-3.3.0.orig/configure.ac
+++ Python-3.3.0/configure.ac
PYTHON_FOR_BUILD="_PYTHON_PROJECT_BASE=$srcdir"' _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
+ AC_MSG_CHECKING(pgen for build)
+ PGEN_FOR_BUILD="${PGEN_FOR_BUILD}"
+ AC_MSG_RESULT($PGEN_FOR_BUILD)
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
+ PGEN_FOR_BUILD='./$(PGEN)'
AC_SUBST(PYTHON_FOR_BUILD)
+AC_SUBST(PGEN_FOR_BUILD)
dnl Ensure that if prefix is specified, it does not end in a slash. If
dnl it does, we get path names containing '//' which is both ugly and