Skip to content

Add config option and cli arg for skip-llvm-rebuild #65848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# =============================================================================
[llvm]

# Skip rebuilding LLVM. If set to true, `bootstrap.py` will not rebuild LLVM.
# This can be used or overridden with the command-line arguments
# --skip-llvm-rebuild and --no-skip-llvm-rebuild as well.
# skip-llvm-rebuild = false

# Indicates whether the LLVM build is a Release or Debug build
#optimize = true

Expand Down
19 changes: 19 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def __init__(self):
self.use_locked_deps = ''
self.use_vendored_sources = ''
self.verbose = False
self.skip_llvm_rebuild = False

def download_stage0(self):
"""Fetch the build system for Rust, written in Rust
Expand Down Expand Up @@ -734,6 +735,9 @@ def update_submodules(self):
if module.endswith("llvm-project"):
if self.get_toml('llvm-config') and self.get_toml('lld') != 'true':
continue
if self.skip_llvm_rebuild:
print("Skipping llvm-project rebuild")
continue
check = self.check_submodule(module, slow_submodules)
filtered_submodules.append((module, check))
submodules_names.append(module)
Expand Down Expand Up @@ -820,6 +824,10 @@ def bootstrap(help_triggered):
parser.add_argument('--src')
parser.add_argument('--clean', action='store_true')
parser.add_argument('-v', '--verbose', action='count', default=0)
parser.add_argument('--skip-llvm-rebuild',
dest='skip_llvm_rebuild', action='store_true', default=None)
parser.add_argument('--no-skip-llvm-rebuild',
dest='skip_llvm_rebuild', action='store_false')

args = [a for a in sys.argv if a != '-h' and a != '--help']
args, _ = parser.parse_known_args(args)
Expand All @@ -840,6 +848,17 @@ def bootstrap(help_triggered):
if config_verbose is not None:
build.verbose = max(build.verbose, int(config_verbose))

config_skip_llvm_rebuild = build.get_toml('skip-llvm-rebuild')
if args.skip_llvm_rebuild is not None:
# explicit cli arg is the strongest truth, ignore config file
build.skip_llvm_rebuild = args.skip_llvm_rebuild
elif config_skip_llvm_rebuild is not None:
# explicit config arg, no cli arg, trust the config file
build.skip_llvm_rebuild = config_skip_llvm_rebuild == 'true'
else:
# no config, no cli arg, defaulting to not skipping
build.skip_llvm_rebuild = False

build.use_vendored_sources = build.get_toml('vendor', 'build') == 'true'

build.use_locked_deps = build.get_toml('locked-deps', 'build') == 'true'
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub struct Config {
pub backtrace_on_ice: bool,

// llvm codegen options
pub skip_llvm_rebuild: bool,
pub llvm_assertions: bool,
pub llvm_optimize: bool,
pub llvm_thin_lto: bool,
Expand Down Expand Up @@ -243,6 +244,7 @@ struct Install {
#[derive(Deserialize, Default)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct Llvm {
skip_llvm_rebuild: Option<bool>,
optimize: Option<bool>,
thin_lto: Option<bool>,
release_debuginfo: Option<bool>,
Expand Down Expand Up @@ -513,6 +515,7 @@ impl Config {
}
set(&mut config.ninja, llvm.ninja);
llvm_assertions = llvm.assertions;
set(&mut config.skip_llvm_rebuild, llvm.skip_llvm_rebuild);
set(&mut config.llvm_optimize, llvm.optimize);
set(&mut config.llvm_thin_lto, llvm.thin_lto);
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
Expand Down