Skip to content

Commit f50c2ba

Browse files
committed
build curl with schannel on windows
1 parent 8c90a3d commit f50c2ba

File tree

5 files changed

+40
-57
lines changed

5 files changed

+40
-57
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if (SPPLICE_TARGET_WINDOWS) # If building for Windows:
8585
target_link_libraries(SppliceCPP
8686
"archive.dll"
8787
"liblzma.dll"
88-
"libcurl-x64.dll"
88+
"libcurl-4.dll"
8989
"libwininet.a"
9090
"libws2_32.a"
9191
)

autobuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ cd dist
8989
# Prepare the Windows binary for distribution.
9090
if [ "$target_windows" == true ] || [ "$target_both" == true ]; then
9191
# Copy project dependencies
92-
cp ../deps/win32/lib/libcurl-x64.dll ./win32
92+
cp ../deps/win32/lib/libcurl-4.dll ./win32
9393
cp ../deps/win32/lib/archive.dll ./win32
9494
cp ../deps/win32/lib/liblzma.dll ./win32
9595
cp ../deps/win32/lib/libcrypto-1_1-x64.dll ./win32

deps.sh

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22
# On the Windows side, most of this is just unzipping and sorting pre-built binaries
33
# On the Linux side, we're only compiling CURL and installing Debian packages
44

5+
if command -v apt > /dev/null; then
6+
7+
echo "Checking for necessary -dev packages..."
8+
sudo apt install \
9+
libarchive-dev \
10+
libxml2-dev \
11+
liblzma-dev \
12+
libacl1-dev \
13+
libgl1-mesa-dev \
14+
libxcb*-dev \
15+
libfontconfig1-dev \
16+
libxkbcommon-x11-dev \
17+
libnghttp2-dev \
18+
libidn2-dev
19+
20+
echo "Checking for MinGW for cross-compilation..."
21+
sudo apt install \
22+
mingw-w64 \
23+
mingw-w64-tools \
24+
gcc-mingw-w64-x86-64 \
25+
g++-mingw-w64-x86-64
26+
27+
echo "Switching to POSIX threads..."
28+
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
29+
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
30+
31+
fi
32+
533
rm -rf ./deps
634
mkdir deps
735
cd deps
@@ -57,12 +85,14 @@ mkdir shared
5785
cd ..; rm -rf openssl
5886

