Bug 1264482 - Use the EnumString type for the different values we get out of split_triplet. r=ted

This commit is contained in:
Mike Hommey 2016-04-06 09:56:35 +09:00
parent 3b84e5ed68
commit 66ab5aca5c
3 changed files with 56 additions and 6 deletions

View File

@ -39,7 +39,7 @@ def android_toolchain(target, host, ndk, toolchain, gnu_compiler_version):
target_base = 'arm-linux-androideabi'
elif target.cpu == 'x86':
target_base = 'x86'
elif target.cpu == 'mips' and target.endianness == 'little':
elif target.cpu == 'mips32' and target.endianness == 'little':
target_base = 'mipsel-linux-android'
else:
die('Target cpu is not supported.')

View File

@ -313,6 +313,10 @@ option('--target', nargs=1,
help='Define the system type where the resulting executables will be '
'used')
@imports(_from='mozbuild.configure.constants', _import='CPU')
@imports(_from='mozbuild.configure.constants', _import='Endianness')
@imports(_from='mozbuild.configure.constants', _import='Kernel')
@imports(_from='mozbuild.configure.constants', _import='OS')
def split_triplet(triplet):
# The standard triplet is defined as
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
@ -408,10 +412,10 @@ def split_triplet(triplet):
return namespace(
alias=triplet,
cpu=canonical_cpu,
kernel=canonical_kernel,
os=canonical_os,
endianness=endianness,
cpu=CPU(canonical_cpu),
kernel=Kernel(canonical_kernel),
os=OS(canonical_os),
endianness=Endianness(endianness),
raw_cpu=cpu,
raw_os=os,
# Toolchains, most notably for cross compilation may use cpu-os
@ -493,7 +497,7 @@ def target_variables(target):
os_target = target.os
os_arch = target.kernel
if target.os == 'Darwin' and target.cpu == 'x86':
if target.kernel == 'Darwin' and target.cpu == 'x86':
os_test = 'i386'
else:
os_test = target.raw_cpu

View File

@ -13,3 +13,49 @@ CompilerType = EnumString.subclass(
'gcc',
'msvc',
)
OS = EnumString.subclass(
'Android',
'DragonFly',
'FreeBSD',
'GNU',
'iOS',
'NetBSD',
'OpenBSD',
'OSX',
'WINNT',
)
Kernel = EnumString.subclass(
'Darwin',
'DragonFly',
'FreeBSD',
'kFreeBSD',
'Linux',
'NetBSD',
'OpenBSD',
'WINNT',
)
CPU = EnumString.subclass(
'aarch64',
'Alpha',
'arm',
'hppa',
'ia64',
'mips32',
'mips64',
'ppc',
'ppc64',
's390',
's390x',
'sparc',
'sparc64',
'x86',
'x86_64',
)
Endianness = EnumString.subclass(
'big',
'little',
)