mk: --android-cross-path to rustc

This commit is contained in:
Young-il Choi 2013-03-05 13:12:23 +09:00
parent 995a019dff
commit a35dc95969
6 changed files with 29 additions and 11 deletions

View File

@ -143,6 +143,7 @@ CFG_PATH_MUNGE_arm-unknown-android := true
CFG_LDPATH_arm-unknown-android :=
CFG_RUN_arm-unknown-android=
CFG_RUN_TARG_arm-unknown-android=
RUSTC_FLAGS_arm-unknown-android :=--android-cross-path='$(CFG_ANDROID_CROSS_PATH)'
# i686-pc-mingw32 configuration
CFG_LIB_NAME_i686-pc-mingw32=$(1).dll

View File

@ -774,11 +774,18 @@ pub fn link_binary(sess: Session,
// instead of hard-coded gcc.
// For win32, there is no cc command,
// so we add a condition to make it use gcc.
let cc_prog: ~str =
if sess.targ_cfg.os == session::os_android {
~"arm-linux-androideabi-g++"
} else if sess.targ_cfg.os == session::os_win32 { ~"gcc" }
else { ~"cc" };
let cc_prog: ~str = if sess.targ_cfg.os == session::os_android {
match &sess.opts.android_cross_path {
&Some(copy path) => {
fmt!("%s/bin/arm-linux-androideabi-gcc", path)
}
&None => {
sess.fatal(~"need Android NDK path for linking \
(--android-cross-path)")
}
}
} else if sess.targ_cfg.os == session::os_win32 { ~"gcc" }
else { ~"cc" };
// The invocations of cc share some flags across platforms
let mut cc_args =
@ -876,9 +883,7 @@ pub fn link_binary(sess: Session,
}
// Stack growth requires statically linking a __morestack function
if sess.targ_cfg.os != session::os_android {
cc_args.push(~"-lmorestack");
}
// FIXME (#2397): At some point we want to rpath our guesses as to where
// extern libraries might live, based on the addl_lib_search_paths

View File

@ -641,6 +641,8 @@ pub fn build_session_options(+binary: ~str,
.map(|s| Path(*s));
let cfg = parse_cfgspecs(getopts::opt_strs(matches, ~"cfg"));
let test = opt_present(matches, ~"test");
let android_cross_path = getopts::opt_maybe_str(
matches, ~"android-cross-path");
let sopts = @session::options {
crate_type: crate_type,
is_static: static,
@ -660,7 +662,8 @@ pub fn build_session_options(+binary: ~str,
test: test,
parse_only: parse_only,
no_trans: no_trans,
debugging_opts: debugging_opts
debugging_opts: debugging_opts,
android_cross_path: android_cross_path
};
return sopts;
}
@ -764,6 +767,8 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
to compile for (see
http://sources.redhat.com/autobook/autobook/autobook_17.html
for detail)", ~"TRIPLE"),
optopt(~"", ~"android-cross-path",
~"The path to the Android NDK", "PATH"),
optmulti(~"W", ~"warn",
~"Set lint warnings", ~"OPT"),
optmulti(~"A", ~"allow",

View File

@ -140,6 +140,7 @@ pub struct options {
parse_only: bool,
no_trans: bool,
debugging_opts: uint,
android_cross_path: Option<~str>
}
pub struct crate_metadata {
@ -289,7 +290,8 @@ pub fn basic_options() -> @options {
test: false,
parse_only: false,
no_trans: false,
debugging_opts: 0u
debugging_opts: 0u,
android_cross_path: None
}
}

View File

@ -49,6 +49,7 @@ public:
case 0: return NULL;
case 1: return m_annihilate_fn;
default: assert(false && "Unknown crate map version!");
return NULL; // Appease -Werror=return-type
}
}
@ -57,6 +58,7 @@ public:
case 0: return reinterpret_cast<const cratemap_v0 *>(this)->m_entries;
case 1: return m_entries;
default: assert(false && "Unknown crate map version!");
return NULL; // Appease -Werror=return-type
}
}
@ -68,6 +70,7 @@ public:
case 1:
return &m_children[1];
default: assert(false && "Unknown crate map version!");
return NULL; // Appease -Werror=return-type
}
}

View File

@ -314,9 +314,11 @@ void update_log_settings(void* crate_map, char* settings) {
n_dirs, &n_matches);
if (n_matches < n_dirs) {
printf("warning: got %" PRIdPTR " RUST_LOG specs, "
// NOTE: Android compiler is complaining about format specifiers here
// and I don't understand why
/*printf("warning: got %" PRIdPTR " RUST_LOG specs, "
"enabled %" PRIdPTR " flags.",
(uintptr_t)n_dirs, (uintptr_t)n_matches);
(uintptr_t)n_dirs, (uintptr_t)n_matches);*/
}
free(buffer);