Merge pull request #565 from sfackler/no-usr-lib
Make sure to not add system dirs to linkage
This commit is contained in:
commit
f8e4e7935d
|
|
@ -15,11 +15,12 @@ build = "build.rs"
|
|||
libc = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
metadeps = "1"
|
||||
pkg-config = "0.3.9"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
user32-sys = "0.2"
|
||||
gdi32-sys = "0.2"
|
||||
|
||||
# We don't actually use metadeps for annoying reasons but this is still hear for tooling
|
||||
[package.metadata.pkg-config]
|
||||
openssl = "1.0.0" # We actually need 1.0.1, but OpenBSD reports as 1.0.0
|
||||
openssl = "1.0.1"
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue