aboutsummaryrefslogtreecommitdiff
path: root/openssl-sys/build.rs
diff options
context:
space:
mode:
authorAndrew Roetker <[email protected]>2017-03-13 15:59:01 -0600
committerAndrew Roetker <[email protected]>2017-03-13 19:18:54 -0600
commit663547a7589806675a26fbd6867838e1b4211790 (patch)
tree74b820ca63cee0e155e585ed792f9be573de837d /openssl-sys/build.rs
parentRelease v0.9.8 (diff)
downloadrust-openssl-663547a7589806675a26fbd6867838e1b4211790.tar.xz
rust-openssl-663547a7589806675a26fbd6867838e1b4211790.zip
(maint) Recreate ability to pass in OPENSSL_LIBS variable
Prior to this commit in 43c951f743e68fac5f45119eda7c994882a1d489 the ability to pass OPENSSL_LIBS was removed from the build.rs of openssl-sys. This commit adds the ability to pass custom names for the OPENSSL_LIBS back in. This is useful for when building openssl across linux and windows with the same lib names (ssl:crypto) and the default names provided by the build script are not valid.
Diffstat (limited to 'openssl-sys/build.rs')
-rw-r--r--openssl-sys/build.rs19
1 files changed, 13 insertions, 6 deletions
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);
}
}