-
Notifications
You must be signed in to change notification settings - Fork 0
/
ton-build.sh
executable file
·68 lines (62 loc) · 2.25 KB
/
ton-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
set -e
#
# Common parameters
#
source /build/emsdk/emsdk_env.sh
export CCACHE_DISABLE=1
export CC=$(which clang)
export CXX=$(which clang++)
export EMSDK_DIR=/build/emsdk
export ZLIB_DIR=/build/zlib
export OPENSSL_DIR=/build/openssl-es
rm -rf /build/ton/build
mkdir -p /build/ton/build
cd /build/ton/build
rm -rf /build/output
mkdir -p /build/output
mkdir -p /build/output/wasm
mkdir -p /build/output/js
#
# Build WASM
#
emcmake cmake -DUSE_EMSCRIPTEN=ON \
-DCMAKE_BUILD_TYPE=Release \
-DZLIB_LIBRARY=$ZLIB_DIR/libz.a \
-DZLIB_INCLUDE_DIR=$ZLIB_DIR \
-DOPENSSL_ROOT_DIR=$OPENSSL_DIR \
-DOPENSSL_INCLUDE_DIR=$OPENSSL_DIR/include \
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.a \
-DOPENSSL_SSL_LIBRARY=$OPENSSL_DIR/libssl.a \
-DCMAKE_TOOLCHAIN_FILE=$EMSDK_DIR/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DCMAKE_CXX_FLAGS="-sUSE_ZLIB=1" \
--graphviz=/build/output/deps.dot \
..
cp -R ../crypto/smartcont ../crypto/fift/lib crypto
emmake make -j$(nproc) emulator-emscripten
emmake make -j$(nproc) funcfiftlib
cp /build/ton/build/crypto/funcfiftlib.wasm \
/build/ton/build/crypto/funcfiftlib.js \
/build/ton/build/crypto/tlbc.wasm \
/build/ton/build/crypto/tlbc.js \
/build/ton/build/emulator/emulator-emscripten.wasm \
/build/ton/build/emulator/emulator-emscripten.js \
/build/output/wasm/
#
# Build NO WASM
#
emcmake cmake -DUSE_EMSCRIPTEN=ON \
-DUSE_EMSCRIPTEN_NO_WASM=ON \
-DCMAKE_BUILD_TYPE=Release \
-DZLIB_LIBRARY=$ZLIB_DIR/libz.a \
-DZLIB_INCLUDE_DIR=$ZLIB_DIR \
-DOPENSSL_ROOT_DIR=$OPENSSL_DIR \
-DOPENSSL_INCLUDE_DIR=$OPENSSL_DIR/include \
-DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.a \
-DOPENSSL_SSL_LIBRARY=$OPENSSL_DIR/libssl.a \
-DCMAKE_TOOLCHAIN_FILE=$EMSDK_DIR/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DCMAKE_CXX_FLAGS="-sUSE_ZLIB=1" \
..
cp -R ../crypto/smartcont ../crypto/fift/lib crypto
emmake make -j$(nproc) emulator-emscripten
cp /build/ton/build/emulator/emulator-emscripten.js \
/build/output/js/