about summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
AgeCommit message (Collapse)AuthorLines
2022-03-07copy over `std::path::absolute` instead of adding `canonicalize` hacksJoshua Nelson-0/+16
this also fixes a bug where bootstrap would try to use the fake `rustc` binary built by bootstrap - cargo puts it in a different directory when using `cargo run` instead of x.py
2022-03-07Don't depend on python for RUST_BOOTSTRAP_CONFIGJoshua Nelson-1/+1
2022-03-05Merge build_helper into utilbjorn3-3/+3
2022-03-05Remove build_helperbjorn3-7/+5
The majority of the code is only used by either rustbuild or rustc_llvm's build script. Rust_build is compiled once for rustbuild and once for every stage. This means that the majority of the code in this crate is needlessly compiled multiple times. By moving only the code actually used by the respective crates to rustbuild and rustc_llvm's build script, this needless duplicate compilation is avoided.
2022-03-04Auto merge of #94298 - Urgau:rustbuild-check-cfg, r=Mark-Simulacrumbors-0/+28
Enable conditional compilation checking on the Rust codebase This pull-request enable conditional compilation checking on every rust project build by the `bootstrap` tool. To be more specific, this PR only enable well known names checking + extra names (bootstrap, parallel_compiler, ...). r? `@Mark-Simulacrum`
2022-03-04Rollup merge of #94524 - bjorn3:remove_num_cpus, r=Mark-SimulacrumMatthias Krüger-1/+3
Remove num_cpus dependency from bootstrap, build-manifest and rustc_s… …ession `std::threads::available_parallelism` was stabilized in rust 1.59. r? ```````````````````````````@Mark-Simulacrum```````````````````````````
2022-03-04Enable conditional compilation checking on the Rust codebaseLoïc BRANSTETT-0/+28
2022-03-03bootstrap: correct reading of flags for llvmJon Gjengset-2/+12
First, this reverts the `CFLAGS`/`CXXFLAGS` of #93918. Those flags are already read by `cc` and populated into `Build` earlier on in the process. We shouldn't be overriding that based on `CFLAGS`, since `cc` also respects overrides like `CFLAGS_{TARGET}` and `HOST_CFLAGS`, which we want to take into account. Second, this adds the same capability to specify target-specific versions of `LDFLAGS` as we have through `cc` for the `C*` flags: https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables Note that this also necessitated an update to compiletest to treat CXXFLAGS separately from CFLAGS.
2022-03-02Remove num_cpus dependency from bootstrap, build-manifest and rustc_sessionbjorn3-1/+3
2022-02-23Always check cg_llvm with ./x.py checkbjorn3-2/+3
Previously it would be skipped if codegen-backends doesn't contain llvm.
2022-02-13Auto merge of #93685 - Mark-Simulacrum:drop-time, r=Mark-Simulacrumbors-19/+1
Drop time dependency from bootstrap This was only used for the inclusion of 'current' dates into our manpages, but it is not clear that this is practically necessary. The manpage is essentially never updated, and so we can likely afford to keep a manual date in these files. It also seems possible to just omit it, but that may cause other tools trouble, so avoid doing that for now. This is largely done to reduce bootstrap complexity; the time crate is not particularly small and in #92480 would have started pulling in num-threads, which does runtime thread count detection. I would prefer to avoid that, so filing this to just drop the nearly unused dependency entirely. r? `@pietroalbini`
2022-02-07Drop time dependency from bootstrapMark Rousskov-19/+1
This was only used for the inclusion of 'current' dates into our manpages, but it is not clear that this is practically necessary. The manpage is essentially never updated, and so we can likely afford to keep a manual date in these files. It also seems possible to just omit it, but that may cause other tools trouble, so avoid doing that for now.
2022-02-06Use shallow clones for submodules managed by rustbuild, not just bootstrap.pyJoshua Nelson-1/+1
I missed this in https://github.com/rust-lang/rust/pull/89757; it made `x.py test src/bootstrap` very slow.
2022-01-30Hide failed command unless in verbose modeMark Rousskov-2/+2
This is particularly intended for invoking compiletest; the command line there is long (3,350 characters on my system) and takes up a lot of screen real estate for little benefit to the majority of those running bootstrap. This moves printing it to verbose mode (-v must be passed) which means that it's still possible to access when needed for debugging. The main downside is that CI logs will by-default become less usable for debugging (particularly) spurious failures, but it is pretty rare for us to really need the information there -- it's usually fairly obvious what is being run with a little investigation.
2022-01-01Remove some dead codebjorn3-5/+0
2021-12-04Use IntoIterator for array impl everywhere.Mara Bos-1/+1
2021-11-26Fix bug where submodules wouldn't be updated when running x.py from a ↵Joshua Nelson-1/+1
subdirectory Previously, it would concatenate the relative path to the current subdirectory, which looked at the wrong folder. I tested this by checking out `1.56.1`, changing the current directory to `src/`, and running `../x.py build`.
2021-10-23remove "field is never read" warningPietro Albini-1/+0
2021-09-19Restore the suggestion to set `ninja = false`.Daira Hopwood-1/+2
2021-09-19[bootstrap] Improve the error message when `ninja` is not found to link to ↵Daira Hopwood-2/+6
installation instructions. Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-08-26switch stage0.txt to stage0.json and add a tool to generate itPietro Albini-1/+1
2021-07-25Don't treat git repos as non-existent when `ignore_git` is setJoshua Nelson-1/+1
The new submodule handling depends on `is_git()` to be accurate to decide whether it should handle submodules at all or not. Unfortunately, `is_git()` treated "this directory does not have a git repository" and "this repository should not be used for SHA/version/commit date info" the same. This changes it to distinguish the two. To clarify: ignore_get is set by default whenever channel == "dev", which it is by default whenever you're compiling locally. So basically everyone would hit this, not just people who had explicitly configured ignore_git. Here's an example of an error this fixes: ``` $ x build Updating only changed submodules Submodules updated in 0.01 seconds Finished dev [unoptimized + debuginfo] target(s) in 0.17s warning: x.py has made several changes recently you may want to look at help: consider looking at the changes in `src/bootstrap/CHANGELOG.md` note: to silence this warning, add `changelog-seen = 2` at the top of `config.toml` Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.16s Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Building LLVM for x86_64-unknown-linux-gnu detected home dir change, cleaning out entire build directory running: "cmake" "/home/joshua/rustc3/src/llvm-project/llvm" "-G" "Ninja" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_DOCS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_ENABLE_BINDINGS=OFF" "-DLLVM_ENABLE_Z3_SOLVER=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=48" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" "-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_LIBXML2=OFF" "-DLLVM_VERSION_SUFFIX=-rust-dev" "-DCMAKE_INSTALL_MESSAGE=LAZY" "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" "-DCMAKE_ASM_COMPILER=gcc" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX=/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_BUILD_TYPE=Release" CMake Error: The source directory "/home/joshua/rustc3/src/llvm-project/llvm" does not exist. Specify --help for usage, or press the help button on the CMake GUI. thread 'main' panicked at ' command did not execute successfully, got: exit status: 1 build script failed, must exit now', /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace finished in 0.783 seconds Build completed unsuccessfully in 0:00:01 ```
2021-07-22Don't default to `submodules = true` unless the rust repo has a .git directoryJoshua Nelson-2/+2
2021-07-20Update all submodules that rustbuild doesn't depend on lazilyJoshua Nelson-5/+108
This only updates the submodules the first time they're needed, instead of unconditionally the first time you run x.py. Ideally, this would move *all* submodules and not exclude some tools and backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the whole workspace to be present to build any crate. On my machine, this takes the time for an initial submodule clone (for `x.py --help`) from 55.70 to 15.87 seconds. This uses exactly the same logic as the LLVM update used, modulo some minor cleanups: - Use a local variable for `src.join(relative_path)` - Remove unnecessary arrays for `book!` macro and make the macro simpler to use - Add more comments
2021-06-26Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkovbors-1/+1
Use HTTPS links where possible While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS. Notes: - I didn't change any to or in licences - Some links don't support HTTPS :( - Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-25Auto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrumbors-0/+6
Move LLVM submodule updates back to native.rs Time to find more bugs! The first commit is a straight revert of https://github.com/rust-lang/rust/pull/85647, the second is a fix for https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/x.2Epy.20always.20updates.20LLVM.20submodule/near/240113320 and https://github.com/rust-lang/rust/pull/82653#issuecomment-846755631. I haven't been able to replicate https://github.com/rust-lang/rust/pull/82653#issuecomment-849013698.
2021-06-23Use HTTPS links where possibleSmitty-1/+1
2021-06-07build doctests with lld if use-lld = trueThe8472-0/+15
2021-06-07Rollup merge of #84940 - jyn514:ninja, r=Mark-SimulacrumGuillaume Gomez-2/+7
Don't run sanity checks for `x.py setup` These requirements change as soon as the command finishes running, and `setup` doesn't build anything, so the check doesn't make sense. Previously, `x.py setup` would give hard errors if `ninja` and `cmake` were not installed, even if the new profile didn't require them. Fixes https://github.com/rust-lang/rust/issues/84938.
2021-06-05Inline maybe_update_submoduleJoshua Nelson-9/+5
It was a trivial function only used once.
2021-06-04Revert "Revert "Move llvm submodule updates to rustbuild""Joshua Nelson-0/+10
This reverts commit ad308264a38531bc8d2179324bac3652a1cda640.
2021-06-04Improve error messageJoshua Nelson-1/+1
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-06-04Note that `ninja = false` goes under `[llvm]`Joshua Nelson-1/+1
2021-06-04Don't run sanity checks for `x.py setup`Joshua Nelson-2/+7
These requirements change as soon as the command finishes running, and `setup` doesn't build anything, so the check doesn't make sense. Previously, `x.py setup` would give hard errors if `ninja` and `cmake` were not installed, even if the new profile didn't require them.
2021-05-24Revert "Move llvm submodule updates to rustbuild"Mark Rousskov-10/+0
2021-05-22Move llvm submodule updates to rustbuildJoshua Nelson-0/+10
This enables better caching, since LLVM is only updated when needed, not whenever x.py is run. Before, bootstrap.py had to use heuristics to guess if LLVM would be needed, and updated the module more often than necessary as a result. This syncs the LLVM submodule only just before building the compiler, so people working on the standard library never have to worry about it. Example output: ``` Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Updating submodule src/llvm-project Submodule 'src/llvm-project' (https://github.com/rust-lang/llvm-project.git) registered for path 'src/llvm-project' Submodule path 'src/llvm-project': checked out 'f9a8d70b6e0365ac2172ca6b7f1de0341297458d' ``` - Don't try to update the LLVM submodule when using system LLVM Previously, this would try to update LLVM unconditionally. Now the submodule is only initialized if `llvm-config` is not set. - Don't update LLVM submodule in dry runs This prevents the following test failures: ``` running 17 tests fatal: invalid gitfile format: /checkout/src/llvm-project/.git test builder::tests::defaults::build_cross_compile ... FAILED ---- builder::tests::defaults::build_default stdout ---- thread 'main' panicked at 'command did not execute successfully: "git" "rev-parse" "HEAD" expected success, got: exit code: 128', src/build_helper/lib.rs:139:9 ``` - Try running git without --progress if it fails the first time This avoids having to do version detection to see if --progress is supported or not. - Don't try to update submodules when the source repository isn't managed by git - Update LLVM submodules that have already been checked out - Only check for whether the submodule should be updated in lib.rs; update it unconditionally in native.rs
2021-05-01Allow formatting specific subdirectoriesJoshua Nelson-2/+2
2021-04-07Cleanup option parsing and config.toml.exampleJoshua Nelson-1/+1
- Add an assertion that `link-shared = true` when `thin-lto = true`. Previously, link-shared would be silently overwritten. - Get rid of `Option<bool>` in bootstrap/config.rs. Set defaults immediately instead of delaying until later in bootstrap. This makes it easier to find what the default value is. - Remove redundant `config.x = false` when the default was already false - Set defaults for `bindir` in `default_opts()` instead of `parse()` - Update `download-ci-llvm = if-supported` option to match bootstrap.py - Remove redundant check for link_shared. Previously, it was checked twice. - Update various options in config.toml.example to their defaults. Previously, some options showed an example value instead of the default value. - Fix incorrect defaults in config.toml.example + `use-libcxx` defaults to false + Add missing `check-stage = 0` + Update several defaults to be conditional (e.g. `if incremental { 10 } else { 100 }`) - Remove redundant defaults in prose - Use the same comment for the default and target-dependent `musl-root` - Fix typos - Link to `cc_detect` for `cc` and `cxx`, since the logic is ... complicated. - Update more defaults to better reflect how they actually get set - Remove ignored `gpg-password-file` option This stopped being used in https://github.com/rust-lang/rust/commit/7704d35accfe1b587ce41ea09ca3bf6a47aca117, but was never removed from config.toml. - Remove unused flags from `config.toml` + Disallow `infodir` and `localstatedir` in `config.toml` + Allow the flags in `./configure`, but give a warning that they will be ignored. + Fix incorrect comment that `datadir` will be ignored. Example output: ``` $ ./configure --set install.infodir=xxx configure: processing command line configure: configure: install.infodir := xxx configure: build.configure-args := ['--set', 'install.infodir=xxx'] warning: infodir will be ignored configure: configure: writing `config.toml` in current directory configure: configure: run `python /home/joshua/rustc3/x.py --help` configure: ``` - Update CHANGELOG - Add "as an example" where appropriate - Link to an issue instead of to ephemeral chats
2021-02-21Add new rustdoc-gui test suiteGuillaume Gomez-0/+4
2020-12-31bootstrap: clippy fixesMatthias Krüger-2/+2
addresses: clippy::or_fun_call clippy::single_char_add_str clippy::comparison_to_empty clippy::or_fun_call
2020-12-23bootstrap: convert llvm-tools to use TarballPietro Albini-4/+0
2020-12-23bootstrap: convert build-manifest to use the new Tarball structPietro Albini-0/+1
2020-12-16Revert "Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum"Eric Huss-21/+0
This reverts commit 7afc5172305cdae588a0318ce545749cf4ed947d, reversing changes made to d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f.
2020-11-16x.py: allow a custom string appended to the versionJosh Stone-1/+7
This adds `rust.description` to the config as a descriptive string to be appended to `rustc --version` output, which is also used in places like debuginfo `DW_AT_producer`. This may be useful for supplementary build information, like distro-specific package versions. For example, in Fedora 33, `gcc --version` outputs: gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6) With this change, we can add similar vendor info to `rustc --version`.
2020-11-11Merge changes from rust-lang/rustZachary Catlin-15/+40
2020-11-11Include llvm-as in llvm-tools-preview componentZachary Catlin-0/+1
Including llvm-as adds the ability to include assembly language fragments that can be inlined using LTO.
2020-11-11Rollup merge of #78947 - dalance:llvm_cov, r=Mark-SimulacrumJonas Schievink-10/+11
Ship llvm-cov through llvm-tools `llvm-cov` is used to generate coverage report with LLVM InstrProf-based code coverage #34701. So if `llvm-cov` is shipped through llvm-tools, users can try it easily accorging to the instruction of [The Rust Unstable Book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/source-based-code-coverage.html).
2020-11-11Rollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-SimulacrumJonas Schievink-4/+7
Support enable/disable sanitizers/profiler per target This PR add options under `[target.*]` of `config.toml` which can enable or disable sanitizers/profiler runtime for corresponding target. If these options are empty, the global options under `[build]` will take effect. Fix #78329
2020-11-11Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrumbors-0/+21
Vendor libtest's dependencies in the rust-src component This is the Rust side of https://github.com/rust-lang/wg-cargo-std-aware/issues/23 Note that this won't produce a useful result for `cargo -Zbuild-std` if there are multiple versions of a crate vendored, but will otherwise produce a valid vendor dir. See https://github.com/rust-lang/cargo/pull/8834 for the other half of this change.
2020-11-12Ship llvm-cov through llvm-toolsdalance-10/+11