Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 43a94a7

Browse files
committed
Issue #27641: Comment out regeneration rules when cross compiling
1 parent 6c7d5a2 commit 43a94a7

4 files changed

Lines changed: 21 additions & 37 deletions

File tree

Makefile.pre.in

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ LIBOBJS= @LIBOBJS@
221221
PYTHON= python$(EXE)
222222
BUILDPYTHON= python$(BUILDEXE)
223223

224-
cross_compiling=@cross_compiling@
225224
PYTHON_FOR_GEN=@PYTHON_FOR_GEN@
226225
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
227226
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
@@ -719,17 +718,13 @@ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
719718
Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
720719
$(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
721720

722-
Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib
723-
if test "$(cross_compiling)" != "yes"; then \
724-
./Programs/_freeze_importlib \
725-
$(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h; \
726-
fi
721+
Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib
722+
./Programs/_freeze_importlib \
723+
$(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h
727724

728-
Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib
729-
if test "$(cross_compiling)" != "yes"; then \
730-
./Programs/_freeze_importlib \
731-
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h; \
732-
fi
725+
Python/importlib.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib
726+
./Programs/_freeze_importlib \
727+
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
733728

734729

735730
############################################################################
@@ -789,22 +784,11 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
789784

790785
$(IO_OBJS): $(IO_H)
791786

792-
$(GRAMMAR_H): $(GRAMMAR_INPUT) @PGEN_DEPENDENCY@
787+
$(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
793788
@$(MKDIR_P) Include
794-
# Avoid copying the file onto itself for an in-tree build
795-
if test "$(cross_compiling)" != "yes"; then \
796-
$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \
797-
else \
798-
cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \
799-
mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \
800-
fi
801-
$(GRAMMAR_C): $(GRAMMAR_H)
802-
if test "$(cross_compiling)" != "yes"; then \
803-
touch $(GRAMMAR_C); \
804-
else \
805-
cp $(srcdir)/Python/graminit.c $(GRAMMAR_C).tmp; \
806-
mv $(GRAMMAR_C).tmp $(GRAMMAR_C); \
807-
fi
789+
$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
790+
$(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
791+
touch $(GRAMMAR_C)
808792

809793
$(PGEN): $(PGENOBJS)
810794
$(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)

Misc/NEWS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ Build
154154
- Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by
155155
Chi Hsuan Yen.
156156

157-
- Issue #27490: Do not build pgen when cross-compiling. Patch by Thomas
158-
Perl.
157+
- Issue #27641: The configure script now inserts comments into the makefile
158+
to prevent the pgen and _freeze_importlib executables from being cross-
159+
compiled.
159160

160161
- Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be
161162
used for file generation during the build.

configure

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ UNIVERSALSDK
739739
CONFIG_ARGS
740740
SOVERSION
741741
VERSION
742-
PGEN_DEPENDENCY
742+
GENERATED_COMMENT
743743
PYTHON_FOR_BUILD
744744
PYTHON_FOR_GEN
745745
host_os
@@ -750,7 +750,6 @@ build_os
750750
build_vendor
751751
build_cpu
752752
build
753-
cross_compiling
754753
HAS_HG
755754
HGBRANCH
756755
HGTAG
@@ -2875,7 +2874,6 @@ fi
28752874
ac_config_headers="$ac_config_headers pyconfig.h"
28762875

28772876

2878-
28792877
ac_aux_dir=
28802878
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
28812879
if test -f "$ac_dir/install-sh"; then
@@ -3050,12 +3048,13 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
30503048
$as_echo "$interp" >&6; }
30513049
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
30523050
fi
3053-
PGEN_DEPENDENCY=''
3051+
# Used to comment out stuff for rebuilding generated files
3052+
GENERATED_COMMENT='#'
30543053
elif test "$cross_compiling" = maybe; then
30553054
as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
30563055
else
30573056
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
3058-
PGEN_DEPENDENCY='$(PGEN)'
3057+
GENERATED_COMMENT=''
30593058
fi
30603059

30613060

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ fi
4949
AC_CONFIG_SRCDIR([Include/object.h])
5050
AC_CONFIG_HEADER(pyconfig.h)
5151

52-
AC_SUBST(cross_compiling)
5352
AC_CANONICAL_HOST
5453
AC_SUBST(build)
5554
AC_SUBST(host)
@@ -81,15 +80,16 @@ if test "$cross_compiling" = yes; then
8180
AC_MSG_RESULT($interp)
8281
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
8382
fi
84-
PGEN_DEPENDENCY=''
83+
# Used to comment out stuff for rebuilding generated files
84+
GENERATED_COMMENT='#'
8585
elif test "$cross_compiling" = maybe; then
8686
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
8787
else
8888
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
89-
PGEN_DEPENDENCY='$(PGEN)'
89+
GENERATED_COMMENT=''
9090
fi
9191
AC_SUBST(PYTHON_FOR_BUILD)
92-
AC_SUBST(PGEN_DEPENDENCY)
92+
AC_SUBST(GENERATED_COMMENT)
9393

9494
dnl Ensure that if prefix is specified, it does not end in a slash. If
9595
dnl it does, we get path names containing '//' which is both ugly and

0 commit comments

Comments
 (0)