Allow build_wasm.sh work on MacOS (#125)

This commit is contained in:
Mike Voronov 2021-08-04 16:41:37 +03:00 committed by GitHub
parent 0528eb485a
commit 257ec06e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,10 +9,18 @@
wasm-pack build ./air-interpreter --no-typescript --release -d ../avm/client/wasm
)
## base64 on MacOS doesn't have -w option
if echo | base64 -w0 > /dev/null 2>&1;
then
BASE64=$(base64 -w0 wasm/air_interpreter_client_bg.wasm)
else
BASE64=$(base64 wasm/air_interpreter_client_bg.wasm)
fi
cat << EOF > ./src/wasm.js
// auto-generated
module.exports = "$(base64 -w0 wasm/air_interpreter_client_bg.wasm)";
module.exports = "$BASE64";
EOF
callserviceimpl=$(cat wasm/air_interpreter_client_bg.js | grep -o '__wbg_callserviceimpl_\w*')