@@ -171,6 +171,17 @@ impl LldMode {
171
171
}
172
172
}
173
173
174
+ /// Determines how will GCC be provided.
175
+ #[ derive( Default , Clone ) ]
176
+ pub enum GccCiMode {
177
+ /// Build GCC from the local `src/gcc` submodule.
178
+ #[ default]
179
+ BuildLocally ,
180
+ /// Try to download GCC from CI.
181
+ /// If it is not available on CI, it will be built locally instead.
182
+ DownloadFromCi ,
183
+ }
184
+
174
185
/// Global configuration for the entire build and/or bootstrap.
175
186
///
176
187
/// This structure is parsed from `config.toml`, and some of the fields are inferred from `git` or build-time parameters.
@@ -283,6 +294,9 @@ pub struct Config {
283
294
pub llvm_ldflags : Option < String > ,
284
295
pub llvm_use_libcxx : bool ,
285
296
297
+ // gcc codegen options
298
+ pub gcc_ci_mode : GccCiMode ,
299
+
286
300
// rust codegen options
287
301
pub rust_optimize : RustOptimize ,
288
302
pub rust_codegen_units : Option < u32 > ,
@@ -999,7 +1013,9 @@ define_config! {
999
1013
1000
1014
define_config ! {
1001
1015
/// TOML representation of how the GCC build is configured.
1002
- struct Gcc { }
1016
+ struct Gcc {
1017
+ download_ci_gcc: Option <bool > = "download-ci-gcc" ,
1018
+ }
1003
1019
}
1004
1020
1005
1021
define_config ! {
@@ -2143,6 +2159,16 @@ impl Config {
2143
2159
config. llvm_from_ci = config. parse_download_ci_llvm ( None , false ) ;
2144
2160
}
2145
2161
2162
+ if let Some ( gcc) = toml. gcc {
2163
+ config. gcc_ci_mode = match gcc. download_ci_gcc {
2164
+ Some ( value) => match value {
2165
+ true => GccCiMode :: DownloadFromCi ,
2166
+ false => GccCiMode :: BuildLocally ,
2167
+ } ,
2168
+ None => GccCiMode :: default ( ) ,
2169
+ } ;
2170
+ }
2171
+
2146
2172
if let Some ( t) = toml. target {
2147
2173
for ( triple, cfg) in t {
2148
2174
let mut target = Target :: from_triple ( & triple) ;
0 commit comments