File reproducible.patch of Package rabbitmq-c
https://github.com/alanxz/rabbitmq-c/pull/638
From d651a13231a0da225d31101cd429b51becd9f23f Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Tue, 22 Dec 2020 15:29:56 +0100
Subject: [PATCH] Use cmake TIMESTAMP function
to allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
Also use UTC to be independent of timezone.
---
tools/CMakeLists.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 7609cd38..1b09975b 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -45,9 +45,10 @@ if (BUILD_TOOLS_DOCS)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
set(XMLTO_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doc/man-date.ent)
+ STRING(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
add_custom_command(
OUTPUT ${XMLTO_DEPENDS}
- COMMAND date +'%Y-%m-%d' > ${XMLTO_DEPENDS}
+ COMMAND echo ${BUILD_DATE} > ${XMLTO_DEPENDS}
VERBATIM
)