mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 08:53:35 +00:00
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
@ -10,6 +10,7 @@
|
||||
|
||||
//! A helper class for dealing with static archives
|
||||
|
||||
use back::link::{get_ar_prog};
|
||||
use driver::session::Session;
|
||||
use metadata::filesearch;
|
||||
use lib::llvm::{ArchiveRef, llvm};
|
||||
@ -37,7 +38,8 @@ 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 = get_ar_prog(sess);
|
||||
|
||||
let mut args = ~[args.to_owned()];
|
||||
let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
|
||||
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)
|
||||
// instead of hard-coded 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 {
|
||||
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 => {
|
||||
sess.fatal("need Android NDK path for linking \
|
||||
(--android-cross-path)")
|
||||
sess.fatal(format!("need Android NDK path for the '{}' tool \
|
||||
(--android-cross-path)", tool))
|
||||
}
|
||||
},
|
||||
abi::OsWin32 => ~"gcc",
|
||||
_ => ~"cc",
|
||||
_ => tool.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user