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