about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-21 17:26:14 -0800
committerbors <bors@rust-lang.org>2014-01-21 17:26:14 -0800
commitf8477c9da5ed784f5981611b6c12623cd2b44806 (patch)
treedb5a4450a71091410420ec9f4552b3191bfe63ac
parent918a7314a8d49d870ff95f8ed6c7bdc5895138c9 (diff)
parent6ccc1e88b7bdfde84df408eb559197ba786dbb22 (diff)
downloadrust-f8477c9da5ed784f5981611b6c12623cd2b44806.tar.gz
rust-f8477c9da5ed784f5981611b6c12623cd2b44806.zip
auto merge of #11500 : jhasse/rust/patch-rlib, r=alexcrichton
Currently `rustpkg` only looks for shared libraries. After this patch it also looks for `*.rlib` files.
-rw-r--r--src/librustpkg/path_util.rs37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/librustpkg/path_util.rs b/src/librustpkg/path_util.rs
index 78ff748c3b9..3c91e660784 100644
--- a/src/librustpkg/path_util.rs
+++ b/src/librustpkg/path_util.rs
@@ -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,
         }
     });
 
@@ -258,17 +261,21 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
                 Some(i) => {
                     debug!("Maybe {} is a version", f_name.slice(i + 1, f_name.len()));
                     match try_parsing_version(f_name.slice(i + 1, f_name.len())) {
-                       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 {
-                                       result_filename = Some(p_path.clone());
-                                   }
-                                   break;
-                               }
-                               None => break
-                           }
+                        Some(ref found_vers) if version == found_vers => {
+                            match f_name.slice(0, i).rfind('-') {
+                                Some(j) => {
+                                    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;
+                                }
+                                None => break
+                            }
 
                        }
                        _ => { f_name = f_name.slice(0, i); }