Skip to content

Commit 9882d7c

Browse files
Apply suggestions
1 parent 95dfe5e commit 9882d7c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

build_system/src/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
128128
&"build",
129129
&"--release",
130130
&"--target",
131-
&config.target_triple,
131+
&config.target,
132132
],
133133
Some(start_dir),
134134
Some(&env),
@@ -138,7 +138,7 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
138138
env.insert("RUSTFLAGS".to_string(), rustflags);
139139

140140
run_command_with_output_and_env(
141-
&[&"cargo", &"build", &"--target", &config.target_triple],
141+
&[&"cargo", &"build", &"--target", &config.target],
142142
Some(start_dir),
143143
Some(&env),
144144
)?;

build_system/src/config.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl Channel {
2121

2222
#[derive(Default, Debug)]
2323
pub struct ConfigInfo {
24+
pub target: String,
2425
pub target_triple: String,
2526
pub host_triple: String,
2627
pub rustc_command: Vec<String>,
@@ -42,6 +43,13 @@ impl ConfigInfo {
4243
args: &mut impl Iterator<Item = String>,
4344
) -> Result<bool, String> {
4445
match arg {
46+
"--target" => {
47+
if let Some(arg) = args.next() {
48+
self.target = arg;
49+
} else {
50+
return Err("Expected a value after `--target`, found nothing".to_string());
51+
}
52+
}
4553
"--target-triple" => match args.next() {
4654
Some(arg) if !arg.is_empty() => self.target_triple = arg.to_string(),
4755
_ => {
@@ -113,6 +121,9 @@ impl ConfigInfo {
113121
if self.target_triple.is_empty() {
114122
self.target_triple = self.host_triple.clone();
115123
}
124+
if self.target.is_empty() && !self.target_triple.is_empty() {
125+
self.target = self.target_triple.clone();
126+
}
116127

117128
let mut linker = None;
118129

@@ -243,6 +254,7 @@ impl ConfigInfo {
243254
println!(
244255
"\
245256
--target-triple [arg] : Set the target triple to [arg]
257+
--target [arg] : Set the target to [arg]
246258
--out-dir : Location where the files will be generated
247259
--release : Build in release mode
248260
--release-sysroot : Build sysroot in release mode

build_system/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ fn std_tests(env: &Env, args: &TestArg) -> Result<(), String> {
482482
&args.config_info.target_triple,
483483
]);
484484
run_command_with_env(&command, None, Some(env))?;
485-
// FIXME: the compiled binary is not run. Is it normal?
485+
// FIXME: the compiled binary is not run.
486486

487487
Ok(())
488488
}

0 commit comments

Comments
 (0)