mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by giving the scripts more appropriate names. Most build scripts should use builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh. Documented in resources/build/README.md. Renames: * resources/build/builder.inc.sh to resources/build/builder-full.inc.sh * resources/build/build-utils.sh to resources/build/builder-basic.inc.sh Other changes: * Moves Android-specific functions out of builder-basic.inc.sh and into android/build.sh. * Renames functions in builder-basic.inc.sh More functions may be moved from builder-basic.inc.sh into utils.inc.sh or other scripts in the future. Fixes: #14065 Build-bot: build all Test-bot: skip
102 lines
2.9 KiB
Bash
Executable file
102 lines
2.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
## START STANDARD BUILD SCRIPT INCLUDE
|
|
# adjust relative paths as necessary
|
|
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
|
|
. "${THIS_SCRIPT%/*}/../../resources/build/builder-full.inc.sh"
|
|
## END STANDARD BUILD SCRIPT INCLUDE
|
|
|
|
################################ Main script ################################
|
|
|
|
builder_describe \
|
|
"Build keyman-system-service." \
|
|
":service" \
|
|
"clean" \
|
|
"configure" \
|
|
"build" \
|
|
"test" \
|
|
"install install artifacts" \
|
|
"uninstall uninstall artifacts" \
|
|
"--no-integration don't run integration tests" \
|
|
"--report create coverage report" \
|
|
"--coverage capture test coverage" \
|
|
"--no-werror don't report warnings as errors"
|
|
|
|
builder_parse "$@"
|
|
|
|
if builder_has_action configure; then
|
|
# Import our standard compiler defines
|
|
source "$KEYMAN_ROOT/resources/build/meson/standard_meson_build.inc.sh"
|
|
standard_meson_build
|
|
|
|
# TODO: it would be cleaner to split this from the standard.meson.build file/folder
|
|
cat "${THIS_SCRIPT_PATH}/resources/meson.build.in" >> "${THIS_SCRIPT_PATH}/resources/meson.build"
|
|
fi
|
|
|
|
if builder_is_debug_build; then
|
|
MESON_TARGET=debug
|
|
export CPPFLAGS=-DG_MESSAGES_DEBUG
|
|
export CFLAGS="-O0"
|
|
export CXXFLAGS="-O0"
|
|
else
|
|
MESON_TARGET=release
|
|
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/"
|
|
}
|
|
|
|
check_missing_coverage_configuration() {
|
|
if builder_has_option --coverage && [ -d "$MESON_PATH" ]; then
|
|
# It's possible that we got configured because we're a dependency of ibus-keyman
|
|
# in which case the `--coverage` option wasn't passed along.
|
|
cd "$MESON_PATH"
|
|
if ! ninja -t targets | grep -q coverage-html ; then
|
|
cd "$THIS_SCRIPT_PATH"
|
|
clean_action
|
|
fi
|
|
cd "$THIS_SCRIPT_PATH"
|
|
fi
|
|
}
|
|
|
|
configure_action() {
|
|
# shellcheck disable=SC2086,SC2154,SC2248
|
|
meson setup ${MESON_COVERAGE} ${MESON_ARGS} --buildtype ${MESON_TARGET} "${builder_extra_params[@]}" "${MESON_PATH}"
|
|
}
|
|
|
|
test_action() {
|
|
# shellcheck disable=SC2086,SC2154
|
|
meson test --print-errorlogs ${builder_verbose}
|
|
if builder_has_option --coverage; then
|
|
# Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
|
|
ninja coverage-html
|
|
fi
|
|
}
|
|
|
|
check_missing_coverage_configuration
|
|
|
|
builder_describe_outputs \
|
|
configure "${MESON_PATH}/build.ninja" \
|
|
build "${MESON_PATH}/src/keyman-system-service"
|
|
|
|
if builder_has_option --coverage; then
|
|
MESON_COVERAGE=-Db_coverage=true
|
|
else
|
|
MESON_COVERAGE=
|
|
fi
|
|
|
|
builder_run_action clean clean_action
|
|
builder_run_action configure configure_action
|
|
|
|
[[ -d "${MESON_PATH}" ]] && cd "${MESON_PATH}"
|
|
|
|
builder_run_action build ninja
|
|
builder_run_action test test_action
|
|
builder_run_action install ninja install
|
|
builder_run_action uninstall ninja uninstall
|