Skip to content

Commit 11cf9e8

Browse files
committed
---
yaml --- r: 3744 b: refs/heads/master c: 4c30932 h: refs/heads/master v: v3
1 parent 5a000c9 commit 11cf9e8

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 94f0e9d956ed3169848ee334df23ffa724001d80
2+
refs/heads/master: 4c309321e0979552f8c9230c6425c96b59ac80da

trunk/src/comp/metadata/creader.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ fn metadata_matches(&vec[u8] crate_data,
122122
ret true;
123123
}
124124

125-
fn default_native_lib_naming(session::session sess) ->
125+
fn default_native_lib_naming(session::session sess, bool static) ->
126126
rec(str prefix, str suffix) {
127-
if (sess.get_opts().static) {
127+
if (static) {
128128
ret rec(prefix="lib", suffix=".rlib");
129129
}
130130
alt (sess.get_targ_cfg().os) {
@@ -158,7 +158,20 @@ fn find_library_crate(&session::session sess, &ast::ident ident,
158158
}
159159
};
160160

161-
auto nn = default_native_lib_naming(sess);
161+
auto nn = default_native_lib_naming(sess, sess.get_opts().static);
162+
auto x = find_library_crate_aux(nn, crate_name, metas,
163+
library_search_paths);
164+
if (x != none || sess.get_opts().static) {
165+
ret x;
166+
}
167+
auto nn2 = default_native_lib_naming(sess, true);
168+
ret find_library_crate_aux(nn2, crate_name, metas, library_search_paths);
169+
}
170+
171+
fn find_library_crate_aux(&rec(str prefix, str suffix) nn, str crate_name,
172+
&(@ast::meta_item)[] metas,
173+
&vec[str] library_search_paths) ->
174+
option::t[tup(str, vec[u8])] {
162175
let str prefix = nn.prefix + crate_name;
163176
// FIXME: we could probably use a 'glob' function in std::fs but it will
164177
// be much easier to write once the unsafe module knows more about FFI

0 commit comments

Comments
 (0)