c120464be0
This commit won't be quite as useful until I implement RUST_PATH and until we change `extern mod` to take a general string instead of an identifier (#5682 and #6407). With that said, now if you're using rustpkg and a program contains: extern mod foo; rustpkg will attempt to search for `foo`, so that you don't have to provide a -L directory explicitly. In addition, rustpkg will actually try to build and install `foo`, unless it's already installed (specifically, I tested that `extern mod extra;` would not cause it to try to find source for `extra` and compile it again). This is as per #5681. Incidentally, I changed some driver code to infer the link name from the crate link_meta attributes. If that change isn't ok, say something. Also, I changed the addl_lib_search_paths field in the session options to be an @mut ~[Path] so that it can be modified after expansion but before later phases.
25 lines
1.1 KiB
Rust
25 lines
1.1 KiB
Rust
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
use path_util::installed_library_in_workspace;
|
|
use core::prelude::*;
|
|
|
|
/// If a library with path `p` matching pkg_id's name exists under sroot_opt,
|
|
/// return Some(p). Return None if there's no such path or if sroot_opt is None.
|
|
pub fn find_library_in_search_path(sroot_opt: Option<@Path>, short_name: &str) -> Option<Path> {
|
|
match sroot_opt {
|
|
Some(sroot) => {
|
|
debug!("Will search for a library with short name %s in \
|
|
%s", short_name, (sroot.push("lib")).to_str());
|
|
installed_library_in_workspace(short_name, sroot)
|
|
}
|
|
None => None
|
|
}
|
|
} |