# HG changeset patch # Parent 3f921c3b1e8724a4f5e27e3329a2e451a44db2a9 Issue #22625: Makefile options to use native programs when cross compiling diff -r 3f921c3b1e87 Makefile.pre.in --- a/Makefile.pre.in Fri Mar 11 22:53:15 2016 +0100 +++ b/Makefile.pre.in Sun Mar 13 05:56:25 2016 +0000 @@ -276,6 +276,8 @@ ########################################################################## # Parser PGEN= Parser/pgen$(EXE) +# Override this with a natively compiled version if cross compiling: +PGEN_FOR_BUILD=$(PGEN) PSRCS= \ Parser/acceler.c \ @@ -481,6 +483,9 @@ all: build_all build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Programs/_testembed python-config +# Build native prerequisites for cross compiling +native: Parser/pgen Programs/_freeze_importlib + # Compile a binary with profile guided optimization. profile-opt: @if [ $(LLVM_PROF_ERR) == yes ]; then \ @@ -710,17 +715,20 @@ ############################################################################ # Importlib +# Override this with a natively compiled version if cross compiling: +FREEZE_IMPORTLIB=Programs/_freeze_importlib + Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) -Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib - ./Programs/_freeze_importlib \ +Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py $(FREEZE_IMPORTLIB) + $(FREEZE_IMPORTLIB) \ $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h -Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib - ./Programs/_freeze_importlib \ +Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py $(FREEZE_IMPORTLIB) + $(FREEZE_IMPORTLIB) \ $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h @@ -781,9 +789,9 @@ $(IO_OBJS): $(IO_H) -$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN) +$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN_FOR_BUILD) @$(MKDIR_P) Include - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) $(GRAMMAR_C): $(GRAMMAR_H) touch $(GRAMMAR_C) @@ -1673,7 +1681,7 @@ Python/thread.o: @THREADHEADERS@ # Declare targets that aren't real files -.PHONY: all build_all sharedmods oldsharedmods test quicktest +.PHONY: all build_all native sharedmods oldsharedmods test quicktest .PHONY: install altinstall oldsharedinstall bininstall altbininstall .PHONY: maninstall libinstall inclinstall libainstall sharedinstall .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure diff -r 3f921c3b1e87 README --- a/README Fri Mar 11 22:53:15 2016 +0100 +++ b/README Sun Mar 13 05:56:25 2016 +0000 @@ -75,6 +75,20 @@ that is optimized and suitable for distribution or production installation. +Cross Compiling +--------------- + +[Please fill in.] Possibly something like: + +mkdir native cross +(cd native && ../configure && make native) +cd cross +../configure --host= --build=x86 \ + ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no +make install DESTDIR=stage PGEN_FOR_BUILD=../native/Parser/pgen \ + FREEZE_IMPORTLIB=../native/Programs/_freeze_importlib + + What's New ----------