Skip to content

Commit

Permalink
Update curl on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ensiform committed Nov 13, 2023
1 parent eac0617 commit d8cf6ca
Show file tree
Hide file tree
Showing 25 changed files with 2,223 additions and 1,030 deletions.
18 changes: 17 additions & 1 deletion src/client/cl_curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,18 @@ static int Com_DL_CallbackProgress( void *data, curl_off_t dltotal, curl_off_t d
static int Com_DL_CallbackProgress( void *data, double dltotal, double dlnow, double ultotal, double ulnow )
#endif
{
double percentage;
#if CURL_AT_LEAST_VERSION(7, 55, 0)
curl_off_t speed;
#else
double speed;
#endif

#if CURL_AT_LEAST_VERSION(7, 32, 0)
curl_off_t percentage;
#else
double percentage;
#endif

download_t *dl = (download_t *)data;

dl->Size = (int)dltotal;
Expand All @@ -354,7 +360,11 @@ static int Com_DL_CallbackProgress( void *data, double dltotal, double dlnow, do
}

if ( dl->Size ) {
#if CURL_AT_LEAST_VERSION(7, 32, 0)
percentage = ( dlnow * 100 ) / dltotal;
#else
percentage = ( dlnow / dltotal ) * 100.0;
#endif
sprintf( dl->progress, " downloading %s: %s (%i%%)", dl->Name, sizeToString( dl->Count ), (int)percentage );
} else {
sprintf( dl->progress, " downloading %s: %s", dl->Name, sizeToString( dl->Count ) );
Expand Down Expand Up @@ -618,7 +628,10 @@ qboolean Com_DL_Begin( download_t *dl, const char *localName, const char *remote
#else
dl->func.easy_setopt( dl->cURL, CURLOPT_PROTOCOLS, ALLOWED_PROTOCOLS );
#endif

#ifdef CURL_MAX_READ_SIZE
dl->func.easy_setopt( dl->cURL, CURLOPT_BUFFERSIZE, CURL_MAX_READ_SIZE );
#endif

dl->cURLM = dl->func.multi_init();

Expand Down Expand Up @@ -1065,7 +1078,10 @@ int DL_BeginDownload( const char *localName, const char *remoteName, int debug )
#else
dl_curl_easy_setopt( dl_request, CURLOPT_PROTOCOLS, ALLOWED_PROTOCOLS );
#endif

#ifdef CURL_MAX_READ_SIZE
dl_curl_easy_setopt( dl_request, CURLOPT_BUFFERSIZE, CURL_MAX_READ_SIZE );
#endif

if ( dl_curl_multi_add_handle( dl_multi, dl_request ) != CURLM_OK ) {
Com_Printf( S_COLOR_RED "ERROR: DL_BeginDownload: multi_add_handle() failed\n" );
Expand Down
15 changes: 15 additions & 0 deletions src/libcurl/conf751.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Script used to compile static curl libraries for mingw
# We intending to support HTTP HTTPS protocols only

./configure --prefix=/lib32 --with-winssl --disable-rt --disable-pthreads --disable-curldebug --disable-ares --disable-ech --disable-largefile --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-alt-svc --disable-websockets --disable-shared --enable-symbol-hiding --disable-versioned-symbols
make -j32
make install
make clean

./configure --prefix=/lib64 --host=x86_64-w64-mingw32 --with-winssl --disable-rt --disable-pthreads --disable-curldebug --disable-ares --disable-ech --disable-largefile --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-alt-svc --disable-websockets --disable-shared --enable-symbol-hiding --disable-versioned-symbols
make -j32
make install
make clean

16 changes: 16 additions & 0 deletions src/libcurl/conf840.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# Script used to compile static curl libraries for mingw
# We intending to support HTTP HTTPS protocols only

OPTIONS="--disable-shared --disable-debug --enable-optimize --disable-curldebug --enable-symbol-hiding --disable-ares --disable-rt --disable-ech --disable-largefile --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-pthreads --disable-ntlm --disable-ntlm-wb --disable-unix-sockets --disable-alt-svc --disable-cookies --disable-socketpair --disable-doh --disable-websockets --disable-file --with-schannel --without-libidn2 --without-librtmp"

make distclean
./configure --prefix=/q3e-lib32 ${OPTIONS}
make -j32 CFLAGS='-O2 -march=i586 -mtune=i686'
make install

make distclean
./configure --prefix=/q3e-lib64 --host=x86_64-w64-mingw32 ${OPTIONS}
make -j32
make install
Loading

0 comments on commit d8cf6ca

Please sign in to comment.