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

Add suppot for more platforms to installer script #1122

Merged
merged 1 commit into from
Jun 13, 2022
Merged
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
23 changes: 22 additions & 1 deletion docs/_installer/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ get_architecture() {
local _ostype="$(uname -s)"
local _cputype="$(uname -m)"

# This is when installing inside docker, or can be useful to side-step
# the script's built-in platform detection heuristic (if it drifts again in the future)
set +u
if [ -n "$TARGETOS" ]; then
_ostype="$TARGETOS" # probably always linux
fi

if [ -n "$TARGETARCH" ]; then
_cputype="$TARGETARCH"
fi
set -u


if [ "$_ostype" = Darwin -a "$_cputype" = i386 ]; then
# Darwin `uname -s` lies
if sysctl hw.optional.x86_64 | grep -q ': 1'; then
Expand All @@ -93,7 +106,7 @@ get_architecture() {
fi

case "$_ostype" in
Linux)
Linux | linux)
local _ostype=unknown-linux-musl
;;

Expand All @@ -114,11 +127,19 @@ get_architecture() {
x86_64 | x86-64 | x64 | amd64)
local _cputype=x86_64
;;
arm64 | aarch64)
local _cputype=aarch64
;;
*)
err "no precompiled binaries available for CPU architecture: $_cputype"

esac

# See https://github.com/rustwasm/wasm-pack/pull/1088
if [ "$_cputype" == "aarch64" ] && [ "$_ostype" == "apple-darwin" ]; then
_cputype="x86_64"
fi

local _arch="$_cputype-$_ostype"

RETVAL="$_arch"
Expand Down