Bug#912299: blender: make the build reproducible
Nicholas M Gregory
ngregory at nyu.edu
Mon Oct 29 22:40:36 GMT 2018
Source: blender
Version: 2.79.b+dfsg0-4
Severity: wishlist
Tags: patch
X-Debbugs-Cc: reproducible-builds at lists.alioth.debian.org
Hi there,
While working on the reproducible builds project
(https://wiki.debian.org/ReproducibleBuilds), we noticed that blender
could not be built reproducibly.
The attached patch changes the build system to use the
SOURCE_DATE_EPOCH envvar (if set) in place of the current build
date/time to make blender build reproducibly.
Best,
-Nick Gregory
================ begin patch ================
diff --git a/build_files/cmake/buildinfo.cmake
b/build_files/cmake/buildinfo.cmake
index a43b99f..ab7d3e3 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -148,12 +148,21 @@ endif()
# BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
# but BUILD_DATE and BUILD_TIME are platform dependent
if(UNIX)
- if(NOT BUILD_DATE)
- execute_process(COMMAND date "+%Y-%m-%d"
OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
- endif()
- if(NOT BUILD_TIME)
- execute_process(COMMAND date "+%H:%M:%S"
OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
- endif()
+ if(DEFINED ENV{SOURCE_DATE_EPOCH})
+ execute_process(COMMAND "date" "-u" "-d"
"@$ENV{SOURCE_DATE_EPOCH}" "+%Y-%m-%d"
+ OUTPUT_VARIABLE BUILD_DATE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND "date" "-u" "-d"
"@$ENV{SOURCE_DATE_EPOCH}" "+%H:%M:%S"
+ OUTPUT_VARIABLE BUILD_TIME
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ if(NOT BUILD_DATE)
+ execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE
BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+ if(NOT BUILD_TIME)
+ execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE
BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+ endif()
elseif(WIN32)
if(NOT BUILD_DATE)
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE
BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
More information about the Reproducible-builds
mailing list