Skip to content

Commit

Permalink
Merge pull request #1122 from omninonsense/master
Browse files Browse the repository at this point in the history
Add suppot for more platforms to installer script
  • Loading branch information
drager authored Jun 13, 2022
2 parents e925ca9 + 2a36a1b commit da5a409
Showing 1 changed file with 22 additions and 1 deletion.
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

0 comments on commit da5a409

Please sign in to comment.