diff options
author | A. Maitland Bottoms <bottoms@debian.org> | 2018-11-01 07:49:46 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-11-15 16:38:06 -0800 |
commit | 3e7decabe166613710dae8e6f1d6512a6f6aa6bc (patch) | |
tree | bfc729dda7436c4234a2929ec9d6714498870ced /host/cmake | |
parent | ec981e9eaae8cc94c450a5468325184e458244d0 (diff) | |
download | uhd-3e7decabe166613710dae8e6f1d6512a6f6aa6bc.tar.gz uhd-3e7decabe166613710dae8e6f1d6512a6f6aa6bc.tar.bz2 uhd-3e7decabe166613710dae8e6f1d6512a6f6aa6bc.zip |
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.
Diffstat (limited to 'host/cmake')
-rw-r--r-- | host/cmake/Modules/UHDBuildInfo.cmake | 5 |
1 files changed, 5 insertions, 0 deletions
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()))" |