1 use rustc_session::Session;
2 use rustc_span::symbol::Symbol;
5 use std::path::{Path, PathBuf};
7 pub fn find_library(name: Symbol, search_paths: &[PathBuf], sess: &Session) -> PathBuf {
8 // On Windows, static libraries sometimes show up as libfoo.a and other
9 // times show up as foo.lib
10 let oslibname = format!(
12 sess.target.target.options.staticlib_prefix,
14 sess.target.target.options.staticlib_suffix
16 let unixlibname = format!("lib{}.a", name);
18 for path in search_paths {
19 debug!("looking for {} inside {:?}", name, path);
20 let test = path.join(&oslibname);
24 if oslibname != unixlibname {
25 let test = path.join(&unixlibname);
32 "could not find native static library `{}`, \
33 perhaps an -L flag is missing?",
38 pub trait ArchiveBuilder<'a> {
39 fn new(sess: &'a Session, output: &Path, input: Option<&Path>) -> Self;
41 fn add_file(&mut self, path: &Path);
42 fn remove_file(&mut self, name: &str);
43 fn src_files(&mut self) -> Vec<String>;
52 fn add_native_library(&mut self, name: Symbol);
53 fn update_symbols(&mut self);