From f6e184952b1abd21fcee00c6493865a85020e1a2 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sat, 15 Jan 2022 21:12:02 -0500 Subject: [PATCH] Applied cmake SOURCE_DATE_EPOCH patch for reproducible builds. --- src/CMakeLists.txt | 7 +++++++ src/config.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 83afea8d..113aa82e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -556,6 +556,13 @@ set(SRC_DRIVERS_SDL set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_SDL}) +# Put build timestamp into BUILD_TS environment variable and from there into +# the FCEUX_BUILD_TIMESTAMP preprocessor definition. +# Note: with CMake >= 3.8.0, this will respect SOURCE_DATE_EPOCH. For more info, +# see . +string(TIMESTAMP BUILD_TS "%H:%M:%S %b %d %Y") +add_definitions( -DFCEUX_BUILD_TIMESTAMP=\"${BUILD_TS}\" ) + if (WIN32) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fceux_git_info.cpp diff --git a/src/config.cpp b/src/config.cpp index 430df5af..b99a1e29 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -13,6 +13,10 @@ static char *aboutString = 0; +#ifndef FCEUX_BUILD_TIMESTAMP +#define FCEUX_BUILD_TIMESTAMP __TIME__ " " __DATE__ +#endif + // returns a string suitable for use in an aboutbox const char *FCEUI_GetAboutString(void) { @@ -48,7 +52,8 @@ const char *FCEUI_GetAboutString(void) "of NES emulation. In Memoriam --\n" "ugetab\n" "\n" - __TIME__ " " __DATE__ "\n"; + "\n" + FCEUX_BUILD_TIMESTAMP "\n"; if (aboutString) return aboutString;