From ad8a2e5a7dd06509d5048fa795a491bf4cb33c8f Mon Sep 17 00:00:00 2001 From: Afonso Bordado Date: Fri, 1 Dec 2023 15:47:54 +0000 Subject: [PATCH] Add RISC-V support to install.sh (#20) 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. --- _site/install.sh | 12 +++++++++++- install.sh | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/_site/install.sh b/_site/install.sh index 9116469..7d1d51e 100644 --- a/_site/install.sh +++ b/_site/install.sh @@ -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" } @@ -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 ;; @@ -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 } diff --git a/install.sh b/install.sh index 9116469..7d1d51e 100644 --- a/install.sh +++ b/install.sh @@ -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" } @@ -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 ;; @@ -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 }