86 Commits

Author SHA1 Message Date
Joshua Nelson
81e2c112d9 [bootstrap] Move sanitize_sh from dist to install
This is the only place it's used, so there's no need for it to be public in another module.
In general, `dist` shouldn't ever touch shell scripts.
2022-05-27 17:52:41 -05:00
Joshua Nelson
0db70ca263 Require all paths passed to ShouldRun::paths to exist on disk
This has two benefits:
1. There is a clearer mental model of how bootstrap works. Steps correspond to paths on disk unless it's strictly impossible for them to do so (e.g. dist components).
2. Bootstrap has better checks for internal consistency. This caught several issues:
  - `src/sanitizers` doesn't exist; I changed it to just be a `sanitizers` alias.
  - `src/tools/lld` doesn't exist; I removed it, since `lld` alone already works.
  - `src/llvm` doesn't exist; removed it since `llvm` and `src/llvm-project` both work.
  - `src/lldb_batchmode.py` doesn't exist, it was moved to `src/etc`.
  - `install` was still using `src/librustc` instead of `compiler/rustc`.
  - None of the tools in `dist` / `install` allowed using `src/tools/X` to build them. This might be intentional - I can change them to aliases if you like.
2022-04-16 13:13:39 -05:00
bjorn3
e657da72aa Merge build_helper into util 2022-03-05 15:31:22 +01:00
bjorn3
0cfc3e1016 Remove build_helper
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-05 15:31:22 +01:00
Pietro Albini
c15e248090
refactor extended tarball generaton to use the new ensure_if_default 2021-07-23 17:56:37 +02:00
Pietro Albini
7167f8b83f
change output of dist cargo and clippy to be consistent with other tools 2021-07-19 16:15:59 +02:00
Pietro Albini
0c8baa729d
refactor gating of dist docs 2021-07-19 16:15:48 +02:00
Eric Huss
166c147c27 Provide a better error when x.py install src/doc doesn't work. 2021-07-12 13:29:47 -07:00
Eric Huss
60ff731110 Add comments why install steps should never fail. 2021-07-11 09:01:31 -07:00
Eric Huss
f698cacc33 Fix rust-analyzer install when not available. 2021-07-09 10:38:28 -07:00
Joshua M. Clulow
4873271955 bootstrap: use bash on illumos to run install scripts
The default illumos shell ("sh" in the default PATH) is ksh93, rather
than bash, and does not support constructs like "local" that came from
bash.  The bootstrap function for invoking "install.sh" scripts should
use "bash" explicitly there to avoid issues.
2021-04-16 11:28:41 -07:00
Rich Kadel
ed89e6b831 Address review comments and Windows failure, and make cleaner 2021-04-03 18:03:50 -07:00
Rich Kadel
23325caf43 Make rust-demangler installable
Adds bootstrap rules to support installing rust-demangler.

When compiling with `-Z instrument-coverage`, the coverage reports are
generated by `llvm-cov`. `llvm-cov` includes a built-in demangler for
C++, and an option to supply an alternate demangler. For Rust, we have
`rust-demangler`, currently used in `rustc` coverage tests.

Fuchsia's toolchain for Rust is built via `./x.py install`. Fuchsia is
adding support for Rust coverage, and we need to include the
`rust-demangler` in the installed `bin` directory.

Configured rust-demangler as an in-tree extended tool.

Added tests to support `./x.py test rust-demangler`.

Install with extended tools by default only if `profiler = true`.
2021-04-03 11:42:54 -07:00
Matthias Krüger
ec50a2086a avoid converting types into themselves (clippy::useless_conversion) 2021-02-17 20:37:09 +01:00
Pietro Albini
5034b504b4
bootstrap: fix wrong docs installation path 2021-02-10 18:46:40 +01:00
Pietro Albini
2caf9bcb33
bootstrap: fix x.py install not working with relative prefix 2021-01-07 20:40:42 +01:00
Pietro Albini
8e0ab0fb5e
bootstrap: use the correct paths during ./x.py install 2020-12-31 11:38:32 +01:00
Yuxuan Shui
fbc9d50d75
make sure installer only creates directories in DESTDIR
Fixes #80238

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-20 17:16:02 +00:00
Mark Rousskov
4de836e214 Install std for non-host targets 2020-09-24 09:37:23 -04:00
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
bors
2c21a6f3a8 Auto merge of #74495 - shepmaster:bootstrap-dist-target-files, r=Mark-Simulacrum
Teach bootstrap install and dist commands about TargetSelection

With this, we can now use a target JSON file to build a
cross-compiler:

```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```

r? @Mark-Simulacrum
2020-07-19 22:50:46 +00:00
Jake Goulding
57614da715 Teach bootstrap install and dist commands about TargetSelection
With this, we can now use a target JSON file to build a
cross-compiler:

```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```
2020-07-19 13:04:33 -04:00
Manish Goregaokar
5f76240354
Rollup merge of #74457 - Keruspe:install, r=Mark-Simulacrum
rustbuild: drop tool::should_install

Always install when the build succeeds

Fixes #74431
2020-07-17 18:13:53 -07:00
Marc-Antoine Perennou
4adb13c3a4 rustbuild: drop tool::should_install
Always install when the build succeeds

