2023-12-21 11:59:20 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#***************************************************************************
|
|
|
|
# _ _ ____ _
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
#
|
|
|
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
|
|
#
|
|
|
|
# This software is licensed as described in the file COPYING, which
|
|
|
|
# you should have received as part of this distribution. The terms
|
|
|
|
# are also available at https://curl.se/docs/copyright.html.
|
|
|
|
#
|
|
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
|
|
#
|
|
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, either express or implied.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: curl
|
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
# shellcheck disable=SC3040,SC2039
|
|
|
|
set -eux; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
|
|
|
|
|
|
|
|
# build
|
|
|
|
|
|
|
|
if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then
|
2024-04-10 00:21:55 +08:00
|
|
|
openssl_root_win='C:/OpenSSL-v32-Win64'
|
2023-12-21 11:59:20 +08:00
|
|
|
else
|
|
|
|
openssl_root_win='C:/OpenSSL-v111-Win64'
|
|
|
|
fi
|
GHA: add three old (gcc 6, 7, 9) mingw-w64 jobs
Re-implement old mingw-w64 jobs in GHA. This allows to use the latest
Windows runners, replacing Windows Server 2012 R2 (gcc 6) and Windows
Server 2016 (gcc 7, 9) with Windows Server 2022.
GHA runners are also significantly faster, and allow running tests in
parallel (`-j14`). It also offloads 3 more long-running jobs from
AppVeyor CI.
These jobs download (then cache) the mingw-w64 packages from their
original location, which allows flexibility in choosing which versions
and flavours (win32/POSIX, SEH/DWARF, 64/32-bit) we want to test in CI.
The new jobs use these distros:
- https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/ (for gcc 7, same as on AppVeyor)
- https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/ (for gcc 6, same as on AppVeyor)
- https://winlibs.com/ (for gcc 9)
I matched existing AppVeyor job configs, with these differences:
- gcc 6.4.0 instead of 6.3.0.
(same distro as on AppVeyor, but the latest bugfix release)
- gcc 9.5.0 instead of 9.1.0 and a different (but compatible) binary distro.
(in AppVeyor this relies on an old MSYS2 pre-installed on the runner)
- using win32 builds instead of posix for gcc 6.4.0 and 7.3.0.
- websockets enabled.
- always build examples.
- always build tests (this wasn't done for 6.4.0 with AppVeyor CI).
I did not replicate existing test exclusions, and oddly enough the few
failures (so far) were different from MSYS2 jobs and also from their
AppVeyor CI counterparts.
Also:
- delete redundant (default) `-u` option from `cygpath` calls.
- allow matrix options to override default ones in CMake.
- detect and use Windows-supplied curl for `TFLAGS` `-ac` option.
(it's available in modern runners.)
- delete the 3 AppVeyor CI jobs now replicated in GHA.
- appveyor: prefer `SYSTEMROOT` over `WINDIR`.
- tidy-up quotes.
Job performance:
```
AppVeyor GHA
w/examples
w/tests
-------- ----------
CMake, mingw-w64, gcc 6, Debug, x86, Schannel, Static, no-unity 1m25s 8m50s
CMake, mingw-w64, gcc 7, Debug, x64, Schannel, Static, Unicode 31m45s 9m39s
CMake, mingw-w64, gcc 9, Debug, x64, Schannel, Static 28m25s 13m38s
```
Based on these runs:
https://ci.appveyor.com/project/curlorg/curl/builds/49880799
https://github.com/curl/curl/actions/runs/9218292508
Notice that building examples and tests is time consuming.
We can tweak any build parameter as necessary to make them more useful
and/or without clogging the job queue or introducing flakiness.
Closes #13759
2024-05-23 20:54:49 +08:00
|
|
|
openssl_root="$(cygpath "${openssl_root_win}")"
|
2023-12-21 11:59:20 +08:00
|
|
|
|
|
|
|
if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
|
|
|
|
options=''
|
|
|
|
[[ "${TARGET:-}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture'
|
|
|
|
[ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}"
|
2024-05-16 19:49:22 +08:00
|
|
|
[ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}"
|
2023-12-21 11:59:20 +08:00
|
|
|
[ "${PRJ_CFG}" = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
|
|
|
|
[ "${PRJ_CFG}" = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
|
|
|
|
[[ "${PRJ_GEN}" = *'Visual Studio'* ]] && options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false'
|
2024-05-15 14:19:54 +08:00
|
|
|
if [ "${PRJ_GEN}" = 'Visual Studio 9 2008' ]; then
|
2024-05-27 20:33:54 +08:00
|
|
|
[ "${DEBUG}" = 'ON' ] && [ "${SHARED}" = 'ON' ] && SKIP_RUN='Crash on startup in ENABLE_DEBUG=ON shared builds'
|
2024-05-15 14:19:54 +08:00
|
|
|
# Fails to run without this due to missing MSVCR90.dll / MSVCR90D.dll
|
|
|
|
options+=' -DCURL_STATIC_CRT=ON'
|
|
|
|
fi
|
2023-12-21 11:59:20 +08:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
cmake -B _bld "-G${PRJ_GEN}" ${TARGET:-} ${options} \
|
|
|
|
"-DCURL_USE_OPENSSL=${OPENSSL}" \
|
|
|
|
"-DCURL_USE_SCHANNEL=${SCHANNEL}" \
|
|
|
|
"-DHTTP_ONLY=${HTTP_ONLY}" \
|
|
|
|
"-DBUILD_SHARED_LIBS=${SHARED}" \
|
|
|
|
"-DENABLE_WEBSOCKETS=${WEBSOCKETS:-}" \
|
|
|
|
"-DCMAKE_UNITY_BUILD=${UNITY}" \
|
|
|
|
'-DCURL_WERROR=ON' \
|
|
|
|
"-DENABLE_DEBUG=${DEBUG}" \
|
|
|
|
"-DENABLE_UNICODE=${ENABLE_UNICODE}" \
|
2024-05-11 21:34:12 +08:00
|
|
|
'-DCMAKE_INSTALL_PREFIX=C:/curl' \
|
2023-12-21 11:59:20 +08:00
|
|
|
"-DCMAKE_BUILD_TYPE=${PRJ_CFG}"
|
|
|
|
# shellcheck disable=SC2086
|
2024-05-19 16:15:48 +08:00
|
|
|
cmake --build _bld --config "${PRJ_CFG}" --parallel 2 -- ${BUILD_OPT:-}
|
2023-12-21 11:59:20 +08:00
|
|
|
if [ "${SHARED}" = 'ON' ]; then
|
|
|
|
cp -f -p _bld/lib/*.dll _bld/src/
|
|
|
|
fi
|
|
|
|
if [ "${OPENSSL}" = 'ON' ]; then
|
|
|
|
cp -f -p "${openssl_root}"/*.dll _bld/src/
|
|
|
|
fi
|
|
|
|
curl='_bld/src/curl.exe'
|
|
|
|
elif [ "${BUILD_SYSTEM}" = 'VisualStudioSolution' ]; then
|
|
|
|
(
|
|
|
|
cd projects
|
|
|
|
./generate.bat "${VC_VERSION}"
|
2023-12-22 08:26:59 +08:00
|
|
|
msbuild.exe -maxcpucount "-property:Configuration=${PRJ_CFG}" "Windows/${VC_VERSION}/curl-all.sln"
|
2023-12-21 11:59:20 +08:00
|
|
|
)
|
|
|
|
curl="build/Win32/${VC_VERSION}/${PRJ_CFG}/curld.exe"
|
|
|
|
elif [ "${BUILD_SYSTEM}" = 'winbuild_vs2015' ]; then
|
|
|
|
./buildconf.bat
|
|
|
|
(
|
|
|
|
cd winbuild
|
|
|
|
cat << EOF > _make.bat
|
|
|
|
call "C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/SetEnv.cmd" /x64
|
|
|
|
call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x86_amd64
|
|
|
|
nmake -f Makefile.vc mode=dll VC=14 "SSL_PATH=${openssl_root_win}" WITH_SSL=dll MACHINE=x64 DEBUG=${DEBUG} ENABLE_UNICODE=${ENABLE_UNICODE}
|
|
|
|
EOF
|
|
|
|
./_make.bat
|
|
|
|
rm _make.bat
|
|
|
|
)
|
|
|
|
curl="builds/libcurl-vc14-x64-${PATHPART}-dll-ssl-dll-ipv6-sspi/bin/curl.exe"
|
|
|
|
elif [ "${BUILD_SYSTEM}" = 'winbuild_vs2017' ]; then
|
|
|
|
./buildconf.bat
|
|
|
|
(
|
|
|
|
cd winbuild
|
|
|
|
cat << EOF > _make.bat
|
|
|
|
call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars64.bat"
|
2024-05-01 16:20:58 +08:00
|
|
|
nmake -f Makefile.vc mode=dll VC=14.10 "SSL_PATH=${openssl_root_win}" WITH_SSL=dll MACHINE=x64 DEBUG=${DEBUG} ENABLE_UNICODE=${ENABLE_UNICODE} ENABLE_WEBSOCKETS=yes
|
2023-12-21 11:59:20 +08:00
|
|
|
EOF
|
|
|
|
./_make.bat
|
|
|
|
rm _make.bat
|
|
|
|
)
|
|
|
|
curl="builds/libcurl-vc14.10-x64-${PATHPART}-dll-ssl-dll-ipv6-sspi/bin/curl.exe"
|
|
|
|
fi
|
|
|
|
|
|
|
|
find . -name '*.exe' -o -name '*.dll'
|
|
|
|
if [ -z "${SKIP_RUN:-}" ]; then
|
2024-05-13 06:34:54 +08:00
|
|
|
"${curl}" --disable --version
|
2023-12-21 11:59:20 +08:00
|
|
|
else
|
|
|
|
echo "Skip running curl.exe. Reason: ${SKIP_RUN}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if false; then
|
|
|
|
for log in CMakeFiles/CMakeConfigureLog.yaml CMakeFiles/CMakeOutput.log CMakeFiles/CMakeError.log; do
|
|
|
|
[ -r "_bld/${log}" ] && cat "_bld/${log}"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2024-05-28 00:48:32 +08:00
|
|
|
# build tests
|
2023-12-21 11:59:20 +08:00
|
|
|
|
2024-05-28 00:48:32 +08:00
|
|
|
if [[ "${TFLAGS}" != 'skipall' ]] && \
|
|
|
|
[ "${BUILD_SYSTEM}" = 'CMake' ]; then
|
|
|
|
cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target testdeps
|
|
|
|
fi
|
|
|
|
|
|
|
|
# run tests
|
|
|
|
|
|
|
|
if [[ "${TFLAGS}" != 'skipall' ]] && \
|
|
|
|
[[ "${TFLAGS}" != 'skiprun' ]]; then
|
GHA: add three old (gcc 6, 7, 9) mingw-w64 jobs
Re-implement old mingw-w64 jobs in GHA. This allows to use the latest
Windows runners, replacing Windows Server 2012 R2 (gcc 6) and Windows
Server 2016 (gcc 7, 9) with Windows Server 2022.
GHA runners are also significantly faster, and allow running tests in
parallel (`-j14`). It also offloads 3 more long-running jobs from
AppVeyor CI.
These jobs download (then cache) the mingw-w64 packages from their
original location, which allows flexibility in choosing which versions
and flavours (win32/POSIX, SEH/DWARF, 64/32-bit) we want to test in CI.
The new jobs use these distros:
- https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/ (for gcc 7, same as on AppVeyor)
- https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/ (for gcc 6, same as on AppVeyor)
- https://winlibs.com/ (for gcc 9)
I matched existing AppVeyor job configs, with these differences:
- gcc 6.4.0 instead of 6.3.0.
(same distro as on AppVeyor, but the latest bugfix release)
- gcc 9.5.0 instead of 9.1.0 and a different (but compatible) binary distro.
(in AppVeyor this relies on an old MSYS2 pre-installed on the runner)
- using win32 builds instead of posix for gcc 6.4.0 and 7.3.0.
- websockets enabled.
- always build examples.
- always build tests (this wasn't done for 6.4.0 with AppVeyor CI).
I did not replicate existing test exclusions, and oddly enough the few
failures (so far) were different from MSYS2 jobs and also from their
AppVeyor CI counterparts.
Also:
- delete redundant (default) `-u` option from `cygpath` calls.
- allow matrix options to override default ones in CMake.
- detect and use Windows-supplied curl for `TFLAGS` `-ac` option.
(it's available in modern runners.)
- delete the 3 AppVeyor CI jobs now replicated in GHA.
- appveyor: prefer `SYSTEMROOT` over `WINDIR`.
- tidy-up quotes.
Job performance:
```
AppVeyor GHA
w/examples
w/tests
-------- ----------
CMake, mingw-w64, gcc 6, Debug, x86, Schannel, Static, no-unity 1m25s 8m50s
CMake, mingw-w64, gcc 7, Debug, x64, Schannel, Static, Unicode 31m45s 9m39s
CMake, mingw-w64, gcc 9, Debug, x64, Schannel, Static 28m25s 13m38s
```
Based on these runs:
https://ci.appveyor.com/project/curlorg/curl/builds/49880799
https://github.com/curl/curl/actions/runs/9218292508
Notice that building examples and tests is time consuming.
We can tweak any build parameter as necessary to make them more useful
and/or without clogging the job queue or introducing flakiness.
Closes #13759
2024-05-23 20:54:49 +08:00
|
|
|
if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
|
|
|
|
TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
|
|
|
|
elif [ -x "$(cygpath 'C:/msys64/usr/bin/curl.exe')" ]; then
|
|
|
|
TFLAGS+=" -ac $(cygpath 'C:/msys64/usr/bin/curl.exe')"
|
2023-12-22 08:26:59 +08:00
|
|
|
fi
|
2023-12-21 11:59:20 +08:00
|
|
|
if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
|
|
|
|
ls _bld/lib/*.dll >/dev/null 2>&1 && cp -f -p _bld/lib/*.dll _bld/tests/libtest/
|
2023-12-22 08:26:59 +08:00
|
|
|
cmake --build _bld --config "${PRJ_CFG}" --target test-ci
|
2023-12-21 11:59:20 +08:00
|
|
|
else
|
|
|
|
(
|
2023-12-22 08:26:59 +08:00
|
|
|
TFLAGS="-a -p !flaky -r -rm ${TFLAGS}"
|
2023-12-21 11:59:20 +08:00
|
|
|
cd _bld/tests
|
2023-12-22 08:26:59 +08:00
|
|
|
./runtests.pl
|
2023-12-21 11:59:20 +08:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
fi
|