From 3c1dd1a79d99e0a87fbe6474ab89478f9830db5e Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Mon, 31 Jul 2023 11:58:12 -0700 Subject: [PATCH] chore(runtime) build Wasmtime with 'posix-signals-on-macos' on macOS --- util/runtime.sh | 12 ++++++++++++ util/runtimes/wasmtime.sh | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/util/runtime.sh b/util/runtime.sh index 806ef819e..5a49d36c7 100755 --- a/util/runtime.sh +++ b/util/runtime.sh @@ -145,6 +145,18 @@ if check_target "$TARGET_DIR"; then exit 0 fi +# overrides + +case $OSTYPE in + darwin*) + if [[ "$RUNTIME" = "wasmtime" ]]; then + # must be built with the 'posix-signals-on-macos' feature + notice "installing wasmtime on macOS, forcing 'build' mode" + MODE="build" + fi + ;; +esac + notice "installing $RUNTIME in $TARGET_DIR..." BUILD_SCRIPT=$NGX_WASM_DIR/util/runtimes/$RUNTIME.sh diff --git a/util/runtimes/wasmtime.sh b/util/runtimes/wasmtime.sh index a7eca2ef0..0b906c6a1 100755 --- a/util/runtimes/wasmtime.sh +++ b/util/runtimes/wasmtime.sh @@ -108,6 +108,11 @@ build_wasmtime() { cargo_target_dir="target/release" fi + if [ "$(uname -s)" = "Darwin" ]; then + # See https://github.com/bytecodealliance/wasmtime/issues/6785 + args+="--features wasmtime/posix-signals-on-macos" + fi + if [ "$clean" = "clean" -a -d $cargo_target_dir ]; then rm -rf $cargo_target_dir fi