1 use rustc_data_structures::temp_dir::MaybeTempDir;
2 use rustc_session::cstore::DllImport;
3 use rustc_session::Session;
4 use rustc_span::symbol::Symbol;
7 use std::path::{Path, PathBuf};
9 pub(super) fn find_library(
12 search_paths: &[PathBuf],
15 // On Windows, static libraries sometimes show up as libfoo.a and other
16 // times show up as foo.lib
17 let oslibname = if verbatim {
20 format!("{}{}{}", sess.target.staticlib_prefix, name, sess.target.staticlib_suffix)
22 let unixlibname = format!("lib{}.a", name);
24 for path in search_paths {
25 debug!("looking for {} inside {:?}", name, path);
26 let test = path.join(&oslibname);
30 if oslibname != unixlibname {
31 let test = path.join(&unixlibname);
38 "could not find native static library `{}`, \
39 perhaps an -L flag is missing?",
44 pub trait ArchiveBuilder<'a> {
45 fn new(sess: &'a Session, output: &Path, input: Option<&Path>) -> Self;
47 fn add_file(&mut self, path: &Path);
48 fn remove_file(&mut self, name: &str);
49 fn src_files(&mut self) -> Vec<String>;
51 fn add_archive<F>(&mut self, archive: &Path, skip: F) -> io::Result<()>
53 F: FnMut(&str) -> bool + 'static;
54 fn update_symbols(&mut self);
58 fn inject_dll_import_lib(
61 dll_imports: &[DllImport],
62 tmpdir: &MaybeTempDir,