diff --git a/client/build.sh b/client/build.sh index 8cb15d8..ac0b268 100755 --- a/client/build.sh +++ b/client/build.sh @@ -27,7 +27,7 @@ EXPORTED_FUNCS="${EXPORTED_FUNCS:1}" #compile options 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" #clean output dir @@ -50,7 +50,7 @@ if [[ "$*" == *"release"* ]]; then COMPILER_OPTIONS="-Oz -flto $COMPILER_OPTIONS" echo "note: building with release optimizations" else - COMPILER_OPTIONS="$COMPILER_OPTIONS --profiling" + COMPILER_OPTIONS="$COMPILER_OPTIONS --profiling -g" fi if [[ "$*" == *"single_file"* ]]; then diff --git a/client/tools/all_deps.sh b/client/tools/all_deps.sh index 6e0cebd..385ad70 100755 --- a/client/tools/all_deps.sh +++ b/client/tools/all_deps.sh @@ -5,15 +5,15 @@ set -e mkdir -p build -OPENSSL_PREFIX=$(realpath build/openssl-wasm) +WOLFSSL_PREFIX=$(realpath build/wolfssl-wasm) CJSON_PREFIX=$(realpath build/cjson-wasm) CURL_PREFIX=$(realpath build/curl-wasm) ZLIB_PREFIX=$(realpath build/zlib-wasm) BROTLI_PREFIX=$(realpath build/brotli-wasm) NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm) -if [ ! -d $OPENSSL_PREFIX ]; then - tools/openssl.sh +if [ ! -d $WOLFSSL_PREFIX ]; then + tools/wolfssl.sh fi if [ ! -d $CJSON_PREFIX ]; then tools/cjson.sh @@ -31,7 +31,7 @@ if [ ! -d $CURL_PREFIX ]; then tools/curl.sh fi -cp -r $OPENSSL_PREFIX/* $CURL_PREFIX +cp -r $WOLFSSL_PREFIX/* $CURL_PREFIX cp -r $CJSON_PREFIX/* $CURL_PREFIX cp -r $ZLIB_PREFIX/* $CURL_PREFIX cp -r $BROTLI_PREFIX/* $CURL_PREFIX diff --git a/client/tools/curl.sh b/client/tools/curl.sh index bd6ee25..eeb7d9f 100755 --- a/client/tools/curl.sh +++ b/client/tools/curl.sh @@ -7,7 +7,7 @@ set -e CORE_COUNT=$(nproc --all) PREFIX=$(realpath build/curl-wasm) -OPENSSL_PREFIX=$(realpath build/openssl-wasm) +WOLFSSL_PREFIX=$(realpath build/wolfssl-wasm) ZLIB_PREFIX=$(realpath build/zlib-wasm) BROTLI_PREFIX=$(realpath build/brotli-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 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 -emmake make -j$CORE_COUNT LIBS="-lbrotlicommon" +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 CFLAGS="-Oz" LIBS="-lbrotlicommon" rm -rf $PREFIX mkdir -p $PREFIX/include mkdir -p $PREFIX/lib cp -r include/curl $PREFIX/include cp lib/.libs/libcurl.a $PREFIX/lib -cp -r $OPENSSL_PREFIX/* $PREFIX cd ../../ \ No newline at end of file diff --git a/client/tools/openssl.sh b/client/tools/openssl.sh deleted file mode 100755 index ad4c47f..0000000 --- a/client/tools/openssl.sh +++ /dev/null @@ -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 ../../ \ No newline at end of file diff --git a/client/tools/wolfssl.sh b/client/tools/wolfssl.sh new file mode 100755 index 0000000..ca40dca --- /dev/null +++ b/client/tools/wolfssl.sh @@ -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 ../../ \ No newline at end of file