Bug 1443471 - Use correct rust target for mingw clang. r?glandium draft
authorJacek Caban <jacek@codeweavers.com>
Mon, 25 Jun 2018 19:57:43 +0200
changeset 811374 d96f1ceee5734d9f824c718115690825994dcba5
parent 811328 0ccb88caf8e4b226e996653204a97e922a65a696
child 811375 2b5356e88b7934b2ce3b4040f2407871c4353814
child 811383 cff47ff6fd5e1a7cf04987dedd042b06a8947272
push id114282
push userbmo:jacek@codeweavers.com
push dateWed, 27 Jun 2018 14:19:01 +0000
reviewersglandium
bugs1443471
milestone63.0a1
Bug 1443471 - Use correct rust target for mingw clang. r?glandium MozReview-Commit-ID: G40IanxGWXv
build/moz.configure/rust.configure
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -144,37 +144,37 @@ def rust_supported_targets(rustc):
 @template
 def rust_triple_alias(host_or_target):
     """Template defining the alias used for rustc's --target flag.
     `host_or_target` is either `host` or `target` (the @depends functions
     from init.configure).
     """
     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')
     @imports(_from='mozbuild.configure.util', _import='LineIO')
     @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
         # Rust uses distinct target triples for targetting the GNU C++ ABI
         # and the MSVC C++ ABI on Win32, whereas autoconf has a single
         # triple and relies on the user to ensure that everything is
         # compiled for the appropriate ABI.  We need to perform appropriate
         # munging to get the correct option to rustc.
         # 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'
             host_or_target_raw_os = host_or_target_os
         else:
             host_or_target_os = host_or_target.os
             host_or_target_raw_os = host_or_target.raw_os