Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 81b089c

Browse files
committed
Add [gcc] download-ci-gcc option
1 parent c1e778d commit 81b089c

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

config.example.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@
167167
# Tweaking how GCC is compiled
168168
# =============================================================================
169169
[gcc]
170+
# Download GCC from CI instead of building it locally.
171+
# Note that this will attempt to download GCC even if there are local
172+
# modifications to the `src/gcc` submodule.
173+
# Currently, this is only supported for the `x86_64-unknown-linux-gnu` target.
174+
# download-ci-gcc = false
170175

171176
# =============================================================================
172177
# General build configuration options

src/bootstrap/src/core/config/config.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ impl LldMode {
171171
}
172172
}
173173

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+
174185
/// Global configuration for the entire build and/or bootstrap.
175186
///
176187
/// This structure is parsed from `config.toml`, and some of the fields are inferred from `git` or build-time parameters.
@@ -281,6 +292,9 @@ pub struct Config {
281292
pub llvm_ldflags: Option<String>,
282293
pub llvm_use_libcxx: bool,
283294

295+
// gcc codegen options
296+
pub gcc_ci_mode: GccCiMode,
297+
284298
// rust codegen options
285299
pub rust_optimize: RustOptimize,
286300
pub rust_codegen_units: Option<u32>,
@@ -992,7 +1006,9 @@ define_config! {
9921006

9931007
define_config! {
9941008
/// TOML representation of how the GCC build is configured.
995-
struct Gcc {}
1009+
struct Gcc {
1010+
download_ci_gcc: Option<bool> = "download-ci-gcc",
1011+
}
9961012
}
9971013

9981014
define_config! {
@@ -2123,6 +2139,16 @@ impl Config {
21232139
config.llvm_from_ci = config.parse_download_ci_llvm(None, false);
21242140
}
21252141

2142+
if let Some(gcc) = toml.gcc {
2143+
config.gcc_ci_mode = match gcc.download_ci_gcc {
2144+
Some(value) => match value {
2145+
true => GccCiMode::DownloadFromCi,
2146+
false => GccCiMode::BuildLocally,
2147+
},
2148+
None => GccCiMode::default(),
2149+
};
2150+
}
2151+
21262152
if let Some(t) = toml.target {
21272153
for (triple, cfg) in t {
21282154
let mut target = Target::from_triple(&triple);

0 commit comments

Comments
 (0)