2021-02-10 06:27:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-11-09 11:20:52 +00:00
|
|
|
cd "$CI_CONT_SRCDIR"
|
2019-08-15 12:28:17 +00:00
|
|
|
|
2023-08-24 13:42:45 +00:00
|
|
|
export CCACHE_BASEDIR="$(pwd)"
|
|
|
|
export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
|
|
|
|
export CCACHE_MAXSIZE="500M"
|
|
|
|
export PATH="$CCACHE_WRAPPERSDIR:$PATH"
|
|
|
|
|
|
|
|
# Enable these conditionally since their best use case is during
|
|
|
|
# non-interactive workloads without having a Shell
|
|
|
|
if ! [ -t 1 ]; then
|
|
|
|
export VIR_TEST_VERBOSE="1"
|
|
|
|
export VIR_TEST_DEBUG="1"
|
|
|
|
fi
|
2019-08-15 12:28:17 +00:00
|
|
|
|
2023-08-25 14:12:32 +00:00
|
|
|
GIT_ROOT="$(git rev-parse --show-toplevel)"
|
|
|
|
|
2020-11-09 11:20:52 +00:00
|
|
|
# $MESON_OPTS is an env that can optionally be set in the container,
|
2019-08-15 12:28:17 +00:00
|
|
|
# populated at build time from the Dockerfile. A typical use case would
|
2020-11-09 11:20:52 +00:00
|
|
|
# be to pass options to trigger cross-compilation
|
2023-02-01 14:22:59 +00:00
|
|
|
#
|
|
|
|
# $MESON_ARGS correspond to meson's setup args, i.e. configure args. It's
|
2023-08-24 13:43:13 +00:00
|
|
|
# populated from a GitLab's job configuration
|
2019-08-15 12:28:17 +00:00
|
|
|
|
2023-08-24 15:35:53 +00:00
|
|
|
meson setup build --werror -Dsystem=true $MESON_OPTS $MESON_ARGS || \
|
2020-11-09 11:20:52 +00:00
|
|
|
(cat build/meson-logs/meson-log.txt && exit 1)
|
2019-08-15 12:28:17 +00:00
|
|
|
|
2023-01-31 17:06:53 +00:00
|
|
|
ninja -C build $NINJA_ARGS
|
2023-08-24 13:45:44 +00:00
|
|
|
|
|
|
|
run_cmd() {
|
|
|
|
printf "\e[32m[RUN COMMAND]: '%s'\e[0m\n" "$*"
|
|
|
|
"$@"
|
|
|
|
}
|
2023-08-24 13:44:52 +00:00
|
|
|
|
|
|
|
run_meson_setup() {
|
|
|
|
run_cmd meson setup build --error -Dsystem=true $MESON_OPTS $MESON_ARGS || \
|
|
|
|
(cat "${GIT_ROOT}/build/meson-logs/meson-log.txt" && exit 1)
|
|
|
|
}
|
2023-08-24 13:46:53 +00:00
|
|
|
|
|
|
|
run_build() {
|
|
|
|
test -f $GIT_ROOT/build/build.ninja || run_meson_setup
|
|
|
|
run_cmd meson compile -C build $BUILD_ARGS
|
|
|
|
}
|