build: Build libraries in the bin directory on win32

This commit is contained in:
Brian Anderson 2012-01-10 17:45:03 -08:00
parent 79d489cedf
commit c00ec5f9c9
5 changed files with 42 additions and 12 deletions

View file

@ -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() {

View file

@ -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>;
@ -80,7 +81,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,
@ -121,6 +122,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()))
}
}
}
// 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
}