diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2024-01-26 12:03:59 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2024-01-26 12:03:59 +0100 |
| commit | f3d890a36d6299dbd70377ce57b0bd9d61de5c1b (patch) | |
| tree | 36b51022af641c0f464fd0c5d4456b722e5f735b /examples/rust/build.sh | |
| parent | 461126ce309f99e4ad2a6ddcbc175ea01c5e8fee (diff) | |
docs: working selfhosted example
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'examples/rust/build.sh')
| -rwxr-xr-x | examples/rust/build.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/rust/build.sh b/examples/rust/build.sh new file mode 100755 index 0000000..2c8069a --- /dev/null +++ b/examples/rust/build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +cd "$(dirname "$0")" + +bins=("hello" "tinywasm") +exclude_wat=("tinywasm") +out_dir="../../target/wasm32-unknown-unknown/wasm" +dest_dir="out" + +for bin in "${bins[@]}"; do + cargo build --target wasm32-unknown-unknown --package rust-wasm-examples --profile=wasm --bin "$bin" + + cp "$out_dir/$bin.wasm" "$dest_dir/" + wasm-opt "$dest_dir/$bin.wasm" -o "$dest_dir/$bin.wasm" -O --intrinsic-lowering -O + + if [[ ! " ${exclude_wat[@]} " =~ " $bin " ]]; then + wasm2wat "$dest_dir/$bin.wasm" -o "$dest_dir/$bin.wat" + fi +done |
