@@ -415,7 +415,11 @@ def build_triple(self):
415415 # The goal here is to come up with the same triple as LLVM would,
416416 # at least for the subset of platforms we're willing to target.
417417 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'
419423 elif ostype == 'FreeBSD' :
420424 ostype = 'unknown-freebsd'
421425 elif ostype == 'DragonFly' :
@@ -472,15 +476,21 @@ def build_triple(self):
472476 cputype = 'i686'
473477 elif cputype in {'xscale' , 'arm' }:
474478 cputype = 'arm'
479+ if ostype == 'linux-android' :
480+ ostype = 'linux-androideabi'
475481 elif cputype == 'armv6l' :
476482 cputype = 'arm'
477- ostype += 'eabihf'
483+ if ostype == 'linux-android' :
484+ ostype = 'linux-androideabi'
485+ else :
486+ ostype += 'eabihf'
478487 elif cputype in {'armv7l' , 'armv8l' }:
479488 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' }:
484494 cputype = 'aarch64'
485495 elif cputype == 'mips' :
486496 if sys .byteorder == 'big' :
0 commit comments