mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Merge pull request #23559 from ClickHouse/reproducible-build
Reproducible build
This commit is contained in:
commit
280c0666a5
7
contrib/CMakeLists.txt
vendored
7
contrib/CMakeLists.txt
vendored
@ -1,4 +1,3 @@
|
||||
# Third-party libraries may have substandard code.
|
||||
|
||||
# Put all targets defined here and in added subfolders under "contrib/" folder in GUI-based IDEs by default.
|
||||
# Some of third-party projects may override CMAKE_FOLDER or FOLDER property of their targets, so they will
|
||||
@ -11,8 +10,10 @@ else ()
|
||||
endif ()
|
||||
unset (_current_dir_name)
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
|
||||
# Third-party libraries may have substandard code.
|
||||
# Also remove a possible source of nondeterminism.
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -D__DATE__= -D__TIME__= -D__TIMESTAMP__=")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -D__DATE__= -D__TIME__= -D__TIMESTAMP__=")
|
||||
|
||||
if (WITH_COVERAGE)
|
||||
set (WITHOUT_COVERAGE_LIST ${WITHOUT_COVERAGE})
|
||||
|
@ -79,26 +79,9 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(TIMESTAMP TS "%Y/%m/%d %H:%M:%S" UTC)
|
||||
set(GIT_DATE_TIME "${TS}" CACHE STRING "the time we first built rocksdb")
|
||||
|
||||
find_package(Git)
|
||||
|
||||
if(GIT_FOUND AND EXISTS "${ROCKSDB_SOURCE_DIR}/.git")
|
||||
if(WIN32)
|
||||
execute_process(COMMAND $ENV{COMSPEC} /C ${GIT_EXECUTABLE} -C ${ROCKSDB_SOURCE_DIR} rev-parse HEAD OUTPUT_VARIABLE GIT_SHA)
|
||||
else()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${ROCKSDB_SOURCE_DIR} rev-parse HEAD OUTPUT_VARIABLE GIT_SHA)
|
||||
endif()
|
||||
else()
|
||||
set(GIT_SHA 0)
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "[^0-9a-f]+" "" GIT_SHA "${GIT_SHA}")
|
||||
|
||||
set(BUILD_VERSION_CC ${CMAKE_BINARY_DIR}/rocksdb_build_version.cc)
|
||||
configure_file(${ROCKSDB_SOURCE_DIR}/util/build_version.cc.in ${BUILD_VERSION_CC} @ONLY)
|
||||
set(BUILD_VERSION_CC rocksdb_build_version.cc)
|
||||
add_library(rocksdb_build_version OBJECT ${BUILD_VERSION_CC})
|
||||
|
||||
target_include_directories(rocksdb_build_version PRIVATE
|
||||
${ROCKSDB_SOURCE_DIR}/util)
|
||||
if(MSVC)
|
||||
|
3
contrib/rocksdb-cmake/rocksdb_build_version.cc
Normal file
3
contrib/rocksdb-cmake/rocksdb_build_version.cc
Normal file
@ -0,0 +1,3 @@
|
||||
const char* rocksdb_build_git_sha = "rocksdb_build_git_sha:0";
|
||||
const char* rocksdb_build_git_date = "rocksdb_build_git_date:2000-01-01";
|
||||
const char* rocksdb_build_compile_date = "2000-01-01";
|
@ -15,6 +15,7 @@
|
||||
#cmakedefine VERSION_DESCRIBE "@VERSION_DESCRIBE@"
|
||||
#cmakedefine VERSION_GITHASH "@VERSION_GITHASH@"
|
||||
#cmakedefine VERSION_INTEGER @VERSION_INTEGER@
|
||||
#cmakedefine VERSION_DATE @VERSION_DATE@
|
||||
|
||||
#if defined(VERSION_MAJOR)
|
||||
#define DBMS_VERSION_MAJOR VERSION_MAJOR
|
||||
|
@ -8,7 +8,6 @@ get_property (BUILD_INCLUDE_DIRECTORIES DIRECTORY ${ClickHouse_SOURCE_DIR} PROPE
|
||||
|
||||
get_property(TZDATA_VERSION GLOBAL PROPERTY TZDATA_VERSION_PROP)
|
||||
|
||||
string (TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
|
||||
configure_file (StorageSystemBuildOptions.generated.cpp.in ${CONFIG_BUILD})
|
||||
|
||||
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
|
||||
|
@ -1,22 +1,15 @@
|
||||
// .cpp autogenerated by cmake
|
||||
|
||||
#cmakedefine01 BUILD_DETERMINISTIC
|
||||
|
||||
const char * auto_config_build[]
|
||||
{
|
||||
"VERSION_FULL", "@VERSION_FULL@",
|
||||
"VERSION_DESCRIBE", "@VERSION_DESCRIBE@",
|
||||
"VERSION_INTEGER", "@VERSION_INTEGER@",
|
||||
|
||||
#if BUILD_DETERMINISTIC
|
||||
"SYSTEM", "@CMAKE_SYSTEM_NAME@",
|
||||
#else
|
||||
"VERSION_GITHASH", "@VERSION_GITHASH@",
|
||||
"VERSION_REVISION", "@VERSION_REVISION@",
|
||||
"BUILD_DATE", "@BUILD_DATE@",
|
||||
"VERSION_DATE", "@VERSION_DATE@",
|
||||
"SYSTEM", "@CMAKE_SYSTEM@",
|
||||
#endif
|
||||
|
||||
"BUILD_TYPE", "@CMAKE_BUILD_TYPE@",
|
||||
"SYSTEM_PROCESSOR", "@CMAKE_SYSTEM_PROCESSOR@",
|
||||
"LIBRARY_ARCHITECTURE", "@CMAKE_LIBRARY_ARCHITECTURE@",
|
||||
|
@ -1,4 +1,3 @@
|
||||
BUILD_DATE
|
||||
BUILD_TYPE
|
||||
CXX_COMPILER
|
||||
CXX_FLAGS
|
||||
|
@ -4,4 +4,4 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.build_options" | perl -lnE 'print $1 if /(BUILD_DATE|BUILD_TYPE|CXX_COMPILER)\s+\S+/ || /(CXX_FLAGS|LINK_FLAGS|TZDATA_VERSION)/';
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.build_options" | perl -lnE 'print $1 if /(BUILD_TYPE|CXX_COMPILER)\s+\S+/ || /(CXX_FLAGS|LINK_FLAGS|TZDATA_VERSION)/';
|
||||
|
@ -91,9 +91,12 @@ function gen_revision_author {
|
||||
|
||||
git_describe=`git describe`
|
||||
git_hash=`git rev-parse HEAD`
|
||||
VERSION_DATE=`git show -s --format=%cs $git_hash`
|
||||
|
||||
sed -i -e "s/SET(VERSION_REVISION [^) ]*/SET(VERSION_REVISION $VERSION_REVISION/g;" \
|
||||
-e "s/SET(VERSION_DESCRIBE [^) ]*/SET(VERSION_DESCRIBE $git_describe/g;" \
|
||||
-e "s/SET(VERSION_GITHASH [^) ]*/SET(VERSION_GITHASH $git_hash/g;" \
|
||||
-e "s/SET(VERSION_DATE [^) ]*/SET(VERSION_DATE $VERSION_DATE/g;" \
|
||||
-e "s/SET(VERSION_MAJOR [^) ]*/SET(VERSION_MAJOR $VERSION_MAJOR/g;" \
|
||||
-e "s/SET(VERSION_MINOR [^) ]*/SET(VERSION_MINOR $VERSION_MINOR/g;" \
|
||||
-e "s/SET(VERSION_PATCH [^) ]*/SET(VERSION_PATCH $VERSION_PATCH/g;" \
|
||||
|
Loading…
Reference in New Issue
Block a user