From cd87d38e728c527aea6ab8b8038a28dfa499a4eb Mon Sep 17 00:00:00 2001 From: Chris Frantz Date: Fri, 10 Dec 2021 15:31:46 -0800 Subject: [PATCH] Use the cargo-supplied RUSTC environment variable. When executing build scripts, [cargo sets several environment variables](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts). Use the cargo-supplied value for `RUSTC`. This _also_ allows `libudev-sys` to be build by [bazel](https://bazel.build) using rules created by `cargo raze`. Signed-off-by: Chris Frantz --- build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 20cf4a0..3b6adc5 100644 --- a/build.rs +++ b/build.rs @@ -25,7 +25,8 @@ fn check_func(function_name: &str) -> bool { writeln!(&mut test_file, "}}").unwrap(); } - let output = Command::new("rustc"). + let rustc = env::var("RUSTC").unwrap(); + let output = Command::new(rustc). arg(&test_file_name). arg("--out-dir").arg(&out_dir). arg("-l").arg("udev").