about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-01-10 17:45:03 -0800
committerBrian Anderson <banderson@mozilla.com>2012-01-14 13:43:04 -0800
commit9e40e43e743ef622952ba814e471fe94e48dcbb9 (patch)
treeaad4e1409fb9e243c08882ff692fb2e3535ffd54 /src/comp
parent84664304ccc8df4d2fa8c4da6b5edd9f8816fdf0 (diff)
downloadrust-9e40e43e743ef622952ba814e471fe94e48dcbb9.tar.gz
rust-9e40e43e743ef622952ba814e471fe94e48dcbb9.zip
build: Build libraries in the bin directory on win32
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/back/rpath.rs1
-rw-r--r--src/comp/util/filesearch.rs17
2 files changed, 14 insertions, 4 deletions
diff --git a/src/comp/back/rpath.rs b/src/comp/back/rpath.rs
index 16b0c62bf05..417d553c36a 100644
--- a/src/comp/back/rpath.rs
+++ b/src/comp/back/rpath.rs
@@ -191,7 +191,6 @@ fn minimize_rpaths(rpaths: [str]) -> [str] {
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "macos")]
 #[cfg(target_os = "freebsd")]
-#[cfg(test)]
 mod test {
     #[test]
     fn test_rpaths_to_flags() {
diff --git a/src/comp/util/filesearch.rs b/src/comp/util/filesearch.rs
index 7aceaf1ef1a..906a02adec0 100644
--- a/src/comp/util/filesearch.rs
+++ b/src/comp/util/filesearch.rs
@@ -16,6 +16,7 @@ export pick_file;
 export search;
 export relative_target_lib_path;
 export get_cargo_root;
+export libdir;
 
 type pick<T> = block(path: fs::path) -> option::t<T>;
 
@@ -81,7 +82,7 @@ fn search<T: copy>(filesearch: filesearch, pick: pick<T>) -> option::t<T> {
 }
 
 fn relative_target_lib_path(target_triple: str) -> [fs::path] {
-    ["lib", "rustc", target_triple, "lib"]
+    [libdir(), "rustc", target_triple, libdir()]
 }
 
 fn make_target_lib_path(sysroot: fs::path,
@@ -122,6 +123,16 @@ fn get_cargo_root() -> result::t<fs::path, str> {
 
 fn get_cargo_lib_path() -> result::t<fs::path, str> {
     result::chain(get_cargo_root()) { |p|
-        result::ok(fs::connect(p, "lib"))
+        result::ok(fs::connect(p, libdir()))
     }
-}
\ No newline at end of file
+}
+
+// The name of the directory rustc expects libraries to be located.
+// On Unix should be "lib", on windows "bin"
+fn libdir() -> str {
+   let libdir = #env("CFG_LIBDIR");
+   if str::is_empty(libdir) {
+      fail "rustc compiled without CFG_LIBDIR environment variable";
+   }
+   libdir
+}