Skip to content

Commit a787988

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 b4344f7 commit a787988

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
@@ -1920,6 +1920,13 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
19201920
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
19211921
-o $@ $(srcdir)/Modules/getbuildinfo.c
19221922

1923+
ifdef UNVERSIONED_COMPILER
1924+
Python/getcompiler.o: $(srcdir)/Python/getcompiler.c Makefile
1925+
$(CC) -c $(PY_CORE_CFLAGS) \
1926+
-DCOMPILER='"$(UNVERSIONED_COMPILER)"' \
1927+
-o $@ $(srcdir)/Python/getcompiler.c
1928+
endif
1929+
19231930
Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)
19241931
$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
19251932
-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)