From 6baa8dbdfb8bc6c409778912cc3c8ea3dd39c342 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Sun, 12 Jul 2015 22:23:00 +0300 Subject: [PATCH] Allow overriding the compile time in "perl -V" output The C preprocessor macros __DATE__ and __TIME__ embed the compile time into the binary for the purposes of "perl -V" output. This makes the build unreproducible: compiling the same source with the same toolchain cannot be made to yield bitwise identical binaries and other generated files. The compile time can now be overridden with the PERL_BUILD_DATE macro. Bug: https://rt.perl.org/Ticket/Display.html?id=125830 Bug-Debian: https://bugs.debian.org/774422 Patch-Name: debian/do-not-record-build-date.diff --- perl.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/perl.c b/perl.c index f0d056f..b64975b 100644 --- a/perl.c +++ b/perl.c @@ -1806,15 +1806,20 @@ S_Internals_V(pTHX_ CV *cv) PUSHs(Perl_newSVpvn_flags(aTHX_ non_bincompat_options, sizeof(non_bincompat_options) - 1, SVs_TEMP)); -#ifdef __DATE__ -# ifdef __TIME__ +#ifndef PERL_BUILD_DATE +# ifdef __DATE__ +# ifdef __TIME__ +# define PERL_BUILD_DATE __DATE__ " " __TIME__ +# else +# define PERL_BUILD_DATE __DATE__ +# endif +# endif +#endif + +#ifdef PERL_BUILD_DATE PUSHs(Perl_newSVpvn_flags(aTHX_ - STR_WITH_LEN("Compiled at " __DATE__ " " __TIME__), - SVs_TEMP)); -# else - PUSHs(Perl_newSVpvn_flags(aTHX_ STR_WITH_LEN("Compiled on " __DATE__), + STR_WITH_LEN("Compiled at " PERL_BUILD_DATE), SVs_TEMP)); -# endif #else PUSHs(&PL_sv_undef); #endif -- 1.8.3.1