Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support windows install #25

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions _site/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ release_url() {
echo "https://github.com/bytecodealliance/wasmtime/releases"
}

release_file_postfix(){
if [ "$1" == "mingw" ]; then
echo "zip"
else
echo "tar.xz"
fi
}

download_release_from_repo() {
local version="$1"
local arch="$2"
local os_info="$3"
local tmpdir="$4"

local filename="wasmtime-$version-$arch-$os_info.tar.xz"
local postfix=$(release_file_postfix $os_info)
local filename="wasmtime-$version-$arch-$os_info.$postfix"
local download_file="$tmpdir/$filename"
local archive_url="$(release_url)/download/$version/$filename"
info $archive_url
Expand Down Expand Up @@ -258,6 +266,9 @@ parse_os_info() {
Darwin)
echo "macos"
;;
MINGW64*)
echo "mingw"
;;
*)
return 1
esac
Expand Down Expand Up @@ -448,13 +459,25 @@ install_from_file() {
local archive="$1"
local copy_to="$2"
local extract_to="$(dirname $archive)"
local extracted_path="$extract_to/$(basename $archive .tar.xz)"

local filename
if [[ $archive == *.zip ]]; then
filename=$(basename "$archive" .zip)
else
filename=$(basename "$archive" .tar.xz)
fi

local extracted_path="$extract_to/$filename"

create_tree "$copy_to"

info 'Extracting' "Wasmtime binaries"
# extract the files to the temp directory
tar -xvf "$archive" -C "$extract_to"
if [[ $archive == *.zip ]]; then
unzip -q "$archive" -d "$extract_to"
else
tar -xvf "$archive" -C "$extract_to"
fi

# copy the files to the specified directory
# binaries go into the bin folder
Expand Down
31 changes: 27 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ release_url() {
echo "https://github.com/bytecodealliance/wasmtime/releases"
}

release_file_postfix(){
if [ "$1" == "mingw" ]; then
echo "zip"
else
echo "tar.xz"
fi
}

download_release_from_repo() {
local version="$1"
local arch="$2"
local os_info="$3"
local tmpdir="$4"

local filename="wasmtime-$version-$arch-$os_info.tar.xz"
local postfix=$(release_file_postfix $os_info)
local filename="wasmtime-$version-$arch-$os_info.$postfix"
local download_file="$tmpdir/$filename"
local archive_url="$(release_url)/download/$version/$filename"
info $archive_url
Expand Down Expand Up @@ -258,6 +266,9 @@ parse_os_info() {
Darwin)
echo "macos"
;;
MINGW64*)
echo "mingw"
;;
*)
return 1
esac
Expand Down Expand Up @@ -448,13 +459,25 @@ install_from_file() {
local archive="$1"
local copy_to="$2"
local extract_to="$(dirname $archive)"
local extracted_path="$extract_to/$(basename $archive .tar.xz)"

local filename
if [[ $archive == *.zip ]]; then
filename=$(basename "$archive" .zip)
else
filename=$(basename "$archive" .tar.xz)
fi

local extracted_path="$extract_to/$filename"

create_tree "$copy_to"

info 'Extracting' "Wasmtime binaries"
# extract the files to the temp directory
tar -xvf "$archive" -C "$extract_to"
if [[ $archive == *.zip ]]; then
unzip -q "$archive" -d "$extract_to"
else
tar -xvf "$archive" -C "$extract_to"
fi

# copy the files to the specified directory
# binaries go into the bin folder
Expand Down
Loading