File tree 2 files changed +32
-6
lines changed
2 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,18 @@ installation via an environment variable:
73
73
set OPENSSL_DIR=C:\OpenSSL-Win64
74
74
```
75
75
76
+ Note that this OpenSSL distribution does not ship with any root certificates.
77
+ So to make requests to servers on the internet, you have to install them
78
+ manually. Download the [ cacert.pem file from here] , copy it somewhere safe
79
+ (` C:\OpenSSL-Win64\certs ` is a good place) and point the ` SSL_CERT_FILE `
80
+ environment variable there:
81
+
82
+ ```
83
+ set SSL_CERT_FILE=C:\OpenSSL-Win64\certs\cacert.pem
84
+ ```
85
+
86
+ [ cacert.pem file from here ] : https://curl.haxx.se/docs/caextract.html
87
+
76
88
After that, you're just a ` cargo build ` away!
77
89
78
90
### Windows GNU (MinGW)
@@ -102,6 +114,12 @@ The build script can be configured via environment variables:
102
114
* ` OPENSSL_DIR ` - If specified, a directory that will be used to find
103
115
OpenSSL installation. It's expected that under this directory the ` include `
104
116
folder has header files and a ` lib ` folder has the runtime libraries.
117
+ * ` OPENSSL_LIB_DIR ` - If specified, a directory that will be used to find
118
+ OpenSSL libraries. Overrides the ` lib ` folder implied by ` OPENSSL_DIR `
119
+ (if specified).
120
+ * ` OPENSSL_INCLUDE_DIR ` - If specified, a directory that will be used to find
121
+ OpenSSL header files. Overrides the ` include ` folder implied by ` OPENSSL_DIR `
122
+ (if specified).
105
123
* ` OPENSSL_STATIC ` - If specified, OpenSSL libraries will be statically rather
106
124
than dynamically linked.
107
125
Original file line number Diff line number Diff line change @@ -11,17 +11,25 @@ use std::process::Command;
11
11
fn main ( ) {
12
12
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
13
13
14
- let openssl_dir = env:: var_os ( "OPENSSL_DIR" ) . unwrap_or_else ( || {
15
- find_openssl_dir ( & target)
16
- } ) ;
14
+ let lib_dir = env:: var_os ( "OPENSSL_LIB_DIR" ) . map ( PathBuf :: from) ;
15
+ let include_dir = env:: var_os ( "OPENSSL_INCLUDE_DIR" ) . map ( PathBuf :: from) ;
16
+
17
+ let ( lib_dir, include_dir) = if lib_dir. is_none ( ) || include_dir. is_none ( ) {
18
+ let openssl_dir = env:: var_os ( "OPENSSL_DIR" ) . unwrap_or_else ( || {
19
+ find_openssl_dir ( & target)
20
+ } ) ;
21
+ let openssl_dir = Path :: new ( & openssl_dir) ;
22
+ let lib_dir = lib_dir. unwrap_or_else ( || openssl_dir. join ( "lib" ) ) ;
23
+ let include_dir = include_dir. unwrap_or_else ( || openssl_dir. join ( "include" ) ) ;
24
+ ( lib_dir, include_dir)
25
+ } else {
26
+ ( lib_dir. unwrap ( ) , include_dir. unwrap ( ) )
27
+ } ;
17
28
18
- let lib_dir = Path :: new ( & openssl_dir) . join ( "lib" ) ;
19
- let include_dir = Path :: new ( & openssl_dir) . join ( "include" ) ;
20
29
if !Path :: new ( & lib_dir) . exists ( ) {
21
30
panic ! ( "OpenSSL library directory does not exist: {}" ,
22
31
lib_dir. to_string_lossy( ) ) ;
23
32
}
24
-
25
33
if !Path :: new ( & include_dir) . exists ( ) {
26
34
panic ! ( "OpenSSL include directory does not exist: {}" ,
27
35
include_dir. to_string_lossy( ) ) ;
You can’t perform that action at this time.
0 commit comments