Merge branch 'wolfssl-testing' into v0.6

This commit is contained in:
ading2210 2024-03-19 16:00:37 -04:00
commit 6b32d503e2
5 changed files with 37 additions and 40 deletions

View file

@ -27,7 +27,7 @@ EXPORTED_FUNCS="${EXPORTED_FUNCS:1}"
#compile options #compile options
RUNTIME_METHODS="addFunction,removeFunction,allocate,ALLOC_NORMAL" RUNTIME_METHODS="addFunction,removeFunction,allocate,ALLOC_NORMAL"
COMPILER_OPTIONS="-o $MODULE_FILE -lcurl -lssl -lcrypto -lcjson -lz -lbrotlidec -lbrotlicommon -lnghttp2 -I $INCLUDE_DIR -L $LIB_DIR" COMPILER_OPTIONS="-o $MODULE_FILE -lcurl -lwolfssl -lcjson -lz -lbrotlidec -lbrotlicommon -lnghttp2 -I $INCLUDE_DIR -L $LIB_DIR"
EMSCRIPTEN_OPTIONS="-lwebsocket.js -sENVIRONMENT=worker,web -sASSERTIONS=1 -sLLD_REPORT_UNDEFINED -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS" EMSCRIPTEN_OPTIONS="-lwebsocket.js -sENVIRONMENT=worker,web -sASSERTIONS=1 -sLLD_REPORT_UNDEFINED -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS"
#clean output dir #clean output dir
@ -50,7 +50,7 @@ if [[ "$*" == *"release"* ]]; then
COMPILER_OPTIONS="-Oz -flto $COMPILER_OPTIONS" COMPILER_OPTIONS="-Oz -flto $COMPILER_OPTIONS"
echo "note: building with release optimizations" echo "note: building with release optimizations"
else else
COMPILER_OPTIONS="$COMPILER_OPTIONS --profiling" COMPILER_OPTIONS="$COMPILER_OPTIONS --profiling -g"
fi fi
if [[ "$*" == *"single_file"* ]]; then if [[ "$*" == *"single_file"* ]]; then

View file

@ -5,15 +5,15 @@
set -e set -e
mkdir -p build mkdir -p build
OPENSSL_PREFIX=$(realpath build/openssl-wasm) WOLFSSL_PREFIX=$(realpath build/wolfssl-wasm)
CJSON_PREFIX=$(realpath build/cjson-wasm) CJSON_PREFIX=$(realpath build/cjson-wasm)
CURL_PREFIX=$(realpath build/curl-wasm) CURL_PREFIX=$(realpath build/curl-wasm)
ZLIB_PREFIX=$(realpath build/zlib-wasm) ZLIB_PREFIX=$(realpath build/zlib-wasm)
BROTLI_PREFIX=$(realpath build/brotli-wasm) BROTLI_PREFIX=$(realpath build/brotli-wasm)
NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm) NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm)
if [ ! -d $OPENSSL_PREFIX ]; then if [ ! -d $WOLFSSL_PREFIX ]; then
tools/openssl.sh tools/wolfssl.sh
fi fi
if [ ! -d $CJSON_PREFIX ]; then if [ ! -d $CJSON_PREFIX ]; then
tools/cjson.sh tools/cjson.sh
@ -31,7 +31,7 @@ if [ ! -d $CURL_PREFIX ]; then
tools/curl.sh tools/curl.sh
fi fi
cp -r $OPENSSL_PREFIX/* $CURL_PREFIX cp -r $WOLFSSL_PREFIX/* $CURL_PREFIX
cp -r $CJSON_PREFIX/* $CURL_PREFIX cp -r $CJSON_PREFIX/* $CURL_PREFIX
cp -r $ZLIB_PREFIX/* $CURL_PREFIX cp -r $ZLIB_PREFIX/* $CURL_PREFIX
cp -r $BROTLI_PREFIX/* $CURL_PREFIX cp -r $BROTLI_PREFIX/* $CURL_PREFIX

View file

@ -7,7 +7,7 @@ set -e
CORE_COUNT=$(nproc --all) CORE_COUNT=$(nproc --all)
PREFIX=$(realpath build/curl-wasm) PREFIX=$(realpath build/curl-wasm)
OPENSSL_PREFIX=$(realpath build/openssl-wasm) WOLFSSL_PREFIX=$(realpath build/wolfssl-wasm)
ZLIB_PREFIX=$(realpath build/zlib-wasm) ZLIB_PREFIX=$(realpath build/zlib-wasm)
BROTLI_PREFIX=$(realpath build/brotli-wasm) BROTLI_PREFIX=$(realpath build/brotli-wasm)
NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm) NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm)
@ -18,14 +18,13 @@ git clone -b curl-8_6_0 --depth=1 https://github.com/curl/curl
cd curl cd curl
autoreconf -fi autoreconf -fi
emconfigure ./configure --host i686-linux --disable-shared --disable-threaded-resolver --without-libpsl --disable-netrc --disable-ipv6 --disable-tftp --disable-ntlm-wb --enable-websockets --with-ssl=$OPENSSL_PREFIX --with-zlib=$ZLIB_PREFIX --with-brotli=$BROTLI_PREFIX --with-nghttp2=$NGHTTP2_PREFIX emconfigure ./configure --host i686-linux --disable-shared --disable-threaded-resolver --without-libpsl --disable-netrc --disable-ipv6 --disable-tftp --disable-ntlm-wb --enable-websockets --with-wolfssl=$WOLFSSL_PREFIX --with-zlib=$ZLIB_PREFIX --with-brotli=$BROTLI_PREFIX --with-nghttp2=$NGHTTP2_PREFIX
emmake make -j$CORE_COUNT LIBS="-lbrotlicommon" emmake make -j$CORE_COUNT CFLAGS="-Oz" LIBS="-lbrotlicommon"
rm -rf $PREFIX rm -rf $PREFIX
mkdir -p $PREFIX/include mkdir -p $PREFIX/include
mkdir -p $PREFIX/lib mkdir -p $PREFIX/lib
cp -r include/curl $PREFIX/include cp -r include/curl $PREFIX/include
cp lib/.libs/libcurl.a $PREFIX/lib cp lib/.libs/libcurl.a $PREFIX/lib
cp -r $OPENSSL_PREFIX/* $PREFIX
cd ../../ cd ../../

View file

@ -1,30 +0,0 @@
#!/bin/bash
#compile openssl for use with emscripten
set -x
set -e
CORE_COUNT=$(nproc --all)
PREFIX=$(realpath build/openssl-wasm)
mkdir -p $PREFIX
cd build
rm -rf openssl
git clone -b openssl-3.2.1 --depth=1 https://github.com/openssl/openssl
cd openssl
export CFLAGS="-Wall -Oz"
export CXXFLAGS="-Wall -Oz"
emconfigure ./Configure linux-x32 --prefix=$PREFIX -no-asm -static -no-afalgeng -no-dso -no-threads -DOPENSSL_SYS_NETWARE -DSIG_DFL=0 -DSIG_IGN=0 -DHAVE_FORK=0 -DOPENSSL_NO_AFALGENG=1 -DOPENSSL_NO_SPEED=1 -DOPENSSL_NO_DYNAMIC_ENGINE -DDLOPEN_FLAG=0
sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile
emmake make -j$CORE_COUNT build_generated libssl.a libcrypto.a
rm -rf $PREFIX/include/*
rm -rf $PREFIX/lib/*
mkdir -p $PREFIX/include
mkdir -p $PREFIX/lib
cp -r include/openssl $PREFIX/include
cp libcrypto.a libssl.a $PREFIX/lib
cd ../../

28
client/tools/wolfssl.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
#compile wolfssl for use with emscripten
set -x
set -e
CORE_COUNT=$(nproc --all)
PREFIX=$(realpath build/wolfssl-wasm)
rm -rf $PREFIX
mkdir -p $PREFIX
cd build
rm -rf wolfssl
git clone -b v5.6.6-stable --depth=1 https://github.com/wolfSSL/wolfssl wolfssl
cd wolfssl
autoreconf -fi
CFLAGS="-Oz -DSP_WORD_SIZE=32" emconfigure ./configure --prefix=$PREFIX --enable-curl --enable-static --disable-shared --host=i686-linux --disable-examples --disable-asm --enable-sni --enable-alpn --enable-truncatedhmac --enable-oldtls --enable-tlsv12 --enable-all-crypto --disable-asyncthreads --disable-threadlocal --enable-tlsx
emmake make -j$CORE_COUNT
make install
rm -rf $PREFIX/bin
rm -rf $PREFIX/share
rm -rf $PREFIX/lib/pkgconfig
rm -rf $PREFIX/lib/*.la
cd ../../