Skip to content

Commit dd8ce9e

Browse files
authored
bpo-45886: Allow overriding freeze command for cross compiling (GH-29735)
1 parent f9de97a commit dd8ce9e

File tree

3 files changed

+48
-43
lines changed

3 files changed

+48
-43
lines changed

Makefile.pre.in

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,9 @@ Python/deepfreeze/frozen_only.c: Python/frozen_modules/frozen_only.h $(DEEPFREEZ
10081008
############################################################################
10091009
# frozen modules (including importlib)
10101010

1011+
# Allow developers to override freeze_module command for cross building (bpo-45886)
1012+
FREEZE_MODULE?=Programs/_freeze_module
1013+
10111014
# FROZEN_FILES_* are auto-generated by Tools/scripts/freeze_modules.py.
10121015
FROZEN_FILES_IN = \
10131016
Lib/importlib/_bootstrap.py \
@@ -1061,69 +1064,69 @@ Programs/_freeze_module: Programs/_freeze_module.o $(LIBRARY_OBJS_OMIT_FROZEN)
10611064

10621065
# BEGIN: freezing modules
10631066

1064-
Python/frozen_modules/importlib._bootstrap.h: Programs/_freeze_module Lib/importlib/_bootstrap.py
1065-
Programs/_freeze_module importlib._bootstrap $(srcdir)/Lib/importlib/_bootstrap.py Python/frozen_modules/importlib._bootstrap.h
1067+
Python/frozen_modules/importlib._bootstrap.h: $(FREEZE_MODULE) Lib/importlib/_bootstrap.py
1068+
$(FREEZE_MODULE) importlib._bootstrap $(srcdir)/Lib/importlib/_bootstrap.py Python/frozen_modules/importlib._bootstrap.h
10661069

1067-
Python/frozen_modules/importlib._bootstrap_external.h: Programs/_freeze_module Lib/importlib/_bootstrap_external.py
1068-
Programs/_freeze_module importlib._bootstrap_external $(srcdir)/Lib/importlib/_bootstrap_external.py Python/frozen_modules/importlib._bootstrap_external.h
1070+
Python/frozen_modules/importlib._bootstrap_external.h: $(FREEZE_MODULE) Lib/importlib/_bootstrap_external.py
1071+
$(FREEZE_MODULE) importlib._bootstrap_external $(srcdir)/Lib/importlib/_bootstrap_external.py Python/frozen_modules/importlib._bootstrap_external.h
10691072

1070-
Python/frozen_modules/zipimport.h: Programs/_freeze_module Lib/zipimport.py
1071-
Programs/_freeze_module zipimport $(srcdir)/Lib/zipimport.py Python/frozen_modules/zipimport.h
1073+
Python/frozen_modules/zipimport.h: $(FREEZE_MODULE) Lib/zipimport.py
1074+
$(FREEZE_MODULE) zipimport $(srcdir)/Lib/zipimport.py Python/frozen_modules/zipimport.h
10721075

1073-
Python/frozen_modules/abc.h: Programs/_freeze_module Lib/abc.py
1074-
Programs/_freeze_module abc $(srcdir)/Lib/abc.py Python/frozen_modules/abc.h
1076+
Python/frozen_modules/abc.h: $(FREEZE_MODULE) Lib/abc.py
1077+
$(FREEZE_MODULE) abc $(srcdir)/Lib/abc.py Python/frozen_modules/abc.h
10751078

1076-
Python/frozen_modules/codecs.h: Programs/_freeze_module Lib/codecs.py
1077-
Programs/_freeze_module codecs $(srcdir)/Lib/codecs.py Python/frozen_modules/codecs.h
1079+
Python/frozen_modules/codecs.h: $(FREEZE_MODULE) Lib/codecs.py
1080+
$(FREEZE_MODULE) codecs $(srcdir)/Lib/codecs.py Python/frozen_modules/codecs.h
10781081

1079-
Python/frozen_modules/io.h: Programs/_freeze_module Lib/io.py
1080-
Programs/_freeze_module io $(srcdir)/Lib/io.py Python/frozen_modules/io.h
1082+
Python/frozen_modules/io.h: $(FREEZE_MODULE) Lib/io.py
1083+
$(FREEZE_MODULE) io $(srcdir)/Lib/io.py Python/frozen_modules/io.h
10811084

1082-
Python/frozen_modules/_collections_abc.h: Programs/_freeze_module Lib/_collections_abc.py
1083-
Programs/_freeze_module _collections_abc $(srcdir)/Lib/_collections_abc.py Python/frozen_modules/_collections_abc.h
1085+
Python/frozen_modules/_collections_abc.h: $(FREEZE_MODULE) Lib/_collections_abc.py
1086+
$(FREEZE_MODULE) _collections_abc $(srcdir)/Lib/_collections_abc.py Python/frozen_modules/_collections_abc.h
10841087

1085-
Python/frozen_modules/_sitebuiltins.h: Programs/_freeze_module Lib/_sitebuiltins.py
1086-
Programs/_freeze_module _sitebuiltins $(srcdir)/Lib/_sitebuiltins.py Python/frozen_modules/_sitebuiltins.h
1088+
Python/frozen_modules/_sitebuiltins.h: $(FREEZE_MODULE) Lib/_sitebuiltins.py
1089+
$(FREEZE_MODULE) _sitebuiltins $(srcdir)/Lib/_sitebuiltins.py Python/frozen_modules/_sitebuiltins.h
10871090

1088-
Python/frozen_modules/genericpath.h: Programs/_freeze_module Lib/genericpath.py
1089-
Programs/_freeze_module genericpath $(srcdir)/Lib/genericpath.py Python/frozen_modules/genericpath.h
1091+
Python/frozen_modules/genericpath.h: $(FREEZE_MODULE) Lib/genericpath.py
1092+
$(FREEZE_MODULE) genericpath $(srcdir)/Lib/genericpath.py Python/frozen_modules/genericpath.h
10901093

1091-
Python/frozen_modules/ntpath.h: Programs/_freeze_module Lib/ntpath.py
1092-
Programs/_freeze_module ntpath $(srcdir)/Lib/ntpath.py Python/frozen_modules/ntpath.h
1094+
Python/frozen_modules/ntpath.h: $(FREEZE_MODULE) Lib/ntpath.py
1095+
$(FREEZE_MODULE) ntpath $(srcdir)/Lib/ntpath.py Python/frozen_modules/ntpath.h
10931096

1094-
Python/frozen_modules/posixpath.h: Programs/_freeze_module Lib/posixpath.py
1095-
Programs/_freeze_module posixpath $(srcdir)/Lib/posixpath.py Python/frozen_modules/posixpath.h
1097+
Python/frozen_modules/posixpath.h: $(FREEZE_MODULE) Lib/posixpath.py
1098+
$(FREEZE_MODULE) posixpath $(srcdir)/Lib/posixpath.py Python/frozen_modules/posixpath.h
10961099

1097-
Python/frozen_modules/os.h: Programs/_freeze_module Lib/os.py
1098-
Programs/_freeze_module os $(srcdir)/Lib/os.py Python/frozen_modules/os.h
1100+
Python/frozen_modules/os.h: $(FREEZE_MODULE) Lib/os.py
1101+
$(FREEZE_MODULE) os $(srcdir)/Lib/os.py Python/frozen_modules/os.h
10991102

1100-
Python/frozen_modules/site.h: Programs/_freeze_module Lib/site.py
1101-
Programs/_freeze_module site $(srcdir)/Lib/site.py Python/frozen_modules/site.h
1103+
Python/frozen_modules/site.h: $(FREEZE_MODULE) Lib/site.py
1104+
$(FREEZE_MODULE) site $(srcdir)/Lib/site.py Python/frozen_modules/site.h
11021105

1103-
Python/frozen_modules/stat.h: Programs/_freeze_module Lib/stat.py
1104-
Programs/_freeze_module stat $(srcdir)/Lib/stat.py Python/frozen_modules/stat.h
1106+
Python/frozen_modules/stat.h: $(FREEZE_MODULE) Lib/stat.py
1107+
$(FREEZE_MODULE) stat $(srcdir)/Lib/stat.py Python/frozen_modules/stat.h
11051108

1106-
Python/frozen_modules/__hello__.h: Programs/_freeze_module Lib/__hello__.py
1107-
Programs/_freeze_module __hello__ $(srcdir)/Lib/__hello__.py Python/frozen_modules/__hello__.h
1109+
Python/frozen_modules/__hello__.h: $(FREEZE_MODULE) Lib/__hello__.py
1110+
$(FREEZE_MODULE) __hello__ $(srcdir)/Lib/__hello__.py Python/frozen_modules/__hello__.h
11081111

1109-
Python/frozen_modules/__phello__.h: Programs/_freeze_module Lib/__phello__/__init__.py
1110-
Programs/_freeze_module __phello__ $(srcdir)/Lib/__phello__/__init__.py Python/frozen_modules/__phello__.h
1112+
Python/frozen_modules/__phello__.h: $(FREEZE_MODULE) Lib/__phello__/__init__.py
1113+
$(FREEZE_MODULE) __phello__ $(srcdir)/Lib/__phello__/__init__.py Python/frozen_modules/__phello__.h
11111114

1112-
Python/frozen_modules/__phello__.ham.h: Programs/_freeze_module Lib/__phello__/ham/__init__.py
1113-
Programs/_freeze_module __phello__.ham $(srcdir)/Lib/__phello__/ham/__init__.py Python/frozen_modules/__phello__.ham.h
1115+
Python/frozen_modules/__phello__.ham.h: $(FREEZE_MODULE) Lib/__phello__/ham/__init__.py
1116+
$(FREEZE_MODULE) __phello__.ham $(srcdir)/Lib/__phello__/ham/__init__.py Python/frozen_modules/__phello__.ham.h
11141117

1115-
Python/frozen_modules/__phello__.ham.eggs.h: Programs/_freeze_module Lib/__phello__/ham/eggs.py
1116-
Programs/_freeze_module __phello__.ham.eggs $(srcdir)/Lib/__phello__/ham/eggs.py Python/frozen_modules/__phello__.ham.eggs.h
1118+
Python/frozen_modules/__phello__.ham.eggs.h: $(FREEZE_MODULE) Lib/__phello__/ham/eggs.py
1119+
$(FREEZE_MODULE) __phello__.ham.eggs $(srcdir)/Lib/__phello__/ham/eggs.py Python/frozen_modules/__phello__.ham.eggs.h
11171120

1118-
Python/frozen_modules/__phello__.spam.h: Programs/_freeze_module Lib/__phello__/spam.py
1119-
Programs/_freeze_module __phello__.spam $(srcdir)/Lib/__phello__/spam.py Python/frozen_modules/__phello__.spam.h
1121+
Python/frozen_modules/__phello__.spam.h: $(FREEZE_MODULE) Lib/__phello__/spam.py
1122+
$(FREEZE_MODULE) __phello__.spam $(srcdir)/Lib/__phello__/spam.py Python/frozen_modules/__phello__.spam.h
11201123

1121-
Python/frozen_modules/frozen_only.h: Programs/_freeze_module Tools/freeze/flag.py
1122-
Programs/_freeze_module frozen_only $(srcdir)/Tools/freeze/flag.py Python/frozen_modules/frozen_only.h
1124+
Python/frozen_modules/frozen_only.h: $(FREEZE_MODULE) Tools/freeze/flag.py
1125+
$(FREEZE_MODULE) frozen_only $(srcdir)/Tools/freeze/flag.py Python/frozen_modules/frozen_only.h
11231126

11241127
# END: freezing modules
11251128

1126-
Tools/scripts/freeze_modules.py: Programs/_freeze_module
1129+
Tools/scripts/freeze_modules.py: $(FREEZE_MODULE)
11271130

11281131
.PHONY: regen-frozen
11291132
regen-frozen: Tools/scripts/freeze_modules.py $(FROZEN_FILES_IN)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The ``_freeze_module`` program path can now be overridden on the command
2+
line, e.g. ``make FREEZE_MODULE=../x86_64/Program/_freeze_module``.

Tools/scripts/freeze_modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,10 @@ def regen_makefile(modules):
598598
pyfile = relpath_for_posix_display(src.pyfile, ROOT_DIR)
599599
pyfiles.append(f'\t\t{pyfile} \\')
600600

601-
freeze = (f'Programs/_freeze_module {src.frozenid} '
601+
freeze = (f'$(FREEZE_MODULE) {src.frozenid} '
602602
f'$(srcdir)/{pyfile} {header}')
603603
rules.extend([
604-
f'{header}: Programs/_freeze_module {pyfile}',
604+
f'{header}: $(FREEZE_MODULE) {pyfile}',
605605
f'\t{freeze}',
606606
'',
607607
])

0 commit comments

Comments
 (0)