From 9e40e43e743ef622952ba814e471fe94e48dcbb9 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 10 Jan 2012 17:45:03 -0800 Subject: build: Build libraries in the bin directory on win32 --- src/comp/back/rpath.rs | 1 - src/comp/util/filesearch.rs | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/comp') 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 = block(path: fs::path) -> option::t; @@ -81,7 +82,7 @@ fn search(filesearch: filesearch, pick: pick) -> option::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 { fn get_cargo_lib_path() -> result::t { 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 +} -- cgit 1.4.1-3-g733a5