Commit Graph

424 Commits

Author SHA1 Message Date
J. Neuschäfer 747019ce46 bootstrap.py: Respect build.jobs while building bootstrap tool
On resource-constrained systems, it is vital to respect the value of
build.jobs, in order to avoid overwhelming the available memory.
2025-09-25 12:08:58 +02:00
Samuel Tardieu b79a4bfad6 Do not use git -C dir
Older versions of git (≤ 1.8.5) do not support the `-C dir` global
option. Use the `cwd` optional argument when using Python's
`subprocess` functionality instead.
2025-09-16 21:53:42 +02:00
bors 8a1b39995e Auto merge of #146614 - Zalathar:rollup-hcxvdi1, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#145095 (Migrate `UnsizedConstParamTy`  to unstable impl of `ConstParamTy_`)
 - rust-lang/rust#145960 (Split `FnCtxt::report_args_error` into subfunctions)
 - rust-lang/rust#146402 (interpret: fix overlapping aggregate initialization)
 - rust-lang/rust#146466 (llvm-wrapper: other cleanup)
 - rust-lang/rust#146574 (compiletest: Enable new-output-capture by default)
 - rust-lang/rust#146599 (replace some `#[const_trait]` with `const trait`)
 - rust-lang/rust#146601 (compiletest: Make `./x test --test-args ...` work again)
 - rust-lang/rust#146608 (improve internal bootstrap docs)
 - rust-lang/rust#146609 (bootstrap: lower verbosity of cargo to one less than bootstrap's)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-16 04:26:18 +00:00
binarycat 29ca09be09 bootstrap: lower verbosity of cargo to one less than bootstrap's
the main thing this does is eliminate the "Fresh ..." output when
`--verbose` is only passed once.
2025-09-15 14:42:44 -05:00
binarycat b92ad97f1d bootstrap.py: disable incremental build for bootstrap in CI 2025-09-14 18:26:29 -05:00
Havard Eidnes 2f1b6d19f1 bootstrap.py: follow up more 'tidy' insistence (string quotes). 2025-08-24 09:39:33 +00:00
Havard Eidnes 3a2392bb08 bootstrap.py: follow up tidy output from CI.
I thought tidy would be more allergic to 80-coloumn overflow,
but so be it.
2025-08-23 21:40:19 +00:00
Havard Eidnes 45bcbd99a5 bootstrap.py: Improve CPU detection on NetBSD,
...and add adaptation of detection for some arm variants.
2025-08-23 19:15:46 +00:00
Jens Reidel 9e4f777602 bootstrap: Detect musl hosts
Currently, all non-Android Linux hosts are assumed to be using glibc.
This obviously isn't very portable and will currently result in
downloading a stage0 toolchain for glibc even on musl hosts.

There are multiple ways to detect musl somewhat reliably, but the
easiest option is to check for the python SOABI config variable, which
has values like "cpython-313-x86_64-linux-gnu" or
"cpython-313-powerpc64-linux-musl".

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-18 09:39:13 +02:00
WANG Rui 38d69c3f57 Add new Tier-3 targets: loongarch32-unknown-none*
MCP: https://github.com/rust-lang/compiler-team/issues/865
2025-06-06 08:19:38 +08:00
Vadim Petrochenkov 043b164b3b bootstrap: Remove bin_root from PATH 2025-05-27 20:31:21 +03:00
Matthias Krüger b70e119e37 Rollup merge of #139804 - WaffleLapkin:real, r=jieyouxu
use `realpath` in `bootstrap.py` when creating build-dir

Fixes #139800
r? `@jieyouxu`

