1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(build): remove timestamps from build to allow reproducible builds

avoid Qt embedding timestamps into translations after copying .ts to .qm to work towards reproducible builds. Now reproducible locally as long as there is absolutely no change to environment.
This commit is contained in:
Anthony Bilinski 2019-01-24 13:10:39 -08:00
parent edf6b67313
commit 013771c13a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
2 changed files with 16 additions and 9 deletions

View File

@ -69,6 +69,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-overflow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
# avoid timestamps in binary for reproducible builds, not added until GCC 4.9
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wdate-time COMPILER_SUPPORTS_WDATE_TIME)
if(COMPILER_SUPPORTS_WDATE_TIME)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdate-time")
endif()
if (NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstack-protector")
@ -101,6 +108,15 @@ include_directories(${CMAKE_SOURCE_DIR})
include(Dependencies)
if(NOT Qt5Widgets_VERSION VERSION_LESS "5.9")
# Drop the file modification time of source files from generated files
# to help with reproducible builds. We do not use QFileInfo.lastModified
# so this has no unwanted side effects. This mtime started appearing in
# Qt 5.8. The option to force the old file format without mtime was
# added in Qt 5.9. See https://bugreports.qt.io/browse/QTBUG-58769
set(RCC_OPTIONS ${RCC_OPTIONS} -format-version 1)
endif()
################################################################################
#
# :: qTox main library sources

View File

@ -199,14 +199,6 @@ add_definitions(
-DGIT_VERSION="${GIT_VERSION}"
)
if (NOT TIMESTAMP)
execute_process(
COMMAND date +%s
OUTPUT_VARIABLE TIMESTAMP
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
set(APPLE_EXT False)
if (FOUNDATION_FOUND AND IOKIT_FOUND)
set(APPLE_EXT True)
@ -230,6 +222,5 @@ if (PLATFORM_EXTENSIONS)
endif()
add_definitions(
-DTIMESTAMP=${TIMESTAMP}
-DLOG_TO_FILE=1
)