diff --git a/.github/workflows/build-win.yaml b/.github/workflows/build-win.yaml index b92c6fe7..e602c817 100644 --- a/.github/workflows/build-win.yaml +++ b/.github/workflows/build-win.yaml @@ -61,6 +61,7 @@ jobs: mingw-w64-${{ matrix.env }}-nasm mingw-w64-${{ matrix.env }}-gcc mingw-w64-${{ matrix.env }}-go + mingw-w64-${{ matrix.env }}-libuv - name: Copy and patch shell: msys2 {0} diff --git a/chrome/patches/curl-impersonate.patch b/chrome/patches/curl-impersonate.patch index e4bbe8f4..0c63a537 100644 --- a/chrome/patches/curl-impersonate.patch +++ b/chrome/patches/curl-impersonate.patch @@ -146,7 +146,7 @@ index 54f92d931..ea5895e9b 100644 exit 1 diff --git a/export.sh b/export.sh new file mode 100755 -index 000000000..7bced6879 +index 000000000..db9ea5ea9 --- /dev/null +++ b/export.sh @@ -0,0 +1,9 @@ @@ -157,7 +157,7 @@ index 000000000..7bced6879 +# 1. https://github.com/curl/curl/pull/13244/files +# 2. https://everything.curl.dev/build/windows.html + -+git df curl-8_7_1 > chrome.patch ++git diff curl-8_7_1 > chrome.patch +mv chrome.patch ../curl-impersonate/chrome/patches/curl-impersonate.patch diff --git a/include/curl/curl.h b/include/curl/curl.h index b2377b789..89271eafa 100644 diff --git a/configure.ac b/configure.ac index e1b79b28..f55f66e5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([curl-impersonate], [0.7.0], [lwt@lwthiker.com]) +AC_INIT([curl-impersonate], [0.7.0], [lwt@lwthiker.com, kong@yifei.me]) AC_CANONICAL_BUILD AC_CANONICAL_HOST diff --git a/win/build.sh b/win/build.sh index 1a13b7f6..8b66aaa1 100644 --- a/win/build.sh +++ b/win/build.sh @@ -2,7 +2,7 @@ set -ex -mkdir build/ +mkdir -p build/ cd build/ # Download and patch boringssl @@ -19,7 +19,7 @@ patch -p1 < $patchfile sed -i 's/-ggdb//g' CMakeLists.txt sed -i 's/-Werror//g' CMakeLists.txt -cmake -G "Ninja" -S . -B lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc.exe -DOPENSSL_NO_ASM=1 +cmake -G "Ninja" -S . -B lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc.exe ninja -C lib crypto ssl mv lib/crypto/libcrypto.a lib/libcrypto.a mv lib/ssl/libssl.a lib/libssl.a @@ -33,8 +33,7 @@ export BROTLI_LIBS='-lbrotlidec -lbrotlicommon' export NGHTTP2_PATH=nghttp2_stub export LIBIDN2_PATH=idn2_stub export SSL=1 -export OPENSSL_PATH=$PWD/boringssl -export OPENSSL_LIBPATH=$PWD/boringssl/lib +export SSL_PATH=$PWD/boringssl export OPENSSL_LIBS='-lssl -lcrypto' @@ -52,19 +51,21 @@ cd curl patchfile=../../chrome/patches/curl-impersonate.patch patch -p1 < $patchfile -# sed -i 's/-shared/-s -static -shared/g' lib/Makefile.mk -# sed -i 's/-static/-s -static/g' src/Makefile.mk +sed -i 's/-shared/-s -static -shared/g' lib/Makefile.mk +sed -i 's/-static/-s -static/g' src/Makefile.mk # # sed -i 's/-DUSE_NGHTTP2/-DUSE_NGHTTP2 -DNGHTTP2_STATICLIB/g' lib/Makefile.mk # sed -i 's/-DUSE_NGHTTP2/-DUSE_NGHTTP2 -DNGHTTP2_STATICLIB/g' src/Makefile.mk -sed -i 's/-lidn2/-lidn2 -lunistring -liconv/g' lib/Makefile.mk -sed -i 's/-lidn2/-lidn2 -lunistring -liconv/g' src/Makefile.mk +# sed -i 's/-lidn2/-lidn2 -lunistring -liconv/g' lib/Makefile.mk +# sed -i 's/-lidn2/-lidn2 -lunistring -liconv/g' src/Makefile.mk # print all options -cmake -LAH +# cmake -LAH cmake -B build -G "MinGW Makefiles" \ + -DSSL_PATH=$PWD/boringssl \ + -DOPENSSL_LIBS='-lssl -lcrypto' \ -DENABLE_IPV6=ON \ -DENABLE_UNICODE=ON \ -DUSE_NGHTTP2=ON \ @@ -73,23 +74,29 @@ cmake -B build -G "MinGW Makefiles" \ -DCULR_ZLIB=ON \ -DCURL_ZSTD=ON \ -DENABLE_IPV6=ON \ - -DCURL_ENABLE_SSL=ON \ - -DCURL_USE_OPENSSL=ON \ + -DENABLE_SSL=ON \ + -DUSE_OPENSSL=ON \ -DHAVE_BORINGSSL=1 \ -DUSE_ECH=ON \ + -DHAVE_ECH=ON \ -DBUILD_STATIC_CURL=ON \ -DBUILD_STATIC_LIBS=ON \ + -DBUILD_CURL_EXE=ON \ + -DCURL_STATIC_CRT=ON \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_FLAGS=-Wno-unused-variable \ +cd build mingw32-make clean mingw32-make -j CFLAGS="-Wno-unused-variable" CFG=-ssl-zlib-nghttp2-idn2-brotli-zstd-ipv6 +cd .. + mkdir -p ../dist ls build mv build/lib/libcurl* ../dist/ -mv build/*.exe ../dist/ +mv build/src/*.exe ../dist/ cd .. dist/curl.exe -V