5987
mkdir curl; cd curl
60-
wget https://curl.se/windows/dl-8.10.1_2/curl-8.10.1_2-win64-mingw.zip
61-
unzip curl-8.10.1_2-win64-mingw.zip
62-
mv curl-8.10.1_2-win64-mingw curl
63-
mv ./curl/bin/*.exe ../bin
64-
mv ./curl/bin/*.dll ../lib
65-
mv ./curl/lib/* ../lib
88+
wget https://curl.se/download/curl-8.10.1.zip
89+
unzip curl-8.10.1.zip
90+
mv curl-8.10.1 curl; cd curl
91+
./configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-sysroot=/usr/x86_64-w64-mingw32 --enable-optimize --with-schannel --disable-dependency-tracking --disable-static --enable-shared --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-docs --disable-sspi --disable-aws --disable-ntlm --disable-unix-sockets --disable-socketpair --disable-dateparse --disable-progress-meter --enable-websockets --without-brotli --without-libssh2 --without-libssh --without-wolfssh --without-librtmp --without-libpsl
92+
make
93+
cd ..
94+
mv ./curl/src/curl.exe ../bin
95+
mv ./curl/lib/.libs/libcurl-4.dll ../lib
6696
mv ./curl/include/* ../include
6797
cd ..; rm -rf curl
6898

@@ -79,7 +109,7 @@ mkdir shared
79109
wget https://curl.se/download/curl-8.10.1.zip
80110
unzip curl-8.10.1.zip
81111
mv curl-8.10.1 curl; cd curl
82-
./configure --enable-optimize --with-openssl --disable-dependency-tracking --disable-shared --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-docs --disable-sspi --disable-aws --disable-ntlm --disable-unix-sockets --disable-socketpair --disable-dateparse --disable-progress-meter --enable-websockets --without-brotli --without-libssh2 --without-libssh --without-wolfssh --without-librtmp
112+
./configure --enable-optimize --with-openssl --disable-dependency-tracking --disable-shared --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-docs --disable-sspi --disable-aws --disable-ntlm --disable-unix-sockets --disable-socketpair --disable-dateparse --disable-progress-meter --enable-websockets --without-brotli --without-libssh2 --without-libssh --without-wolfssh --without-librtmp --without-libpsl
83113
make
84114
cd ..
85115
mv ./curl/src/curl ../bin
@@ -88,32 +118,3 @@ mkdir shared
88118
cd ..; rm -rf curl
89119

90120
cd ..
91-
92-
if command -v apt > /dev/null; then
93-
94-
echo "Checking for necessary -dev packages..."
95-
sudo apt install \
96-
libarchive-dev \
97-
libxml2-dev \
98-
liblzma-dev \
99-
libacl1-dev \
100-
libgl1-mesa-dev \
101-
libxcb*-dev \
102-
libfontconfig1-dev \
103-
libxkbcommon-x11-dev \
104-
libpsl-dev \
105-
libnghttp2-dev \
106-
libidn2-dev
107-
108-
echo "Checking for MinGW for cross-compilation..."
109-
sudo apt install \
110-
mingw-w64 \
111-
mingw-w64-tools \
112-
gcc-mingw-w64-x86-64 \
113-
g++-mingw-w64-x86-64
114-
115-
echo "Switching to POSIX threads..."
116-
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
117-
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
118-
119-
fi

setup/setup.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
5252
Source: "..\dist\win32\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
5353
Source: "..\dist\win32\archive.dll"; DestDir: "{app}"; Flags: ignoreversion
5454
Source: "..\dist\win32\libcrypto-1_1-x64.dll"; DestDir: "{app}"; Flags: ignoreversion
55-
Source: "..\dist\win32\libcurl-x64.dll"; DestDir: "{app}"; Flags: ignoreversion
55+
Source: "..\dist\win32\libcurl-4.dll"; DestDir: "{app}"; Flags: ignoreversion
5656
Source: "..\dist\win32\libgcc_s_seh-1.dll"; DestDir: "{app}"; Flags: ignoreversion
5757
Source: "..\dist\win32\liblzma.dll"; DestDir: "{app}"; Flags: ignoreversion
5858
Source: "..\dist\win32\libstdc++-6.dll"; DestDir: "{app}"; Flags: ignoreversion

tools/curl.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ bool ToolsCURL::downloadFile (const std::string &url, const std::filesystem::pat
6161
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ofs);
6262
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
6363

64-
#ifdef TARGET_WINDOWS
65-
// TODO: Build CURL with Schannel on Windows
66-
// This should *NOT* be here in the final release
67-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
68-
#endif
69-
7064
CURLcode response = curl_easy_perform(curl);
7165

7266
// Clean up CURL
@@ -100,12 +94,6 @@ std::string ToolsCURL::downloadString (const std::string &url) {
10094
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
10195
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
10296

103-
#ifdef TARGET_WINDOWS
104-
// TODO: Build CURL with Schannel on Windows
105-
// This should *NOT* be here in the final release
106-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
107-
#endif
108-
10997
// Perform the request
11098
CURLcode response = curl_easy_perform(curl);
11199

@@ -136,12 +124,6 @@ CURL* ToolsCURL::wsConnect (const std::string &url) {
136124
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
137125
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L);
138126

139-
#ifdef TARGET_WINDOWS
140-
// TODO: Build CURL with Schannel on Windows
141-
// This should *NOT* be here in the final release
142-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
143-
#endif
144-
145127
// Perform the request
146128
CURLcode response = curl_easy_perform(curl);
147129

0 commit comments

Comments
 (0)