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
Implement the following updates: * Add CI_SYSNAME and set it to `uname -s`. * Set the default CI_CC value to "clang" on all BSD systems. * Replace CI_SRCDIR_REL_BUILDDIR and CI_INSTALLDIR_REL_BUILDDIR with CI_SRCDIR_NATIVE and CI_INSTALLDIR_NATIVE. The former variables were hard-coded and error-prone; the new variables are computed and safe to use.
This commit is contained in:
parent
a37d483651
commit
8c3fdb0ac1
@ -4,12 +4,13 @@ set -e
|
||||
# ci_autotools.sh
|
||||
# Continuously integrate libpng using the GNU Autotools.
|
||||
#
|
||||
# Copyright (c) 2019-2020 Cosmin Truta.
|
||||
# Copyright (c) 2019-2021 Cosmin Truta.
|
||||
#
|
||||
# This software is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h.
|
||||
|
||||
readonly CI_SYSNAME="$(uname -s)"
|
||||
readonly CI_SCRIPTNAME="$(basename "$0")"
|
||||
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
||||
@ -35,8 +36,10 @@ function ci_spawn {
|
||||
function ci_init_autotools {
|
||||
# Initialize the CI_ variables with default values, where applicable.
|
||||
CI_MAKE="${CI_MAKE:-make}"
|
||||
[[ $(uname -s || echo unknown) == Darwin ]] && CI_CC="${CI_CC:-clang}"
|
||||
[[ $CI_SYSNAME == Darwin || $CI_SYSNAME == *BSD || $CI_SYSNAME == DragonFly ]] &&
|
||||
CI_CC="${CI_CC:-clang}"
|
||||
# Print the CI_ variables.
|
||||
ci_info "system name: $CI_SYSNAME"
|
||||
ci_info "source directory: $CI_SRCDIR"
|
||||
ci_info "build directory: $CI_BUILDDIR"
|
||||
ci_info "install directory: $CI_INSTALLDIR"
|
||||
|
@ -4,19 +4,18 @@ set -e
|
||||
# ci_cmake.sh
|
||||
# Continuously integrate libpng using CMake.
|
||||
#
|
||||
# Copyright (c) 2019-2020 Cosmin Truta.
|
||||
# Copyright (c) 2019-2021 Cosmin Truta.
|
||||
#
|
||||
# This software is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h.
|
||||
|
||||
readonly CI_SYSNAME="$(uname -s)"
|
||||
readonly CI_SCRIPTNAME="$(basename "$0")"
|
||||
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
||||
readonly CI_BUILDDIR="$CI_SRCDIR/out/cmake.build"
|
||||
readonly CI_INSTALLDIR="$CI_SRCDIR/out/cmake.install"
|
||||
readonly CI_SRCDIR_REL_BUILDDIR="../.."
|
||||
readonly CI_INSTALLDIR_REL_BUILDDIR="../../out/cmake.install"
|
||||
|
||||
function ci_info {
|
||||
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
||||
@ -38,12 +37,34 @@ function ci_init_cmake {
|
||||
# Initialize the CI_ variables with default values, where applicable.
|
||||
CI_CMAKE="${CI_CMAKE:-cmake}"
|
||||
CI_CTEST="${CI_CTEST:-ctest}"
|
||||
[[ $(uname -s || echo unknown) == Darwin ]] && CI_CC="${CI_CC:-clang}"
|
||||
[[ $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_GENERATOR == "Visual Studio"* ]] && {
|
||||
# Initialize the CI_..._NATIVE variables.
|
||||
if [[ -x $CYGPATH ]]
|
||||
then
|
||||
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)"
|
||||
CI_INSTALLDIR_NATIVE="$(cd "$CI_INSTALLDIR" ; pwd -W || pwd -P)"
|
||||
fi
|
||||
# Clean up incidental mixtures of Windows and Bash-on-Windows
|
||||
# environment variables, to avoid confusing MSBuild.
|
||||
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
|
||||
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
|
||||
}
|
||||
# Print the CI_ variables.
|
||||
ci_info "system name: $CI_SYSNAME"
|
||||
ci_info "source directory: $CI_SRCDIR"
|
||||
[[ $CI_SRCDIR_NATIVE ]] && ci_info "source directory (native): $CI_SRCDIR_NATIVE"
|
||||
ci_info "build directory: $CI_BUILDDIR"
|
||||
[[ $CI_BUILDDIR_NATIVE ]] && ci_info "build directory (native): $CI_BUILDDIR_NATIVE"
|
||||
ci_info "install directory: $CI_INSTALLDIR"
|
||||
[[ $CI_INSTALLDIR_NATIVE ]] && ci_info "install directory (native): $CI_INSTALLDIR_NATIVE"
|
||||
ci_info "environment option: \$CI_CMAKE='$CI_CMAKE'"
|
||||
ci_info "environment option: \$CI_CMAKE_GENERATOR='$CI_CMAKE_GENERATOR'"
|
||||
ci_info "environment option: \$CI_CMAKE_GENERATOR_PLATFORM='$CI_CMAKE_GENERATOR_PLATFORM'"
|
||||
@ -81,25 +102,21 @@ function ci_build_cmake {
|
||||
ALL_CMAKE_VARS+=($CI_CMAKE_VARS)
|
||||
local -a ALL_CMAKE_BUILD_FLAGS=($CI_CMAKE_BUILD_FLAGS)
|
||||
local -a ALL_CTEST_FLAGS=($CI_CTEST_FLAGS)
|
||||
# Initialize SRCDIR_NATIVE and INSTALLDIR_NATIVE.
|
||||
local SRCDIR_NATIVE="${CI_SRCDIR_NATIVE:-"$CI_SRCDIR"}"
|
||||
local INSTALLDIR_NATIVE="${CI_INSTALLDIR_NATIVE:-"$CI_INSTALLDIR"}"
|
||||
# Export the CMake build environment.
|
||||
[[ $CI_CMAKE_GENERATOR ]] &&
|
||||
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
|
||||
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
|
||||
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
|
||||
# Fix the build environment, if necessary.
|
||||
[[ $CI_CMAKE_GENERATOR == "Visual Studio "* ]] && {
|
||||
# Clean up incidental mixtures of Windows and Bash-on-Windows
|
||||
# environment variables, to avoid confusing MSBuild.
|
||||
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
|
||||
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
|
||||
}
|
||||
# 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_CMAKE" "${ALL_CMAKE_VARS[@]}" \
|
||||
-DCMAKE_INSTALL_PREFIX="$CI_INSTALLDIR_REL_BUILDDIR" \
|
||||
"$CI_SRCDIR_REL_BUILDDIR"
|
||||
-DCMAKE_INSTALL_PREFIX="$INSTALLDIR_NATIVE" \
|
||||
"$SRCDIR_NATIVE"
|
||||
ci_spawn "$CI_CMAKE" --build . \
|
||||
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||
"${ALL_CMAKE_BUILD_FLAGS[@]}"
|
||||
|
@ -4,12 +4,13 @@ set -e
|
||||
# ci_legacy.sh
|
||||
# Continuously integrate libpng using the legacy makefiles.
|
||||
#
|
||||
# Copyright (c) 2019-2020 Cosmin Truta.
|
||||
# Copyright (c) 2019-2021 Cosmin Truta.
|
||||
#
|
||||
# This software is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h.
|
||||
|
||||
readonly CI_SYSNAME="$(uname -s)"
|
||||
readonly CI_SCRIPTNAME="$(basename "$0")"
|
||||
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
||||
@ -34,13 +35,15 @@ function ci_spawn {
|
||||
function ci_init_legacy {
|
||||
# Initialize the CI_ variables with default values, where applicable.
|
||||
CI_MAKE="${CI_MAKE:-make}"
|
||||
[[ $(uname -s || echo unknown) == Darwin ]] && CI_CC="${CI_CC:-clang}"
|
||||
[[ $CI_SYSNAME == Darwin || $CI_SYSNAME == *BSD || $CI_SYSNAME == DragonFly ]] &&
|
||||
CI_CC="${CI_CC:-clang}"
|
||||
[[ $CI_CC == *clang* ]] &&
|
||||
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-scripts/makefile.clang}"
|
||||
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-scripts/makefile.gcc}"
|
||||
CI_LD="${CI_LD:-$CI_CC}"
|
||||
CI_LIBS="${CI_LIBS:--lz -lm}"
|
||||
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.clang"}"
|
||||
CI_LEGACY_MAKEFILES="${CI_LEGACY_MAKEFILES:-"scripts/makefile.gcc"}"
|
||||
CI_LD="${CI_LD:-"$CI_CC"}"
|
||||
CI_LIBS="${CI_LIBS:-"-lz -lm"}"
|
||||
# Print the CI_ variables.
|
||||
ci_info "system name: $CI_SYSNAME"
|
||||
ci_info "source directory: $CI_SRCDIR"
|
||||
ci_info "build directory: $CI_BUILDDIR"
|
||||
ci_info "environment option: \$CI_LEGACY_MAKEFILES='$CI_LEGACY_MAKEFILES'"
|
||||
|
Loading…
x
Reference in New Issue
Block a user