My use case for `./build` being a symlink is this: my "default" ~~partition~~ btrfs subvolume is snapshotted/backed up. I don't want to backup target-likes, so I move them to a special subvolume which isn't backed up. `./build` is a symlink into that subvolume. (`build.build-dir` configuration is not fully sufficient, it is still nice to be able to check build files with `ls ./build` or call tools from there)
2025-04-14 18:15:34 +02:00
Waffle Lapkin d5de2fa8bb use realpath in bootstrap.py when creating build-dir
this avoids crashes when `./build` is a symlink to a non-existent
directory.
2025-04-14 15:37:12 +02:00
bit-aloo 2dc650b97b replace commit placeholder in vendor status with actual commit 2025-04-01 17:21:15 +05:30
bit-aloo 1954494ec9 change config.toml to bootstrap.toml for bootstrap module 2025-03-17 12:56:41 +05:30
Chris Denton ab7793d4d4 Don't move ownership of job object 2025-01-24 22:05:30 +00:00
Tanvi Pooranmal Meena 7d806171d0 Add logic to override profile for non git sources 2025-01-20 11:07:32 +05:30
许杰友 Jieyou Xu (Joe) a4b9aa3e6e bootstrap.py: build bootstrap binary with --features=tracing if BOOTSTRAP_TRACING env var is set 2025-01-13 08:16:18 +08:00
Guillaume Gomez 5a9c9ef541 Rollup merge of #133821 - Kobzol:replace-black-with-ruff, r=onur-ozkan
Replace black with ruff in `tidy`

`ruff` can both lint and format Python code (in fact, it should be a mostly drop-in replacement for `black` in terms of formatting), so it's not needed to use `black` anymore. This PR removes `black` and replaces it with `ruff`, to get rid of one Python dependency, and also to make Python formatting faster (although that's a small thing).

If we decide to merge this, we'll need to "reformat the world" - `ruff` is not perfectly compatible with `black`, and it also looks like `black` was actually ignoring some files before. I tried it locally (`./x test tidy --extra-checks=py:fmt --bless`) and it also reformatted some code in subtrees (e.g. `clippy` or `rustc_codegen_gcc`) - I'm not sure how to handle that.
2024-12-05 23:47:11 +01:00
Chris Denton 898d75122f Update comments on Windows job objects 2024-12-05 03:45:05 +00:00
Jakub Beránek 536516f949 Reformat Python code with ruff 2024-12-04 23:03:44 +01:00
Ralf Jung 330ef743de bootstrap: show diagnostics relative to rustc src dir 2024-11-30 10:08:31 +01:00
onur-ozkan 47d6667454 do not remove .cargo directroy
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-23 08:56:54 +03:00
onur-ozkan d2c58ec6c4 delete sub directory "debug" to not delete the change-id file
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-17 07:53:19 +03:00
Matthias Krüger 6e6171b074 Rollup merge of #129594 - lolbinarycat:explain-curl-options, r=albertlarsan68
explain the options bootstrap passes to curl

also fixes a discrepancy where the rust side doesn't use -L

docs are only on the rust side, since duplicated prose has a tendancy to get out-of-sync, and also because there are talks of removing the python script all together eventually.
2024-09-07 23:30:12 +02:00
binarycat 757affd1a9 bootstrap: pass long options to curl 2024-09-05 15:25:51 -04:00
binarycat 44fac8934a explain the options curl passes to bootstrap
also fixes a discrepency where the rust side doesn't use -L

must not be merged before #129134

docs are only on the rust side, since duplicated prose
has a tendancy to get out-of-sync, and also because there
are talks of removing the python script all together eventually.
2024-08-25 12:18:45 -04:00
Matthias Krüger a44e5a94ab Rollup merge of #129459 - onur-ozkan:separate-stage0-bins, r=Kobzol
handle stage0 `cargo` and `rustc` separately

This change allows setting either `build.cargo` or `build.rustc` without requiring both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Blocker for https://github.com/rust-lang/rust/pull/129152
2024-08-25 16:51:05 +02:00
binarycat 69ca95bf7f use tuples for semver, not floats 2024-08-23 11:57:23 -04:00
onur-ozkan 5f2cedc5dc handle stage0 cargo and rustc separately
This change allows setting either `build.cargo` or `build.rustc` without requiring
both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-23 15:39:45 +03:00
binarycat 12e6389788 bootstrap: improve error recovery flags to curl
alternative to #128459

