mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
ci: Improve the support for cross-build verifications
Introduce CI_TARGET_TRIPLET and CI_TARGET_ABI. Rename CI_HOST_MACHINE and CI_TARGET_MACHINE, respectively, to CI_HOST_ARCH and CI_TARGET_ARCH, following on the conventional target triplet nomenclature. Introduce CI_BUILD_SYSTEM and CI_BUILD_ARCH, following on the GNU Autotools (host/build/target) practice and nomenclature. Ensure that CI_TARGET_SYSTEM, CI_TARGET_ARCH and CI_TARGET_ABI are all initialized when verifying a cross-platform build. Work around an obscure CMake error by ensuring that CMake variables (CMAKE_AR and CMAKE_RANLIB) are initialized to the full executable paths of their CI_* equivalents (CI_AR and CI_RANLIB). Implement other general-purpose improvements: * Check all CI_NO_* variables in an arithmetic context, to allow setting them explicitly to zero in external configurations. * Label the assertions with descriptions of what's being asserted. * Add more comments and tracing printouts.
This commit is contained in:
@@ -17,6 +17,7 @@ cd "$CI_TOPLEVEL_DIR"
|
||||
CI_SRC_DIR="$CI_TOPLEVEL_DIR"
|
||||
|
||||
function ci_init_build {
|
||||
# Ensure that the mandatory variables are initialized.
|
||||
CI_MAKE="${CI_MAKE:-make}"
|
||||
case "$CI_CC" in
|
||||
( *clang* )
|
||||
@@ -30,12 +31,13 @@ function ci_init_build {
|
||||
|
||||
function ci_trace_build {
|
||||
ci_info "## START OF CONFIGURATION ##"
|
||||
ci_info "host arch: $CI_HOST_ARCH"
|
||||
ci_info "host system: $CI_HOST_SYSTEM"
|
||||
ci_info "host machine hardware: $CI_HOST_MACHINE"
|
||||
[[ "$CI_TARGET_SYSTEM" != "$CI_HOST_SYSTEM" ]] &&
|
||||
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_HOST_SYSTEM.$CI_HOST_ARCH" ]] && {
|
||||
ci_info "target arch: $CI_TARGET_ARCH"
|
||||
ci_info "target system: $CI_TARGET_SYSTEM"
|
||||
[[ "$CI_TARGET_MACHINE" != "$CI_HOST_MACHINE" ]] &&
|
||||
ci_info "target machine hardware: $CI_TARGET_MACHINE"
|
||||
ci_info "target ABI: $CI_TARGET_ABI"
|
||||
}
|
||||
ci_info "source directory: $CI_SRC_DIR"
|
||||
ci_info "environment option: \$CI_MAKEFILES: '$CI_MAKEFILES'"
|
||||
ci_info "environment option: \$CI_MAKE: '$CI_MAKE'"
|
||||
@@ -110,24 +112,28 @@ function ci_build {
|
||||
[[ $CI_LIBS ]] && ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
|
||||
ALL_MAKE_VARS+=($CI_MAKE_VARS)
|
||||
# Build!
|
||||
ci_assert "$CI_SRC_DIR" -ef .
|
||||
local MY_MAKEFILE
|
||||
for MY_MAKEFILE in $CI_MAKEFILES
|
||||
do
|
||||
ci_info "using makefile: $MY_MAKEFILE"
|
||||
# Spawn "make".
|
||||
ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \
|
||||
"${ALL_MAKE_FLAGS[@]}" \
|
||||
"${ALL_MAKE_VARS[@]}"
|
||||
[[ $CI_NO_TEST ]] ||
|
||||
[[ $((CI_NO_TEST)) -ne 0 ]] || {
|
||||
# Spawn "make test" if testing is not disabled.
|
||||
ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \
|
||||
"${ALL_MAKE_FLAGS[@]}" \
|
||||
"${ALL_MAKE_VARS[@]}" \
|
||||
test
|
||||
[[ $CI_NO_CLEAN ]] ||
|
||||
}
|
||||
[[ $((CI_NO_CLEAN)) -ne 0 ]] || {
|
||||
# Spawn "make clean" if cleaning is not disabled.
|
||||
ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \
|
||||
"${ALL_MAKE_FLAGS[@]}" \
|
||||
"${ALL_MAKE_VARS[@]}" \
|
||||
clean
|
||||
}
|
||||
done
|
||||
ci_info "## END OF BUILD ##"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user