Loading README.md +9 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,15 @@ rust-openssl to a separate installation. ### Windows Install OpenSSL from [here][1]. Cargo will not be able to find OpenSSL if it's On Windows, consider building with [mingw-w64](http://mingw-w64.org/). Build script will try to find mingw in `PATH` environment variable to provide Cargo with location where openssl libs from mingw-w64 package may be found. If you followed guide [Building on Windows](https://github.com/rust-lang/rust#building-on-windows) from rust repo, then you should have [MSYS2](http://msys2.github.io/) with `mingw-w64-openssl` installed as part of `mingw-w64-x86_64-toolchain` (or `mingw-w64-i686-toolchain`) package. Alternatively, install OpenSSL from [here][1]. Cargo will not be able to find OpenSSL if it's installed to the default location. You can either copy the `include/openssl` directory, `libssl32.dll`, and `libeay32.dll` to locations that Cargo can find or pass the location to Cargo via environment variables: Loading openssl-sys/build.rs +32 −1 Original line number Diff line number Diff line Loading @@ -18,13 +18,22 @@ fn main() { build_old_openssl_shim(&info.include_paths); return; } if let Some(mingw_paths) = get_mingw_in_path() { for path in mingw_paths { println!("cargo:rustc-flags=-L native={}", path); } } } let libs_env = env::var("OPENSSL_LIBS").ok(); let libs = match libs_env { Some(ref v) => v.split(":").collect(), None => if target.contains("windows") { if get_mingw_in_path().is_some() && lib_dir.is_none() && include_dir.is_none() { vec!("eay32", "ssleay32") } else { vec!("eay32", "ssl32") } } else { vec!("crypto", "ssl") } Loading Loading @@ -62,3 +71,25 @@ fn build_old_openssl_shim(include_paths: &[PathBuf]) { config.file("src/old_openssl_shim.c") .compile("libold_openssl_shim.a"); } fn get_mingw_in_path() -> Option<Vec<String>> { match env::var_os("PATH") { Some(env_path) => { let paths: Vec<String> = env::split_paths(&env_path).filter_map(|path| { use std::ascii::AsciiExt; match path.to_str() { Some(path_str) => { if path_str.to_ascii_lowercase().contains("mingw") { Some(path_str.to_string()) } else { None } }, None => None } }).collect(); if paths.len() > 0 { Some(paths) } else { None } }, None => None } } Loading
README.md +9 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,15 @@ rust-openssl to a separate installation. ### Windows Install OpenSSL from [here][1]. Cargo will not be able to find OpenSSL if it's On Windows, consider building with [mingw-w64](http://mingw-w64.org/). Build script will try to find mingw in `PATH` environment variable to provide Cargo with location where openssl libs from mingw-w64 package may be found. If you followed guide [Building on Windows](https://github.com/rust-lang/rust#building-on-windows) from rust repo, then you should have [MSYS2](http://msys2.github.io/) with `mingw-w64-openssl` installed as part of `mingw-w64-x86_64-toolchain` (or `mingw-w64-i686-toolchain`) package. Alternatively, install OpenSSL from [here][1]. Cargo will not be able to find OpenSSL if it's installed to the default location. You can either copy the `include/openssl` directory, `libssl32.dll`, and `libeay32.dll` to locations that Cargo can find or pass the location to Cargo via environment variables: Loading
openssl-sys/build.rs +32 −1 Original line number Diff line number Diff line Loading @@ -18,13 +18,22 @@ fn main() { build_old_openssl_shim(&info.include_paths); return; } if let Some(mingw_paths) = get_mingw_in_path() { for path in mingw_paths { println!("cargo:rustc-flags=-L native={}", path); } } } let libs_env = env::var("OPENSSL_LIBS").ok(); let libs = match libs_env { Some(ref v) => v.split(":").collect(), None => if target.contains("windows") { if get_mingw_in_path().is_some() && lib_dir.is_none() && include_dir.is_none() { vec!("eay32", "ssleay32") } else { vec!("eay32", "ssl32") } } else { vec!("crypto", "ssl") } Loading Loading @@ -62,3 +71,25 @@ fn build_old_openssl_shim(include_paths: &[PathBuf]) { config.file("src/old_openssl_shim.c") .compile("libold_openssl_shim.a"); } fn get_mingw_in_path() -> Option<Vec<String>> { match env::var_os("PATH") { Some(env_path) => { let paths: Vec<String> = env::split_paths(&env_path).filter_map(|path| { use std::ascii::AsciiExt; match path.to_str() { Some(path_str) => { if path_str.to_ascii_lowercase().contains("mingw") { Some(path_str.to_string()) } else { None } }, None => None } }).collect(); if paths.len() > 0 { Some(paths) } else { None } }, None => None } }