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 812160 8007181b27bedc02b58a9f383413dd5b767e3eb8
parent 812159 8bbee95274f4bf79e403a4f644dd727d15568129
child 812161 cee23f1dd2d6a3b5b9327e4a26e27f966cbb6ab1
push id114464
push userbmo:jacek@codeweavers.com
push dateThu, 28 Jun 2018 16:53:46 +0000
reviewersglandium
bugs1443471
milestone60.1.0
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