Issue #27641: Merge cross-compiling improvement from 3.5

This commit is contained in:
Martin Panter 2016-08-04 01:53:40 +00:00
commit 0c859f362c
4 changed files with 21 additions and 37 deletions

View File

@ -222,7 +222,6 @@ LIBOBJS= @LIBOBJS@
PYTHON= python$(EXE) PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE) BUILDPYTHON= python$(BUILDEXE)
cross_compiling=@cross_compiling@
PYTHON_FOR_GEN=@PYTHON_FOR_GEN@ PYTHON_FOR_GEN=@PYTHON_FOR_GEN@
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
@ -720,17 +719,13 @@ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) 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) $(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 Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib
if test "$(cross_compiling)" != "yes"; then \
./Programs/_freeze_importlib \ ./Programs/_freeze_importlib \
$(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h; \ $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h
fi
Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib Python/importlib.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib
if test "$(cross_compiling)" != "yes"; then \
./Programs/_freeze_importlib \ ./Programs/_freeze_importlib \
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h; \ $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
fi
############################################################################ ############################################################################
@ -791,22 +786,11 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
$(IO_OBJS): $(IO_H) $(IO_OBJS): $(IO_H)
$(GRAMMAR_H): $(GRAMMAR_INPUT) @PGEN_DEPENDENCY@ $(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
@$(MKDIR_P) Include @$(MKDIR_P) Include
# Avoid copying the file onto itself for an in-tree build $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
if test "$(cross_compiling)" != "yes"; then \ $(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ touch $(GRAMMAR_C)
else \
cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \
mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \
fi
$(GRAMMAR_C): $(GRAMMAR_H)
if test "$(cross_compiling)" != "yes"; then \
touch $(GRAMMAR_C); \
else \
cp $(srcdir)/Python/graminit.c $(GRAMMAR_C).tmp; \
mv $(GRAMMAR_C).tmp $(GRAMMAR_C); \
fi
$(PGEN): $(PGENOBJS) $(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)

View File

@ -101,8 +101,9 @@ Build
- Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by - Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by
Chi Hsuan Yen. Chi Hsuan Yen.
- Issue #27490: Do not build pgen when cross-compiling. Patch by Thomas - Issue #27641: The configure script now inserts comments into the makefile
Perl. to prevent the pgen and _freeze_importlib executables from being cross-
compiled.
- Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be - Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be
used for file generation during the build. used for file generation during the build.

9
configure vendored
View File

@ -740,7 +740,7 @@ UNIVERSALSDK
CONFIG_ARGS CONFIG_ARGS
SOVERSION SOVERSION
VERSION VERSION
PGEN_DEPENDENCY GENERATED_COMMENT
PYTHON_FOR_BUILD PYTHON_FOR_BUILD
PYTHON_FOR_GEN PYTHON_FOR_GEN
host_os host_os
@ -751,7 +751,6 @@ build_os
build_vendor build_vendor
build_cpu build_cpu
build build
cross_compiling
HAS_HG HAS_HG
HGBRANCH HGBRANCH
HGTAG HGTAG
@ -2876,7 +2875,6 @@ fi
ac_config_headers="$ac_config_headers pyconfig.h" ac_config_headers="$ac_config_headers pyconfig.h"
ac_aux_dir= ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then if test -f "$ac_dir/install-sh"; then
@ -3051,12 +3049,13 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
$as_echo "$interp" >&6; } $as_echo "$interp" >&6; }
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
fi fi
PGEN_DEPENDENCY='' # Used to comment out stuff for rebuilding generated files
GENERATED_COMMENT='#'
elif test "$cross_compiling" = maybe; then elif test "$cross_compiling" = maybe; then
as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
else else
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
PGEN_DEPENDENCY='$(PGEN)' GENERATED_COMMENT=''
fi fi

View File

@ -49,7 +49,6 @@ fi
AC_CONFIG_SRCDIR([Include/object.h]) AC_CONFIG_SRCDIR([Include/object.h])
AC_CONFIG_HEADER(pyconfig.h) AC_CONFIG_HEADER(pyconfig.h)
AC_SUBST(cross_compiling)
AC_CANONICAL_HOST AC_CANONICAL_HOST
AC_SUBST(build) AC_SUBST(build)
AC_SUBST(host) AC_SUBST(host)
@ -81,15 +80,16 @@ if test "$cross_compiling" = yes; then
AC_MSG_RESULT($interp) AC_MSG_RESULT($interp)
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
fi fi
PGEN_DEPENDENCY='' # Used to comment out stuff for rebuilding generated files
GENERATED_COMMENT='#'
elif test "$cross_compiling" = maybe; then elif test "$cross_compiling" = maybe; then
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
else else
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
PGEN_DEPENDENCY='$(PGEN)' GENERATED_COMMENT=''
fi fi
AC_SUBST(PYTHON_FOR_BUILD) AC_SUBST(PYTHON_FOR_BUILD)
AC_SUBST(PGEN_DEPENDENCY) AC_SUBST(GENERATED_COMMENT)
dnl Ensure that if prefix is specified, it does not end in a slash. If 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 dnl it does, we get path names containing '//' which is both ugly and