fixes #110178
2024-08-16 19:30:20 -04:00
onur-ozkan 48192701e0 use "bootstrap" instead of "rustbuild" in comments and docs
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-07 00:07:08 +03:00
DianQK 4281c2c3d5 patch rust-lld and ld.lld on NixOS 2024-06-19 22:33:58 +08:00
onur-ozkan 92f85f12a8 wipe bootstrap build before switching to bumped rustc
Technically, wiping bootstrap builds can increase the build time.
But in practice, trying to manually resolve post-bump issues and
even accidentally removing the entire build directory will result
in a much greater loss of time. After all, the bootstrap build process
is not a particularly lengthy operation.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-03 07:19:11 +03:00
onur-ozkan f2d50b6d36 use stage0 file in bootstrap.py
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-05-09 17:51:12 +03:00
onur-ozkan 6dd011de64 suggest x.py vendor instead of cargo vendor
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-04-22 17:12:05 +03:00
Guillaume Gomez 8873ca57f8 Rollup merge of #122334 - GuillaumeGomez:vendor-cg_gcc, r=Mark-Simulacrum
Vendor rustc_codegen_gcc

I used https://github.com/rust-lang/rust/pull/115274 as base for this update.

r? `@bjorn3`
2024-04-05 16:38:49 +02:00
Nilstrieb 60b97a2f3d Fix nix patching for LLVM 18
LLVM 18 now ships `libLLVM*.so.*`, so `.so` is not the sole extension
anymore, which breaks the dylib detection. Oops! Adjust it to only
search for `.so` somewhere.
2024-03-22 22:38:48 +01:00
Guillaume Gomez fa418487e0 Vendor rustc_codegen_gcc 2024-03-11 16:29:00 +01:00
Luca Barbato c98e25bab9 Add a build option to specify the bootstrap cache
Setting the bootstrap cache path to an external location can help to
speed up builds in cases where the build directory is not kept between
builds, e.g. in CI or other automated build systems.
2024-03-05 10:35:43 +01:00
Jeffery To d911613280 Allow bootstrap cache path to be set by environment variable
This allows the bootstrap cache path to be set by the
`RUSTC_BOOTSTRAP_CACHE` environment variable.

Setting the bootstrap cache path to an external location can help to
speed up builds in cases where the build directory is not kept between
builds, e.g. in CI or other automated build systems.
2024-03-04 10:35:52 +01:00
Marek 'seqre' Grzelak 3cde0e8fb6 Add instructions of how to use pre-vendored 'rustc-src' 2024-01-28 19:27:24 -06:00
David Tolnay f6b3bcc431 Capture the rationale for -Zallow-features= in bootstrap.py 2024-01-20 09:47:53 -08:00
onur-ozkan 21b4fe222f Set RUSTC_BOOTSTRAP=1 consistently
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-01-18 19:47:44 +03:00
David Tolnay ee370a1157 Consistently unset RUSTC_BOOTSTRAP when compiling bootstrap 2024-01-15 10:05:50 -08:00
asquared31415 9341325c73 make x.py clippy download and use beta clippy 2023-12-16 15:24:59 -05:00
Ralf Jung 68ea62100b add comment about keeping flags in sync between bootstrap.py and bootstrap.rs 2023-12-05 19:25:07 +01:00
onur-ozkan 1017042575 give dev-friendly error message for incorrect config profiles
before this change, an incorrect profile would result in the following error:

```sh
...
...
  File "/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/bootstrap.py", line 1088, in bootstrap
    with open(include_path) as included_toml:
         ^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/defaults/config.aaaa.toml'
```

with this change, the error message is now:

```sh
...
...
  File "/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/bootstrap.py", line 1088, in bootstrap
    raise Exception("Unrecognized profile '{}'. Check src/bootstrap/defaults"
Exception: Unrecognized profile 'aaaa'. Check src/bootstrap/defaults for available options.
```

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-26 19:05:02 +03:00
onur-ozkan d1e26401bc chore(bootstrap): capitalize {error, warning, info, note} tags
This should enhance the readability.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-09 09:22:43 +03:00
onur-ozkan 89d610cd06 Add RUSTFLAGS_BOOTSTRAP to RUSTFLAGS for bootstrap compilation
Note that RUSTFLAGS_BOOTSTRAP should always be added to the end of
RUSTFLAGS to be actually effective (e.g., if we have `-Dwarnings` in
RUSTFLAGS, passing `-Awarnings` from RUSTFLAGS_BOOTSTRAP should override it).

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-08 13:41:56 +03:00