summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosmin Truta <ctruta@gmail.com>2022-11-27 21:58:07 +0200
committerCosmin Truta <ctruta@gmail.com>2022-11-27 21:58:07 +0200
commit9db8cff6ef9b213f27263865a145a4c0e7ef08fc (patch)
tree239ac3db403fe5483d1af0c7fe2e674945bd799d
parentb445aade83e55bb62095e7efdcfd38b540609750 (diff)
downloadlibpng-9db8cff6ef9b213f27263865a145a4c0e7ef08fc.tar.gz
ci: Fix verification under Cygwin Bash + CMake + Visual Studio; update
Fix autodetection and use of the cygpath executable on Windows. Add a new variable CI_CMAKE_TOOLCHAIN_FILE to ci_verify_cmake.sh. This should help in future cross-platform testing. Remove the implicit initialization of CI_CC, CI_LD and CI_LIBS from ci_verify_makefiles.sh. This should help the testing of default values of their respective make variables (CC, LD and LIBS).
-rwxr-xr-xci/ci_verify_cmake.sh35
-rwxr-xr-xci/ci_verify_makefiles.sh13
2 files changed, 25 insertions, 23 deletions
diff --git a/ci/ci_verify_cmake.sh b/ci/ci_verify_cmake.sh
index a92e62899..7cf992154 100755
--- a/ci/ci_verify_cmake.sh
+++ b/ci/ci_verify_cmake.sh
@@ -38,7 +38,8 @@ function ci_init_cmake {
CI_CMAKE="${CI_CMAKE:-cmake}"
CI_CTEST="${CI_CTEST:-ctest}"
CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}"
- [[ -x $(command -v ninja) ]] && CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
+ [[ -x $(command -v ninja) ]] &&
+ CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]]
then
# Initialize the CI_...DIR_NATIVE variables, for the benefit of
@@ -46,11 +47,11 @@ function ci_init_cmake {
# can only be used inside Bash-on-Windows.
mkdir -p "$CI_BUILDDIR"
mkdir -p "$CI_INSTALLDIR"
- if [[ -x $CYGPATH ]]
+ if [[ -x $(command -v cygpath) ]]
then
- CI_SRCDIR_NATIVE="$("$CYGPATH" -w "$CI_SRCDIR")"
- CI_BUILDDIR_NATIVE="$("$CYGPATH" -w "$CI_BUILDDIR")"
- CI_INSTALLDIR_NATIVE="$("$CYGPATH" -w "$CI_INSTALLDIR")"
+ CI_SRCDIR_NATIVE="$(cygpath -w "$CI_SRCDIR")"
+ CI_BUILDDIR_NATIVE="$(cygpath -w "$CI_BUILDDIR")"
+ CI_INSTALLDIR_NATIVE="$(cygpath -w "$CI_INSTALLDIR")"
else
CI_SRCDIR_NATIVE="$(cd "$CI_SRCDIR" ; pwd -W || pwd -P)"
CI_BUILDDIR_NATIVE="$(cd "$CI_BUILDDIR" ; pwd -W || pwd -P)"
@@ -61,7 +62,8 @@ function ci_init_cmake {
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
# Ensure that CI_CMAKE_GENERATOR_PLATFORM is initialized for this generator.
- [[ $CI_CMAKE_GENERATOR_PLATFORM ]] || ci_err "missing: \$CI_CMAKE_GENERATOR_PLATFORM"
+ [[ $CI_CMAKE_GENERATOR_PLATFORM ]] ||
+ ci_err "missing: \$CI_CMAKE_GENERATOR_PLATFORM"
fi
}
@@ -83,6 +85,7 @@ function ci_trace_cmake {
ci_info "environment option: \$CI_CMAKE_GENERATOR_PLATFORM: '$CI_CMAKE_GENERATOR_PLATFORM'"
ci_info "environment option: \$CI_CMAKE_BUILD_TYPE: '$CI_CMAKE_BUILD_TYPE'"
ci_info "environment option: \$CI_CMAKE_BUILD_FLAGS: '$CI_CMAKE_BUILD_FLAGS'"
+ ci_info "environment option: \$CI_CMAKE_TOOLCHAIN_FILE: '$CI_CMAKE_TOOLCHAIN_FILE'"
ci_info "environment option: \$CI_CMAKE_VARS: '$CI_CMAKE_VARS'"
ci_info "environment option: \$CI_CTEST: '$CI_CTEST'"
ci_info "environment option: \$CI_CTEST_FLAGS: '$CI_CTEST_FLAGS'"
@@ -113,16 +116,24 @@ function ci_build_cmake {
ci_spawn "$(command -v "$CI_CTEST")" --version
# Initialize ALL_CC_FLAGS as a string.
local ALL_CC_FLAGS="$CI_CC_FLAGS"
- [[ $CI_SANITIZERS ]] && ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_CC_FLAGS"
+ [[ $CI_SANITIZERS ]] &&
+ ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_CC_FLAGS"
# Initialize ALL_CMAKE_VARS, ALL_CMAKE_BUILD_FLAGS and ALL_CTEST_FLAGS as arrays.
local -a ALL_CMAKE_VARS=()
- [[ $CI_CC ]] && ALL_CMAKE_VARS+=(-DCMAKE_C_COMPILER="$CI_CC")
- [[ $ALL_CC_FLAGS ]] && ALL_CMAKE_VARS+=(-DCMAKE_C_FLAGS="$ALL_CC_FLAGS")
- [[ $CI_AR ]] && ALL_CMAKE_VARS+=(-DCMAKE_AR="$CI_AR")
- [[ $CI_RANLIB ]] && ALL_CMAKE_VARS+=(-DCMAKE_RANLIB="$CI_RANLIB")
+ [[ $CI_CMAKE_TOOLCHAIN_FILE ]] &&
+ ALL_CMAKE_VARS+=(-DCMAKE_TOOLCHAIN_FILE="$CI_CMAKE_TOOLCHAIN_FILE")
+ [[ $CI_CC ]] &&
+ ALL_CMAKE_VARS+=(-DCMAKE_C_COMPILER="$CI_CC")
+ [[ $ALL_CC_FLAGS ]] &&
+ ALL_CMAKE_VARS+=(-DCMAKE_C_FLAGS="$ALL_CC_FLAGS")
+ [[ $CI_AR ]] &&
+ ALL_CMAKE_VARS+=(-DCMAKE_AR="$CI_AR")
+ [[ $CI_RANLIB ]] &&
+ ALL_CMAKE_VARS+=(-DCMAKE_RANLIB="$CI_RANLIB")
ALL_CMAKE_VARS+=(-DCMAKE_BUILD_TYPE="$CI_CMAKE_BUILD_TYPE")
ALL_CMAKE_VARS+=(-DCMAKE_VERBOSE_MAKEFILE=ON)
- [[ $CI_NO_TEST ]] && ALL_CMAKE_VARS+=(-DPNG_TESTS=OFF)
+ [[ $CI_NO_TEST ]] &&
+ ALL_CMAKE_VARS+=(-DPNG_TESTS=OFF)
ALL_CMAKE_VARS+=($CI_CMAKE_VARS)
local -a ALL_CMAKE_BUILD_FLAGS=($CI_CMAKE_BUILD_FLAGS)
local -a ALL_CTEST_FLAGS=($CI_CTEST_FLAGS)
diff --git a/ci/ci_verify_makefiles.sh b/ci/ci_verify_makefiles.sh
index 17658f711..9f65ec021 100755
--- a/ci/ci_verify_makefiles.sh
+++ b/ci/ci_verify_makefiles.sh
@@ -35,23 +35,14 @@ function ci_init_makefiles {
CI_SYSTEM_NAME="$(uname -s)"
CI_MACHINE_NAME="$(uname -m)"
CI_MAKE="${CI_MAKE:-make}"
- case "$CI_SYSTEM_NAME" in
- ( Darwin | *BSD | DragonFly )
- [[ -x $(command -v clang) ]] && CI_CC="${CI_CC:-clang}" ;;
- ( * )
- [[ -x $(command -v gcc) ]] && CI_CC="${CI_CC:-gcc}" ;;
- esac
- CI_CC="${CI_CC:-cc}"
case "$CI_CC" in
( *clang* )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.clang"}" ;;
( *gcc* )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.gcc"}" ;;
- ( cc | c89 | c99 )
+ ( * )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.std"}" ;;
esac
- CI_LD="${CI_LD:-"$CI_CC"}"
- CI_LIBS="${CI_LIBS:-"-lz -lm"}"
}
function ci_trace_makefiles {
@@ -113,7 +104,7 @@ function ci_build_makefiles {
[[ $CI_RANLIB ]] && ALL_MAKE_VARS+=(RANLIB="$CI_RANLIB")
[[ $CI_LD ]] && ALL_MAKE_VARS+=(LD="$CI_LD")
[[ $ALL_LD_FLAGS ]] && ALL_MAKE_VARS+=(LDFLAGS="$ALL_LD_FLAGS")
- ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
+ [[ $CI_LIBS ]] && ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
ALL_MAKE_VARS+=($CI_MAKE_VARS)
# Build!
ci_spawn cd "$CI_SRCDIR"