117 lines
3.5 KiB
Diff
117 lines
3.5 KiB
Diff
Mozilla rustc check does not support crossbuild: let's remove it
|
|
Remove calls to unwrap_rustup, they fail if rustup isn't present
|
|
|
|
Do not try to figure out the rust target as it is broken on musl
|
|
instead use what is set in RUST_TARGET
|
|
|
|
Skip extra checks on cross builds (broken for arm*)
|
|
|
|
diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
|
|
index e64dc5d5ec..c4778f8cc8 100644
|
|
--- a/build/moz.configure/rust.configure
|
|
+++ b/build/moz.configure/rust.configure
|
|
@@ -91,9 +91,6 @@ def unwrap_rustup(prog, name):
|
|
return unwrap
|
|
|
|
|
|
-rustc = unwrap_rustup(rustc, "rustc")
|
|
-cargo = unwrap_rustup(cargo, "cargo")
|
|
-
|
|
|
|
set_config("CARGO", cargo)
|
|
set_config("RUSTC", rustc)
|
|
@@ -274,7 +271,9 @@ def rust_supported_targets(rustc):
|
|
data.setdefault(key, []).append(namespace(rust_target=t, target=info))
|
|
return data
|
|
|
|
-
|
|
+@imports('os')
|
|
+@imports(_from='mozbuild.util', _import='ensure_unicode')
|
|
+@imports(_from='mozbuild.util', _import='system_encoding')
|
|
def detect_rustc_target(
|
|
host_or_target, compiler_info, arm_target, rust_supported_targets
|
|
):
|
|
@@ -396,12 +395,14 @@ def detect_rustc_target(
|
|
|
|
return None
|
|
|
|
- rustc_target = find_candidate(candidates)
|
|
+ rustc_target = os.environ['RUST_TARGET']
|
|
+
|
|
|
|
if rustc_target is None:
|
|
die("Don't know how to translate {} for rustc".format(host_or_target.alias))
|
|
|
|
- return rustc_target
|
|
+ return ensure_unicode(rustc_target, system_encoding)
|
|
+
|
|
|
|
|
|
@imports("os")
|
|
@@ -423,35 +424,6 @@ def assert_rust_compile(host_or_target, rustc_target, rustc):
|
|
|
|
os.write(in_fd, source)
|
|
os.close(in_fd)
|
|
-
|
|
- cmd = [
|
|
- rustc,
|
|
- "--crate-type",
|
|
- "staticlib",
|
|
- target_arg,
|
|
- "-o",
|
|
- out_path,
|
|
- in_path,
|
|
- ]
|
|
-
|
|
- def failed():
|
|
- die(
|
|
- dedent(
|
|
- """\
|
|
- Cannot compile for {} with {}
|
|
- The target may be unsupported, or you may not have
|
|
- a rust std library for that target installed. Try:
|
|
-
|
|
- rustup target add {}
|
|
- """.format(
|
|
- host_or_target.alias, rustc, rustc_target
|
|
- )
|
|
- )
|
|
- )
|
|
-
|
|
- check_cmd_output(*cmd, onerror=failed)
|
|
- if not os.path.exists(out_path) or os.path.getsize(out_path) == 0:
|
|
- failed()
|
|
finally:
|
|
os.remove(in_path)
|
|
os.remove(out_path)
|
|
@@ -475,28 +447,7 @@ def rust_host_triple(
|
|
host, compiler_info, arm_target, rust_supported_targets
|
|
)
|
|
if rustc_target != rustc_host:
|
|
- if host.alias == rustc_target:
|
|
- configure_host = host.alias
|
|
- else:
|
|
- configure_host = "{}/{}".format(host.alias, rustc_target)
|
|
- die(
|
|
- dedent(
|
|
- """\
|
|
- The rust compiler host ({rustc}) is not suitable for the configure host ({configure}).
|
|
-
|
|
- You can solve this by:
|
|
- * Set your configure host to match the rust compiler host by editing your
|
|
- mozconfig and adding "ac_add_options --host={rustc}".
|
|
- * Or, install the rust toolchain for {configure}, if supported, by running
|
|
- "rustup default stable-{rustc_target}"
|
|
- """.format(
|
|
- rustc=rustc_host,
|
|
- configure=configure_host,
|
|
- rustc_target=rustc_target,
|
|
- )
|
|
- )
|
|
- )
|
|
- assert_rust_compile(host, rustc_target, rustc)
|
|
+ return rustc_host
|
|
return rustc_target
|
|
|
|
|