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 android support to rustup-init.sh #949

Merged
merged 1 commit into from
Feb 11, 2017
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
29 changes: 24 additions & 5 deletions rustup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ main() {

local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t rustup)"
local _file="$_dir/rustup-init$_ext"

local _ansi_escapes_are_valid=false
if [ -t 2 ]; then
if [ "${TERM+set}" = 'set' ]; then
Expand All @@ -52,13 +52,13 @@ main() {
esac
fi
fi

if $_ansi_escapes_are_valid; then
printf "\33[1minfo:\33[0m downloading installer\n" 1>&2
else
printf '%s\n' 'info: downloading installer' 1>&2
fi

ensure mkdir -p "$_dir"
ensure curl -sSfL "$_url" -o "$_file"
ensure chmod u+x "$_file"
Expand Down Expand Up @@ -146,6 +146,10 @@ get_architecture() {
local _ostype="$(uname -s)"
local _cputype="$(uname -m)"

if [ "$(uname -o)" = Android ]; then
local _ostype=Android
fi

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

case "$_ostype" in

Android)
local _ostype=linux-android
;;

Linux)
local _ostype=unknown-linux-gnu
;;
Expand Down Expand Up @@ -193,16 +201,27 @@ get_architecture() {

xscale | arm)
local _cputype=arm
if [ "$_ostype" == "linux-android" ]; then
local _ostype=linux-androideabi
fi
;;

armv6l)
local _cputype=arm
local _ostype="${_ostype}eabihf"
if [ "$_ostype" == "linux-android" ]; then
local _ostype=linux-androideabi
else
local _ostype="${_ostype}eabihf"
fi
;;

armv7l)
local _cputype=armv7
local _ostype="${_ostype}eabihf"
if [ "$_ostype" == "linux-android" ]; then
local _ostype=linux-androideabi
else
local _ostype="${_ostype}eabihf"
fi
;;

aarch64)
Expand Down