Support reproducible building

Submitted by Rebecca N. Palmer on Jan. 6, 2019, 11:01 a.m.

Details

Message ID 1a57e048-6623-6d17-d0ba-15ae35ba4393@zoho.com
State New
Series "Support reproducible building"
Headers show

Commit Message

Rebecca N. Palmer Jan. 6, 2019, 11:01 a.m.
See https://reproducible-builds.org for what this means.

Making beignet reproducible requires additional setup including Debian's 
patched Clang (https://bugs.debian.org/877359), but building it with 
this patch does not.

Signed-off-by: Rebecca N. Palmer <rebecca_palmer@zoho.com>
---
The first link is currently down; I don't know why or for how long.

Patch hide | download patch | download mbox

--- a/backend/src/libocl/CMakeLists.txt
+++ b/backend/src/libocl/CMakeLists.txt
@@ -229,6 +229,8 @@  ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_D
 
 ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_DIR}/beignet.local.pch
     COMMAND mkdir -p ${OCL_OBJECT_DIR}
+    # the tests are this way round to return success whether or not SOURCE_DATE_EPOCH is set
+    COMMAND test -z $ENV{SOURCE_DATE_EPOCH} || touch -d '@$ENV{SOURCE_DATE_EPOCH}' ${OCL_OBJECT_DIR}/include/*.h
     COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS} -I ${OCL_OBJECT_DIR}/include/ -emit-pch -x cl ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet.local.pch
     DEPENDS ${OCL_HEADER_FILES}
     COMMENT "Generate the pch file: ${OCL_OBJECT_DIR}/beignet.local.pch"
@@ -236,6 +238,7 @@  ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_D
 
 ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_DIR}/beignet.pch
     COMMAND mkdir -p ${OCL_OBJECT_DIR}
+    COMMAND test -z $ENV{SOURCE_DATE_EPOCH} || touch -d '@$ENV{SOURCE_DATE_EPOCH}' ${OCL_OBJECT_DIR}/include/*.h
     COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS} -I ${OCL_OBJECT_DIR}/include/ --relocatable-pch -emit-pch -isysroot ${LIBOCL_BINARY_DIR} -x cl ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet.pch
     DEPENDS ${OCL_HEADER_FILES}
     COMMENT "Generate the pch file: ${OCL_OBJECT_DIR}/beignet.pch"
@@ -273,6 +276,7 @@  if (ENABLE_OPENCL_20)
 
   ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_DIR}/beignet_20.local.pch
     COMMAND mkdir -p ${OCL_OBJECT_DIR}
+    COMMAND test -z $ENV{SOURCE_DATE_EPOCH} || touch -d '@$ENV{SOURCE_DATE_EPOCH}' ${OCL_OBJECT_DIR}/include/*.h
     COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS_20} -I ${OCL_OBJECT_DIR}/include/ -emit-pch -x cl ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet_20.local.pch
     DEPENDS ${OCL_HEADER_FILES}
     COMMENT "Generate the pch file: ${OCL_OBJECT_DIR}/beignet_20.local.pch"
@@ -280,6 +284,7 @@  if (ENABLE_OPENCL_20)
 
   ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_DIR}/beignet_20.pch
     COMMAND mkdir -p ${OCL_OBJECT_DIR}
+    COMMAND test -z $ENV{SOURCE_DATE_EPOCH} || touch -d '@$ENV{SOURCE_DATE_EPOCH}' ${OCL_OBJECT_DIR}/include/*.h
     COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS_20} -I ${OCL_OBJECT_DIR}/include/ --relocatable-pch -emit-pch -isysroot ${LIBOCL_BINARY_DIR} -x cl ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet_20.pch
     DEPENDS ${OCL_HEADER_FILES}
     COMMENT "Generate the pch file: ${OCL_OBJECT_DIR}/beignet_20.pch"