aboutsummaryrefslogtreecommitdiff
path: root/openssl-sys
diff options
context:
space:
mode:
authorSimon Mazur <[email protected]>2015-06-10 03:37:01 +0300
committerSimon Mazur <[email protected]>2015-06-10 03:37:01 +0300
commitc532c1992e3b6c1dd009fa2d490fe069fca8a8b4 (patch)
tree2f3ac0af34081115a723220aac97c28fcad1ece1 /openssl-sys
parentMerge pull request #223 from Manishearth/patch-2 (diff)
downloadrust-openssl-c532c1992e3b6c1dd009fa2d490fe069fca8a8b4.tar.xz
rust-openssl-c532c1992e3b6c1dd009fa2d490fe069fca8a8b4.zip
Added support for building on Windows with MinGW
Diffstat (limited to 'openssl-sys')
-rw-r--r--openssl-sys/build.rs31
1 files changed, 30 insertions, 1 deletions
diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs
index 51d78ffc..ff4a213e 100644
--- a/openssl-sys/build.rs
+++ b/openssl-sys/build.rs
@@ -24,7 +24,14 @@ fn main() {
let libs = match libs_env {
Some(ref v) => v.split(":").collect(),
None => if target.contains("windows") {
- vec!("eay32", "ssl32")
+ if let Some(mingw_paths) = check_mingw_path() {
+ for path in mingw_paths {
+ println!("cargo:rustc-flags=-L native={}", path);
+ }
+ vec!("eay32", "ssleay32")
+ } else {
+ vec!("eay32", "ssl32")
+ }
} else {
vec!("crypto", "ssl")
}
@@ -62,3 +69,25 @@ fn build_old_openssl_shim(include_paths: &[PathBuf]) {
config.file("src/old_openssl_shim.c")
.compile("libold_openssl_shim.a");
}
+
+fn check_mingw_path() -> Option<Vec<String>> {
+ use std::ascii::AsciiExt;
+
+ let mut paths = vec![];
+
+ if let Some(env_path) = env::var("PATH").ok() {
+ for path in env::split_paths(&env_path) {
+ if let Some(path_str) = path.to_str() {
+ if path_str.to_ascii_lowercase().contains("mingw") {
+ paths.push(path_str.to_string());
+ }
+ }
+ }
+ }
+
+ if paths.len() > 0 {
+ Option::Some(paths)
+ } else {
+ Option::None
+ }
+}