Merge branch 'master' of github.com:sfackler/rust-openssl
This commit is contained in:
commit
3cfcf13880
18
README.md
18
README.md
|
|
@ -73,6 +73,18 @@ installation via an environment variable:
|
||||||
set OPENSSL_DIR=C:\OpenSSL-Win64
|
set OPENSSL_DIR=C:\OpenSSL-Win64
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that this OpenSSL distribution does not ship with any root certificates.
|
||||||
|
So to make requests to servers on the internet, you have to install them
|
||||||
|
manually. Download the [cacert.pem file from here], copy it somewhere safe
|
||||||
|
(`C:\OpenSSL-Win64\certs` is a good place) and point the `SSL_CERT_FILE`
|
||||||
|
environment variable there:
|
||||||
|
|
||||||
|
```
|
||||||
|
set SSL_CERT_FILE=C:\OpenSSL-Win64\certs\cacert.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
[cacert.pem file from here]: https://curl.haxx.se/docs/caextract.html
|
||||||
|
|
||||||
After that, you're just a `cargo build` away!
|
After that, you're just a `cargo build` away!
|
||||||
|
|
||||||
### Windows GNU (MinGW)
|
### Windows GNU (MinGW)
|
||||||
|
|
@ -102,6 +114,12 @@ The build script can be configured via environment variables:
|
||||||
* `OPENSSL_DIR` - If specified, a directory that will be used to find
|
* `OPENSSL_DIR` - If specified, a directory that will be used to find
|
||||||
OpenSSL installation. It's expected that under this directory the `include`
|
OpenSSL installation. It's expected that under this directory the `include`
|
||||||
folder has header files and a `lib` folder has the runtime libraries.
|
folder has header files and a `lib` folder has the runtime libraries.
|
||||||
|
* `OPENSSL_LIB_DIR` - If specified, a directory that will be used to find
|
||||||
|
OpenSSL libraries. Overrides the `lib` folder implied by `OPENSSL_DIR`
|
||||||
|
(if specified).
|
||||||
|
* `OPENSSL_INCLUDE_DIR` - If specified, a directory that will be used to find
|
||||||
|
OpenSSL header files. Overrides the `include` folder implied by `OPENSSL_DIR`
|
||||||
|
(if specified).
|
||||||
* `OPENSSL_STATIC` - If specified, OpenSSL libraries will be statically rather
|
* `OPENSSL_STATIC` - If specified, OpenSSL libraries will be statically rather
|
||||||
than dynamically linked.
|
than dynamically linked.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,25 @@ use std::process::Command;
|
||||||
fn main() {
|
fn main() {
|
||||||
let target = env::var("TARGET").unwrap();
|
let target = env::var("TARGET").unwrap();
|
||||||
|
|
||||||
let openssl_dir = env::var_os("OPENSSL_DIR").unwrap_or_else(|| {
|
let lib_dir = env::var_os("OPENSSL_LIB_DIR").map(PathBuf::from);
|
||||||
find_openssl_dir(&target)
|
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() {
|
if !Path::new(&lib_dir).exists() {
|
||||||
panic!("OpenSSL library directory does not exist: {}",
|
panic!("OpenSSL library directory does not exist: {}",
|
||||||
lib_dir.to_string_lossy());
|
lib_dir.to_string_lossy());
|
||||||
}
|
}
|
||||||
|
|
||||||
if !Path::new(&include_dir).exists() {
|
if !Path::new(&include_dir).exists() {
|
||||||
panic!("OpenSSL include directory does not exist: {}",
|
panic!("OpenSSL include directory does not exist: {}",
|
||||||
include_dir.to_string_lossy());
|
include_dir.to_string_lossy());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue