Skip to content

rustc: Recognize -L framework=foo #21944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions man/rustc.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ Display the help message
\fB\-\-cfg\fR SPEC
Configure the compilation environment
.TP
\fB\-L\fR PATH
Add a directory to the library search path
.TP
\fB\-l\fR NAME[:KIND]
\fB\-L\fR [KIND=]PATH
Add a directory to the library search path. The optional KIND can be one of:
dependency = only lookup transitive dependencies here
crate = only lookup local `extern crate` directives here
native = only lookup native libraries here
framework = only look for OSX frameworks here
all = look for anything here (the default)
.TP
\fB\-l\fR [KIND=]NAME
Link the generated crate(s) to the specified native library NAME. The optional
KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.
.TP
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
vec![
opt::flag("h", "help", "Display this message"),
opt::multi("", "cfg", "Configure the compilation environment", "SPEC"),
opt::multi("L", "", "Add a directory to the library search path", "PATH"),
opt::multi("L", "", "Add a directory to the library search path",
"[KIND=]PATH"),
opt::multi("l", "", "Link the generated crate(s) to the specified native
library NAME. The optional KIND can be one of,
static, dylib, or framework. If omitted, dylib is
Expand Down
3 changes: 3 additions & 0 deletions src/librustc/session/search_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub enum PathKind {
Native,
Crate,
Dependency,
Framework,
ExternFlag,
All,
}
Expand All @@ -41,6 +42,8 @@ impl SearchPaths {
(PathKind::Crate, &path["crate=".len()..])
} else if path.starts_with("dependency=") {
(PathKind::Dependency, &path["dependency=".len()..])
} else if path.starts_with("framework=") {
(PathKind::Framework, &path["framework=".len()..])
} else if path.starts_with("all=") {
(PathKind::All, &path["all=".len()..])
} else {
Expand Down
7 changes: 5 additions & 2 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,11 @@ fn link_args(cmd: &mut Command,
// in the current crate. Upstream crates with native library dependencies
// may have their native library pulled in above.
fn add_local_native_libraries(cmd: &mut Command, sess: &Session) {
sess.target_filesearch(PathKind::All).for_each_lib_search_path(|path, _| {
cmd.arg("-L").arg(path);
sess.target_filesearch(PathKind::All).for_each_lib_search_path(|path, k| {
match k {
PathKind::Framework => { cmd.arg("-F").arg(path); }
_ => { cmd.arg("-L").arg(path); }
}
FileDoesntMatch
});

Expand Down