From 7b36037e2201ea6927458c1b5fc31502d0747b6f Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 15 Oct 2024 14:25:34 +0200 Subject: [PATCH] fix: let util/mkbuildinf.pl use SOURCE_DATE_EPOCH, even if it's zero Doing this allows reproducible builds, for those who want this. Fixes #25475 Reviewed-by: Tomas Mraz Reviewed-by: Tom Cosgrove (Merged from https://github.com/openssl/openssl/pull/25699) --- util/mkbuildinf.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/mkbuildinf.pl b/util/mkbuildinf.pl index 1c273872be..7b1aba054c 100755 --- a/util/mkbuildinf.pl +++ b/util/mkbuildinf.pl @@ -12,7 +12,9 @@ use warnings; my ($cflags, $platform) = @ARGV; $cflags = "compiler: $cflags"; -my $date = gmtime($ENV{'SOURCE_DATE_EPOCH'} || time()) . " UTC"; +# Use the value of the envvar SOURCE_DATE_EPOCH, even if it's +# zero or the empty string. +my $date = gmtime($ENV{'SOURCE_DATE_EPOCH'} // time()) . " UTC"; print <<"END_OUTPUT"; /*