3
3
4
4
use crate :: OutputLib :: { Crypto , RustWrapper , Ssl } ;
5
5
use crate :: {
6
- cargo_env, emit_rustc_cfg, emit_warning, execute_command, is_cpu_jitter_entropy , is_no_asm ,
7
- option_env , target , target_arch, target_env, target_family, target_os , target_underscored ,
8
- target_vendor, OutputLibType , TestCommandResult ,
6
+ cargo_env, effective_target , emit_rustc_cfg, emit_warning, execute_command,
7
+ is_cpu_jitter_entropy , is_no_asm , option_env , target_arch, target_env, target_family,
8
+ target_os , target_underscored , target_vendor, OutputLibType , TestCommandResult ,
9
9
} ;
10
10
use std:: collections:: HashMap ;
11
11
use std:: env;
@@ -111,6 +111,15 @@ impl CmakeBuilder {
111
111
emit_rustc_cfg ( "cpu_jitter_entropy" ) ;
112
112
}
113
113
114
+ if let Some ( cc) = option_env ! ( "AWS_LC_FIPS_SYS_CC" ) {
115
+ env:: set_var ( "CC" , cc) ;
116
+ emit_warning ( & format ! ( "Setting CC: {}" , cc) ) ;
117
+ }
118
+ if let Some ( cxx) = option_env ! ( "AWS_LC_FIPS_SYS_CXX" ) {
119
+ env:: set_var ( "CXX" , cxx) ;
120
+ emit_warning ( & format ! ( "Setting CXX: {}" , cxx) ) ;
121
+ }
122
+
114
123
let cc_build = cc:: Build :: new ( ) ;
115
124
let opt_level = cargo_env ( "OPT_LEVEL" ) ;
116
125
if opt_level. ne ( "0" ) {
@@ -207,12 +216,13 @@ impl CmakeBuilder {
207
216
return cmake_cfg;
208
217
}
209
218
210
- // If the build environment vendor is Apple
211
- #[ cfg( target_vendor = "apple" ) ]
212
- {
213
- const NO_OVERRIDE_T_OPTION : & str = "-Wno-overriding-t-option" ;
214
- if let Ok ( true ) = cc_build. is_flag_supported ( NO_OVERRIDE_T_OPTION ) {
215
- cmake_cfg. cflag ( NO_OVERRIDE_T_OPTION ) ;
219
+ if target_vendor ( ) == "apple" {
220
+ let disable_warnings: [ & str ; 2 ] =
221
+ [ "-Wno-overriding-t-option" , "-Wno-overriding-option" ] ;
222
+ for disabler in disable_warnings {
223
+ if let Ok ( true ) = cc_build. is_flag_supported ( disabler) {
224
+ cmake_cfg. cflag ( disabler) ;
225
+ }
216
226
}
217
227
if target_arch ( ) == "aarch64" {
218
228
cmake_cfg. define ( "CMAKE_OSX_ARCHITECTURES" , "arm64" ) ;
@@ -222,12 +232,11 @@ impl CmakeBuilder {
222
232
cmake_cfg. define ( "CMAKE_OSX_ARCHITECTURES" , "x86_64" ) ;
223
233
cmake_cfg. define ( "CMAKE_SYSTEM_PROCESSOR" , "x86_64" ) ;
224
234
}
225
- }
226
-
227
- if target_vendor ( ) == "apple" && target_os ( ) . trim ( ) == "ios" {
228
- cmake_cfg. define ( "CMAKE_SYSTEM_NAME" , "iOS" ) ;
229
- if target ( ) . trim ( ) . ends_with ( "-ios-sim" ) {
230
- cmake_cfg. define ( "CMAKE_OSX_SYSROOT" , "iphonesimulator" ) ;
235
+ if target_os ( ) . trim ( ) == "ios" {
236
+ cmake_cfg. define ( "CMAKE_SYSTEM_NAME" , "iOS" ) ;
237
+ if effective_target ( ) . trim ( ) . ends_with ( "-ios-sim" ) {
238
+ cmake_cfg. define ( "CMAKE_OSX_SYSROOT" , "iphonesimulator" ) ;
239
+ }
231
240
}
232
241
}
233
242
@@ -268,6 +277,7 @@ impl CmakeBuilder {
268
277
if major > 13 {
269
278
// TODO: Update when FIPS GCC 14 build is fixed
270
279
emit_warning ( "WARNING: FIPS build is known to fail on GCC >= 14. See: https://github.com/aws/aws-lc-rs/issues/569" ) ;
280
+ emit_warning ( "Consider specifying a different compiler in your environment by setting `CC` or: `export AWS_LC_FIPS_SYS_CC=clang`" ) ;
271
281
return Some ( false ) ;
272
282
}
273
283
}
@@ -307,7 +317,7 @@ impl CmakeBuilder {
307
317
) ;
308
318
let mut cflags = vec ! [ "-Wno-unused-command-line-argument" ] ;
309
319
let mut asmflags = vec ! [ ] ;
310
- match target ( ) . as_str ( ) {
320
+ match effective_target ( ) . as_str ( ) {
311
321
"aarch64-unknown-linux-ohos" => { }
312
322
"armv7-unknown-linux-ohos" => {
313
323
const ARM7_FLAGS : [ & str ; 6 ] = [
0 commit comments