From 3e7decabe166613710dae8e6f1d6512a6f6aa6bc Mon Sep 17 00:00:00 2001 From: "A. Maitland Bottoms" Date: Thu, 1 Nov 2018 07:49:46 -0700 Subject: cmake: Add SOURCE_DATE_EPOCH Reproducible builds set SOURCE_DATE_EPOCH rather than arbitrary build timestamps. Use it if set, otherwise revert to the old way. --- host/cmake/Modules/UHDBuildInfo.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'host/cmake') diff --git a/host/cmake/Modules/UHDBuildInfo.cmake b/host/cmake/Modules/UHDBuildInfo.cmake index 468635b15..e1af7190a 100644 --- a/host/cmake/Modules/UHDBuildInfo.cmake +++ b/host/cmake/Modules/UHDBuildInfo.cmake @@ -15,6 +15,11 @@ macro(UHD_LOAD_BUILD_INFO) # Build date if(IGNORE_BUILD_DATE) set(UHD_BUILD_DATE "") + elseif(DEFINED ENV{SOURCE_DATE_EPOCH}) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c + "import time; print(time.strftime('%a, %d %b %Y %H:%M:%S UTC', time.gmtime($ENV{SOURCE_DATE_EPOCH})))" + OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE + ) else() execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import time; print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))" -- cgit v1.2.3