mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
ci: Update the CI scripts
Apply the following changes: * Set CI_CMAKE_GENERATOR to "Ninja" by default in ci_cmake.sh. * Set CI_CC to cc by default in ci_autotools.sh. * Rename CI_SYSNAME to CI_SYSTEM_NAME; add CI_MACHINE_NAME. * Apply other minor changes and fixes.
This commit is contained in:
parent
103f8346e3
commit
081e6751ab
@ -4,18 +4,17 @@ set -e
|
|||||||
# ci_autotools.sh
|
# ci_autotools.sh
|
||||||
# Continuously integrate libpng using the GNU Autotools.
|
# Continuously integrate libpng using the GNU Autotools.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019-2021 Cosmin Truta.
|
# Copyright (c) 2019-2022 Cosmin Truta.
|
||||||
#
|
#
|
||||||
# This software is released under the libpng license.
|
# This software is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h.
|
# and license in png.h.
|
||||||
|
|
||||||
readonly CI_SYSNAME="$(uname -s)"
|
CI_SCRIPTNAME="$(basename "$0")"
|
||||||
readonly CI_SCRIPTNAME="$(basename "$0")"
|
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
||||||
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
CI_BUILDDIR="$CI_SRCDIR/out/autotools.build"
|
||||||
readonly CI_BUILDDIR="$CI_SRCDIR/out/autotools.build"
|
CI_INSTALLDIR="$CI_SRCDIR/out/autotools.install"
|
||||||
readonly CI_INSTALLDIR="$CI_SRCDIR/out/autotools.install"
|
|
||||||
|
|
||||||
function ci_info {
|
function ci_info {
|
||||||
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
||||||
@ -34,12 +33,20 @@ function ci_spawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ci_init_autotools {
|
function ci_init_autotools {
|
||||||
# Initialize the CI_ variables with default values, where applicable.
|
CI_SYSTEM_NAME="$(uname -s)"
|
||||||
|
CI_MACHINE_NAME="$(uname -m)"
|
||||||
CI_MAKE="${CI_MAKE:-make}"
|
CI_MAKE="${CI_MAKE:-make}"
|
||||||
[[ $CI_SYSNAME == Darwin || $CI_SYSNAME == *BSD || $CI_SYSNAME == DragonFly ]] &&
|
# Set CI_CC to cc by default, if the cc command is available.
|
||||||
CI_CC="${CI_CC:-clang}"
|
# The configure script defaults CC to gcc, which is not always a good idea.
|
||||||
# Print the CI_ variables.
|
[[ -x $(command -v cc) ]] && CI_CC="${CI_CC:-cc}"
|
||||||
ci_info "system name: $CI_SYSNAME"
|
# Ensure that the CI_ variables that cannot be customized reliably are not initialized.
|
||||||
|
[[ ! $CI_CONFIGURE_VARS ]] || ci_err "unexpected: \$CI_CONFIGURE_VARS='$CI_CONFIGURE_VARS'"
|
||||||
|
[[ ! $CI_MAKE_VARS ]] || ci_err "unexpected: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_trace_autotools {
|
||||||
|
ci_info "system name: $CI_SYSTEM_NAME"
|
||||||
|
ci_info "machine hardware name: $CI_MACHINE_NAME"
|
||||||
ci_info "source directory: $CI_SRCDIR"
|
ci_info "source directory: $CI_SRCDIR"
|
||||||
ci_info "build directory: $CI_BUILDDIR"
|
ci_info "build directory: $CI_BUILDDIR"
|
||||||
ci_info "install directory: $CI_INSTALLDIR"
|
ci_info "install directory: $CI_INSTALLDIR"
|
||||||
@ -58,9 +65,6 @@ function ci_init_autotools {
|
|||||||
ci_info "environment option: \$CI_NO_TEST='$CI_NO_TEST'"
|
ci_info "environment option: \$CI_NO_TEST='$CI_NO_TEST'"
|
||||||
ci_info "environment option: \$CI_NO_INSTALL='$CI_NO_INSTALL'"
|
ci_info "environment option: \$CI_NO_INSTALL='$CI_NO_INSTALL'"
|
||||||
ci_info "environment option: \$CI_NO_CLEAN='$CI_NO_CLEAN'"
|
ci_info "environment option: \$CI_NO_CLEAN='$CI_NO_CLEAN'"
|
||||||
# Avoid using the CI_ variables that cannot be customized reliably.
|
|
||||||
[[ ! $CI_CONFIGURE_VARS ]] || ci_err "unexpected: \$CI_CONFIGURE_VARS='$CI_CONFIGURE_VARS'"
|
|
||||||
[[ ! $CI_MAKE_VARS ]] || ci_err "unexpected: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ci_build_autotools {
|
function ci_build_autotools {
|
||||||
@ -74,7 +78,7 @@ function ci_build_autotools {
|
|||||||
[[ $CI_LD ]] && ci_spawn export CPP="$CI_LD"
|
[[ $CI_LD ]] && ci_spawn export CPP="$CI_LD"
|
||||||
[[ $CI_LD_FLAGS ]] && ci_spawn export LDFLAGS="$CI_LD_FLAGS"
|
[[ $CI_LD_FLAGS ]] && ci_spawn export LDFLAGS="$CI_LD_FLAGS"
|
||||||
[[ $CI_SANITIZERS ]] && {
|
[[ $CI_SANITIZERS ]] && {
|
||||||
ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS -O2 $CFLAGS"
|
ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS ${CFLAGS:-"-O2"}"
|
||||||
ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS"
|
ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS"
|
||||||
}
|
}
|
||||||
# Build and install.
|
# Build and install.
|
||||||
@ -91,7 +95,8 @@ function ci_build_autotools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ci_init_autotools
|
ci_init_autotools
|
||||||
[[ ! $* ]] || {
|
ci_trace_autotools
|
||||||
|
[[ $# -eq 0 ]] || {
|
||||||
ci_info "note: this program accepts environment options only"
|
ci_info "note: this program accepts environment options only"
|
||||||
ci_err "unexpected command arguments: '$*'"
|
ci_err "unexpected command arguments: '$*'"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,18 +4,17 @@ set -e
|
|||||||
# ci_cmake.sh
|
# ci_cmake.sh
|
||||||
# Continuously integrate libpng using CMake.
|
# Continuously integrate libpng using CMake.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019-2021 Cosmin Truta.
|
# Copyright (c) 2019-2022 Cosmin Truta.
|
||||||
#
|
#
|
||||||
# This software is released under the libpng license.
|
# This software is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h.
|
# and license in png.h.
|
||||||
|
|
||||||
readonly CI_SYSNAME="$(uname -s)"
|
CI_SCRIPTNAME="$(basename "$0")"
|
||||||
readonly CI_SCRIPTNAME="$(basename "$0")"
|
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
||||||
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
CI_BUILDDIR="$CI_SRCDIR/out/cmake.build"
|
||||||
readonly CI_BUILDDIR="$CI_SRCDIR/out/cmake.build"
|
CI_INSTALLDIR="$CI_SRCDIR/out/cmake.install"
|
||||||
readonly CI_INSTALLDIR="$CI_SRCDIR/out/cmake.install"
|
|
||||||
|
|
||||||
function ci_info {
|
function ci_info {
|
||||||
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
||||||
@ -34,14 +33,19 @@ function ci_spawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ci_init_cmake {
|
function ci_init_cmake {
|
||||||
# Initialize the CI_ variables with default values, where applicable.
|
CI_SYSTEM_NAME="$(uname -s)"
|
||||||
|
CI_MACHINE_NAME="$(uname -m)"
|
||||||
CI_CMAKE="${CI_CMAKE:-cmake}"
|
CI_CMAKE="${CI_CMAKE:-cmake}"
|
||||||
CI_CTEST="${CI_CTEST:-ctest}"
|
CI_CTEST="${CI_CTEST:-ctest}"
|
||||||
[[ $CI_SYSNAME == Darwin || $CI_SYSNAME == *BSD || $CI_SYSNAME == DragonFly ]] &&
|
|
||||||
CI_CC="${CI_CC:-clang}"
|
|
||||||
CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}"
|
CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}"
|
||||||
[[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]] && {
|
[[ -x $(command -v ninja) ]] && CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
|
||||||
# Initialize the CI_..._NATIVE variables.
|
if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]]
|
||||||
|
then
|
||||||
|
# Initialize the CI_...DIR_NATIVE variables, for the benefit of
|
||||||
|
# the native Windows build tools. The regular CI_...DIR variables
|
||||||
|
# can only be used inside Bash-on-Windows.
|
||||||
|
mkdir -p "$CI_BUILDDIR"
|
||||||
|
mkdir -p "$CI_INSTALLDIR"
|
||||||
if [[ -x $CYGPATH ]]
|
if [[ -x $CYGPATH ]]
|
||||||
then
|
then
|
||||||
CI_SRCDIR_NATIVE="$("$CYGPATH" -w "$CI_SRCDIR")"
|
CI_SRCDIR_NATIVE="$("$CYGPATH" -w "$CI_SRCDIR")"
|
||||||
@ -56,9 +60,14 @@ function ci_init_cmake {
|
|||||||
# environment variables, to avoid confusing MSBuild.
|
# environment variables, to avoid confusing MSBuild.
|
||||||
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
|
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
|
||||||
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
|
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
|
||||||
}
|
# Ensure that CI_CMAKE_GENERATOR_PLATFORM is initialized for this generator.
|
||||||
# Print the CI_ variables.
|
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] || ci_err "missing: \$CI_CMAKE_GENERATOR_PLATFORM"
|
||||||
ci_info "system name: $CI_SYSNAME"
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_trace_cmake {
|
||||||
|
ci_info "system name: $CI_SYSTEM_NAME"
|
||||||
|
ci_info "machine hardware name: $CI_MACHINE_NAME"
|
||||||
ci_info "source directory: $CI_SRCDIR"
|
ci_info "source directory: $CI_SRCDIR"
|
||||||
[[ $CI_SRCDIR_NATIVE ]] && ci_info "source directory (native): $CI_SRCDIR_NATIVE"
|
[[ $CI_SRCDIR_NATIVE ]] && ci_info "source directory (native): $CI_SRCDIR_NATIVE"
|
||||||
ci_info "build directory: $CI_BUILDDIR"
|
ci_info "build directory: $CI_BUILDDIR"
|
||||||
@ -81,7 +90,6 @@ function ci_init_cmake {
|
|||||||
ci_info "environment option: \$CI_NO_TEST='$CI_NO_TEST'"
|
ci_info "environment option: \$CI_NO_TEST='$CI_NO_TEST'"
|
||||||
ci_info "environment option: \$CI_NO_INSTALL='$CI_NO_INSTALL'"
|
ci_info "environment option: \$CI_NO_INSTALL='$CI_NO_INSTALL'"
|
||||||
ci_info "environment option: \$CI_NO_CLEAN='$CI_NO_CLEAN'"
|
ci_info "environment option: \$CI_NO_CLEAN='$CI_NO_CLEAN'"
|
||||||
# Print the CMake/CTest program versions.
|
|
||||||
ci_spawn "$(command -v "$CI_CMAKE")" --version
|
ci_spawn "$(command -v "$CI_CMAKE")" --version
|
||||||
ci_spawn "$(command -v "$CI_CTEST")" --version
|
ci_spawn "$(command -v "$CI_CTEST")" --version
|
||||||
}
|
}
|
||||||
@ -105,7 +113,7 @@ function ci_build_cmake {
|
|||||||
# Initialize SRCDIR_NATIVE and INSTALLDIR_NATIVE.
|
# Initialize SRCDIR_NATIVE and INSTALLDIR_NATIVE.
|
||||||
local SRCDIR_NATIVE="${CI_SRCDIR_NATIVE:-"$CI_SRCDIR"}"
|
local SRCDIR_NATIVE="${CI_SRCDIR_NATIVE:-"$CI_SRCDIR"}"
|
||||||
local INSTALLDIR_NATIVE="${CI_INSTALLDIR_NATIVE:-"$CI_INSTALLDIR"}"
|
local INSTALLDIR_NATIVE="${CI_INSTALLDIR_NATIVE:-"$CI_INSTALLDIR"}"
|
||||||
# Export the CMake build environment.
|
# Export the CMake environment variables.
|
||||||
[[ $CI_CMAKE_GENERATOR ]] &&
|
[[ $CI_CMAKE_GENERATOR ]] &&
|
||||||
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
|
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
|
||||||
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
|
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
|
||||||
@ -137,7 +145,8 @@ function ci_build_cmake {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ci_init_cmake
|
ci_init_cmake
|
||||||
[[ ! $* ]] || {
|
ci_trace_cmake
|
||||||
|
[[ $# -eq 0 ]] || {
|
||||||
ci_info "note: this program accepts environment options only"
|
ci_info "note: this program accepts environment options only"
|
||||||
ci_err "unexpected command arguments: '$*'"
|
ci_err "unexpected command arguments: '$*'"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,17 +4,16 @@ set -e
|
|||||||
# ci_legacy.sh
|
# ci_legacy.sh
|
||||||
# Continuously integrate libpng using the legacy makefiles.
|
# Continuously integrate libpng using the legacy makefiles.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019-2021 Cosmin Truta.
|
# Copyright (c) 2019-2022 Cosmin Truta.
|
||||||
#
|
#
|
||||||
# This software is released under the libpng license.
|
# This software is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h.
|
# and license in png.h.
|
||||||
|
|
||||||
readonly CI_SYSNAME="$(uname -s)"
|
CI_SCRIPTNAME="$(basename "$0")"
|
||||||
readonly CI_SCRIPTNAME="$(basename "$0")"
|
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
||||||
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
CI_BUILDDIR="$CI_SRCDIR"
|
||||||
readonly CI_BUILDDIR="$CI_SRCDIR"
|
|
||||||
|
|
||||||
function ci_info {
|
function ci_info {
|
||||||
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
||||||
@ -33,17 +32,31 @@ function ci_spawn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ci_init_legacy {
|
function ci_init_legacy {
|
||||||
# Initialize the CI_ variables with default values, where applicable.
|
CI_SYSTEM_NAME="$(uname -s)"
|
||||||
|
CI_MACHINE_NAME="$(uname -m)"
|
||||||
CI_MAKE="${CI_MAKE:-make}"
|
CI_MAKE="${CI_MAKE:-make}"
|
||||||
[[ $CI_SYSNAME == Darwin || $CI_SYSNAME == *BSD || $CI_SYSNAME == DragonFly ]] &&
|
case "$CI_SYSTEM_NAME" in
|
||||||
CI_CC="${CI_CC:-clang}"
|
( Darwin | *BSD | DragonFly )
|
||||||
[[ $CI_CC == *clang* ]] &&
|
[[ -x $(command -v clang) ]] && CI_CC="${CI_CC:-clang}" ;;
|
||||||
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.clang"}"
|
( * )
|
||||||
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.gcc"}"
|
[[ -x $(command -v gcc) ]] && CI_CC="${CI_CC:-gcc}" ;;
|
||||||
|
esac
|
||||||
|
CI_CC="${CI_CC:-cc}"
|
||||||
|
case "$CI_CC" in
|
||||||
|
( *clang* )
|
||||||
|
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.clang"}" ;;
|
||||||
|
( *gcc* )
|
||||||
|
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.gcc"}" ;;
|
||||||
|
( cc | c89 | c99 )
|
||||||
|
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.std"}" ;;
|
||||||
|
esac
|
||||||
CI_LD="${CI_LD:-"$CI_CC"}"
|
CI_LD="${CI_LD:-"$CI_CC"}"
|
||||||
CI_LIBS="${CI_LIBS:-"-lz -lm"}"
|
CI_LIBS="${CI_LIBS:-"-lz -lm"}"
|
||||||
# Print the CI_ variables.
|
}
|
||||||
ci_info "system name: $CI_SYSNAME"
|
|
||||||
|
function ci_trace_legacy {
|
||||||
|
ci_info "system name: $CI_SYSTEM_NAME"
|
||||||
|
ci_info "machine hardware name: $CI_MACHINE_NAME"
|
||||||
ci_info "source directory: $CI_SRCDIR"
|
ci_info "source directory: $CI_SRCDIR"
|
||||||
ci_info "build directory: $CI_BUILDDIR"
|
ci_info "build directory: $CI_BUILDDIR"
|
||||||
ci_info "environment option: \$CI_LEGACY_MAKEFILES='$CI_LEGACY_MAKEFILES'"
|
ci_info "environment option: \$CI_LEGACY_MAKEFILES='$CI_LEGACY_MAKEFILES'"
|
||||||
@ -69,7 +82,7 @@ function ci_build_legacy {
|
|||||||
local ALL_CC_FLAGS="$CI_CC_FLAGS"
|
local ALL_CC_FLAGS="$CI_CC_FLAGS"
|
||||||
local ALL_LD_FLAGS="$CI_LD_FLAGS"
|
local ALL_LD_FLAGS="$CI_LD_FLAGS"
|
||||||
[[ $CI_SANITIZERS ]] && {
|
[[ $CI_SANITIZERS ]] && {
|
||||||
ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS -O2 $ALL_CC_FLAGS"
|
ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS ${ALL_CC_FLAGS:-"-O2"}"
|
||||||
ALL_LD_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_LD_FLAGS"
|
ALL_LD_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_LD_FLAGS"
|
||||||
}
|
}
|
||||||
# Initialize ALL_MAKE_FLAGS and ALL_MAKE_VARS as arrays.
|
# Initialize ALL_MAKE_FLAGS and ALL_MAKE_VARS as arrays.
|
||||||
@ -112,7 +125,8 @@ function ci_build_legacy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ci_init_legacy
|
ci_init_legacy
|
||||||
[[ ! $* ]] || {
|
ci_trace_legacy
|
||||||
|
[[ $# -eq 0 ]] || {
|
||||||
ci_info "note: this program accepts environment options only"
|
ci_info "note: this program accepts environment options only"
|
||||||
ci_err "unexpected command arguments: '$*'"
|
ci_err "unexpected command arguments: '$*'"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user