Support linking of rlib files in rustpkg

This commit is contained in:
Jan Niklas Hasse 2014-01-12 02:31:33 +01:00
parent 68ebe8141a
commit 76967a008b

View File

@ -226,10 +226,13 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
};
debug!("dir has {:?} entries", dir_contents.len());
let lib_prefix = format!("{}{}", os::consts::DLL_PREFIX, short_name);
let lib_filetype = os::consts::DLL_EXTENSION;
let dll_prefix = format!("{}{}", os::consts::DLL_PREFIX, short_name);
let dll_filetype = os::consts::DLL_EXTENSION;
let rlib_prefix = format!("{}{}", "lib", short_name);
let rlib_filetype = "rlib";
debug!("lib_prefix = {} and lib_filetype = {}", lib_prefix, lib_filetype);
debug!("dll_prefix = {} and dll_filetype = {}", dll_prefix, dll_filetype);
debug!("rlib_prefix = {} and rlib_filetype = {}", rlib_prefix, rlib_filetype);
// Find a filename that matches the pattern:
// (lib_prefix)-hash-(version)(lib_suffix)
@ -238,7 +241,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
debug!("p = {}, p's extension is {:?}", p.display(), extension);
match extension {
None => false,
Some(ref s) => lib_filetype == *s
Some(ref s) => dll_filetype == *s || rlib_filetype == *s,
}
});
@ -261,8 +264,12 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
Some(ref found_vers) if version == found_vers => {
match f_name.slice(0, i).rfind('-') {
Some(j) => {
debug!("Maybe {} equals {}", f_name.slice(0, j), lib_prefix);
if f_name.slice(0, j) == lib_prefix {
let lib_prefix = match p_path.extension_str() {
Some(ref s) if dll_filetype == *s => &dll_prefix,
_ => &rlib_prefix,
};
debug!("Maybe {} equals {}", f_name.slice(0, j), *lib_prefix);
if f_name.slice(0, j) == *lib_prefix {
result_filename = Some(p_path.clone());
}
break;