Bug 1443471 - Use correct rust target for mingw clang. r=glandium

MozReview-Commit-ID: G40IanxGWXv

--HG--
extra : rebase_source : 6d8ba3af796848320cc7e3db05e9c83ba4fecb45
This commit is contained in:
Jacek Caban 2018-06-25 19:57:43 +02:00
Родитель a9c64c8f84
Коммит 041db4695b
2 изменённых файлов: 12 добавлений и 10 удалений

Просмотреть файл

@ -149,7 +149,7 @@ def rust_triple_alias(host_or_target):
"""
assert host_or_target in (host, target)
@depends(rustc, host_or_target, building_with_gcc, rust_supported_targets,
@depends(rustc, host_or_target, c_compiler, rust_supported_targets,
when=rust_compiler)
@imports('os')
@imports('subprocess')
@ -157,7 +157,7 @@ def rust_triple_alias(host_or_target):
@imports(_from='mozbuild.shellutil', _import='quote')
@imports(_from='tempfile', _import='mkstemp')
@imports(_from='textwrap', _import='dedent')
def rust_target(rustc, host_or_target, building_with_gcc,
def rust_target(rustc, host_or_target, compiler_info,
rust_supported_targets):
# Rust's --target options are similar to, but not exactly the same
# as, the autoconf-derived targets we use. An example would be that
@ -169,7 +169,7 @@ def rust_triple_alias(host_or_target):
# We correlate the autoconf-derived targets with the list of targets
# rustc gives us with --print target-list.
if host_or_target.kernel == 'WINNT':
if building_with_gcc:
if compiler_info.type in ('gcc', 'clang'):
host_or_target_os = 'windows-gnu'
else:
host_or_target_os = 'windows-msvc'

Просмотреть файл

@ -1555,7 +1555,7 @@ class RustTest(BaseConfigureTest):
return 0, '', ''
raise NotImplementedError('unsupported arguments')
def get_rust_target(self, target, building_with_gcc=True):
def get_rust_target(self, target, compiler_type='gcc'):
environ = {
'PATH': os.pathsep.join(
mozpath.abspath(p) for p in ('/bin', '/usr/bin')),
@ -1570,9 +1570,9 @@ class RustTest(BaseConfigureTest):
sandbox = self.get_sandbox(paths, {}, [], environ)
# Trick the sandbox into not running the target compiler check
dep = sandbox._depends[sandbox['building_with_gcc']]
dep = sandbox._depends[sandbox['c_compiler']]
getattr(sandbox, '__value_for_depends')[(dep, False)] = \
building_with_gcc
CompilerResult(type=compiler_type)
return sandbox._value_for(sandbox['rust_target_triple'])
def test_rust_target(self):
@ -1622,10 +1622,12 @@ class RustTest(BaseConfigureTest):
# Windows
for autoconf, building_with_gcc, rust in (
('i686-pc-mingw32', False, 'i686-pc-windows-msvc'),
('x86_64-pc-mingw32', False, 'x86_64-pc-windows-msvc'),
('i686-pc-mingw32', True, 'i686-pc-windows-gnu'),
('x86_64-pc-mingw32', True, 'x86_64-pc-windows-gnu'),
('i686-pc-mingw32', 'cl', 'i686-pc-windows-msvc'),
('x86_64-pc-mingw32', 'cl', 'x86_64-pc-windows-msvc'),
('i686-pc-mingw32', 'gcc', 'i686-pc-windows-gnu'),
('x86_64-pc-mingw32', 'gcc', 'x86_64-pc-windows-gnu'),
('i686-pc-mingw32', 'clang', 'i686-pc-windows-gnu'),
('x86_64-pc-mingw32', 'clang', 'x86_64-pc-windows-gnu'),
):
self.assertEqual(self.get_rust_target(autoconf, building_with_gcc), rust)