aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authora.navrotskiy <[email protected]>2015-05-07 16:47:59 +0300
committera.navrotskiy <[email protected]>2015-05-07 16:57:07 +0300
commit59c8a8883910518c7f32305ab3358dae78d86ae1 (patch)
tree5165aececde7ada4d43838599ec9644235a88d3f
parentMerge pull request #210 from manuels/pending (diff)
downloadrust-openssl-59c8a8883910518c7f32305ab3358dae78d86ae1.tar.xz
rust-openssl-59c8a8883910518c7f32305ab3358dae78d86ae1.zip
Add ability to redefine library list via OPENSSL_LIBS environment variable.
It's usefull for compiling with MinGW-w64 installed via MSYS2 (https://wiki.qt.io/MSYS2).
-rw-r--r--openssl-sys/build.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs
index aadaa361..89bd52f8 100644
--- a/openssl-sys/build.rs
+++ b/openssl-sys/build.rs
@@ -20,10 +20,14 @@ fn main() {
}
}
- let (libcrypto, libssl) = if target.contains("windows") {
- ("eay32", "ssl32")
- } else {
- ("crypto", "ssl")
+ let libs_env = env::var("OPENSSL_LIBS").ok();
+ let libs = match libs_env {
+ Some(ref v) => v.split(":").collect(),
+ None => if target.contains("windows") && env::var_os("MSYSTEM").is_none() {
+ vec!("eay32", "ssl32")
+ } else {
+ vec!("crypto", "ssl")
+ }
};
let mode = if env::var_os("OPENSSL_STATIC").is_some() {
@@ -36,7 +40,8 @@ fn main() {
println!("cargo:rustc-flags=-L native={}", lib_dir);
}
- println!("cargo:rustc-flags=-l {0}={1} -l {0}={2}", mode, libcrypto, libssl);
+ let libs_arg = libs.iter().fold(String::new(), |args, lib| args + &format!(" -l {0}={1}", mode, lib));
+ println!("cargo:rustc-flags={0}", libs_arg);
let mut include_dirs = vec![];