Apply suggestions
This commit is contained in:
parent
95dfe5ec90
commit
9882d7c511
@ -128,7 +128,7 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
|
||||
&"build",
|
||||
&"--release",
|
||||
&"--target",
|
||||
&config.target_triple,
|
||||
&config.target,
|
||||
],
|
||||
Some(start_dir),
|
||||
Some(&env),
|
||||
@ -138,7 +138,7 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
|
||||
env.insert("RUSTFLAGS".to_string(), rustflags);
|
||||
|
||||
run_command_with_output_and_env(
|
||||
&[&"cargo", &"build", &"--target", &config.target_triple],
|
||||
&[&"cargo", &"build", &"--target", &config.target],
|
||||
Some(start_dir),
|
||||
Some(&env),
|
||||
)?;
|
||||
|
@ -21,6 +21,7 @@ pub fn as_str(self) -> &'static str {
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct ConfigInfo {
|
||||
pub target: String,
|
||||
pub target_triple: String,
|
||||
pub host_triple: String,
|
||||
pub rustc_command: Vec<String>,
|
||||
@ -42,6 +43,13 @@ pub fn parse_argument(
|
||||
args: &mut impl Iterator<Item = String>,
|
||||
) -> Result<bool, String> {
|
||||
match arg {
|
||||
"--target" => {
|
||||
if let Some(arg) = args.next() {
|
||||
self.target = arg;
|
||||
} else {
|
||||
return Err("Expected a value after `--target`, found nothing".to_string());
|
||||
}
|
||||
}
|
||||
"--target-triple" => match args.next() {
|
||||
Some(arg) if !arg.is_empty() => self.target_triple = arg.to_string(),
|
||||
_ => {
|
||||
@ -113,6 +121,9 @@ pub fn setup(
|
||||
if self.target_triple.is_empty() {
|
||||
self.target_triple = self.host_triple.clone();
|
||||
}
|
||||
if self.target.is_empty() && !self.target_triple.is_empty() {
|
||||
self.target = self.target_triple.clone();
|
||||
}
|
||||
|
||||
let mut linker = None;
|
||||
|
||||
@ -243,6 +254,7 @@ pub fn show_usage() {
|
||||
println!(
|
||||
"\
|
||||
--target-triple [arg] : Set the target triple to [arg]
|
||||
--target [arg] : Set the target to [arg]
|
||||
--out-dir : Location where the files will be generated
|
||||
--release : Build in release mode
|
||||
--release-sysroot : Build sysroot in release mode
|
||||
|
@ -482,7 +482,7 @@ fn std_tests(env: &Env, args: &TestArg) -> Result<(), String> {
|
||||
&args.config_info.target_triple,
|
||||
]);
|
||||
run_command_with_env(&command, None, Some(env))?;
|
||||
// FIXME: the compiled binary is not run. Is it normal?
|
||||
// FIXME: the compiled binary is not run.
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user