Skip to content

Commit

Permalink
adjust wasm and android builds
Browse files Browse the repository at this point in the history
  • Loading branch information
neodix42 committed Nov 25, 2024
1 parent 95661f4 commit fff4ae8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
41 changes: 34 additions & 7 deletions assembly/wasm/fift-func-wasm-build-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export CCACHE_DISABLE=1

echo `pwd`
if [ "$scratch_new" = true ]; then
echo Compiling openssl zlib lz4 emsdk libsodium emsdk ton
rm -rf openssl zlib lz4 emsdk libsodium build
echo Compiling openssl zlib lz4 emsdk secp256k1 libsodium emsdk ton
rm -rf openssl zlib lz4 emsdk libsodium build secp256k1
fi


Expand All @@ -44,15 +44,19 @@ else
echo Using compiled openssl at $OPENSSL_DIR
fi

cd third-party/secp256k1
make clean
rm -rf .libs
cd ../..

if [ ! -d "build" ]; then
mkdir build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DOPENSSL_FOUND=1 \
cmake -GNinja -DTON_USE_JEMALLOC=ON .. \
-DCMAKE_BUILD_TYPE=Release \
-DOPENSSL_ROOT_DIR=$OPENSSL_DIR \
-DOPENSSL_INCLUDE_DIR=$OPENSSL_DIR/include \
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.so \
-DTON_USE_ABSEIL=OFF ..
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.so

test $? -eq 0 || { echo "Can't configure TON build"; exit 1; }
ninja fift smc-envelope
Expand Down Expand Up @@ -125,6 +129,21 @@ else
echo Using compiled lz4 with emscripten at $LZ4_DIR
fi

if [ ! -d "secp256k1" ]; then
git clone https://github.com/bitcoin-core/secp256k1.git
cd secp256k1
git checkout v0.3.2
./autogen.sh
SECP256K1_DIR=`pwd`
emconfigure ./configure --enable-module-recovery --enable-module-extrakeys
emmake make -j16
test $? -eq 0 || { echo "Can't compile secp256k1 with emmake "; exit 1; }
cd ..
else
SECP256K1_DIR=`pwd`/secp256k1
echo Using compiled secp256k1 with emscripten at $SECP256K1_DIR
fi

if [ ! -d "libsodium" ]; then
git clone https://github.com/jedisct1/libsodium
cd libsodium
Expand All @@ -139,6 +158,11 @@ else
echo Using compiled libsodium with emscripten at $SODIUM_DIR
fi

cd third-party/secp256k1
make clean
rm -rf .libs
cd ../..

cd build

emcmake cmake -DUSE_EMSCRIPTEN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
Expand All @@ -153,6 +177,9 @@ emcmake cmake -DUSE_EMSCRIPTEN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAK
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.a \
-DCMAKE_TOOLCHAIN_FILE=$EMSDK_DIR/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DCMAKE_CXX_FLAGS="-sUSE_ZLIB=1" \
-DSECP256K1_INCLUDE_DIR=$SECP256K1_DIR/include \
-DSECP256K1_LIBRARY=$SECP256K1_DIR/.libs/libsecp256k1.a \
-DSODIUM_FOUND=1 \
-DSODIUM_INCLUDE_DIR=$SODIUM_DIR/src/libsodium/include \
-DSODIUM_LIBRARY_RELEASE=$SODIUM_DIR/src/libsodium/.libs/libsodium.a \
..
Expand Down
1 change: 1 addition & 0 deletions example/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ cmake .. -GNinja \
-DLZ4_FOUND=1 \
-DLZ4_INCLUDE_DIRS=${LZ4_INCLUDE_DIR} \
-DLZ4_LIBRARIES=${LZ4_LIBRARY} \
-DSODIUM_FOUND=1 \
-DSODIUM_INCLUDE_DIR=${SODIUM_INCLUDE_DIR} \
-DSODIUM_LIBRARY_RELEASE=${SODIUM_LIBRARY_RELEASE} \
-DBLST_LIB=${BLST_LIBRARY} || exit 1
Expand Down

0 comments on commit fff4ae8

Please sign in to comment.