Do *not* use pthread, because the Mingw-w64 implementation (libwinpthread) depends on GetTickCount64() function in KERNEL32.DLL, which is not available in Windows XP.

Also patch cURL to *not* use InitializeCriticalSectionEx() function, for the same reason.
This commit is contained in:
LoRd_MuldeR 2021-06-08 01:03:15 +02:00
parent 888399eb1b
commit 3d812d4728
2 changed files with 27 additions and 1 deletions

View File

@ -1,4 +1,10 @@
#!/bin/bash #!/bin/bash
# _ _ ____ _
# ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
set -e set -e
readonly MY_MARCH=i386 readonly MY_MARCH=i386
@ -90,7 +96,8 @@ pkg_curl="$(find "${DEPS_DIR}" -maxdepth 1 -name 'curl-*.tar.gz' | sort -rn | he
rm -rf "${CURL_DIR}" && mkdir "${CURL_DIR}" rm -rf "${CURL_DIR}" && mkdir "${CURL_DIR}"
tar -xvf ${pkg_curl} --strip-components=1 -C "${CURL_DIR}" tar -xvf ${pkg_curl} --strip-components=1 -C "${CURL_DIR}"
pushd "${CURL_DIR}" pushd "${CURL_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I\"${DEPS_DIR}/include\"" LDFLAGS="-static -L\"${DEPS_DIR}/lib\"" LIBS="-latomic -lcrypt32" ./configure --disable-shared --enable-static --disable-ldap --with-zlib="${DEPS_DIR}" --with-zstd="${DEPS_DIR}" --with-brotli="${DEPS_DIR}" --with-openssl="${DEPS_DIR}" --with-ca-bundle="cacert.pem" patch -p1 -b < "${BASE_DIR}/patch/curl_mutex_init.diff"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I\"${DEPS_DIR}/include\"" LDFLAGS="-static -no-pthread -L\"${DEPS_DIR}/lib\"" LIBS="-latomic -lcrypt32" ./configure --disable-shared --disable-pthreads --enable-static --disable-ldap --with-zlib="${DEPS_DIR}" --with-zstd="${DEPS_DIR}" --with-brotli="${DEPS_DIR}" --with-openssl="${DEPS_DIR}" --with-ca-bundle="cacert.pem"
make curl_LDFLAGS=-all-static make curl_LDFLAGS=-all-static
cp -vf "${CURL_DIR}/src/curl.exe" "${BASE_DIR}/curl.exe" cp -vf "${CURL_DIR}/src/curl.exe" "${BASE_DIR}/curl.exe"
cp -vf "${DEPS_DIR}/cacert.pem" "${BASE_DIR}/cacert.pem" cp -vf "${DEPS_DIR}/cacert.pem" "${BASE_DIR}/cacert.pem"

View File

@ -0,0 +1,19 @@
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h.old" "b/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h"
index e10b7a1..22fdb49 100644
--- "a/lib/curl_threads.h"
+++ "b/lib/curl_threads.h"
@@ -37,13 +37,7 @@
# define curl_mutex_t CRITICAL_SECTION
# define curl_thread_t HANDLE
# define curl_thread_t_null (HANDLE)0
-# if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
- (_WIN32_WINNT < _WIN32_WINNT_VISTA) || \
- (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
-# define Curl_mutex_init(m) InitializeCriticalSection(m)
-# else
-# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)
-# endif
+# define Curl_mutex_init(m) InitializeCriticalSection(m)
# define Curl_mutex_acquire(m) EnterCriticalSection(m)
# define Curl_mutex_release(m) LeaveCriticalSection(m)
# define Curl_mutex_destroy(m) DeleteCriticalSection(m)