forked from lwthiker/curl-impersonate
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Windows support * Use windows-latest runner
- Loading branch information
Showing
6 changed files
with
220 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,33 +2,35 @@ name: Build for windows | |
on: | ||
push: | ||
branches: | ||
- disabled # only temporary | ||
# - main | ||
# - feature/* | ||
# - bugfix/* | ||
- main | ||
- feature/* | ||
- bugfix/* | ||
tags: | ||
- disabled | ||
# - "v*.*.*" | ||
- "v*.*.*" | ||
pull_request: | ||
branches: | ||
- disabled | ||
# - main | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
BORING_SSL_COMMIT: d24a38200fef19150eef00cad35b138936c08767 | ||
ZLIB_COMMIT: 09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851 | ||
ZSTD_COMMIT: 794ea1b0afca0f020f4e57b6732332231fb23c70 | ||
BROTLI_COMMIT: ed738e842d2fbdf2d6459e39267a633c4a9b2f5d | ||
BORINGSSL_COMMIT: cd95210465496ac2337b313cf49f607762abe286 | ||
CURL_COMMIT: de7b3e89218467159a7af72d58cea8425946e97d | ||
NGHTTP2_COMMIT: 8f44147c385fb1ed93a6f39911eeb30279bfd2dd | ||
|
||
jobs: | ||
build-windows: | ||
name: Build windows binaries | ||
runs-on: windows-2019 | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- { sys: mingw64, env: x86_64 } | ||
- { sys: mingw32, env: i686 } | ||
- { sys: vcvars64, env: x86_64 } | ||
- { sys: vcvars32, env: i686 } | ||
steps: | ||
- name: configure Pagefile | ||
uses: al-cheb/[email protected] | ||
|
@@ -45,46 +47,29 @@ jobs: | |
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- uses: msys2/setup-msys2@v2 | ||
name: Install msys | ||
with: | ||
update: true | ||
msystem: ${{ matrix.sys }} | ||
install: >- | ||
git | ||
patch | ||
unzip | ||
mingw-w64-${{ matrix.env }}-brotli | ||
mingw-w64-${{ matrix.env }}-libidn2 | ||
mingw-w64-${{ matrix.env }}-zstd | ||
mingw-w64-${{ matrix.env }}-nghttp2 | ||
mingw-w64-${{ matrix.env }}-zlib | ||
mingw-w64-${{ matrix.env }}-make | ||
mingw-w64-${{ matrix.env }}-cmake | ||
mingw-w64-${{ matrix.env }}-nasm | ||
mingw-w64-${{ matrix.env }}-gcc | ||
mingw-w64-${{ matrix.env }}-go | ||
mingw-w64-${{ matrix.env }}-libuv | ||
- name: Install NASM | ||
shell: cmd | ||
run: choco install nasm -y | ||
|
||
- name: Copy and patch | ||
shell: msys2 {0} | ||
run: ./win/build.sh ${{ matrix.sys }} | ||
- name: Fetch and patch deps | ||
shell: bash | ||
run: ./win/deps.sh | ||
|
||
# - name: Setup tmate session for debugging | ||
# uses: mxschmitt/action-tmate@v3 | ||
# | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Generate lib files | ||
run: ./win/dll2lib.bat ${{ matrix.env }} build\dist\libcurl.dll | ||
- name: Build | ||
shell: cmd | ||
run: ./win/build.bat ${{ matrix.sys }} | ||
|
||
- name: Build tarball | ||
shell: msys2 {0} | ||
shell: bash | ||
run: | | ||
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then | ||
tar cvzf libcurl-impersonate-${{ github.head_ref || github.ref_name }}.${{ matrix.env }}-win32.tar.gz -C ./build/dist . | ||
tar cvzf libcurl-impersonate-${{ github.head_ref || github.ref_name }}.${{ matrix.env }}-win32.tar.gz -C ./packages . | ||
else | ||
tar cvzf libcurl-impersonate-${{ matrix.env }}-win32.tar.gz -C ./build/dist . | ||
tar cvzf libcurl-impersonate-${{ matrix.env }}-win32.tar.gz -C ./packages . | ||
fi | ||
- name: Upload artifacts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
@echo off | ||
|
||
set "PATH=%PATH:LLVM=Dummy%" | ||
|
||
IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\%1.bat" ( | ||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\%1.bat" | ||
) ELSE ( | ||
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\%1.bat" | ||
) | ||
|
||
:: common dirs | ||
set deps=%cd%\deps | ||
set build=%cd%\build | ||
set packages=%cd%\packages | ||
|
||
:: configuration | ||
set configuration=Release | ||
|
||
set cmake_common_args=-GNinja -DCMAKE_BUILD_TYPE=%configuration%^ | ||
-DCMAKE_PREFIX_PATH="%packages%" -DCMAKE_INSTALL_PREFIX="%packages%"^ | ||
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded^ | ||
-DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DCMAKE_LINKER=link.exe | ||
|
||
:: Build & Install zlib | ||
pushd "%deps%\zlib" | ||
cmake %cmake_common_args% -S . -B "%build%\zlib" | ||
cmake --build "%build%\zlib" --config %configuration% --target install | ||
move /y "%packages%\lib\zlibstatic.lib" "%packages%\lib\zlib.lib" | ||
popd | ||
|
||
:: Build & Install zstd | ||
pushd "%deps%\zstd" | ||
cmake %cmake_common_args% -DZSTD_BUILD_SHARED=OFF -S build\cmake -B "%build%\zstd" | ||
cmake --build "%build%\zstd" --config %configuration% --target install | ||
ren "%packages%\lib\zstd_static.lib" zstd.lib | ||
popd | ||
|
||
:: Build & Install brotli | ||
pushd "%deps%\brotli" | ||
cmake %cmake_common_args% -DBUILD_SHARED_LIBS=OFF -S . -B "%build%\brotli" | ||
cmake --build "%build%\brotli" --config %configuration% --target install | ||
popd | ||
|
||
:: Build & Install nghttp2 | ||
pushd "%deps%\nghttp2" | ||
cmake %cmake_common_args% -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -S . -B "%build%\nghttp2" | ||
cmake --build "%build%\nghttp2" --config %configuration% --target install | ||
popd | ||
|
||
:: Build & Install boringssl | ||
pushd "%deps%\boringssl" | ||
cmake %cmake_common_args% -DCMAKE_POSITION_INDEPENDENT_CODE=ON -S . -B "%build%\boringssl" | ||
cmake --build "%build%\boringssl" --config %configuration% --target install | ||
popd | ||
|
||
:: Build & Install curl | ||
pushd "%deps%\curl" | ||
cmake %cmake_common_args% -DBUILD_SHARED_LIBS=ON^ | ||
-DBUILD_STATIC_LIBS=ON^ | ||
-DBUILD_STATIC_CURL=ON^ | ||
-DCURL_USE_OPENSSL=ON^ | ||
-DCURL_BROTLI=ON^ | ||
-DCURL_ZSTD=ON^ | ||
-DUSE_ZLIB=ON^ | ||
-DUSE_WIN32_IDN=ON^ | ||
-DUSE_NGHTTP2=ON^ | ||
-DHAVE_ECH=1^ | ||
-DUSE_ECH=ON^ | ||
-DENABLE_WEBSOCKETS=ON^ | ||
-DDENABLE_IPV6=ON^ | ||
-DENABLE_UNICODE=ON^ | ||
-DCURL_ENABLE_SSL=ON^ | ||
-DCURL_USE_LIBSSH2=OFF^ | ||
"-DCMAKE_C_FLAGS=/DNGHTTP2_STATICLIB=1 /Dstrtok_r=strtok_s"^ | ||
-S . -B "%build%\curl" | ||
cmake --build "%build%\curl" --config %configuration% --target install | ||
popd |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
diff --git a/deps/boringssl/CMakeLists.txt b/deps/boringssl/CMakeLists.txt | ||
index 2308d57..733407d 100644 | ||
--- a/deps/boringssl/CMakeLists.txt | ||
+++ b/deps/boringssl/CMakeLists.txt | ||
@@ -110,7 +110,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CLANG) | ||
# clang-cl sets different default warnings than clang. It also treats -Wall | ||
# as -Weverything, to match MSVC. Instead -W3 is the alias for -Wall. | ||
# See http://llvm.org/viewvc/llvm-project?view=revision&revision=319116 | ||
- set(C_CXX_FLAGS "${C_CXX_FLAGS} -W3 -Wno-unused-parameter -fmsc-version=1900") | ||
+ set(C_CXX_FLAGS "${C_CXX_FLAGS} -W3 -Wno-unused-parameter -fmsc-version=1900 -Wno-deprecated") | ||
else() | ||
if(EMSCRIPTEN) | ||
# emscripten's emcc/clang does not accept the "-ggdb" flag. | ||
diff --git a/deps/boringssl/crypto/rand_extra/windows.c b/deps/boringssl/crypto/rand_extra/windows.c | ||
index a44774d..56e890f 100644 | ||
--- a/deps/boringssl/crypto/rand_extra/windows.c | ||
+++ b/deps/boringssl/crypto/rand_extra/windows.c | ||
@@ -62,6 +62,9 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) { | ||
typedef BOOL (WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData); | ||
static ProcessPrngFunction g_processprng_fn = NULL; | ||
|
||
+typedef BOOL(WINAPI *RtlGenRandomFunction)(PVOID RandomBuffer, ULONG RandomBufferLength); | ||
+static RtlGenRandomFunction g_rtlgenrandom_fn = NULL; | ||
+ | ||
static void init_processprng(void) { | ||
HMODULE hmod = LoadLibraryW(L"bcryptprimitives"); | ||
if (hmod == NULL) { | ||
@@ -69,7 +72,14 @@ static void init_processprng(void) { | ||
} | ||
g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng"); | ||
if (g_processprng_fn == NULL) { | ||
- abort(); | ||
+ hmod = LoadLibraryW(L"advapi32"); | ||
+ if (hmod == NULL) { | ||
+ abort(); | ||
+ } | ||
+ g_rtlgenrandom_fn = (RtlGenRandomFunction)GetProcAddress(hmod, "SystemFunction036"); | ||
+ if (g_rtlgenrandom_fn == NULL) { | ||
+ abort(); | ||
+ } | ||
} | ||
} | ||
|
||
@@ -83,8 +93,22 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) { | ||
// On non-UWP configurations, use ProcessPrng instead of BCryptGenRandom | ||
// to avoid accessing resources that may be unavailable inside the | ||
// Chromium sandbox. See https://crbug.com/74242 | ||
- if (!g_processprng_fn(out, requested)) { | ||
- abort(); | ||
+ if (g_processprng_fn != NULL) { | ||
+ if (!g_processprng_fn(out, requested)) { | ||
+ abort(); | ||
+ } | ||
+ } else { | ||
+ while (requested > 0) { | ||
+ ULONG output_bytes_this_pass = ULONG_MAX; | ||
+ if (requested < output_bytes_this_pass) { | ||
+ output_bytes_this_pass = (ULONG)requested; | ||
+ } | ||
+ if (g_rtlgenrandom_fn(out, output_bytes_this_pass) == FALSE) { | ||
+ abort(); | ||
+ } | ||
+ requested -= output_bytes_this_pass; | ||
+ out += output_bytes_this_pass; | ||
+ } | ||
} | ||
} | ||
|
||
diff --git a/deps/curl/lib/curl_setup.h b/deps/curl/lib/curl_setup.h | ||
index 286acc3..0ea2480 100644 | ||
--- a/deps/curl/lib/curl_setup.h | ||
+++ b/deps/curl/lib/curl_setup.h | ||
@@ -687,6 +687,10 @@ | ||
#error "No longer supported. Set CURLOPT_CAINFO at runtime instead." | ||
#endif | ||
|
||
+#if defined(USE_LIBSSH2) | ||
+#undef USE_LIBSSH2 | ||
+#endif | ||
+ | ||
#if defined(USE_LIBSSH2) || defined(USE_LIBSSH) || defined(USE_WOLFSSH) | ||
#define USE_SSH | ||
#endif | ||
diff --git a/deps/zstd/lib/common/cpu.h b/deps/zstd/lib/common/cpu.h | ||
index 0e684d9..f8c1ecc 100644 | ||
--- a/deps/zstd/lib/common/cpu.h | ||
+++ b/deps/zstd/lib/common/cpu.h | ||
@@ -35,7 +35,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) { | ||
U32 f7b = 0; | ||
U32 f7c = 0; | ||
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) | ||
-#if !defined(__clang__) | ||
+#if 1 | ||
int reg[4]; | ||
__cpuid((int*)reg, 0); | ||
{ |
Oops, something went wrong.