From d8c10db602ead6cbce4119a1398bbe2ee82a0ea1 Mon Sep 17 00:00:00 2001 From: bitful-pannul <109035169+bitful-pannul@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:50:46 +0200 Subject: [PATCH] branch on linux/mac wasi-sdk (#37) --- modules/sqlite/sqlite_worker/build.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/sqlite/sqlite_worker/build.sh b/modules/sqlite/sqlite_worker/build.sh index 673434f8..9f94bf0e 100755 --- a/modules/sqlite/sqlite_worker/build.sh +++ b/modules/sqlite/sqlite_worker/build.sh @@ -13,9 +13,20 @@ WASI_VERSION=20 WASI_VERSION_FULL=${WASI_VERSION}.0 CC_PATH=$(realpath ./wasi-sdk-${WASI_VERSION_FULL}/bin/clang) +# Determine operating system +OS_TYPE="$(uname)" +if [ "$OS_TYPE" = "Darwin" ]; then + WASI_PLATFORM="macos" +elif [ "$OS_TYPE" = "Linux" ]; then + WASI_PLATFORM="linux" +else + echo "Unsupported OS: $OS_TYPE" + exit 1 +fi + if [ ! -e "$CC_PATH" ]; then - wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz - tar xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz + wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-${WASI_PLATFORM}.tar.gz + tar xvf wasi-sdk-${WASI_VERSION_FULL}-${WASI_PLATFORM}.tar.gz fi CC_PATH=$(realpath ./wasi-sdk-${WASI_VERSION_FULL}/bin/clang) @@ -38,3 +49,4 @@ CARGO_TARGET_WASM32_WASI_LINKER = "$CC_PATH" EOF RUSTFLAGS="-C target-feature=-crt-static -C link-arg=-Wl,--no-entry,--export=init,--export=cabi_realloc" cargo build --release --no-default-features --target wasm32-wasi +