aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2017-01-25 11:59:06 +0100
committerGitHub <[email protected]>2017-01-25 11:59:06 +0100
commitf8e4e7935d3396b62a262950f3412752b15a6a45 (patch)
tree7c9e857370c98a05337ccf1254662eb885bcd856
parentMerge pull request #563 from bluejekyll/master (diff)
parentMake sure to not add system dirs to linkage (diff)
downloadrust-openssl-f8e4e7935d3396b62a262950f3412752b15a6a45.tar.xz
rust-openssl-f8e4e7935d3396b62a262950f3412752b15a6a45.zip
Merge pull request #565 from sfackler/no-usr-lib
Make sure to not add system dirs to linkage
-rw-r--r--openssl-sys/Cargo.toml5
-rw-r--r--openssl-sys/build.rs21
2 files changed, 20 insertions, 6 deletions
diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml
index fe484a79..1f1750dc 100644
--- a/openssl-sys/Cargo.toml
+++ b/openssl-sys/Cargo.toml
@@ -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"
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);
}