Skip to content

Commit c1e280e

Browse files
authored
feat: build wasmtime from source with musl (#18)
1 parent 70b6a0c commit c1e280e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

install-wasmtime.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail -x
23

3-
wget https://github.com/bytecodealliance/wasmtime/releases/download/v0.30.0/wasmtime-v0.30.0-x86_64-linux-c-api.tar.xz
4-
tar -xvf ./wasmtime-v0.30.0-x86_64-linux-c-api.tar.xz
5-
mv wasmtime-v0.30.0-x86_64-linux-c-api wasmtime-c-api
4+
VER=v0.30.0
5+
wget https://github.com/bytecodealliance/wasmtime/releases/download/${VER}/wasmtime-${VER}-x86_64-linux-c-api.tar.xz
6+
tar -xvf ./wasmtime-${VER}-x86_64-linux-c-api.tar.xz > /dev/null
7+
if echo "int main(void) {}" | gcc -o /dev/null -v -x c - &> /dev/stdout| grep collect | tr -s " " "\012" | grep musl; then
8+
# build from source code if the libc is musl
9+
git clone [email protected]:bytecodealliance/wasmtime -b ${VER} \
10+
&& cd wasmtime \
11+
&& git submodule update --init \
12+
&& cargo build --release --manifest-path crates/c-api/Cargo.toml
13+
fi
14+
mv wasmtime-${VER}-x86_64-linux-c-api wasmtime-c-api

0 commit comments

Comments
 (0)