librustc: ar call fix to support android cross compile on mac

This commit is contained in:
Young-il Choi 2013-12-06 15:44:27 +09:00
parent 8adbb383c4
commit 19e97f5c5d
1 changed files with 9 additions and 1 deletions

View File

@ -37,7 +37,15 @@ pub struct ArchiveRO {
fn run_ar(sess: Session, args: &str, cwd: Option<&Path>,
paths: &[&Path]) -> ProcessOutput {
let ar = sess.opts.ar.clone().unwrap_or_else(|| ~"ar");
let ar = if sess.opts.target_triple == ~"arm-linux-androideabi" {
match sess.opts.android_cross_path {
Some(ref path) => *path + "/bin/" + "arm-linux-androideabi-ar",
None => ~"arm-linux-androideabi-ar"
}
} else {
sess.opts.ar.clone().unwrap_or_else(|| ~"ar")
};
let mut args = ~[args.to_owned()];
let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
args.extend(&mut paths);