diff options
| author | Steven Fackler <[email protected]> | 2017-01-24 21:31:41 +0100 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2017-01-24 21:31:41 +0100 |
| commit | 01e46671756d4e729adb0bfd88f3c98638712b5d (patch) | |
| tree | 7c9e857370c98a05337ccf1254662eb885bcd856 /openssl-sys/build.rs | |
| parent | Merge pull request #563 from bluejekyll/master (diff) | |
| download | rust-openssl-01e46671756d4e729adb0bfd88f3c98638712b5d.tar.xz rust-openssl-01e46671756d4e729adb0bfd88f3c98638712b5d.zip | |
Make sure to not add system dirs to linkage
cc #447
Diffstat (limited to 'openssl-sys/build.rs')
| -rw-r--r-- | openssl-sys/build.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index c59a76d4..0e1cdc46 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -1,4 +1,4 @@ -extern crate metadeps; +extern crate pkg_config; use std::collections::HashSet; use std::env; @@ -172,8 +172,16 @@ fn try_pkg_config() { // cflags dirs for showing us lots of `-I`. env::set_var("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS", "1"); - let lib = match metadeps::probe() { - Ok(mut libs) => libs.remove("openssl").unwrap(), + // This is more complex than normal because we need to track down opensslconf.h. + // To do that, we need the inlude paths even if they're on the default search path, but the + // linkage directories emitted from that cause all kinds of issues if other libraries happen to + // live in them. So, we run pkg-config twice, once asking for system dirs but not emitting + // metadata, and a second time emitting metadata but not asking for system dirs. Yay. + let lib = match pkg_config::Config::new() + .cargo_metadata(false) + .print_system_libs(true) + .find("openssl") { + Ok(lib) => lib, Err(_) => return, }; @@ -196,7 +204,7 @@ specific to your distribution: sudo dnf install openssl-devel See rust-openssl README for more information: - + https://github.com/sfackler/rust-openssl#linux "); } @@ -207,6 +215,11 @@ See rust-openssl README for more information: println!("cargo:include={}", include.display()); } + pkg_config::Config::new() + .print_system_libs(false) + .find("openssl") + .unwrap(); + std::process::exit(0); } |