ci: Add a pre-build checkup stage to ci_verify_configure.sh

Also update comments and tracing printouts in ci/ci_*.sh
This commit is contained in:
Cosmin Truta 2024-02-04 21:53:15 +02:00
parent ab6d97b7c8
commit c9ac5bdba4
3 changed files with 19 additions and 13 deletions

View File

@ -82,13 +82,12 @@ function ci_trace_build {
}
function ci_cleanup_old_build {
if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]]
then
ci_info "## START OF PRE-BUILD CLEANUP ##"
[[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || {
ci_spawn rm -fr "$CI_BUILD_DIR"
ci_spawn rm -fr "$CI_INSTALL_DIR"
}
ci_info "## END OF PRE-BUILD CLEANUP ##"
fi
}
function ci_build {
@ -127,7 +126,7 @@ function ci_build {
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
# Build!
# And... build!
# Use $CI_BUILD_TO_SRC_RELDIR and $CI_BUILD_TO_INSTALL_RELDIR
# instead of $CI_SRC_DIR and $CI_INSTALL_DIR from this point onwards.
ci_spawn mkdir -p "$CI_BUILD_DIR"
@ -181,6 +180,7 @@ function main {
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
# And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {

View File

@ -73,13 +73,19 @@ function ci_trace_build {
}
function ci_cleanup_old_build {
if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]]
then
ci_info "## START OF PRE-BUILD CHECKUP ##"
ci_spawn test '!' -f "$CI_SRC_DIR/config.status" || {
# Warn the user, but do not delete their files.
ci_warn "unexpected build configuration file: '$CI_SRC_DIR/config.status'"
ci_warn "the configure script might fail"
}
ci_info "## END OF PRE-BUILD CHECKUP ##"
ci_info "## START OF PRE-BUILD CLEANUP ##"
[[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || {
ci_spawn rm -fr "$CI_BUILD_DIR"
ci_spawn rm -fr "$CI_INSTALL_DIR"
}
ci_info "## END OF PRE-BUILD CLEANUP ##"
fi
}
function ci_build {
@ -97,7 +103,7 @@ function ci_build {
ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS ${CFLAGS:-"-O2"}"
ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS"
}
# Build!
# And... build!
ci_spawn mkdir -p "$CI_BUILD_DIR"
ci_spawn cd "$CI_BUILD_DIR"
# Spawn "configure".

View File

@ -108,7 +108,7 @@ function ci_build {
[[ $ALL_LD_FLAGS ]] && ALL_MAKE_VARS+=(LDFLAGS="$ALL_LD_FLAGS")
[[ $CI_LIBS ]] && ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
ALL_MAKE_VARS+=($CI_MAKE_VARS)
# Build!
# And... build!
local MY_MAKEFILE
for MY_MAKEFILE in $CI_MAKEFILES
do