]> granicus.if.org Git - python/commitdiff
Issue #22359: Disable running cross-compiled _freeze_importlib and pgen
authorMartin Panter <vadmium+py@gmail.com>
Sat, 23 Apr 2016 00:58:44 +0000 (00:58 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sat, 23 Apr 2016 00:58:44 +0000 (00:58 +0000)
Patch by Xavier de Gaye.

Makefile.pre.in
Misc/NEWS
configure
configure.ac

index 17c0b5785d0097c6346d4c05e58cf19fa6abc71c..e5182a623c1c2265aa4d1b33cfba0449aac210e6 100644 (file)
@@ -221,6 +221,7 @@ LIBOBJS=    @LIBOBJS@
 PYTHON=                python$(EXE)
 BUILDPYTHON=   python$(BUILDEXE)
 
+cross_compiling=@cross_compiling@
 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
 _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
 BUILD_GNU_TYPE=        @build@
@@ -718,12 +719,16 @@ Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FRO
        $(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 \
-               $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h
+       if test "$(cross_compiling)" != "yes"; then \
+           ./Programs/_freeze_importlib \
+               $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h; \
+       fi
 
 Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib
-       ./Programs/_freeze_importlib \
-               $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
+       if test "$(cross_compiling)" != "yes"; then \
+           ./Programs/_freeze_importlib \
+               $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h; \
+       fi
 
 
 ############################################################################
@@ -784,10 +789,18 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
 $(IO_OBJS): $(IO_H)
 
 $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN)
-               @$(MKDIR_P) Include
-               $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+       @$(MKDIR_P) Include
+       if test "$(cross_compiling)" != "yes"; then \
+               $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \
+       else \
+               cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \
+       fi
 $(GRAMMAR_C): $(GRAMMAR_H)
-               touch $(GRAMMAR_C)
+       if test "$(cross_compiling)" != "yes"; then \
+               touch $(GRAMMAR_C); \
+       else \
+               cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \
+       fi
 
 $(PGEN): $(PGENOBJS)
                $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
index e11ee400c86709b191984c201c85481f9f0367d2..07b7fde759dc889e65f54dff23ec547a52bba896 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -404,6 +404,11 @@ Tests
 Build
 -----
 
+- Issue #22359: Disable the rules for running _freeze_importlib and pgen when
+  cross-compiling.  The output of these programs is normally saved with the
+  source code anyway, and is still regenerated when doing a native build.
+  Patch by Xavier de Gaye.
+
 - Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm,
   except on Mac OS X. Patch written by Xavier de Gaye.
 
index 68970848702dc8d1d1e7291f18963eadeb125711..1823d148f7e5c06400d880108111d35d968da19c 100755 (executable)
--- a/configure
+++ b/configure
@@ -751,6 +751,7 @@ build_os
 build_vendor
 build_cpu
 build
+cross_compiling
 HAS_HG
 HGBRANCH
 HGTAG
index b13cf059a753452397ff46c954a61b1221b8494e..44811d9a859bb1e92a00284d39627c0c3783f7db 100644 (file)
@@ -49,6 +49,7 @@ fi
 AC_CONFIG_SRCDIR([Include/object.h])
 AC_CONFIG_HEADER(pyconfig.h)
 
+AC_SUBST(cross_compiling)
 AC_CANONICAL_HOST
 AC_SUBST(build)
 AC_SUBST(host)