Skip to content

Commit

Permalink
Try to make builds reproducible
Browse files Browse the repository at this point in the history
Reproducible builds for neovim-qt are not working because mapping flags
passed to the cmake build are included in the code (through version.h.in).
Meaning that builds with slightly different mapping flags end up being
different; even if no other compiler flags are different.

ref #1111

Adds build option for reproducible builds. Currently only affects the use
of compilation flags in the --version output.
  • Loading branch information
equalsraf committed Jul 24, 2024
1 parent c487931 commit 6bf37e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(REPRODUCIBLE_BUILD "Make this build reproducible" OFF)
option(USE_GCOV "Enable gcov support" OFF)
option(ENABLE_CLAZY "Build with KDE Clang Clazy Linter" OFF)
option(ENABLE_TIDY "Build with Clang Tidy Linter" OFF)
Expand Down
2 changes: 2 additions & 0 deletions src/gui/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ void App::showVersionInfo(QCommandLineParser& parser) noexcept

out << "NVIM-QT v" << PROJECT_VERSION << QT_ENDL;
out << "Build type: " << CMAKE_BUILD_TYPE << QT_ENDL;
#if !defined(REPRODUCIBLE_BUILD)
out << "Compilation:" << CMAKE_CXX_FLAGS << QT_ENDL;
#endif
out << "Qt Version: " << QT_VERSION_STR << QT_ENDL;
out << "Environment: " << QT_ENDL;
out << " nvim: " << nvimExecutable << QT_ENDL;
Expand Down
3 changes: 3 additions & 0 deletions src/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
#define RC_PROJECT_NAME "@PROJECT_NAME@\0"
#define RC_PROJECT_VERSION "@PROJECT_VERSION@\0"

#cmakedefine REPRODUCIBLE_BUILD
#if !defined(REPRODUCIBLE_BUILD)
#define CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@"
#endif
#define CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"

#endif // NEOVIM_QT_VERSION

0 comments on commit 6bf37e3

Please sign in to comment.