From fdd1e79a45556dbaca0b6369746151be14bcf3ad Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 20 May 2025 09:00:52 +0200 Subject: [PATCH] maint(linux): add `--no-werror` option to not report warnings as errors By default we add the `--werror` option to meson builds. This might cause problems when compiling with a different compiler, so this option adds the `--no-werror` option to our build scripts. This enables integrators to compile with other compiler versions. Fixes: #13970 Cherry-pick-of: #13988 Test-bot: skip --- core/build.sh | 8 +++++++- core/commands.inc.sh | 2 +- linux/build.sh | 3 ++- linux/ibus-keyman/build.sh | 10 ++++++++-- linux/keyman-system-service/build.sh | 10 ++++++++-- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/core/build.sh b/core/build.sh index b97ce73515..3a1288e089 100755 --- a/core/build.sh +++ b/core/build.sh @@ -69,7 +69,8 @@ Libraries will be built in 'build///src'. "uninstall uninstall libraries from current system" \ "${archtargets[@]}" \ "--no-tests do not configure tests (used by other projects)" \ - "--test,-t=opt_tests test[s] to run (space separated)" + "--test,-t=opt_tests test[s] to run (space separated)" \ + "--no-werror don't report warnings as errors" builder_parse "$@" @@ -115,6 +116,11 @@ builder_describe_outputs \ build:arch /core/build/arch/$BUILDER_CONFIGURATION/src/libkeymancore.a \ build:wasm /core/build/wasm/$BUILDER_CONFIGURATION/src/libkeymancore.a +MESON_ARGS=--werror +if builder_has_option --no-werror; then + MESON_ARGS= +fi + # Import our standard compiler defines; this is copied from # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't # allow us to reference a file outside its root diff --git a/core/commands.inc.sh b/core/commands.inc.sh index f2c49d88ca..761be3db4d 100644 --- a/core/commands.inc.sh +++ b/core/commands.inc.sh @@ -55,7 +55,7 @@ do_configure() { else pushd "$THIS_SCRIPT_PATH" > /dev/null # Additional arguments are used by Linux build, e.g. -Dprefix=${INSTALLDIR} - meson setup "$MESON_PATH" $MESON_CROSS_FILE --werror --buildtype $BUILDER_CONFIGURATION $STANDARD_MESON_ARGS "${builder_extra_params[@]}" + meson setup "$MESON_PATH" $MESON_CROSS_FILE ${MESON_ARGS} --buildtype $BUILDER_CONFIGURATION $STANDARD_MESON_ARGS "${builder_extra_params[@]}" popd > /dev/null fi diff --git a/linux/build.sh b/linux/build.sh index 6b97c287f5..84654dd9c6 100755 --- a/linux/build.sh +++ b/linux/build.sh @@ -26,7 +26,8 @@ builder_describe \ "--no-integration+ don't run integration tests" \ "--coverage+ capture test coverage" \ "--report+ create coverage report" \ - "--open open the coverage reports in the browser" + "--open open the coverage reports in the browser" \ + "--no-werror+ don't report warnings as errors" builder_parse "$@" diff --git a/linux/ibus-keyman/build.sh b/linux/ibus-keyman/build.sh index 231e9039ea..b1b7fba38d 100755 --- a/linux/ibus-keyman/build.sh +++ b/linux/ibus-keyman/build.sh @@ -21,7 +21,8 @@ builder_describe \ "@../keyman-system-service:service" \ "--no-integration don't run integration tests" \ "--report create coverage report" \ - "--coverage capture test coverage" + "--coverage capture test coverage" \ + "--no-werror don't report warnings as errors" builder_parse "$@" @@ -45,6 +46,11 @@ else MESON_COVERAGE= fi +MESON_ARGS=--werror +if builder_has_option --no-werror; then + MESON_ARGS= +fi + # Import our standard compiler defines; this is copied from # /resources/build/meson/standard.meson.build by build.sh, because meson doesn't # allow us to reference a file outside its root. ${THIS_SCRIPT_PATH}/meson.build @@ -56,7 +62,7 @@ fi configure_action() { # shellcheck disable=SC2086,SC2154 - meson setup ${MESON_COVERAGE} --werror --buildtype $MESON_TARGET "${builder_extra_params[@]}" "$MESON_PATH" + meson setup ${MESON_COVERAGE} ${MESON_ARGS} --buildtype $MESON_TARGET "${builder_extra_params[@]}" "$MESON_PATH" } test_action() { diff --git a/linux/keyman-system-service/build.sh b/linux/keyman-system-service/build.sh index c9507726f4..6efe15fa1c 100755 --- a/linux/keyman-system-service/build.sh +++ b/linux/keyman-system-service/build.sh @@ -19,7 +19,8 @@ builder_describe \ "uninstall uninstall artifacts" \ "--no-integration don't run integration tests" \ "--report create coverage report" \ - "--coverage capture test coverage" + "--coverage capture test coverage" \ + "--no-werror don't report warnings as errors" builder_parse "$@" @@ -42,6 +43,11 @@ else fi MESON_PATH="build/$(uname -m)/$MESON_TARGET" +MESON_ARGS=--werror +if builder_has_option --no-werror; then + MESON_ARGS= +fi + clean_action() { rm -rf "$THIS_SCRIPT_PATH/build/" } @@ -61,7 +67,7 @@ check_missing_coverage_configuration() { configure_action() { # shellcheck disable=SC2086,SC2154,SC2248 - meson setup ${MESON_COVERAGE} --werror --buildtype ${MESON_TARGET} "${builder_extra_params[@]}" "${MESON_PATH}" + meson setup ${MESON_COVERAGE} ${MESON_ARGS} --buildtype ${MESON_TARGET} "${builder_extra_params[@]}" "${MESON_PATH}" } test_action() {