This commit is contained in:
LoRd_MuldeR 2021-06-09 17:54:39 +02:00
parent c9e590e806
commit 4e4a8be21e
4 changed files with 52 additions and 20 deletions

View File

@ -166,9 +166,9 @@ pushd "${CURL_DIR}"
patch -p1 -b < "${BASE_DIR}/patch/curl_findw32cacert.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_mutex_init.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_parseconfig.diff"
cp -vf "${LIBS_DIR}/cacert.pem" ca-bundle.pem
sed -i -E 's/\bint[[:space:]]*main[[:space:]]*\(/int wmain(/g' configure
CFLAGS="-municode -mconsole -march=${MY_MARCH} -mtune=${MY_MTUNE} -I\"${LIBS_DIR}/include\"" CPPFLAGS="-DNGHTTP2_STATICLIB" LDFLAGS="-static -no-pthread -L\"${LIBS_DIR}/lib\"" LIBS="-latomic -liconv -lcrypt32" PKG_CONFIG_PATH="${LIBS_DIR}/pkgconfig" ./configure --enable-static --disable-shared --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib="${LIBS_DIR}" --with-zstd="${LIBS_DIR}" --with-brotli="${LIBS_DIR}" --with-openssl="${LIBS_DIR}" --with-libssh2="${LIBS_DIR}" --with-nghttp2="${LIBS_DIR}" --with-libidn2="${LIBS_DIR}" --with-ca-bundle="ca-bundle.pem"
cp -vf "${LIBS_DIR}/cacert.pem" curl-ca-bundle.crt
sed -i -E 's/\bmain[[:space:]]*\(([^\(\)]*)\)/wmain(\1)/g' configure
CFLAGS="-municode -mconsole -march=${MY_MARCH} -mtune=${MY_MTUNE} -I\"${LIBS_DIR}/include\"" CPPFLAGS="-DNGHTTP2_STATICLIB" LDFLAGS="-static -no-pthread -L\"${LIBS_DIR}/lib\"" LIBS="-latomic -liconv -lcrypt32" PKG_CONFIG_PATH="${LIBS_DIR}/pkgconfig" ./configure --enable-static --disable-shared --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib="${LIBS_DIR}" --with-zstd="${LIBS_DIR}" --with-brotli="${LIBS_DIR}" --with-openssl="${LIBS_DIR}" --with-libssh2="${LIBS_DIR}" --with-nghttp2="${LIBS_DIR}" --with-libidn2="${LIBS_DIR}" --with-ca-bundle="curl-ca-bundle.crt"
make curl_LDFLAGS=-all-static
strip -s src/curl.exe
popd
@ -181,7 +181,7 @@ readonly OUT_DIR="${BASE_DIR}/.bin"
rm -rf "${OUT_DIR}" && mkdir "${OUT_DIR}"
pushd "${OUT_DIR}"
cp -vf "${CURL_DIR}/src/curl.exe" curl.exe
cp -vf "${LIBS_DIR}/cacert.pem" ca-bundle.pem
cp -vf "${LIBS_DIR}/cacert.pem" curl-ca-bundle.crt
cp -vf "${LIBS_DIR}/manpage.html" manpage.html
mkdir -p "${OUT_DIR}/legal"
unix2dos -n "${CURL_DIR}/COPYING" legal/curl.COPYING.txt

View File

@ -1,17 +1,49 @@
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_operate.c.ori" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_operate.c"
index cd61316..1431913 100644
--- "a/src/tool_operate.c"
+++ "b/src/tool_operate.c"
@@ -2514,12 +2514,6 @@ static CURLcode transfer_per_config(struct GlobalConfig *global,
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c"
index 98e13bc..34d6496 100644
--- "a/src/tool_doswin.c"
+++ "b/src/tool_doswin.c"
@@ -627,22 +627,32 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
if((curlinfo->features & CURL_VERSION_SSL) &&
backend != CURLSSLBACKEND_SCHANNEL) {
if(env)
curl_free(env);
-#ifdef WIN32
- else {
- result = FindWin32CACert(config, tls_backend_info->backend,
- TEXT("curl-ca-bundle.crt"));
- }
-#endif
- DWORD res_len;
- TCHAR buf[PATH_MAX];
- TCHAR *ptr = NULL;
-
- buf[0] = TEXT('\0');
-
- res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr);
- if(res_len > 0) {
- Curl_safefree(config->cacert);
+ static const size_t BUFFSIZE = 512;
+ TCHAR filebuffer[BUFFSIZE];
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
+ if(len > 0 && len < BUFFSIZE) {
#ifdef UNICODE
- config->cacert = curlx_convert_wchar_to_UTF8(buf);
+ char *bundle_name = curlx_convert_wchar_to_UTF8(bundle_file);
+ char *module_path = curlx_convert_wchar_to_UTF8(filebuffer);
#else
- config->cacert = strdup(buf);
+ char *bundle_name = strdup(bundle_file);
+ char *module_path = strdup(filebuffer);
#endif
- if(!config->cacert)
+ if (module_path && bundle_name) {
+ char *lastdirchar = strrchr(module_path, '\\');
+ if(lastdirchar) {
+ *lastdirchar = '\0';
+ }
+ Curl_safefree(config->cacert);
+ config->cacert = curl_maprintf("%s%s%s", module_path, DIR_CHAR, bundle_name);
+ if(!config->cacert)
+ result = CURLE_OUT_OF_MEMORY;
+ }
+ else
result = CURLE_OUT_OF_MEMORY;
+
+ free(bundle_name);
+ free(module_path);
}
curl_easy_cleanup(curltls);
}

View File

@ -1,4 +1,4 @@
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h.old" "b/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h"
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h" "b/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h"
index e10b7a1..22fdb49 100644
--- "a/lib/curl_threads.h"
+++ "b/lib/curl_threads.h"

View File

@ -1,4 +1,4 @@
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c.orig" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c"
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c"
index d26774f..e0b97c1 100644
--- "a/src/tool_parsecfg.c"
+++ "b/src/tool_parsecfg.c"