build(deps): migrate from curl to curl-winssl on Windows (#3246)

This commit is contained in:
ReenigneArcher
2024-10-01 20:02:14 -04:00
committed by GitHub
parent fa654c12ef
commit 9cc8bc8f62
4 changed files with 26 additions and 39 deletions

View File

@@ -2,18 +2,10 @@
set -e set -e
# update pacman # update pacman
pacman --noconfirm -Suy pacman --noconfirm -Syu
# install wget
pacman --noconfirm -S \
wget
# download working curl
wget https://repo.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst
# install dependencies # install dependencies
pacman -U --noconfirm mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst pacman -S --noconfirm \
pacman -Syu --noconfirm --ignore=mingw-w64-ucrt-x86_64-curl \
base-devel \ base-devel \
diffutils \ diffutils \
gcc \ gcc \
@@ -21,6 +13,7 @@ pacman -Syu --noconfirm --ignore=mingw-w64-ucrt-x86_64-curl \
make \ make \
mingw-w64-ucrt-x86_64-cmake \ mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-cppwinrt \ mingw-w64-ucrt-x86_64-cppwinrt \
mingw-w64-ucrt-x86_64-curl-winssl \
mingw-w64-ucrt-x86_64-graphviz \ mingw-w64-ucrt-x86_64-graphviz \
mingw-w64-ucrt-x86_64-miniupnpc \ mingw-w64-ucrt-x86_64-miniupnpc \
mingw-w64-ucrt-x86_64-nlohmann-json \ mingw-w64-ucrt-x86_64-nlohmann-json \

View File

@@ -1019,30 +1019,20 @@ jobs:
msystem: ucrt64 msystem: ucrt64
update: true update: true
install: >- install: >-
wget git
mingw-w64-ucrt-x86_64-cmake
- name: Update Windows dependencies mingw-w64-ucrt-x86_64-cppwinrt
shell: msys2 {0} mingw-w64-ucrt-x86_64-curl-winssl
run: | mingw-w64-ucrt-x86_64-graphviz
# download working curl mingw-w64-ucrt-x86_64-miniupnpc
wget https://repo.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst mingw-w64-ucrt-x86_64-nlohmann-json
mingw-w64-ucrt-x86_64-nodejs
# install dependencies mingw-w64-ucrt-x86_64-nsis
pacman -U --noconfirm mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst mingw-w64-ucrt-x86_64-onevpl
pacman -Syu --noconfirm \ mingw-w64-ucrt-x86_64-openssl
--ignore=mingw-w64-ucrt-x86_64-curl \ mingw-w64-ucrt-x86_64-opus
git \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-cppwinrt \
mingw-w64-ucrt-x86_64-graphviz \
mingw-w64-ucrt-x86_64-miniupnpc \
mingw-w64-ucrt-x86_64-nlohmann-json \
mingw-w64-ucrt-x86_64-nodejs \
mingw-w64-ucrt-x86_64-nsis \
mingw-w64-ucrt-x86_64-onevpl \
mingw-w64-ucrt-x86_64-openssl \
mingw-w64-ucrt-x86_64-opus \
mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-toolchain
wget
- name: Install Doxygen - name: Install Doxygen
# GCC compiled doxygen has issues when running graphviz # GCC compiled doxygen has issues when running graphviz

View File

@@ -86,7 +86,7 @@ dependencies=(
"mingw-w64-ucrt-x86_64-boost" # Optional "mingw-w64-ucrt-x86_64-boost" # Optional
"mingw-w64-ucrt-x86_64-cmake" "mingw-w64-ucrt-x86_64-cmake"
"mingw-w64-ucrt-x86_64-cppwinrt" "mingw-w64-ucrt-x86_64-cppwinrt"
"mingw-w64-ucrt-x86_64-curl" "mingw-w64-ucrt-x86_64-curl-winssl"
"mingw-w64-ucrt-x86_64-graphviz" # Optional, for docs "mingw-w64-ucrt-x86_64-graphviz" # Optional, for docs
"mingw-w64-ucrt-x86_64-miniupnpc" "mingw-w64-ucrt-x86_64-miniupnpc"
"mingw-w64-ucrt-x86_64-nlohmann-json" "mingw-w64-ucrt-x86_64-nlohmann-json"

View File

@@ -196,7 +196,12 @@ namespace http {
bool bool
download_file(const std::string &url, const std::string &file) { download_file(const std::string &url, const std::string &file) {
CURL *curl = curl_easy_init(); CURL *curl = curl_easy_init();
if (!curl) { if (curl) {
// sonar complains about weak ssl and tls versions
// ideally, the setopts should go after the early returns; however sonar cannot detect the fix
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
}
else {
BOOST_LOG(error) << "Couldn't create CURL instance"; BOOST_LOG(error) << "Couldn't create CURL instance";
return false; return false;
} }
@@ -214,17 +219,16 @@ namespace http {
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
return false; return false;
} }
curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
#ifdef _WIN32
curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
#endif
CURLcode result = curl_easy_perform(curl); CURLcode result = curl_easy_perform(curl);
if (result != CURLE_OK) { if (result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']'; BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';
} }
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
fclose(fp); fclose(fp);
return result == CURLE_OK; return result == CURLE_OK;