-
-
Notifications
You must be signed in to change notification settings - Fork 169
Install UEFI targets via rustup #555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
704ec05
42ed2ce
8d150d6
e964518
7b8a188
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
[toolchain] | ||
channel = "nightly" | ||
|
||
# Install the `rust-src` component so that `-Zbuild-std` works. This in | ||
# addition to the components included in the default profile. | ||
components = ["rust-src"] | ||
targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[toolchain] | ||
channel = "nightly" | ||
components = ["rust-src"] | ||
targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,19 @@ pub fn fix_nested_cargo_env(cmd: &mut Command) { | |
cmd.env("PATH", sanitized_path(orig_path)); | ||
} | ||
|
||
/// Check if the three UEFI targets are installed via rustup (only | ||
/// supported since nightly-2022-11-10). | ||
fn is_target_installed(target: &str) -> Result<bool> { | ||
let output = Command::new("rustup") | ||
.args(["target", "list", "--installed"]) | ||
.output()?; | ||
if !output.status.success() { | ||
bail!("failed to get installed targets"); | ||
} | ||
let stdout = String::from_utf8(output.stdout)?; | ||
Ok(stdout.lines().any(|x| x == target)) | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct Cargo { | ||
pub action: CargoAction, | ||
|
@@ -218,7 +231,14 @@ impl Cargo { | |
} | ||
|
||
if let Some(target) = self.target { | ||
cmd.args(["--target", target.as_triple(), "-Zbuild-std=core,alloc"]); | ||
cmd.args(["--target", target.as_triple()]); | ||
|
||
// If the target is not installed, use build-std. Keep this | ||
// around until our minimum-supported nightly version is at | ||
// least 2022-11-10. | ||
if !is_target_installed(target.as_triple())? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you create a follow-up ticket please to remove this eventually? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went ahead and made a PR: #585 We can merge that after Feb 22, 2023. |
||
cmd.args(["-Zbuild-std=core,alloc"]); | ||
} | ||
} | ||
|
||
if self.packages.is_empty() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks so much better now. Very nice :)