diff options
| author | Peter Korsgaard <jacmet@sunsite.dk> | 2011-01-25 16:24:46 +0100 | 
|---|---|---|
| committer | Peter Korsgaard <jacmet@sunsite.dk> | 2011-01-25 16:24:46 +0100 | 
| commit | 0eef30440e9597b2c0b9c7a0340a3986a7ea2a65 (patch) | |
| tree | f8e74a929418c8085bc09dd5606a10e356923c74 /package/python/python-2.7-001-support-for-build.patch | |
| parent | 4c6a451ac9fab16abcda5834ed4a9b728091ab9e (diff) | |
| parent | 6ea3c8bd4dabe2b11a8beecb6a641336e6e90f3c (diff) | |
| download | buildroot-novena-0eef30440e9597b2c0b9c7a0340a3986a7ea2a65.tar.gz buildroot-novena-0eef30440e9597b2c0b9c7a0340a3986a7ea2a65.zip | |
Merge branch 'for-2011.02/python-bump' of git://git.busybox.net/~tpetazzoni/git/buildroot
Diffstat (limited to 'package/python/python-2.7-001-support-for-build.patch')
| -rw-r--r-- | package/python/python-2.7-001-support-for-build.patch | 153 | 
1 files changed, 153 insertions, 0 deletions
| diff --git a/package/python/python-2.7-001-support-for-build.patch b/package/python/python-2.7-001-support-for-build.patch new file mode 100644 index 000000000..2795e65f3 --- /dev/null +++ b/package/python/python-2.7-001-support-for-build.patch @@ -0,0 +1,153 @@ +Add support in Python build system to specify host tools + +Python needs a Python interpreter and a "pgen" program to build +itself. Unfortunately, the Python build system assumes that it can use +the interpreter and pgen program it has just built to build +itself. Obviously, this cannot work in cross-compilation mode since +the interpreter and the pgen program have been built for the target. + +Therefore, this patch adds support in the Python build system for the +new PYTHON_FOR_BUILD and PGEN_FOR_BUILD variables, so that we can +point Python ./configure script to the Python interpreter and pgen +program that have been previously built for the host. + +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. + +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> +--- + Makefile.pre.in |   32 +++++++++++++++++--------------- + configure.in    |   17 +++++++++++++++++ + 2 files changed, 34 insertions(+), 15 deletions(-) + +Index: Python-2.7.1/Makefile.pre.in +=================================================================== +--- Python-2.7.1.orig/Makefile.pre.in ++++ Python-2.7.1/Makefile.pre.in +@@ -178,7 +178,8 @@ + UNICODE_OBJS=   @UNICODE_OBJS@ +  + PYTHON=		python$(EXE) +-BUILDPYTHON=	python$(BUILDEXE) ++BUILDPYTHON=	./python$(BUILDEXE) ++PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ +  + # The task to run while instrument when building the profile-opt target + PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck +@@ -210,7 +211,8 @@ +  + ########################################################################## + # Parser +-PGEN=		Parser/pgen$(EXE) ++BUILDPGEN=	Parser/pgen$(EXE) ++PGEN_FOR_BUILD=@PGEN_FOR_BUILD@ +  + POBJS=		\ + 		Parser/acceler.o \ +@@ -404,8 +406,8 @@ + # Build the shared modules + sharedmods: $(BUILDPYTHON) + 	@case $$MAKEFLAGS in \ +-	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ +-	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ ++	*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;; \ + 	esac +  + # Build static library +@@ -536,12 +538,12 @@ + 	$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c +  +  +-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) ++$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) + 		-@$(INSTALL) -d Include +-		-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) ++		-$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) +  +-$(PGEN):	$(PGENOBJS) +-		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) ++$(BUILDPGEN):	$(PGENOBJS) ++		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(BUILDPGEN) +  + Parser/grammar.o:	$(srcdir)/Parser/grammar.c \ + 				$(srcdir)/Include/token.h \ +@@ -921,25 +923,25 @@ + 	done + 	$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt + 	PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \ +-		./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ ++		$(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ + 		-d $(LIBDEST) -f \ + 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ + 		$(DESTDIR)$(LIBDEST) + 	PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +-		./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ ++		$(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ + 		-d $(LIBDEST) -f \ + 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ + 		$(DESTDIR)$(LIBDEST) + 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \ +-		./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ ++		$(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ + 		-d $(LIBDEST)/site-packages -f \ + 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +-		./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ ++		$(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ + 		-d $(LIBDEST)/site-packages -f \ + 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +-		./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" ++		$(PYTHON_FOR_BUILD) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" +  + # Create the PLATDIR source directory, if one wasn't distributed.. + $(srcdir)/Lib/$(PLATDIR): +@@ -1044,7 +1046,7 @@ + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: sharedmods +-	$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ ++	$(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \ + 	   	--prefix=$(prefix) \ + 		--install-scripts=$(BINDIR) \ + 		--install-platlib=$(DESTSHARED) \ +@@ -1183,7 +1185,7 @@ + 	find . -name '*.gc??' -exec rm -f {} ';' +  + clobber: clean profile-removal +-	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ ++	-rm -f $(BUILDPYTHON) $(BUILDPGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ + 		tags TAGS \ + 		config.cache config.log pyconfig.h Modules/config.c + 	-rm -rf build platform +Index: Python-2.7.1/configure.in +=================================================================== +--- Python-2.7.1.orig/configure.in ++++ Python-2.7.1/configure.in +@@ -4291,6 +4291,23 @@ + done + AC_MSG_RESULT(done) +  ++if test "$cross_compiling" = "yes"; then ++   AC_MSG_CHECKING(python for build) ++   PYTHON_FOR_BUILD="${PYTHON_FOR_BUILD}" ++   AC_MSG_RESULT($PYTHON_FOR_BUILD) ++   AC_MSG_CHECKING(pgen for build) ++   PGEN_FOR_BUILD="${PGEN_FOR_BUILD}" ++   AC_MSG_RESULT($PGEN_FOR_BUILD) ++else ++   PYTHON_FOR_BUILD='$(BUILDPYTHON)' ++   PGEN_FOR_BUILD='$(BUILDPGEN)' ++fi ++ ++AC_SUBST(PYTHON_FOR_BUILD) ++AC_SUBST(PGEN_FOR_BUILD) ++AC_ARG_VAR(PYTHON_FOR_BUILD,[build system Python]) ++AC_ARG_VAR(PGEN_FOR_BUILD,[build system Python pgen]) ++ + # 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]) | 
