Skip to content

Commit

Permalink
First attempt for winbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
perklet committed Dec 30, 2023
1 parent 92de30e commit cce3a52
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 28 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- feature/*
tags:
- "v*.*.*"
pull_request:
Expand Down
62 changes: 34 additions & 28 deletions win/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,23 @@

set -ex

cd boringssl
mkdir build/
cd build/

rm -rf lib
git checkout -- .
patchfile=../curl-impersonate/chrome/patches/boringssl-old-ciphers.patch
patch -p1 < $patchfile
sed -i 's/-ggdb//g' CMakeLists.txt
sed -i 's/-Werror//g' CMakeLists.txt
# Download and patch boringssl

cd ..
BORING_SSL_COMMIT=d24a38200fef19150eef00cad35b138936c08767
curl -L https://github.com/google/boringssl/archive/$(BORING_SSL_COMMIT).zip -o boringssl.zip
unzip -q -o boringssl.zip
mv boringssl-$(BORING_SSL_COMMIT) boringssl

cd curl
cd boringssl

git checkout -- .
git clean -f
patchfile=../curl-impersonate/chrome/patches/curl-impersonate.patch
patchfile=../../chrome/patches/boringssl-old-ciphers.patch
patch -p1 < $patchfile
sed -i 's/-ggdb//g' CMakeLists.txt
sed -i 's/-Werror//g' CMakeLists.txt

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

cd ..

cd boringssl

rm -rf lib
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
Expand All @@ -59,10 +44,31 @@ export OPENSSL_LIBPATH=$PWD/boringssl/lib
export OPENSSL_LIBS='-lssl -lcrypto'
export HTTP2=1
export WEBSOCKETS=1
export ECH=1

CURL_VERSION=curl-8.1.1

curl -L "https://curl.se/download/$(CURL_VERSION).tar.xz" \
-o "$(CURL_VERSION).tar.xz"
tar -xf $(CURL_VERSION).tar.xz
mv $(CURL_VERSION) curl

cd curl
mingw32-make -f Makefile.dist mingw32-clean CFLAGS=-Wno-unused-variable
mingw32-make -f Makefile.dist mingw32 -j CFLAGS=-Wno-unused-variable

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/-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

# mingw32-make mingw32-clean CFLAGS=-Wno-unused-variable
mingw32-make mingw32 -j CFLAGS=-Wno-unused-variable

mkdir -p ../dist
mv lib/libcurl* ../dist/
Expand Down

0 comments on commit cce3a52

Please sign in to comment.