wasm-utils/runner/build.sh

34 lines
984 B
Bash
Raw Normal View History

2017-04-12 13:58:22 +03:00
#!/bin/sh
# "Compile rust source and put it as a tested contract"
mkdir -p out
2017-04-12 16:03:06 +03:00
file=$1
if [ ${file: -3} == ".rs" ]
then
# Rust is compiled with rustc
rustc $file -o out/contract.js -O --target wasm32-unknown-emscripten
2017-04-27 23:18:54 +03:00
2017-04-27 23:40:51 +03:00
# Gas injector
cargo run --manifest-path=./../gas/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
2017-04-27 23:18:54 +03:00
# Allocator replacer
cargo run --manifest-path=./../ext/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
# Symbols optimizer
cargo run --manifest-path=./../opt/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
2017-04-12 16:03:06 +03:00
else
# c/c++ can be compiled directly by emcc
2017-05-04 17:38:09 +03:00
emcc $file -O3 -s WASM=1 -s SIDE_MODULE=1 -o out/contract.wasm
2017-04-27 21:28:06 +03:00
2017-04-27 23:18:54 +03:00
# Gas injector
cargo run --manifest-path=./../gas/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
2017-04-27 23:38:02 +03:00
# Symbols optimizer
cargo run --manifest-path=./../opt/Cargo.toml --release -- ./out/contract.wasm ./out/contract.wasm
2017-04-27 23:18:54 +03:00
fi
2017-04-27 21:28:06 +03:00