Skip to content

Commit

Permalink
Add RISC-V support to install.sh (#20)
Browse files Browse the repository at this point in the history
This commit adds support for the RISC-V Architecture
to the install.sh script.

Wasmtime already publishes precompiled binaries for
this target, we just need to add some minimal support
to get it working here.

There is a slight wrinkle, Linux identifies RISC-V
as "riscv64", but wasmtime uses the name "riscv64gc".
So this commit adds a mapping from the former to
the latter when fetching the binaries.
  • Loading branch information
afonso360 authored Dec 1, 2023
1 parent 6c4e4b2 commit ad8a2e5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion _site/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ get_architecture() {
arm64)
arch=aarch64
;;
# Linux identifies RISC-V as "riscv64", but wasmtime tags
# their releases using the toolchain name "riscv64gc"
# When encountering riscv64, map it to that name.
riscv64)
arch=riscv64gc
;;
esac
echo "$arch"
}
Expand All @@ -487,6 +493,10 @@ check_architecture() {

# Otherwise, check the matrix of OS/architecture support.
case "$arch/$os" in
# See the comment in get_architecture regarding this name.
riscv64gc/Linux)
return 0
;;
aarch64/Linux)
return 0
;;
Expand All @@ -501,7 +511,7 @@ check_architecture() {
;;
esac

error "Sorry! Wasmtime currently only provides pre-built binaries for x86_64 (Linux, macOS, Windows), aarch64 (Linux, macOS), and s390x (Linux)."
error "Sorry! Wasmtime currently only provides pre-built binaries for x86_64 (Linux, macOS, Windows), aarch64 (Linux, macOS), s390x (Linux) and riscv64 (Linux)."
return 1
}

Expand Down
12 changes: 11 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ get_architecture() {
arm64)
arch=aarch64
;;
# Linux identifies RISC-V as "riscv64", but wasmtime tags
# their releases using the toolchain name "riscv64gc"
# When encountering riscv64, map it to that name.
riscv64)
arch=riscv64gc
;;
esac
echo "$arch"
}
Expand All @@ -487,6 +493,10 @@ check_architecture() {

# Otherwise, check the matrix of OS/architecture support.
case "$arch/$os" in
# See the comment in get_architecture regarding this name.
riscv64gc/Linux)
return 0
;;
aarch64/Linux)
return 0
;;
Expand All @@ -501,7 +511,7 @@ check_architecture() {
;;
esac

error "Sorry! Wasmtime currently only provides pre-built binaries for x86_64 (Linux, macOS, Windows), aarch64 (Linux, macOS), and s390x (Linux)."
error "Sorry! Wasmtime currently only provides pre-built binaries for x86_64 (Linux, macOS, Windows), aarch64 (Linux, macOS), s390x (Linux) and riscv64 (Linux)."
return 1
}

Expand Down

0 comments on commit ad8a2e5

Please sign in to comment.