Skip to content

Commit

Permalink
Unrolled build for rust-lang#127434
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#127434 - onur-ozkan:use-bootstrap-instead-of-rustbuild, r=Mark-Simulacrum

use "bootstrap" instead of "rustbuild" in comments and docs

Let's stick with the single name "bootstrap" to refer to the bootstrap project to avoid confusion. This should make it clearer, especially for new contributors.
  • Loading branch information
rust-timer authored Jul 14, 2024
2 parents 4cd8dc6 + 4819270 commit 716fc17
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 45 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ python x.py build

Right now, building Rust only works with some known versions of Visual Studio.
If you have a more recent version installed and the build system doesn't
understand, you may need to force rustbuild to use an older version.
understand, you may need to force bootstrap to use an older version.
This can be done by manually calling the appropriate vcvars file before running
the bootstrap.

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ impl<'a> GccLinker<'a> {
self.link_arg("-dylib");

// Note that the `osx_rpath_install_name` option here is a hack
// purely to support rustbuild right now, we should get a more
// purely to support bootstrap right now, we should get a more
// principled solution at some point to force the compiler to pass
// the right `-Wl,-install_name` with an `@rpath` in it.
if self.sess.opts.cg.rpath || self.sess.opts.unstable_opts.osx_rpath_install_name {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
// This is the location used by the `rust-src` `rustup` component.
let mut candidate = sysroot.join("lib/rustlib/src/rust");
if let Ok(metadata) = candidate.symlink_metadata() {
// Replace the symlink rustbuild creates, with its destination.
// Replace the symlink bootstrap creates, with its destination.
// We could try to use `fs::canonicalize` instead, but that might
// produce unnecessarily verbose path.
if metadata.file_type().is_symlink() {
Expand Down
8 changes: 4 additions & 4 deletions config.example.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sample TOML configuration file for building Rust.
#
# To configure rustbuild, run `./configure` or `./x.py setup`.
# To configure bootstrap, run `./configure` or `./x.py setup`.
# See https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#create-a-configtoml for more information.
#
# All options are commented out by default in this file, and they're commented
Expand Down Expand Up @@ -109,7 +109,7 @@
# increases the size of binaries and consequently the memory required by
# each linker process.
# If set to 0, linker invocations are treated like any other job and
# controlled by rustbuild's -j parameter.
# controlled by bootstrap's -j parameter.
#link-jobs = 0

# Whether to build LLVM as a dynamically linked library (as opposed to statically linked).
Expand Down Expand Up @@ -371,11 +371,11 @@
# Useful for modifying only the stage2 compiler without having to pass `--keep-stage 0` each time.
#local-rebuild = false

# Print out how long each rustbuild step took (mostly intended for CI and
# Print out how long each bootstrap step took (mostly intended for CI and
# tracking over time)
#print-step-timings = false

# Print out resource usage data for each rustbuild step, as defined by the Unix
# Print out resource usage data for each bootstrap step, as defined by the Unix
# struct rusage. (Note that this setting is completely unstable: the data it
# captures, what platforms it supports, the format of its associated output, and
# this setting's very existence, are all subject to change.)
Expand Down
18 changes: 9 additions & 9 deletions src/bootstrap/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# rustbuild - Bootstrapping Rust
# Bootstrapping Rust

This README is aimed at helping to explain how Rust is bootstrapped,
and some of the technical details of the build system.
and some of the technical details of the bootstrap build system.

Note that this README only covers internal information, not how to use the tool.
Please check [bootstrapping dev guide][bootstrapping-dev-guide] for further information.
Expand All @@ -12,17 +12,17 @@ Please check [bootstrapping dev guide][bootstrapping-dev-guide] for further info

The build system defers most of the complicated logic of managing invocations
of rustc and rustdoc to Cargo itself. However, moving through various stages
and copying artifacts is still necessary for it to do. Each time rustbuild
and copying artifacts is still necessary for it to do. Each time bootstrap
is invoked, it will iterate through the list of predefined steps and execute
each serially in turn if it matches the paths passed or is a default rule.
For each step, rustbuild relies on the step internally being incremental and
parallel. Note, though, that the `-j` parameter to rustbuild gets forwarded
For each step, bootstrap relies on the step internally being incremental and
parallel. Note, though, that the `-j` parameter to bootstrap gets forwarded
to appropriate test harnesses and such.

## Build phases

The rustbuild build system goes through a few phases to actually build the
compiler. What actually happens when you invoke rustbuild is:
Bootstrap build system goes through a few phases to actually build the
compiler. What actually happens when you invoke bootstrap is:

1. The entry point script (`x` for unix like systems, `x.ps1` for windows systems,
`x.py` cross-platform) is run. This script is responsible for downloading the stage0
Expand Down Expand Up @@ -151,9 +151,9 @@ build/
stage3/
```

## Extending rustbuild
## Extending bootstrap

When you use the bootstrap system, you'll call it through the entry point script
When you use bootstrap, you'll call it through the entry point script
(`x`, `x.ps1`, or `x.py`). However, most of the code lives in `src/bootstrap`.
`bootstrap` has a difficult problem: it is written in Rust, but yet it is run
before the Rust compiler is built! To work around this, there are two components
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ def build_triple(self):

def check_vendored_status(self):
"""Check that vendoring is configured properly"""
# keep this consistent with the equivalent check in rustbuild:
# keep this consistent with the equivalent check in bootstrap:
# https://github.com/rust-lang/rust/blob/a8a33cf27166d3eabaffc58ed3799e054af3b0c6/src/bootstrap/lib.rs#L399-L405
if 'SUDO_USER' in os.environ and not self.use_vendored_sources:
if os.getuid() == 0:
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ all:
$(Q)$(BOOTSTRAP) doc --stage 2 $(BOOTSTRAP_ARGS)

help:
$(Q)echo 'Welcome to the rustbuild build system!'
$(Q)echo 'Welcome to bootstrap, the Rust build system!'
$(Q)echo
$(Q)echo This makefile is a thin veneer over the ./x.py script located
$(Q)echo in this directory. To get the full power of the build system
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! rustbuild, the Rust build system
//! bootstrap, the Rust build system
//!
//! This is the entry point for the build system used to compile the `rustc`
//! compiler. Lots of documentation can be found in the `README.md` file in the
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Implementation of compiling various phases of the compiler and standard
//! library.
//!
//! This module contains some of the real meat in the rustbuild build system
//! This module contains some of the real meat in the bootstrap build system
//! which is where Cargo is used to compile the standard library, libtest, and
//! the compiler. This module is also responsible for assembling the sysroot as it
//! goes along from the output of the previous stage.
Expand Down Expand Up @@ -818,8 +818,8 @@ pub struct Rustc {
pub compiler: Compiler,
/// Whether to build a subset of crates, rather than the whole compiler.
///
/// This should only be requested by the user, not used within rustbuild itself.
/// Using it within rustbuild can lead to confusing situation where lints are replayed
/// This should only be requested by the user, not used within bootstrap itself.
/// Using it within bootstrap can lead to confusing situation where lints are replayed
/// in two different steps.
crates: Vec<String>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Documentation generation for rustbuilder.
//! Documentation generation for bootstrap.
//!
//! This module implements generation for all bits and pieces of documentation
//! for the Rust project. This notably includes suites like the rust book, the
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3044,7 +3044,7 @@ impl Step for Bootstrap {
// https://github.com/rust-lang/rust/issues/49215
cmd.env("RUSTFLAGS", flags);
}
// rustbuild tests are racy on directory creation so just run them one at a time.
// bootstrap tests are racy on directory creation so just run them one at a time.
// Since there's not many this shouldn't be a problem.
run_cargo_test(cmd, &["--test-threads=1"], &[], "bootstrap", None, compiler, host, builder);
}
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1627,11 +1627,11 @@ impl<'a> Builder<'a> {
}

// This tells Cargo (and in turn, rustc) to output more complete
// dependency information. Most importantly for rustbuild, this
// dependency information. Most importantly for bootstrap, this
// includes sysroot artifacts, like libstd, which means that we don't
// need to track those in rustbuild (an error prone process!). This
// need to track those in bootstrap (an error prone process!). This
// feature is currently unstable as there may be some bugs and such, but
// it represents a big improvement in rustbuild's reliability on
// it represents a big improvement in bootstrap's reliability on
// rebuilds, so we're using it here.
//
// For some additional context, see #63470 (the PR originally adding
Expand All @@ -1643,7 +1643,7 @@ impl<'a> Builder<'a> {
// Restrict the allowed features so we don't depend on nightly
// accidentally.
//
// binary-dep-depinfo is used by rustbuild itself for all
// binary-dep-depinfo is used by bootstrap itself for all
// compilations.
//
// Lots of tools depend on proc_macro2 and proc-macro-error.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ mod defaults {
// rustdoc/rustcc/std here (the user only requested a host=B build, so
// there's not really a need for us to build for target A in this case
// (since we're producing stage 1 libraries/binaries). But currently
// rustbuild is just a bit buggy here; this should be fixed though.
// bootstrap is just a bit buggy here; this should be fixed though.
assert_eq!(
first(cache.all::<compile::Std>()),
&[
Expand Down
5 changes: 2 additions & 3 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,7 @@ impl Merge for TomlConfig {
}
}

// We are using a decl macro instead of a derive proc macro here to reduce the compile time of
// rustbuild.
// We are using a decl macro instead of a derive proc macro here to reduce the compile time of bootstrap.
macro_rules! define_config {
($(#[$attr:meta])* struct $name:ident {
$($field:ident: Option<$field_ty:ty> = $field_key:literal,)*
Expand Down Expand Up @@ -704,7 +703,7 @@ macro_rules! define_config {

// The following is a trimmed version of what serde_derive generates. All parts not relevant
// for toml deserialization have been removed. This reduces the binary size and improves
// compile time of rustbuild.
// compile time of bootstrap.
impl<'de> Deserialize<'de> for $name {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/config/flags.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Command-line interface of the rustbuild build system.
//! Command-line interface of the bootstrap build system.
//!
//! This module implements the command-line parsing of the build system which
//! has various flags to configure how it's run.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/sanity.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Sanity checking performed by rustbuild before actually executing anything.
//! Sanity checking performed by bootstrap before actually executing anything.
//!
//! This module contains the implementation of ensuring that the build
//! environment looks reasonable before progressing. This will verify that
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Implementation of rustbuild, the Rust build system.
//! Implementation of bootstrap, the Rust build system.
//!
//! This module, and its descendants, are the implementation of the Rust build
//! system. Most of this build system is backed by Cargo but the outer layer
//! here serves as the ability to orchestrate calling Cargo, sequencing Cargo
//! builds, building artifacts like LLVM, etc. The goals of rustbuild are:
//! builds, building artifacts like LLVM, etc. The goals of bootstrap are:
//!
//! * To be an easily understandable, easily extensible, and maintainable build
//! system.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Various utility functions used throughout rustbuild.
//! Various utility functions used throughout bootstrap.
//!
//! Simple things like testing the various filesystem operations here and there,
//! not a lot of interesting happenings here unfortunately.
Expand Down
2 changes: 1 addition & 1 deletion src/ci/scripts/install-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if isMacOS; then
# our own clang can figure out the correct include path on its own.
ciCommandSetEnv SDKROOT "$(xcrun --sdk macosx --show-sdk-path)"

# Configure `AR` specifically so rustbuild doesn't try to infer it as
# Configure `AR` specifically so bootstrap doesn't try to infer it as
# `clang-ar` by accident.
ciCommandSetEnv AR "ar"
elif isWindows && ! isKnownToBeMingwBuild; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ on how to setup a development and runtime environment.

As a tier 2 target, the target is built by the Rust project.

You can configure rustbuild like so:
You can configure bootstrap like so:

```toml
[build]
Expand Down
2 changes: 1 addition & 1 deletion src/tools/build_helper/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl CiEnv {
/// If in a CI environment, forces the command to run with colors.
pub fn force_coloring_in_ci(self, cmd: &mut Command) {
if self != CiEnv::None {
// Due to use of stamp/docker, the output stream of rustbuild is not
// Due to use of stamp/docker, the output stream of bootstrap is not
// a TTY in CI, so coloring is by-default turned off.
// The explicit `TERM=xterm` environment is needed for
// `--color always` to actually work. This env var was lost when
Expand Down
2 changes: 1 addition & 1 deletion src/tools/lint-docs/src/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'a> LintExtractor<'a> {
.map_err(|e| format!("could not read {}: {}", groups_path.display(), e))?;
let new_contents =
contents.replace("{{groups-table}}", &self.make_groups_table(lints, &groups)?);
// Delete the output because rustbuild uses hard links in its copies.
// Delete the output because bootstrap uses hard links in its copies.
let _ = fs::remove_file(&groups_path);
fs::write(&groups_path, new_contents)
.map_err(|e| format!("could not write to {}: {}", groups_path.display(), e))?;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/lint-docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ impl<'a> LintExtractor<'a> {
}
add_rename_redirect(level, &mut result);
let out_path = self.out_path.join("listing").join(level.doc_filename());
// Delete the output because rustbuild uses hard links in its copies.
// Delete the output because bootstrap uses hard links in its copies.
let _ = fs::remove_file(&out_path);
fs::write(&out_path, result)
.map_err(|e| format!("could not write to {}: {}", out_path.display(), e))?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct VersionInfo {
pub version: &'static str,
/// The release channel we were built for (stable/beta/nightly/dev).
///
/// `None` if not built via rustbuild.
/// `None` if not built via bootstrap.
pub release_channel: Option<&'static str>,
/// Information about the Git repository we may have been built from.
///
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-installer/src/combiner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Combiner {
.with_context(|| format!("failed to read components in '{}'", input_tarball))?;
for component in pkg_components.split_whitespace() {
// All we need to do is copy the component directory. We could
// move it, but rustbuild wants to reuse the unpacked package
// move it, but bootstrap wants to reuse the unpacked package
// dir for OS-specific installers on macOS and Windows.
let component_dir = package_dir.join(component);
create_dir(&component_dir)?;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-installer/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ combined_remains() {
--package-name=rust \
--input-tarballs="$OUT_DIR/rustc.tar.gz,$OUT_DIR/cargo.tar.gz,$OUT_DIR/rust-docs.tar.gz"
for component in rustc cargo rust-docs; do
# rustbuild wants the original extracted package intact too
# bootstrap wants the original extracted package intact too
try test -d "$WORK_DIR/$component/$component"
try test -d "$WORK_DIR/rust/$component"
done
Expand Down

0 comments on commit 716fc17

Please sign in to comment.