summaryrefslogtreecommitdiff
blob: 25a518bd1e657592ec2c80710c36d99732e1f1c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# HG changeset patch
# User Martin Panter <vadmium+py@gmail.com>
# Date 1461373124 0
# Node ID 66e40df31faca467937c7b9d5d2e825471f97822
# Parent  a246047734b3496a7dc4ebaf1f0232dadf22eab6
Issue #22359: Disable running cross-compiled _freeze_importlib and pgen

Patch by Xavier de Gaye.

diff --git a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -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/_fr
 	$(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/sys
 $(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)
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -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)