diff options
| author | Steven Fackler <[email protected]> | 2016-12-20 14:30:56 -0800 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-12-20 14:30:56 -0800 |
| commit | 3cfcf13880247b6faf12cc02cd3f7184e5b84965 (patch) | |
| tree | 9d30ef929a4286884619f363581707ea3e124796 /openssl-sys | |
| parent | Release v0.9.3 (diff) | |
| parent | Merge pull request #535 from Philipp91/patch-1 (diff) | |
| download | rust-openssl-3cfcf13880247b6faf12cc02cd3f7184e5b84965.tar.xz rust-openssl-3cfcf13880247b6faf12cc02cd3f7184e5b84965.zip | |
Merge branch 'master' of github.com:sfackler/rust-openssl
Diffstat (limited to 'openssl-sys')
| -rw-r--r-- | openssl-sys/build.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index b6c8c2de..ce173192 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -11,17 +11,25 @@ use std::process::Command; fn main() { let target = env::var("TARGET").unwrap(); - let openssl_dir = env::var_os("OPENSSL_DIR").unwrap_or_else(|| { - find_openssl_dir(&target) - }); + let lib_dir = env::var_os("OPENSSL_LIB_DIR").map(PathBuf::from); + let include_dir = env::var_os("OPENSSL_INCLUDE_DIR").map(PathBuf::from); + + let (lib_dir, include_dir) = if lib_dir.is_none() || include_dir.is_none() { + let openssl_dir = env::var_os("OPENSSL_DIR").unwrap_or_else(|| { + find_openssl_dir(&target) + }); + let openssl_dir = Path::new(&openssl_dir); + let lib_dir = lib_dir.unwrap_or_else(|| openssl_dir.join("lib")); + let include_dir = include_dir.unwrap_or_else(|| openssl_dir.join("include")); + (lib_dir, include_dir) + } else { + (lib_dir.unwrap(), include_dir.unwrap()) + }; - let lib_dir = Path::new(&openssl_dir).join("lib"); - let include_dir = Path::new(&openssl_dir).join("include"); if !Path::new(&lib_dir).exists() { panic!("OpenSSL library directory does not exist: {}", lib_dir.to_string_lossy()); } - if !Path::new(&include_dir).exists() { panic!("OpenSSL include directory does not exist: {}", include_dir.to_string_lossy()); |