wasm-utils/runner/build.sh

24 lines
612 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
else
# c/c++ can be compiled directly by emcc
emcc $file -Os -s WASM=1 -s SIDE_MODULE=1 -o out/contract.wasm
2017-04-12 18:06:03 +03:00
fi
2017-04-12 18:44:03 +03:00
if [ ! -f ./../gas/target/release/gas ] && [ ! -f ./../gas/target/release/gas.exe ]
then
2017-04-12 18:06:03 +03:00
echo "No gas utility, compile it in /gas folder with"
2017-04-12 18:44:03 +03:00
echo "cargo build --release"
else
./../gas/target/release/gas ./out/contract.wasm ./out/contract.wasm
2017-04-12 18:06:03 +03:00
fi