diff --git a/.appveyor.yml b/.appveyor.yml index 07e7bc483..932a2801c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -13,58 +13,57 @@ environment: matrix: - TOOLCHAIN: vstudio AUTOMATION: cmake - CI_CMAKE_GENERATOR: Visual Studio 16 2019 - CI_CMAKE_GENERATOR_PLATFORM: Win32 + ARCH: x86 - TOOLCHAIN: vstudio AUTOMATION: cmake - CI_CMAKE_GENERATOR: Visual Studio 16 2019 - CI_CMAKE_GENERATOR_PLATFORM: X64 + ARCH: x64 - TOOLCHAIN: vstudio AUTOMATION: cmake - CI_CMAKE_GENERATOR: Visual Studio 16 2019 - CI_CMAKE_GENERATOR_PLATFORM: ARM64 + ARCH: arm64 CI_NO_TEST: 1 - TOOLCHAIN: msys2 AUTOMATION: cmake - CI_CMAKE_GENERATOR: Unix Makefiles - CI_CC: i686-w64-mingw32-gcc + ARCH: i686 - TOOLCHAIN: msys2 AUTOMATION: cmake - CI_CMAKE_GENERATOR: Unix Makefiles - CI_CC: x86_64-w64-mingw32-gcc + ARCH: x86_64 - TOOLCHAIN: msys2 AUTOMATION: autotools - CI_CC: i686-w64-mingw32-gcc + ARCH: i686 - TOOLCHAIN: msys2 AUTOMATION: autotools - CI_CC: x86_64-w64-mingw32-gcc + ARCH: x86_64 - TOOLCHAIN: msys2 AUTOMATION: legacy - CI_CC: i686-w64-mingw32-gcc + ARCH: i686 - TOOLCHAIN: msys2 AUTOMATION: legacy - CI_CC: x86_64-w64-mingw32-gcc + ARCH: x86_64 install: - - 'if "%TOOLCHAIN%"=="vstudio" if "%CI_CMAKE_GENERATOR_PLATFORM%"=="Win32" C:\tools\vcpkg\vcpkg.exe install zlib:x86-windows' - - 'if "%TOOLCHAIN%"=="vstudio" if "%CI_CMAKE_GENERATOR_PLATFORM%"=="X64" C:\tools\vcpkg\vcpkg.exe install zlib:x64-windows' - - 'if "%TOOLCHAIN%"=="vstudio" if "%CI_CMAKE_GENERATOR_PLATFORM%"=="ARM64" C:\tools\vcpkg\vcpkg.exe install zlib:arm64-windows' + - 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows' - 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe integrate install' before_build: - 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_VARS=-DCMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake' - - 'if "%TOOLCHAIN%"=="msys2" if "%CI_CC%"=="i686-w64-mingw32-gcc" set PATH=C:\msys64\mingw32\bin;%PATH%' - - 'if "%TOOLCHAIN%"=="msys2" if "%CI_CC%"=="x86_64-w64-mingw32-gcc" set PATH=C:\msys64\mingw64\bin;%PATH%' + - 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_GENERATOR=Visual Studio 16 2019' + - 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x86" set CI_CMAKE_GENERATOR_PLATFORM=Win32' + - 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x64" set CI_CMAKE_GENERATOR_PLATFORM=X64' + - 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_GENERATOR_PLATFORM=ARM64' + - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" set CI_CMAKE_GENERATOR=Unix Makefiles' + - 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="i686" set PATH=C:\msys64\mingw32\bin;%PATH%' + - 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="x86_64" set PATH=C:\msys64\mingw64\bin;%PATH%' + - 'if "%TOOLCHAIN%"=="msys2" set CI_CC=%ARCH%-w64-mingw32-gcc' - 'set CI_CMAKE_BUILD_FLAGS=--parallel 2' - 'set CI_CTEST_FLAGS=--parallel 2' - 'set CI_MAKE_FLAGS=-j2' - 'set CI_LEGACY_MAKEFILES=scripts/makefile.gcc scripts/makefile.msys scripts/makefile.std' build_script: - - 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_cmake.sh"' - - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_cmake.sh"' - - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="autotools" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_autotools.sh"' - - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="legacy" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_legacy.sh"' + - 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"' + - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"' + - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="autotools" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_autotools.sh"' + - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="legacy" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_legacy.sh"' cache: - C:\tools\vcpkg\installed diff --git a/.travis.yml b/.travis.yml index e2b07eac0..3c1eb0ccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,4 @@ before_script: - 'export CI_LEGACY_MAKEFILES="scripts/makefile.$TRAVIS_COMPILER scripts/makefile.std"' script: - - './scripts/ci_$AUTOMATION.sh' - -sudo: false + - './ci/ci_$AUTOMATION.sh' diff --git a/AUTHORS b/AUTHORS index c1f119bba..45fb425db 100644 --- a/AUTHORS +++ b/AUTHORS @@ -38,8 +38,8 @@ Authors, for copyright and licensing purposes. - Dan Field The build projects, the build scripts, the test scripts, and other -files in the "projects", "scripts" and "tests" directories, have other -copyright owners, but are released under the libpng license. +files in the "ci", "projects", "scripts" and "tests" directories, have +other copyright owners, but are released under the libpng license. Some files in the "contrib" directory, and some tools-generated files that are distributed with libpng, have other copyright owners, and are diff --git a/scripts/ci_autotools.sh b/ci/ci_autotools.sh similarity index 80% rename from scripts/ci_autotools.sh rename to ci/ci_autotools.sh index 8cc70fe36..ce9157bb7 100755 --- a/scripts/ci_autotools.sh +++ b/ci/ci_autotools.sh @@ -7,13 +7,13 @@ set -e # Copyright (c) 2019-2020 Cosmin Truta. # # This software is released under the libpng license. -# For conditions of distribution and use, see the disclaimer and license -# in png.h. +# For conditions of distribution and use, see the disclaimer +# and license in png.h. -CI_SCRIPTNAME="$(basename "$0")" -CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" -CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")" -CI_BUILDDIR="$CI_SRCDIR/out/autotools.build" +readonly CI_SCRIPTNAME="$(basename "$0")" +readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" +readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")" +readonly CI_BUILDDIR="$CI_SRCDIR/out/autotools.build" function ci_info { printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*" @@ -52,11 +52,11 @@ function ci_init_autotools { } function ci_build_autotools { - # Initialize the configure environment. - [[ $CI_CC ]] && export CC="$CI_CC" - [[ $CI_CC_FLAGS ]] && export CFLAGS="$CI_CC_FLAGS" - [[ $CI_SANITIZERS ]] && export CFLAGS="-fsanitize=$CI_SANITIZERS -O2 $CFLAGS" - # Build. + # Export the configure build environment. + [[ $CI_CC ]] && ci_spawn export CC="$CI_CC" + [[ $CI_CC_FLAGS ]] && ci_spawn export CFLAGS="$CI_CC_FLAGS" + [[ $CI_SANITIZERS ]] && ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS -O2 $CFLAGS" + # Build! ci_spawn rm -fr "$CI_BUILDDIR" ci_spawn mkdir -p "$CI_BUILDDIR" ci_spawn cd "$CI_BUILDDIR" diff --git a/scripts/ci_cmake.sh b/ci/ci_cmake.sh similarity index 84% rename from scripts/ci_cmake.sh rename to ci/ci_cmake.sh index c868ef87c..1a4e5965e 100755 --- a/scripts/ci_cmake.sh +++ b/ci/ci_cmake.sh @@ -7,13 +7,13 @@ set -e # Copyright (c) 2019-2020 Cosmin Truta. # # This software is released under the libpng license. -# For conditions of distribution and use, see the disclaimer and license -# in png.h. +# For conditions of distribution and use, see the disclaimer +# and license in png.h. -CI_SCRIPTNAME="$(basename "$0")" -CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" -CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")" -CI_BUILDDIR="$CI_SRCDIR/out/cmake.build" +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" function ci_info { printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*" @@ -53,14 +53,12 @@ function ci_init_cmake { ci_info "environment option: \$CI_SANITIZERS='$CI_SANITIZERS'" ci_info "environment option: \$CI_NO_TEST='$CI_NO_TEST'" 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_CTEST")" --version } function ci_build_cmake { - # Initialize the CMake environment. - [[ $CI_CMAKE_GENERATOR ]] && - export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR" - [[ $CI_CMAKE_GENERATOR_PLATFORM ]] && - export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM" # 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" @@ -71,10 +69,14 @@ function ci_build_cmake { [[ $ALL_CC_FLAGS ]] && ALL_CMAKE_VARS+=("-DCMAKE_C_FLAGS=$ALL_CC_FLAGS") 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") ALL_CMAKE_VARS+=($CI_CMAKE_VARS) - # Build. - ci_spawn "$(command -v "$CI_CMAKE")" --version - ci_spawn "$(command -v "$CI_CTEST")" --version + # 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" + # Build! ci_spawn "$CI_CMAKE" -E remove_directory "$CI_BUILDDIR" ci_spawn "$CI_CMAKE" -E make_directory "$CI_BUILDDIR" ci_spawn cd "$CI_BUILDDIR" diff --git a/scripts/ci_legacy.sh b/ci/ci_legacy.sh similarity index 91% rename from scripts/ci_legacy.sh rename to ci/ci_legacy.sh index 77f73c99f..a933894a6 100755 --- a/scripts/ci_legacy.sh +++ b/ci/ci_legacy.sh @@ -7,13 +7,13 @@ set -e # Copyright (c) 2019-2020 Cosmin Truta. # # This software is released under the libpng license. -# For conditions of distribution and use, see the disclaimer and license -# in png.h. +# For conditions of distribution and use, see the disclaimer +# and license in png.h. -CI_SCRIPTNAME="$(basename "$0")" -CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" -CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")" -CI_BUILDDIR="$CI_SRCDIR" +readonly CI_SCRIPTNAME="$(basename "$0")" +readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" +readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")" +readonly CI_BUILDDIR="$CI_SRCDIR" function ci_info { printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*" @@ -79,12 +79,12 @@ function ci_build_legacy { [[ $ALL_LD_FLAGS ]] && ALL_MAKE_ARGS+=("LDFLAGS=$ALL_LD_FLAGS") ALL_MAKE_ARGS+=("LIBS=$CI_LIBS") ALL_MAKE_ARGS+=($CI_MAKE_VARS) - # Build. + # Build! ci_spawn cd "$CI_SRCDIR" - [[ $CI_LEGACY_MAKEFILES ]] || ci_err "bad or missing: \$CI_LEGACY_MAKEFILES" local MY_MAKEFILE for MY_MAKEFILE in $CI_LEGACY_MAKEFILES do + ci_info "using makefile: $MY_MAKEFILE" ci_spawn "$CI_MAKE" "${ALL_MAKE_ARGS[@]}" -f $MY_MAKEFILE [[ $CI_NO_TEST ]] || ci_spawn "$CI_MAKE" "${ALL_MAKE_ARGS[@]}" -f $MY_MAKEFILE test [[ $CI_NO_CLEAN ]] || ci_spawn "$CI_MAKE" "${ALL_MAKE_ARGS[@]}" -f $MY_MAKEFILE clean