@@ -28,6 +28,7 @@ enum Version {
28
28
Openssl11x ,
29
29
Openssl10x ,
30
30
Libressl ,
31
+ Boringssl ,
31
32
}
32
33
33
34
fn env_inner ( name : & str ) -> Option < OsString > {
@@ -60,21 +61,9 @@ fn find_openssl(target: &str) -> (Vec<PathBuf>, PathBuf) {
60
61
find_normal:: get_openssl ( target)
61
62
}
62
63
63
- fn check_ssl_kind ( ) {
64
- if cfg ! ( feature = "unstable_boringssl" ) {
65
- println ! ( "cargo:rustc-cfg=boringssl" ) ;
66
- // BoringSSL does not have any build logic, exit early
67
- std:: process:: exit ( 0 ) ;
68
- } else {
69
- println ! ( "cargo:rustc-cfg=openssl" ) ;
70
- }
71
- }
72
-
73
64
fn main ( ) {
74
65
check_rustc_versions ( ) ;
75
66
76
- check_ssl_kind ( ) ;
77
-
78
67
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
79
68
80
69
let ( lib_dirs, include_dir) = find_openssl ( & target) ;
@@ -231,9 +220,21 @@ See rust-openssl documentation for more information:
231
220
}
232
221
233
222
if is_boringssl {
234
- panic ! ( "BoringSSL detected, but `unstable_boringssl` feature wasn't specified." )
223
+ let rust_dir = include_dirs[ 0 ] . join ( ".." ) . join ( "rust" ) ;
224
+ println ! ( "cargo:rustc-cfg=boringssl" ) ;
225
+ println ! ( "cargo:boringssl=true" ) ;
226
+ println ! (
227
+ "cargo:rustc-env=BORINGSSL_RUST_WRAPPER={}/wrapper_{}.rs" ,
228
+ rust_dir. display( ) ,
229
+ env:: var( "TARGET" ) . unwrap( )
230
+ ) ;
231
+ println ! ( "cargo:rustc-link-search=native={}" , rust_dir. display( ) ) ;
232
+ println ! ( "cargo:rustc-link-lib=static=rust_wrapper" ) ;
233
+ // BoringSSL does not have any additional build logic, exit early
234
+ return Version :: Boringssl ;
235
235
}
236
236
237
+ println ! ( "cargo:rustc-cfg=openssl" ) ;
237
238
for enabled in & enabled {
238
239
println ! ( "cargo:rustc-cfg=osslconf=\" {}\" " , enabled) ;
239
240
}
0 commit comments