Skip to content

Commit

Permalink
Expose target libdir information via print command.
Browse files Browse the repository at this point in the history
With custom libdir it is required to have an access to library
placement.
  • Loading branch information
o01eg committed Mar 1, 2020
1 parent ee50590 commit 4023e5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ impl RustcDefaultCalls {
println!("{}", targets.join("\n"));
}
Sysroot => println!("{}", sess.sysroot.display()),
TargetLibdir => println!(
"{}",
sess.target_tlib_path.as_ref().unwrap_or(&sess.host_tlib_path).dir.display()
),
TargetSpec => println!("{}", sess.target.target.to_json().pretty()),
FileNames | CrateName => {
let input = input.unwrap_or_else(|| {
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ impl ExternEntry {
pub enum PrintRequest {
FileNames,
Sysroot,
TargetLibdir,
CrateName,
Cfg,
TargetList,
Expand Down Expand Up @@ -1344,6 +1345,7 @@ fn collect_print_requests(
"crate-name" => PrintRequest::CrateName,
"file-names" => PrintRequest::FileNames,
"sysroot" => PrintRequest::Sysroot,
"target-libdir" => PrintRequest::TargetLibdir,
"cfg" => PrintRequest::Cfg,
"target-list" => PrintRequest::TargetList,
"target-cpus" => PrintRequest::TargetCPUs,
Expand Down

0 comments on commit 4023e5d

Please sign in to comment.