Skip to content

Commit

Permalink
Try to fix windows build again
Browse files Browse the repository at this point in the history
  • Loading branch information
perklet committed Jun 16, 2024
1 parent 2b601ee commit ac9672e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions chrome/patches/curl-impersonate.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([curl-impersonate], [0.7.0], [[email protected]])
AC_INIT([curl-impersonate], [0.7.0], [[email protected], [email protected]])

AC_CANONICAL_BUILD
AC_CANONICAL_HOST
Expand Down
31 changes: 19 additions & 12 deletions win/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ex

mkdir build/
mkdir -p build/
cd build/

# Download and patch boringssl
Expand All @@ -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
Expand All @@ -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'


Expand All @@ -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 \
Expand All @@ -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

0 comments on commit ac9672e

Please sign in to comment.