summaryrefslogtreecommitdiff
path: root/ci/ci_verify_configure.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/ci_verify_configure.sh')
-rwxr-xr-xci/ci_verify_configure.sh35
1 files changed, 23 insertions, 12 deletions
diff --git a/ci/ci_verify_configure.sh b/ci/ci_verify_configure.sh
index df822061a..a8e88787a 100755
--- a/ci/ci_verify_configure.sh
+++ b/ci/ci_verify_configure.sh
@@ -4,7 +4,7 @@ set -e
# ci_verify_configure.sh
# Continuously integrate libpng using the configure script.
#
-# Copyright (c) 2019-2022 Cosmin Truta.
+# Copyright (c) 2019-2023 Cosmin Truta.
#
# This software is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
@@ -13,8 +13,8 @@ set -e
CI_SCRIPTNAME="$(basename "$0")"
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
-CI_BUILDDIR="$CI_SRCDIR/out/configure.build"
-CI_INSTALLDIR="$CI_SRCDIR/out/configure.install"
+CI_BUILDDIR="$CI_SRCDIR/out/ci_verify_configure.build"
+CI_INSTALLDIR="$CI_SRCDIR/out/ci_verify_configure.install"
function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
@@ -32,7 +32,7 @@ function ci_spawn {
"$@"
}
-function ci_init_configure {
+function ci_init_configure_build {
CI_SYSTEM_NAME="$(uname -s)"
CI_MACHINE_NAME="$(uname -m)"
CI_MAKE="${CI_MAKE:-make}"
@@ -44,7 +44,7 @@ function ci_init_configure {
[[ ! $CI_MAKE_VARS ]] || ci_err "unexpected: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
}
-function ci_trace_configure {
+function ci_trace_configure_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "system name: $CI_SYSTEM_NAME"
ci_info "machine hardware name: $CI_MACHINE_NAME"
@@ -80,6 +80,13 @@ function ci_trace_configure {
ci_info "## END OF CONFIGURATION ##"
}
+function ci_cleanup_old_configure_build {
+ [[ ! -e $CI_BUILDDIR ]] ||
+ ci_spawn rm -fr "$CI_BUILDDIR"
+ [[ ! -e $CI_INSTALLDIR ]] ||
+ ci_spawn rm -fr "$CI_INSTALLDIR"
+}
+
function ci_build_configure {
ci_info "## START OF BUILD ##"
# Export the configure build environment.
@@ -96,7 +103,6 @@ function ci_build_configure {
ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS"
}
# Build and install.
- ci_spawn rm -fr "$CI_BUILDDIR" "$CI_INSTALLDIR"
ci_spawn mkdir -p "$CI_BUILDDIR"
ci_spawn cd "$CI_BUILDDIR"
ci_spawn "$CI_SRCDIR/configure" --prefix="$CI_INSTALLDIR" $CI_CONFIGURE_FLAGS
@@ -108,10 +114,15 @@ function ci_build_configure {
ci_info "## END OF BUILD ##"
}
-ci_init_configure
-ci_trace_configure
-[[ $# -eq 0 ]] || {
- ci_info "note: this program accepts environment options only"
- ci_err "unexpected command arguments: '$*'"
+function main {
+ [[ $# -eq 0 ]] || {
+ ci_info "note: this program accepts environment options only"
+ ci_err "unexpected command arguments: '$*'"
+ }
+ ci_init_configure_build
+ ci_trace_configure_build
+ ci_cleanup_old_configure_build
+ ci_build_configure
}
-ci_build_configure
+
+main "$@"