From c4975d01e591e51dbe2f32bb75af27a5575e1122 Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Sun, 7 Aug 2022 10:29:45 +0200 Subject: [PATCH] Split config.h into separate headers to avoid extensive rebuild Eg. if only the version was changed, config.h was updated, and everything was recompiled. New structure, maintain these manually: config.h.in - for configured variables that are stable if configuration parameters are unchanged config_version.h.in - for version/hash related variables ---- config_unused.h.in - still generated by autoheader with all variables, don't use it Signed-off-by: Aron Budea Change-Id: Id9a50a9f1e798a3b3814778d8683b7d7cb57bb29 --- .gitignore | 4 +- common/Util.cpp | 1 + config.h.in | 104 +++++++++++++++++++++++++++++++++++ config_version.h.in | 7 +++ configure.ac | 8 +++ kit/ForKit.cpp | 1 + kit/Kit.cpp | 1 + net/HttpHelper.cpp | 1 + net/HttpRequest.hpp | 4 +- test/RequestDetailsTests.cpp | 1 + wsd/COOLWSD.cpp | 1 + wsd/FileServer.cpp | 1 + 12 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 config.h.in create mode 100644 config_version.h.in diff --git a/.gitignore b/.gitignore index 110f631003..95cbb2faa4 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,9 @@ coolwsd.xml aclocal.m4 autom4te.cache config.h -config.h.in +config_unused.h +config_unused.h.in +config_version.h ios/config.h config.log config.guess diff --git a/common/Util.cpp b/common/Util.cpp index 27fac8d38a..149fe1dcf3 100644 --- a/common/Util.cpp +++ b/common/Util.cpp @@ -6,6 +6,7 @@ */ #include +#include #include "Util.hpp" diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000000..13230c45cd --- /dev/null +++ b/config.h.in @@ -0,0 +1,104 @@ +/* Variables that usually don't change once configured */ + +/* The user-visible name of the app you build. */ +#undef APP_NAME + +/* Default value of feature_lock.calc_unlock_highlights */ +#undef CALC_UNLOCK_HIGHLIGHTS + +/* Define to 1 if this is a code-coverage build. */ +#undef CODE_COVERAGE + +/* Enable permanent anonymization in logs */ +#undef COOLWSD_ANONYMIZE_USER_DATA + +/* Destination for Trace Event output */ +#undef COOLWSD_TRACEEVENTFILE + +/* The user-name which is allowed to run coolwsd and its tools */ +#undef COOL_USER_ID + +/* Whether to disable SECCOMP */ +#undef DISABLE_SECCOMP + +/* Default value of feature_lock.draw_unlock_highlights */ +#undef DRAW_UNLOCK_HIGHLIGHTS + +/* Whether to compile in some extra debugging support code and disable some + security pieces */ +#undef ENABLE_DEBUG + +/* Whether to compile and enable feature locking */ +#undef ENABLE_FEATURE_LOCK + +/* Whether to compile and enable feature restrictions */ +#undef ENABLE_FEATURE_RESTRICTION + +/* Whether to enable SSL */ +#undef ENABLE_SSL + +/* Whether to enable support key */ +#undef ENABLE_SUPPORT_KEY + +/* Should the Release notes message be shown on upgrade */ +#undef ENABLE_WELCOME_MESSAGE + +/* User feedback URL. */ +#undef FEEDBACK_URL + +/* Whether OpenSSL has PKCS5_PBKDF2_HMAC() */ +#undef HAVE_PKCS5_PBKDF2_HMAC + +/* Define to 1 if you have the `ppoll' function. */ +#undef HAVE_PPOLL + +/* Whether the used C++ has support for std::filesystem. */ +#undef HAVE_STD_FILESYSTEM + +/* Whether the std::filesystem is in the experimental header. */ +#undef HAVE_STD_FILESYSTEM_EXPERIMENTAL + +/* Default value of feature_lock.impress_unlock_highlights */ +#undef IMPRESS_UNLOCK_HIGHLIGHTS + +/* Infobar URL. */ +#undef INFOBAR_URL + +/* Define to 1 if this is a libfuzzer build. */ +#undef LIBFUZZER + +/* Default value of feature_lock.locked_commands */ +#undef LOCKED_COMMANDS + +/* Enable logging of test assertions */ +#undef LOK_LOG_ASSERTIONS + +/* Path to LibreOffice installation */ +#undef LO_PATH + +/* Limit the maximum number of open connections */ +#undef MAX_CONNECTIONS + +/* Limit the maximum number of open documents */ +#undef MAX_DOCUMENTS + +/* Define to 1 if this is a mobileapp (eg. Android) build. */ +#undef MOBILEAPP + +/* Default value of feature_lock.unlock_description */ +#undef UNLOCK_DESCRIPTION + +/* Default value of feature_lock.unlock_link */ +#undef UNLOCK_LINK + +/* Default value of feature_lock.unlock_title */ +#undef UNLOCK_TITLE + +/* Default value of per_documents.document_signing_url */ +#undef VEREIGN_URL + +/* The welcome url of the build. */ +#undef WELCOME_URL + +/* Default value of feature_lock.writer_unlock_highlights */ +#undef WRITER_UNLOCK_HIGHLIGHTS diff --git a/config_version.h.in b/config_version.h.in new file mode 100644 index 0000000000..292362b1c0 --- /dev/null +++ b/config_version.h.in @@ -0,0 +1,7 @@ +/* Version-related variables */ + +/* Collabora Online WebSocket server version */ +#undef COOLWSD_VERSION + +/* Collabora Online git hash if present */ +#undef COOLWSD_VERSION_HASH diff --git a/configure.ac b/configure.ac index 4ded8ed399..e7418d1988 100644 --- a/configure.ac +++ b/configure.ac @@ -58,7 +58,15 @@ AC_DEFINE_UNQUOTED([COOLWSD_VERSION_HASH],[["$COOLWSD_VERSION_HASH"]],[Collabora AC_CONFIG_SRCDIR([wsd/COOLWSD.cpp]) +# this is a dummy header, autoheader adds all entries to it +# don't include config_unused.h anywhere! +AC_CONFIG_HEADERS([config_unused.h]) + +# maintain config.h.in and config_version.h.in manually +# config.h.in is for configurable variables that are stable if configure parameters are unchanged AC_CONFIG_HEADERS([config.h]) +# config_version.h.in is for version/hash related variables +AC_CONFIG_HEADERS([config_version.h]) # Checks for programs. AC_PROG_CXX diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp index 3dd46f38d9..04b729a5ad 100644 --- a/kit/ForKit.cpp +++ b/kit/ForKit.cpp @@ -10,6 +10,7 @@ */ #include +#include #ifndef __FreeBSD__ #include diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 4ca2f27767..d07aa70a20 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -10,6 +10,7 @@ */ #include +#include #include #ifdef __linux__ diff --git a/net/HttpHelper.cpp b/net/HttpHelper.cpp index 1ed9980751..8acaa9d0ab 100644 --- a/net/HttpHelper.cpp +++ b/net/HttpHelper.cpp @@ -6,6 +6,7 @@ */ #include +#include #include "HttpHelper.hpp" diff --git a/net/HttpRequest.hpp b/net/HttpRequest.hpp index 01984ab18c..fb16e2a10c 100644 --- a/net/HttpRequest.hpp +++ b/net/HttpRequest.hpp @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include @@ -29,7 +31,7 @@ #include "Log.hpp" #include "Util.hpp" -#ifndef COOLWSD_VERSION +#ifndef APP_NAME static_assert(false, "config.h must be included in the .cpp being compiled"); #endif diff --git a/test/RequestDetailsTests.cpp b/test/RequestDetailsTests.cpp index 4524dbbd24..c50c7d9cc2 100644 --- a/test/RequestDetailsTests.cpp +++ b/test/RequestDetailsTests.cpp @@ -6,6 +6,7 @@ */ #include +#include #include diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index 5aab354eb4..3a1b8623b7 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -6,6 +6,7 @@ */ #include +#include #include #include "COOLWSD.hpp" #include "ProofKey.hpp" diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp index 1f61dd89d8..1e781281f4 100644 --- a/wsd/FileServer.cpp +++ b/wsd/FileServer.cpp @@ -6,6 +6,7 @@ */ #include +#include #include #include