aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2017-03-14 10:30:08 -0700
committerGitHub <[email protected]>2017-03-14 10:30:08 -0700
commit7f2a8671d8e8c22d5015fbc27bcdfd2371cd2859 (patch)
tree74b820ca63cee0e155e585ed792f9be573de837d
parentRelease v0.9.8 (diff)
parent(maint) Recreate ability to pass in OPENSSL_LIBS variable (diff)
downloadrust-openssl-7f2a8671d8e8c22d5015fbc27bcdfd2371cd2859.tar.xz
rust-openssl-7f2a8671d8e8c22d5015fbc27bcdfd2371cd2859.zip
Merge pull request #598 from ajroetker/maint/recreate_ability_to_pass_in_OPENSSL_LIBS
(maint) Recreate ability to pass in OPENSSL_LIBS variable
-rw-r--r--README.md2
-rw-r--r--openssl-sys/build.rs19
2 files changed, 15 insertions, 6 deletions
diff --git a/README.md b/README.md
index 579a6872..365d57b1 100644
--- a/README.md
+++ b/README.md
@@ -133,6 +133,8 @@ The build script can be configured via environment variables:
(if specified).
* `OPENSSL_STATIC` - If specified, OpenSSL libraries will be statically rather
than dynamically linked.
+* `OPENSSL_LIBS` - If specified, the names of the OpenSSL libraries that will be
+ linked, e.g. `ssl:crypto`.
If `OPENSSL_DIR` is specified, then the build script will skip the pkg-config
step.
diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs
index fc0f4680..969c5983 100644
--- a/openssl-sys/build.rs
+++ b/openssl-sys/build.rs
@@ -65,16 +65,23 @@ fn main() {
let version = validate_headers(&[include_dir.clone().into()]);
- let libs = match version {
- Version::Openssl101 | Version::Openssl102 if target.contains("windows") => {
- ["ssleay32", "libeay32"]
+ let libs_env = env::var("OPENSSL_LIBS").ok();
+ let libs = match libs_env {
+ Some(ref v) => v.split(":").collect(),
+ None => {
+ match version {
+ Version::Openssl101 | Version::Openssl102 if target.contains("windows") => {
+ vec!["ssleay32", "libeay32"]
+ }
+ Version::Openssl110 if target.contains("windows") => vec!["libssl", "libcrypto"],
+ _ => vec!["ssl", "crypto"],
+ }
}
- Version::Openssl110 if target.contains("windows") => ["libssl", "libcrypto"],
- _ => ["ssl", "crypto"],
};
+
let kind = determine_mode(Path::new(&lib_dir), &libs);
- for lib in libs.iter() {
+ for lib in libs.into_iter() {
println!("cargo:rustc-link-lib={}={}", kind, lib);
}
}