mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-30 03:34:25 +03:00
Use SOURCE_DATE_EPOCH for timestamp if present
The Debian reproducible builds effort suggests using this environment variable for timestamps.
This commit is contained in:
@@ -14,8 +14,6 @@ set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION})
|
||||
set (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo"
|
||||
CACHE STRING "" FORCE)
|
||||
|
||||
string (TIMESTAMP BUILD_DATE "%Y-%m-%d")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
@@ -98,6 +96,18 @@ else()
|
||||
message(FATAL_ERROR "No python interpreter found")
|
||||
endif()
|
||||
|
||||
# allow for reproducible builds - python for portability
|
||||
if (DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
execute_process(
|
||||
COMMAND "${PYTHON}" "${CMAKE_MODULE_PATH}/formatdate.py" "$ENV{SOURCE_DATE_EPOCH}"
|
||||
OUTPUT_VARIABLE BUILD_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else ()
|
||||
string (TIMESTAMP BUILD_DATE "%Y-%m-%d")
|
||||
endif ()
|
||||
message(STATUS "Build date: ${BUILD_DATE}")
|
||||
|
||||
|
||||
if(${RAGEL} STREQUAL "RAGEL-NOTFOUND")
|
||||
message(FATAL_ERROR "Ragel state machine compiler not found")
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user