]> granicus.if.org Git - python/commitdiff
Issue #27641: Comment out regeneration rules when cross compiling
authorMartin Panter <vadmium+py@gmail.com>
Fri, 29 Jul 2016 05:52:32 +0000 (05:52 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Fri, 29 Jul 2016 05:52:32 +0000 (05:52 +0000)
Makefile.pre.in
Misc/NEWS
configure
configure.ac

index ccfdd59952e30351df75de5424f491bd40ca17ad..3aafca892ab205daa3ee2f2e748bb6aae74109fe 100644 (file)
@@ -200,7 +200,6 @@ UNICODE_OBJS=   @UNICODE_OBJS@
 PYTHON=                python$(EXE)
 BUILDPYTHON=   python$(BUILDEXE)
 
-cross_compiling=@cross_compiling@
 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
 _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
 HOST_GNU_TYPE=  @host@
@@ -680,22 +679,11 @@ Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule
 
 Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.h
 
-$(GRAMMAR_H): $(GRAMMAR_INPUT) @PGEN_DEPENDENCY@
+$(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
        @$(MKDIR_P) Include
-       # Avoid copying the file onto itself for an in-tree build
-       if test "$(cross_compiling)" != "yes"; then \
-               $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(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) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+$(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
+       touch $(GRAMMAR_C)
 
 $(PGEN):       $(PGENOBJS)
                $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
index a911bef5b2999ef799690b9afe35fb2c458592c7..8378cfba9e7a42ceafa9dae68f477c065a701ccf 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -94,8 +94,8 @@ What's New in Python 2.7.12?
 Build
 -----
 
-- Issue #27490: Do not build pgen when cross-compiling.  Patch by Thomas
-  Perl.
+- Issue #27641: The configure script now inserts comments into the makefile
+  to prevent the pgen executable from being cross-compiled.
 
 - Issue #26930: Update Windows builds to use OpenSSL 1.0.2h.
 
index 521dd7a06ce4c611127c6853cb9a9a32dfc16717..2030083f833e1cfce39f489b761ac52211add2af 100755 (executable)
--- a/configure
+++ b/configure
@@ -735,7 +735,7 @@ UNIVERSALSDK
 CONFIG_ARGS
 SOVERSION
 VERSION
-PGEN_DEPENDENCY
+GENERATED_COMMENT
 PYTHON_FOR_BUILD
 host_os
 host_vendor
@@ -745,7 +745,6 @@ build_os
 build_vendor
 build_cpu
 build
-cross_compiling
 target_alias
 host_alias
 build_alias
@@ -2800,7 +2799,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_config_headers="$ac_config_headers pyconfig.h"
 
 
-
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   if test -f "$ac_dir/install-sh"; then
@@ -2925,12 +2923,13 @@ $as_echo_n "checking for python interpreter for cross build... " >&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
     fi
-    PGEN_DEPENDENCY=''
+    # Used to comment out stuff for rebuilding generated files
+    GENERATED_COMMENT='#'
 elif test "$cross_compiling" = maybe; then
     as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
 else
     PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
-    PGEN_DEPENDENCY='$(PGEN)'
+    GENERATED_COMMENT=''
 fi
 
 
index c4dfe79053e9a84239b502bb7efce4f796ba59f0..dc8435fb756c038d2faad416adc6f0f337870657 100644 (file)
@@ -12,7 +12,6 @@ AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
 AC_CONFIG_SRCDIR([Include/object.h])
 AC_CONFIG_HEADER(pyconfig.h)
 
-AC_SUBST(cross_compiling)
 AC_CANONICAL_HOST
 AC_SUBST(build)
 AC_SUBST(host)
@@ -36,15 +35,16 @@ if test "$cross_compiling" = yes; then
         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
     fi
-    PGEN_DEPENDENCY=''
+    # Used to comment out stuff for rebuilding generated files
+    GENERATED_COMMENT='#'
 elif test "$cross_compiling" = maybe; then
     AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
 else
     PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
-    PGEN_DEPENDENCY='$(PGEN)'
+    GENERATED_COMMENT=''
 fi
 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 it does, we get path names containing '//' which is both ugly and