]> git.lizzy.rs Git - rust.git/commitdiff
Get rid of the android-cross-path flag to rustc.
authorLuqman Aden <laden@csclub.uwaterloo.ca>
Tue, 13 May 2014 18:44:30 +0000 (14:44 -0400)
committerLuqman Aden <laden@csclub.uwaterloo.ca>
Wed, 14 May 2014 06:16:14 +0000 (02:16 -0400)
There's no need to include this specific flag just for android. We can
already deal with what it tries to solve by using -C linker=/path/to/cc
and -C ar=/path/to/ar. The Makefiles for rustc already set this up when
we're crosscompiling.

I did add the flag to compiletest though so it can find gdb. Though, I'm
pretty sure we don't run debuginfo tests on android anyways right now.

[breaking-change]

man/rustc.1
mk/platform.mk
mk/tests.mk
src/compiletest/common.rs
src/compiletest/compiletest.rs
src/compiletest/runtest.rs
src/etc/zsh/_rust
src/librustc/back/link.rs
src/librustc/driver/config.rs

index 9e92504e5a77521bf4dc4a48a96ddcd4ac41e834..c88c9cec403ec18a14fe3f00783599dcf02269dc 100644 (file)
@@ -138,9 +138,6 @@ A space-separated list of arguments to pass through to LLVM.
 If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
 throughout compilation in the output directory.
 .TP
-\fBandroid-cross-path\fR=path/to/ndk/bin
-Directory to find the Android NDK cross-compilation tools
-.TP
 \fBno-rpath\fR
 If specified, then the rpath value for dynamic libraries will not be set in
 either dynamic library or executable outputs.
index ecff34159da77274db3a53854242bb255f9b361b..76c9debba8016be85384c8257a7712b30f083526 100644 (file)
@@ -307,7 +307,7 @@ CFG_LDPATH_arm-linux-androideabi :=
 CFG_RUN_arm-linux-androideabi=
 CFG_RUN_TARG_arm-linux-androideabi=
 RUSTC_FLAGS_arm-linux-androideabi :=
-RUSTC_CROSS_FLAGS_arm-linux-androideabi :=-C android-cross-path=$(CFG_ANDROID_CROSS_PATH)
+RUSTC_CROSS_FLAGS_arm-linux-androideabi :=
 
 # arm-unknown-linux-gnueabihf configuration
 CROSS_PREFIX_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-
index 9ce7077e03cccc468d9fdc0326f48d868ad2da4f..befd1a737f7e67a1a096b3c8f1fcf0a99e1ae028 100644 (file)
@@ -601,6 +601,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=                                              \
         --stage-id stage$(1)-$(2)                                                      \
         --target $(2)                                       \
         --host $(3)                                       \
+        --android-cross-path=$(CFG_ANDROID_CROSS_PATH)    \
         --adb-path=$(CFG_ADB)                          \
         --adb-test-dir=$(CFG_ADB_TEST_DIR)                  \
         --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
