@@ -415,7 +415,11 @@ def build_triple(self):
415
415
# The goal here is to come up with the same triple as LLVM would,
416
416
# at least for the subset of platforms we're willing to target.
417
417
if ostype == 'Linux' :
418
- ostype = 'unknown-linux-gnu'
418
+ os = subprocess .check_output (['uname' , '-o' ]).strip ().decode (default_encoding )
419
+ if os == 'Android' :
420
+ ostype = 'linux-android'
421
+ else :
422
+ ostype = 'unknown-linux-gnu'
419
423
elif ostype == 'FreeBSD' :
420
424
ostype = 'unknown-freebsd'
421
425
elif ostype == 'DragonFly' :
@@ -472,15 +476,21 @@ def build_triple(self):
472
476
cputype = 'i686'
473
477
elif cputype in {'xscale' , 'arm' }:
474
478
cputype = 'arm'
479
+ if ostype == 'linux-android' :
480
+ ostype = 'linux-androideabi'
475
481
elif cputype == 'armv6l' :
476
482
cputype = 'arm'
477
- ostype += 'eabihf'
483
+ if ostype == 'linux-android' :
484
+ ostype = 'linux-androideabi'
485
+ else :
486
+ ostype += 'eabihf'
478
487
elif cputype in {'armv7l' , 'armv8l' }:
479
488
cputype = 'armv7'
480
- ostype += 'eabihf'
481
- elif cputype == 'aarch64' :
482
- cputype = 'aarch64'
483
- elif cputype == 'arm64' :
489
+ if ostype == 'linux-android' :
490
+ ostype = 'linux-androideabi'
491
+ else :
492
+ ostype += 'eabihf'
493
+ elif cputype in {'aarch64' , 'arm64' }:
484
494
cputype = 'aarch64'
485
495
elif cputype == 'mips' :
486
496
if sys .byteorder == 'big' :
0 commit comments