Skip to content

Commit 39f408f

Browse files
committed
Allow overriding COMPILER with UNVERSIONED_COMPILER
Introduce UNVERSIONED_COMPILER variable in Makefile.pre.in to allow overriding the COMPILER macro definition during the build of Python/getcompiler.o. This enables reproducible builds by providing a way to set a generic compiler identification string (e.g., "[GCC]") instead of the default versioned one. The rule is made conditional on UNVERSIONED_COMPILER being defined. References: https://discuss.python.org/t/unversioned-compiler-symbol-for-getcompiler-c/91735 Fixes: #144121
1 parent cf71e34 commit 39f408f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Makefile.pre.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,13 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
19261926
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
19271927
-o $@ $(srcdir)/Modules/getbuildinfo.c
19281928

1929+
ifdef UNVERSIONED_COMPILER
1930+
Python/getcompiler.o: $(srcdir)/Python/getcompiler.c Makefile
1931+
$(CC) -c $(PY_CORE_CFLAGS) \
1932+
-DCOMPILER='"$(UNVERSIONED_COMPILER)"' \
1933+
-o $@ $(srcdir)/Python/getcompiler.c
1934+
endif
1935+
19291936
Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)
19301937
$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
19311938
-DPREFIX='"$(host_prefix)"' \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Make it possible for the COMPILER definition in getcompiler.c to be static
2+
in order to make builds reproducible.

0 commit comments

Comments
 (0)