index ca59f344e288f6e984e3a28394cf80cbf69d48b1..9934a48c856554c1096538333e9e5a3b714beec7 100644 (file)
@@ -126,6 +126,9 @@ pub struct Config {
     // Host triple for the compiler being invoked
     pub host: ~str,
 
+    // Path to the android tools
+    pub android_cross_path: Path,
+
     // Extra parameter to run adb on arm-linux-androideabi
     pub adb_path: ~str,
 
index ee0fe2065303b852d0b014522c70c82cfa0b9f0a..b393b31017d36910b929c8a566357ea19715c276 100644 (file)
@@ -79,6 +79,7 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
           optflag("", "jit", "run tests under the JIT"),
           optopt("", "target", "the target to build for", "TARGET"),
           optopt("", "host", "the host to build for", "HOST"),
+          optopt("", "android-cross-path", "Android NDK standalone path", "PATH"),
           optopt("", "adb-path", "path to the android debugger", "PATH"),
           optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
           optopt("", "lldb-python-dir", "directory containing LLDB's python module", "PATH"),
@@ -142,6 +143,7 @@ fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
         jit: matches.opt_present("jit"),
         target: opt_str2(matches.opt_str("target")).to_str(),
         host: opt_str2(matches.opt_str("host")).to_str(),
+        android_cross_path: opt_path(matches, "android-cross-path"),
         adb_path: opt_str2(matches.opt_str("adb-path")).to_str(),
         adb_test_dir:
             opt_str2(matches.opt_str("adb-test-dir")).to_str(),
@@ -173,6 +175,7 @@ pub fn log_config(config: &Config) {
     logv(c, format!("jit: {}", config.jit));
     logv(c, format!("target: {}", config.target));
     logv(c, format!("host: {}", config.host));
+    logv(c, format!("android-cross-path: {}", config.android_cross_path.display()));
     logv(c, format!("adb_path: {}", config.adb_path));
     logv(c, format!("adb_test_dir: {}", config.adb_test_dir));
     logv(c, format!("adb_device_status: {}", config.adb_device_status));
index d18f1370a9f4769f1e8026d8a42bb29cc4b26ebb..dab1185435d9319c850a5e9ff1dcc95ab644f653 100644 (file)
@@ -347,18 +347,10 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
                 break;
             }
 
-            let args = split_maybe_args(&config.target_rustcflags);
-            let mut tool_path = StrBuf::new();
-            for arg in args.iter() {
-                if arg.contains("android-cross-path=") {
-                    tool_path = StrBuf::from_str(arg.replace("android-cross-path=", ""));
-                    break;
-                }
-            }
-
-            if tool_path.is_empty() {
-                fatal("cannot found android cross path".to_owned());
-            }
+            let tool_path = match config.android_cross_path.as_str() {
+                Some(x) => x.to_strbuf(),
+                None => fatal("cannot find android cross path".to_owned())
+            };
 
             let debugger_script = make_out_name(config, testfile, "debugger.script");
             // FIXME (#9639): This needs to handle non-utf8 paths
index 8986b004898081678150b972ffbf2bd727b96e95..9c821117205422427ae9f68f7321a706833fff17 100644 (file)
@@ -5,7 +5,6 @@ local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug
 typeset -A opt_args
 
 _rustc_opts_switches=(
-    --android-cross-path'[The path to the Android NDK]'
     --ar'[Program to use for managing archives instead of the default.]'
     -c'[Compile and assemble, but do not link]'
     --cfg'[Configure the compilation environment]'
index 588d30ee4af010757b05e50c5194a64c94977882..de6b5925edbdec8c647a48c6ff74a5747c3e886b 100644 (file)
@@ -757,40 +757,15 @@ pub fn get_cc_prog(sess: &Session) -> StrBuf {
     // 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".to_strbuf(),
-        _ => {},
-    }
-
-    get_system_tool(sess, "cc")
+        abi::OsWin32 => "gcc",
+        _ => "cc",
+    }.to_strbuf()
 }
 
 pub fn get_ar_prog(sess: &Session) -> StrBuf {
     match sess.opts.cg.ar {
-        Some(ref ar) => return (*ar).clone(),
-        None => {}
-    }
-
-    get_system_tool(sess, "ar")
-}
-
-fn get_system_tool(sess: &Session, tool: &str) -> StrBuf {
-    match sess.targ_cfg.os {
-        abi::OsAndroid => match sess.opts.cg.android_cross_path {
-            Some(ref path) => {
-                let tool_str = match tool {
-                    "cc" => "gcc",
-                    _ => tool
-                };
-                format_strbuf!("{}/bin/arm-linux-androideabi-{}",
-                               *path,
-                               tool_str)
-            }
-            None => {
-                sess.fatal(format!("need Android NDK path for the '{}' tool \
-                                    (-C android-cross-path)", tool))
-            }
-        },
-        _ => tool.to_strbuf(),
+        Some(ref ar) => (*ar).clone(),
+        None => "ar".to_strbuf()
     }
 }
 
index e9c8d4a58cdefd6a624e306fab25c2f0a96384fd..b60468e85bbf16fc5d569f496638c82a992a45d4 100644 (file)
@@ -294,8 +294,6 @@ fn parse_list(slot: &mut Vec<StrBuf>, v: Option<&str>)
         "a list of arguments to pass to llvm (space separated)"),
     save_temps: bool = (false, parse_bool,
         "save all temporary output files during compilation"),
-    android_cross_path: Option<StrBuf> = (None, parse_opt_string,
-        "the path to the Android NDK"),
     no_rpath: bool = (false, parse_bool,
         "disables setting the rpath in libs/exes"),
     no_prepopulate_passes: bool = (false, parse_bool,