diff --git a/runtime/spidermonkey/build-engine.sh b/runtime/spidermonkey/build-engine.sh index 389fccdea9..d29f7e6e29 100755 --- a/runtime/spidermonkey/build-engine.sh +++ b/runtime/spidermonkey/build-engine.sh @@ -64,7 +64,16 @@ esac # Ensure the Rust version matches that used by Gecko, and can compile to WASI -rustup target add wasm32-wasi +rustc_valid= +if command -v rustc > /dev/null && command -v cargo > /dev/null; then + if rustc --print target-list | grep -q '^wasm32-wasi$'; then + rustc_valid=1 + fi +fi + +if [ -z "$rustc_valid" ]; then + rustup target add wasm32-wasi +fi # Use Gecko's build system bootstrapping to ensure all dependencies are # installed