Skip to content

Commit 2d2056e

Browse files
authored
Rollup merge of rust-lang#41370 - malbarbo:android-bootstrap, r=alexcrichton
Add bootstrap support for android
2 parents 1ae52ab + a42c025 commit 2d2056e

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/bootstrap/bootstrap.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,11 @@ def build_triple(self):
407407
# The goal here is to come up with the same triple as LLVM would,
408408
# at least for the subset of platforms we're willing to target.
409409
if ostype == 'Linux':
410-
ostype = 'unknown-linux-gnu'
410+
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
411+
if os == 'Android':
412+
ostype = 'linux-android'
413+
else:
414+
ostype = 'unknown-linux-gnu'
411415
elif ostype == 'FreeBSD':
412416
ostype = 'unknown-freebsd'
413417
elif ostype == 'DragonFly':
@@ -464,15 +468,21 @@ def build_triple(self):
464468
cputype = 'i686'
465469
elif cputype in {'xscale', 'arm'}:
466470
cputype = 'arm'
471+
if ostype == 'linux-android':
472+
ostype = 'linux-androideabi'
467473
elif cputype == 'armv6l':
468474
cputype = 'arm'
469-
ostype += 'eabihf'
475+
if ostype == 'linux-android':
476+
ostype = 'linux-androideabi'
477+
else:
478+
ostype += 'eabihf'
470479
elif cputype in {'armv7l', 'armv8l'}:
471480
cputype = 'armv7'
472-
ostype += 'eabihf'
473-
elif cputype == 'aarch64':
474-
cputype = 'aarch64'
475-
elif cputype == 'arm64':
481+
if ostype == 'linux-android':
482+
ostype = 'linux-androideabi'
483+
else:
484+
ostype += 'eabihf'
485+
elif cputype in {'aarch64', 'arm64'}:
476486
cputype = 'aarch64'
477487
elif cputype == 'mips':
478488
if sys.byteorder == 'big':

0 commit comments

Comments
 (0)