Fixes #74431

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-07-17 22:11:06 +02:00
Jake Goulding
e2b337dc57 Teach bootstrap about target files vs target triples
`rustc` allows passing in predefined target triples as well as JSON
target specification files. This change allows bootstrap to have the
first inkling about those differences. This allows building a
cross-compiler for an out-of-tree architecture (even though that
compiler won't work for other reasons).

Even if no one ever uses this functionality, I think the newtype
around the `Interned<String>` improves the readability of the code.
2020-07-17 10:08:04 -04:00
Aleksey Kladov
058c1b60a5 Add rust-analyzer submodule
The current plan is that submodule tracks the `release` branch of
rust-analyzer, which is updated once a week.

rust-analyzer is a workspace (with a virtual manifest), the actual
binary is provide by `crates/rust-analyzer` package.

Note that we intentionally don't add rust-analyzer to `Kind::Test`,
for two reasons.

*First*, at the moment rust-analyzer's test suite does a couple of
things which might not work in the context of rust repository. For
example, it shells out directly to `rustup` and `rustfmt`. So, making
this work requires non-trivial efforts.

*Second*, it seems unlikely that running tests in rust-lang/rust repo
would provide any additional guarantees. rust-analyzer builds with
stable and does not depend on the specifics of the compiler, so
changes to compiler can't break ra, unless they break stability
guarantee. Additionally, rust-analyzer itself is gated on bors, so we
are pretty confident that test suite passes.
2020-07-03 16:55:35 +02:00
NODA, Kai
8e7606f204 bootstrap/install.rs: support a nonexistent prefix in x.py install
PR #49778 introduced fs::canonicalize() which fails for a nonexistent path.
This is a surprise for someone used to GNU Autotools' configure which can create any necessary intermediate directories in prefix.

This change makes it run fs::create_dir_all() before canonicalize().
2020-06-16 00:12:47 +08:00
Oliver Scherer
a1824505d8 Gate on clippy on CI 2020-05-02 09:46:42 +02:00
Matthias Krüger
5f979e9afa bootstrap: fix clippy warnings 2020-02-03 20:26:36 +01:00
Ximin Luo
a9dca3b243 rustbuild: fix cross-compile install
although, not sure why this works - it wasn't needed before
2019-12-01 00:53:25 +00:00
Mark Rousskov
2fc32b9e72 Locate rustc binary similarly to codegen backend loading
This ensures that the failure cases for finding the codegen backend and
for finding the rustc binary are essentially the same, and since we
almost always will load the codegen backend, this is essentially meaning
that the rustc change is not a regression.
2019-09-10 16:57:14 -04:00
Tyler Mandry
4f3cd3ca07 Fix x.py install
Make sure we look for save analysis in the right place. Fixes #61703.
2019-06-11 14:27:37 -07:00
Alex Crichton
7b362bb841 Fixup style 2019-05-28 11:56:05 -07:00
Alex Crichton
59291dc788 rustbuild: Assert extended builds don't dist too much
This extends a test in the previous commit to assert that we don't build
extra rustc compilers even when the "extended" option is set to true.
This involved some internal refactoring to have more judicious usage of
`compiler_for`, added in the previous commit, as well.

Various `dist::*` targets were refactored to be parameterized with a
`Compiler` instead of a `stage`/`host`, and then the various parameters
within the `Extended` target were tweaked to ensure that we don't ever
accidentally ask for a stage2 build compiler when we're distributing
something.
2019-05-28 11:50:05 -07:00
Andy Russell
b2f71fb540
remove unneeded extern crates from build tools 2019-05-09 12:03:13 -04:00
Taiki Endo
6343d6bc0d bootstrap: deny(rust_2018_idioms) 2019-02-25 19:30:32 +09:00
Oliver Scherer
f8033a2923 fixup 2019-01-08 15:21:06 +01:00
Oliver Scherer
83530120ea Prepare everything for distributing miri via rustup 2019-01-08 15:21:06 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
ljedrz
a5a3da541b bootstrap: fix edition 2018-12-10 13:59:28 +01:00
ljedrz
fe588d894f Replace a few expect+format combos with unwrap_or_else+panic 2018-07-23 14:47:13 +02:00
Oliver Schneider
8f55152f84 Did you mean to block nightlies on clippy? 2018-07-01 01:35:39 +02:00
Mark Simulacrum
be1e7893d5 Remove uses of Build across Builder steps 2018-04-17 19:50:50 -06:00
Tamir Duberstein
94879023ad
rustbuild: canonicalize prefix install_sh
Testing:
```
  $ git diff
  diff --git a/config.toml.example b/config.toml.example
  index 9dd3002506..b47bc490cd 100644
  --- a/config.toml.example
  +++ b/config.toml.example
  @@ -196,7 +196,7 @@
   [install]

   # Instead of installing to /usr/local, install to this path instead.
  -#prefix = "/usr/local"
  +prefix = "install-prefix"

   # Where to install system configuration files
   # If this is a relative path, it will get installed in `prefix` above
  $ mkdir install-prefix
  $ ./x.py install -i --stage 0 --config config.toml.example
  ...
  $ ls install-prefix/
  bin	lib	share
```

Closes #36989.
2018-04-08 18:57:59 -04:00
Mark Simulacrum
545b92f46d Avoid printing output when in dry run mode 2018-04-03 11:43:14 -06:00
bors
222b0eb583 Auto merge of #48295 - Keruspe:master, r=alexcrichton
rustbuild: pass datadir to rust-installer

This fixes zsh completion install when $datadir != $prefix/share
2018-03-12 08:11:19 +00:00
Mark Simulacrum
1c8f3b011c Remove ONLY_BUILD.
All uses are replaced with not accessing run.target/run.host, and
instead directly using run.builder.build.build.
2018-03-08 20:30:00 -07:00
Mark Simulacrum
1191510881 Remove ONLY_BUILD_TARGETS.
All cases where it is used can be replaced by substituing run.host for
run.builder.build.build; that is its only effect. As such, it is
removable.
2018-03-08 20:30:00 -07:00
Marc-Antoine Perennou
d14f07e089 bootstrap: pass datadir to rust-installer
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2018-03-08 07:47:21 +01:00
O01eg
78a0b7fd46
Refactor checks on list of extended tools. 2018-02-07 20:57:02 +03:00