@@ -36,6 +36,9 @@ pub(crate) struct Env {
3636 pub ( crate ) android_ndk_home : Option < PathBuf > ,
3737 pub ( crate ) cmake_toolchain_file : Option < PathBuf > ,
3838 pub ( crate ) cpp_runtime_lib : Option < OsString > ,
39+ /// C compiler (ignored if using FIPS)
40+ pub ( crate ) cc : Option < OsString > ,
41+ pub ( crate ) cxx : Option < OsString > ,
3942 pub ( crate ) docs_rs : bool ,
4043}
4144
@@ -146,18 +149,15 @@ impl Env {
146149 const NORMAL_PREFIX : & str = "BORING_BSSL" ;
147150 const FIPS_PREFIX : & str = "BORING_BSSL_FIPS" ;
148151
152+ let var_prefix = if host == target { "HOST" } else { "TARGET" } ;
149153 let target_with_underscores = target. replace ( '-' , "_" ) ;
150154
151- // Logic stolen from cmake-rs.
152- let target_var = |name : & str | {
153- let kind = if host == target { "HOST" } else { "TARGET" } ;
154-
155- // TODO(rmehra): look for just `name` first, as most people just set that
155+ let target_only_var = |name : & str | {
156156 var ( & format ! ( "{name}_{target}" ) )
157157 . or_else ( || var ( & format ! ( "{name}_{target_with_underscores}" ) ) )
158- . or_else ( || var ( & format ! ( "{kind}_{name}" ) ) )
159- . or_else ( || var ( name) )
158+ . or_else ( || var ( & format ! ( "{var_prefix}_{name}" ) ) )
160159 } ;
160+ let target_var = |name : & str | target_only_var ( name) . or_else ( || var ( name) ) ;
161161
162162 let boringssl_var = |name : & str | {
163163 // The passed name is the non-fips version of the environment variable,
@@ -186,6 +186,9 @@ impl Env {
186186 android_ndk_home : target_var ( "ANDROID_NDK_HOME" ) . map ( Into :: into) ,
187187 cmake_toolchain_file : target_var ( "CMAKE_TOOLCHAIN_FILE" ) . map ( Into :: into) ,
188188 cpp_runtime_lib : target_var ( "BORING_BSSL_RUST_CPPLIB" ) ,
189+ // matches the `cc` crate
190+ cc : target_only_var ( "CC" ) ,
191+ cxx : target_only_var ( "CXX" ) ,
189192 docs_rs : var ( "DOCS_RS" ) . is_some ( ) ,
190193 }
191194 }
0 commit comments