Commit graph

416 commits

Author SHA1 Message Date
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
Matthias Krüger
cb4e2994c2
Rollup merge of #116292 - onur-ozkan:warn-wrong-sources, r=clubby789
warn if source is not either a git clone or a dist tarball

When the repository is downloaded directly via HTTP(as in #115041), builds may fail due to missing submodules.

This PR adds a check that warns people in such cases.
2023-10-01 12:18:11 +02:00
onur-ozkan
88e7718ec3 warn if source is not either a git clone or a dist tarball
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-09-30 20:03:26 +03:00
Pouriya Jahanbakhsh
598f11a1ee ref(bootstrap.py): add eprint function
just like `print` but for `stderr`
2023-09-25 06:57:13 +03:30
Samuel Thibault
dcea7709f2 added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
Kai Luo
122d1cc8c3 Adjust comment 2023-09-13 16:10:26 +08:00
Kai Luo
5049a7167c Adjust comment 2023-09-13 16:08:23 +08:00
Kai Luo
fc17e09029 Add comment to elaborate 2023-09-13 16:05:50 +08:00
Kai Luo
2962528b4a Make AIX known by bootstrap 2023-09-13 15:04:34 +08:00