Skip to content

Commit dfd45e7

Browse files
committed
---
yaml --- r: 5683 b: refs/heads/master c: 1f2e999 h: refs/heads/master i: 5681: b7ca476 5679: 4e1a95a v: v3
1 parent 2fa8535 commit dfd45e7

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1391154b1492987a357293c1e3774f9326fc640b
2+
refs/heads/master: 1f2e9992625219aee8fab5037db64169f0d674e2

trunk/src/comp/driver/rustc.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,10 @@ fn build_session_options(match: getopts::match)
397397
ret sopts;
398398
}
399399

400-
fn build_session(binary: str,
401-
sopts: @session::options) -> session::session {
400+
fn build_session(sopts: @session::options) -> session::session {
402401
let target_cfg = build_target_config(sopts);
403402
let cstore = cstore::mk_cstore();
404403
let filesearch = filesearch::mk_filesearch(
405-
binary,
406404
sopts.maybe_sysroot,
407405
sopts.target_triple,
408406
sopts.addl_lib_search_paths);
@@ -456,7 +454,7 @@ fn main(args: [str]) {
456454
ret;
457455
}
458456
let sopts = build_session_options(match);
459-
let sess = build_session(binary, sopts);
457+
let sess = build_session(sopts);
460458
let n_inputs = vec::len::<str>(match.free);
461459
let output_file = getopts::opt_maybe_str(match, "o");
462460
if n_inputs == 0u {
@@ -537,7 +535,7 @@ mod test {
537535
getopts::success(m) { m }
538536
};
539537
let sessopts = build_session_options(match);
540-
let sess = build_session("whatever", sessopts);
538+
let sess = build_session(sessopts);
541539
let cfg = build_configuration(sess, "whatever", "whatever");
542540
assert (attr::contains_name(cfg, "test"));
543541
}
@@ -551,7 +549,7 @@ mod test {
551549
getopts::success(m) { m }
552550
};
553551
let sessopts = build_session_options(match);
554-
let sess = build_session("whatever", sessopts);
552+
let sess = build_session(sessopts);
555553
let cfg = build_configuration(sess, "whatever", "whatever");
556554
let test_items = attr::find_meta_items_by_name(cfg, "test");
557555
assert (vec::len(test_items) == 1u);

trunk/src/comp/util/filesearch.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import std::option;
44
import std::fs;
55
import std::vec;
66
import std::str;
7+
import std::os;
78
import back::link;
89

910
export filesearch;
@@ -26,8 +27,7 @@ type filesearch = obj {
2627
fn get_target_lib_file_path(file: fs::path) -> fs::path;
2728
};
2829

29-
fn mk_filesearch(binary_name: fs::path,
30-
maybe_sysroot: option::t<fs::path>,
30+
fn mk_filesearch(maybe_sysroot: option::t<fs::path>,
3131
target_triple: str,
3232
addl_lib_search_paths: [fs::path]) -> filesearch {
3333
obj filesearch_impl(sysroot: fs::path,
@@ -48,7 +48,7 @@ fn mk_filesearch(binary_name: fs::path,
4848
}
4949
}
5050

51-
let sysroot = get_sysroot(maybe_sysroot, binary_name);
51+
let sysroot = get_sysroot(maybe_sysroot);
5252
log #fmt("using sysroot = %s", sysroot);
5353
ret filesearch_impl(sysroot, addl_lib_search_paths, target_triple);
5454
}
@@ -79,16 +79,18 @@ fn make_target_lib_path(sysroot: fs::path,
7979
ret path;
8080
}
8181

82-
fn get_default_sysroot(binary: fs::path) -> fs::path {
83-
let dirname = fs::dirname(binary);
84-
if str::eq(dirname, binary) { ret "../"; }
85-
ret fs::connect(dirname, "../");
82+
fn get_default_sysroot() -> fs::path {
83+
alt os::get_exe_path() {
84+
option::some(p) { fs::connect(p, "../") }
85+
option::none. {
86+
fail "can't determine value for sysroot";
87+
}
88+
}
8689
}
8790

88-
fn get_sysroot(maybe_sysroot: option::t<fs::path>,
89-
binary: fs::path) -> fs::path {
91+
fn get_sysroot(maybe_sysroot: option::t<fs::path>) -> fs::path {
9092
alt maybe_sysroot {
9193
option::some(sr) { sr }
92-
option::none. { get_default_sysroot(binary) }
94+
option::none. { get_default_sysroot() }
9395
}
9496
}

0 commit comments

Comments
 (0)