Hack broken rust target selection so it produces the right target on raspbian.
authorPeter Michael Green <plugwash@raspbian.org>
Mon, 31 Aug 2020 00:18:03 +0000 (01:18 +0100)
committerRaspbian forward porter <root@raspbian.org>
Mon, 31 Aug 2020 00:18:03 +0000 (01:18 +0100)
Gbp-Pq: Name raspbian-rust-triplet-hack.patch

build/moz.configure/rust.configure

index dc2335525303a01c8f8177e1f8b48affb34c8630..e58ccb6c15052128a2fb349bbb8aa7d66f57ca87 100644 (file)
@@ -185,9 +185,14 @@ def rust_compiler(rustc_info, cargo_info, build_project):
 
 
 @depends(rustc, when=rust_compiler)
+@imports('sys')
+@imports(_from='__builtin__', _import='repr')
 @imports(_from='__builtin__', _import='ValueError')
 def rust_supported_targets(rustc):
     out = check_cmd_output(rustc, '--print', 'target-list').splitlines()
+    #HACK: if there are multiple matches the algorithm uses the last one
+    #put arm-unknown-linux-gnuebihf on the end of the list so it gets preffered
+    out.append('arm-unknown-linux-gnueabihf')
     data = {}
     for t in out:
         try:
@@ -225,11 +230,13 @@ def rust_triple_alias(host_or_target):
              arm_target, when=rust_compiler)
     @checking('for rust %s triplet' % host_or_target_str)
     @imports('os')
+    @imports('sys')
     @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')
+    @imports(_from='__builtin__', _import='repr')
     def rust_target(rustc, host_or_target, compiler_info,
                     rust_supported_targets, arm_target):
         # Rust's --target options are similar to, but not exactly the same