auto merge of #10900 : yichoi/rust/mac_android_cross, r=alexcrichton
this patch should be followed by https://github.com/alexcrichton/libuv/pull/2
This commit is contained in:
commit
a6d3e57dca
2 changed files with 31 additions and 6 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
//! A helper class for dealing with static archives
|
//! A helper class for dealing with static archives
|
||||||
|
|
||||||
|
use back::link::{get_ar_prog};
|
||||||
use driver::session::Session;
|
use driver::session::Session;
|
||||||
use metadata::filesearch;
|
use metadata::filesearch;
|
||||||
use lib::llvm::{ArchiveRef, llvm};
|
use lib::llvm::{ArchiveRef, llvm};
|
||||||
|
@ -37,7 +38,8 @@ pub struct ArchiveRO {
|
||||||
|
|
||||||
fn run_ar(sess: Session, args: &str, cwd: Option<&Path>,
|
fn run_ar(sess: Session, args: &str, cwd: Option<&Path>,
|
||||||
paths: &[&Path]) -> ProcessOutput {
|
paths: &[&Path]) -> ProcessOutput {
|
||||||
let ar = sess.opts.ar.clone().unwrap_or_else(|| ~"ar");
|
let ar = get_ar_prog(sess);
|
||||||
|
|
||||||
let mut args = ~[args.to_owned()];
|
let mut args = ~[args.to_owned()];
|
||||||
let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
|
let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
|
||||||
args.extend(&mut paths);
|
args.extend(&mut paths);
|
||||||
|
|
|
@ -723,16 +723,39 @@ pub fn get_cc_prog(sess: Session) -> ~str {
|
||||||
// It would be flexible to use cc (system's default C compiler)
|
// It would be flexible to use cc (system's default C compiler)
|
||||||
// instead of hard-coded gcc.
|
// instead of hard-coded gcc.
|
||||||
// For win32, there is no cc command, so we add a condition to make it use gcc.
|
// For win32, there is no cc command, so we add a condition to make it use gcc.
|
||||||
|
match sess.targ_cfg.os {
|
||||||
|
abi::OsWin32 => return ~"gcc",
|
||||||
|
_ => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
get_system_tool(sess, "cc")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_ar_prog(sess: Session) -> ~str {
|
||||||
|
match sess.opts.ar {
|
||||||
|
Some(ref ar) => return ar.to_owned(),
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
get_system_tool(sess, "ar")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_system_tool(sess: Session, tool: &str) -> ~str {
|
||||||
match sess.targ_cfg.os {
|
match sess.targ_cfg.os {
|
||||||
abi::OsAndroid => match sess.opts.android_cross_path {
|
abi::OsAndroid => match sess.opts.android_cross_path {
|
||||||
Some(ref path) => format!("{}/bin/arm-linux-androideabi-gcc", *path),
|
Some(ref path) => {
|
||||||
|
let tool_str = match tool {
|
||||||
|
"cc" => "gcc",
|
||||||
|
_ => tool
|
||||||
|
};
|
||||||
|
format!("{}/bin/arm-linux-androideabi-{}", *path, tool_str)
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
sess.fatal("need Android NDK path for linking \
|
sess.fatal(format!("need Android NDK path for the '{}' tool \
|
||||||
(--android-cross-path)")
|
(--android-cross-path)", tool))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
abi::OsWin32 => ~"gcc",
|
_ => tool.to_owned(),
|
||||||
_ => ~"cc",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue