mirror of
https://git.proxmox.com/git/rustc
synced 2026-01-27 05:29:01 +00:00
New upstream version 1.46.0~beta.2+dfsg1
This commit is contained in:
parent
f9f354fc89
commit
f035d41bc1
527
CONTRIBUTING.md
527
CONTRIBUTING.md
@ -1,529 +1,8 @@
|
||||
# Contributing to Rust
|
||||
[contributing-to-rust]: #contributing-to-rust
|
||||
|
||||
Thank you for your interest in contributing to Rust! There are many ways to
|
||||
contribute, and we appreciate all of them. This document is a bit long, so here's
|
||||
links to the major sections:
|
||||
Thank you for your interest in contributing to Rust!
|
||||
|
||||
* [Feature Requests](#feature-requests)
|
||||
* [Bug Reports](#bug-reports)
|
||||
* [The Build System](#the-build-system)
|
||||
* [Pull Requests](#pull-requests)
|
||||
* [Writing Documentation](#writing-documentation)
|
||||
* [Issue Triage](#issue-triage)
|
||||
* [Out-of-tree Contributions](#out-of-tree-contributions)
|
||||
* [Helpful Links and Information](#helpful-links-and-information)
|
||||
To get started, read the [Getting Started] guide in the [rustc-dev-guide].
|
||||
|
||||
If you have questions, please make a post on [internals.rust-lang.org][internals] or
|
||||
hop on the [Rust Discord server][rust-discord] or [Rust Zulip server][rust-zulip].
|
||||
|
||||
As a reminder, all contributors are expected to follow our [Code of Conduct][coc].
|
||||
|
||||
The [rustc-dev-guide] is your friend! It describes how the compiler works and how
|
||||
to contribute to it in more detail than this document.
|
||||
|
||||
If this is your first time contributing, the [walkthrough] chapter of the guide
|
||||
can give you a good example of how a typical contribution would go.
|
||||
|
||||
[internals]: https://internals.rust-lang.org
|
||||
[rust-discord]: http://discord.gg/rust-lang
|
||||
[rust-zulip]: https://rust-lang.zulipchat.com
|
||||
[coc]: https://www.rust-lang.org/conduct.html
|
||||
[Getting Started]: https://rustc-dev-guide.rust-lang.org/getting-started.html
|
||||
[rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org/
|
||||
[walkthrough]: https://rustc-dev-guide.rust-lang.org/walkthrough.html
|
||||
|
||||
## Feature Requests
|
||||
[feature-requests]: #feature-requests
|
||||
|
||||
To request a change to the way the Rust language works, please head over
|
||||
to the [RFCs repository](https://github.com/rust-lang/rfcs) and view the
|
||||
[README](https://github.com/rust-lang/rfcs/blob/master/README.md)
|
||||
for instructions.
|
||||
|
||||
## Bug Reports
|
||||
[bug-reports]: #bug-reports
|
||||
|
||||
While bugs are unfortunate, they're a reality in software. We can't fix what we
|
||||
don't know about, so please report liberally. If you're not sure if something
|
||||
is a bug or not, feel free to file a bug anyway.
|
||||
|
||||
**If you believe reporting your bug publicly represents a security risk to Rust users,
|
||||
please follow our [instructions for reporting security vulnerabilities](https://www.rust-lang.org/policies/security)**.
|
||||
|
||||
If you're using the nightly channel, please check if the bug exists in the
|
||||
latest toolchain before filing your bug. It might be fixed already.
|
||||
|
||||
If you have the chance, before reporting a bug, please [search existing
|
||||
issues](https://github.com/rust-lang/rust/search?q=&type=Issues&utf8=%E2%9C%93),
|
||||
as it's possible that someone else has already reported your error. This doesn't
|
||||
always work, and sometimes it's hard to know what to search for, so consider this
|
||||
extra credit. We won't mind if you accidentally file a duplicate report.
|
||||
|
||||
Similarly, to help others who encountered the bug find your issue,
|
||||
consider filing an issue with a descriptive title, which contains information that might be unique to it.
|
||||
This can be the language or compiler feature used, the conditions that trigger the bug,
|
||||
or part of the error message if there is any.
|
||||
An example could be: **"impossible case reached" on lifetime inference for impl Trait in return position**.
|
||||
|
||||
Opening an issue is as easy as following [this
|
||||
link](https://github.com/rust-lang/rust/issues/new) and filling out the fields.
|
||||
Here's a template that you can use to file a bug, though it's not necessary to
|
||||
use it exactly:
|
||||
|
||||
<short summary of the bug>
|
||||
|
||||
I tried this code:
|
||||
|
||||
<code sample that causes the bug>
|
||||
|
||||
I expected to see this happen: <explanation>
|
||||
|
||||
Instead, this happened: <explanation>
|
||||
|
||||
## Meta
|
||||
|
||||
`rustc --version --verbose`:
|
||||
|
||||
Backtrace:
|
||||
|
||||
All three components are important: what you did, what you expected, what
|
||||
happened instead. Please include the output of `rustc --version --verbose`,
|
||||
which includes important information about what platform you're on, what
|
||||
version of Rust you're using, etc.
|
||||
|
||||
Sometimes, a backtrace is helpful, and so including that is nice. To get
|
||||
a backtrace, set the `RUST_BACKTRACE` environment variable to a value
|
||||
other than `0`. The easiest way
|
||||
to do this is to invoke `rustc` like this:
|
||||
|
||||
```bash
|
||||
$ RUST_BACKTRACE=1 rustc ...
|
||||
```
|
||||
|
||||
## The Build System
|
||||
|
||||
For info on how to configure and build the compiler, please see [this
|
||||
chapter][rustcguidebuild] of the rustc-dev-guide. This chapter contains info for
|
||||
contributions to the compiler and the standard library. It also lists some
|
||||
really useful commands to the build system (`./x.py`), which could save you a
|
||||
lot of time.
|
||||
|
||||
[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
|
||||
|
||||
## Pull Requests
|
||||
[pull-requests]: #pull-requests
|
||||
|
||||
Pull requests are the primary mechanism we use to change Rust. GitHub itself
|
||||
has some [great documentation][about-pull-requests] on using the Pull Request feature.
|
||||
We use the "fork and pull" model [described here][development-models], where
|
||||
contributors push changes to their personal fork and create pull requests to
|
||||
bring those changes into the source repository.
|
||||
|
||||
[about-pull-requests]: https://help.github.com/articles/about-pull-requests/
|
||||
[development-models]: https://help.github.com/articles/about-collaborative-development-models/
|
||||
|
||||
Please make pull requests against the `master` branch.
|
||||
|
||||
Rust follows a no merge policy, meaning, when you encounter merge
|
||||
conflicts you are expected to always rebase instead of merge.
|
||||
E.g. always use rebase when bringing the latest changes from
|
||||
the master branch to your feature branch.
|
||||
Also, please make sure that fixup commits are squashed into other related
|
||||
commits with meaningful commit messages.
|
||||
|
||||
GitHub allows [closing issues using keywords][closing-keywords]. This feature
|
||||
should be used to keep the issue tracker tidy. However, it is generally preferred
|
||||
to put the "closes #123" text in the PR description rather than the issue commit;
|
||||
particularly during rebasing, citing the issue number in the commit can "spam"
|
||||
the issue in question.
|
||||
|
||||
[closing-keywords]: https://help.github.com/en/articles/closing-issues-using-keywords
|
||||
|
||||
Please make sure your pull request is in compliance with Rust's style
|
||||
guidelines by running
|
||||
|
||||
$ python x.py test tidy
|
||||
|
||||
Make this check before every pull request (and every new commit in a pull
|
||||
request); you can add [git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)
|
||||
before every push to make sure you never forget to make this check.
|
||||
|
||||
All pull requests are reviewed by another person. We have a bot,
|
||||
[@rust-highfive][rust-highfive], that will automatically assign a random person to review your
|
||||
request.
|
||||
|
||||
If you want to request that a specific person reviews your pull request,
|
||||
you can add an `r?` to the pull request description. For example, [Steve][steveklabnik] usually reviews
|
||||
documentation changes. So if you were to make a documentation change, add
|
||||
|
||||
r? @steveklabnik
|
||||
|
||||
to the end of the pull request description, and [@rust-highfive][rust-highfive] will assign
|
||||
[@steveklabnik][steveklabnik] instead of a random person. This is entirely optional.
|
||||
|
||||
After someone has reviewed your pull request, they will leave an annotation
|
||||
on the pull request with an `r+`. It will look something like this:
|
||||
|
||||
@bors r+
|
||||
|
||||
This tells [@bors][bors], our lovable integration bot, that your pull request has
|
||||
been approved. The PR then enters the [merge queue][merge-queue], where [@bors][bors]
|
||||
will run all the tests on every platform we support. If it all works out,
|
||||
[@bors][bors] will merge your code into `master` and close the pull request.
|
||||
|
||||
Depending on the scale of the change, you may see a slightly different form of `r+`:
|
||||
|
||||
@bors r+ rollup
|
||||
|
||||
The additional `rollup` tells [@bors][bors] that this change is eligible for to be
|
||||
"rolled up". Changes that are rolled up are tested and merged at the same time, to
|
||||
speed the process up. Typically only small changes that are expected not to conflict
|
||||
with one another are rolled up.
|
||||
|
||||
[rust-highfive]: https://github.com/rust-highfive
|
||||
[steveklabnik]: https://github.com/steveklabnik
|
||||
[bors]: https://github.com/bors
|
||||
[merge-queue]: https://buildbot2.rust-lang.org/homu/queue/rust
|
||||
|
||||
Speaking of tests, Rust has a comprehensive test suite. More information about
|
||||
it can be found [here][rctd].
|
||||
|
||||
### External Dependencies (subtree)
|
||||
|
||||
As a developer to this repository, you don't have to treat the following external projects
|
||||
differently from other crates that are directly in this repo:
|
||||
|
||||
* Clippy
|
||||
|
||||
They are just regular files and directories. This is in contrast to `submodule` dependencies
|
||||
(see below for those). Only tool authors will actually use any operations here.
|
||||
|
||||
#### Synchronizing a subtree
|
||||
|
||||
There are two synchronization directions: `subtree push` and `subtree pull`.
|
||||
|
||||
```
|
||||
git subtree push -P src/tools/clippy git@github.com:your-github-name/rust-clippy sync-from-rust
|
||||
```
|
||||
|
||||
takes all the changes that
|
||||
happened to the copy in this repo and creates commits on the remote repo that match the local
|
||||
changes. Every local commit that touched the subtree causes a commit on the remote repo, but is
|
||||
modified to move the files from the specified directory to the tool repo root.
|
||||
|
||||
Make sure to not pick the `master` branch on the tool repo, so you can open a normal PR to the tool
|
||||
to merge that subrepo push.
|
||||
|
||||
```
|
||||
git subtree pull -P src/tools/clippy https://github.com/rust-lang/rust-clippy master
|
||||
```
|
||||
|
||||
takes all changes since the last `subtree pull` from the tool repo
|
||||
repo and adds these commits to the rustc repo + a merge commit that moves the tool changes into
|
||||
the specified directory in the rust repository.
|
||||
|
||||
It is recommended that you always do a push first and get that merged to the tool master branch.
|
||||
Then, when you do a pull, the merge works without conflicts.
|
||||
While it's definitely possible to resolve conflicts during a pull, you may have to redo the conflict
|
||||
resolution if your PR doesn't get merged fast enough and there are new conflicts. Do not try to
|
||||
rebase the result of a `git subtree pull`, rebasing merge commits is a bad idea in general.
|
||||
|
||||
You always need to specify the `-P` prefix to the subtree directory and the corresponding remote
|
||||
repository. If you specify the wrong directory or repository
|
||||
you'll get very fun merges that try to push the wrong directory to the wrong remote repository.
|
||||
Luckily you can just abort this without any consequences by throwing away either the pulled commits
|
||||
in rustc or the pushed branch on the remote and try again. It is usually fairly obvious
|
||||
that this is happening because you suddenly get thousands of commits that want to be synchronized.
|
||||
|
||||
#### Creating a new subtree dependency
|
||||
|
||||
If you want to create a new subtree dependency from an existing repository, call (from this
|
||||
repository's root directory!)
|
||||
|
||||
```
|
||||
git subtree add -P src/tools/clippy https://github.com/rust-lang/rust-clippy.git master
|
||||
```
|
||||
|
||||
This will create a new commit, which you may not rebase under any circumstances! Delete the commit
|
||||
and redo the operation if you need to rebase.
|
||||
|
||||
Now you're done, the `src/tools/clippy` directory behaves as if Clippy were part of the rustc
|
||||
monorepo, so no one but you (or others that synchronize subtrees) actually needs to use `git subtree`.
|
||||
|
||||
|
||||
### External Dependencies (submodules)
|
||||
|
||||
Currently building Rust will also build the following external projects:
|
||||
|
||||
* [miri](https://github.com/rust-lang/miri)
|
||||
* [rustfmt](https://github.com/rust-lang/rustfmt)
|
||||
* [rls](https://github.com/rust-lang/rls/)
|
||||
|
||||
We allow breakage of these tools in the nightly channel. Maintainers of these
|
||||
projects will be notified of the breakages and should fix them as soon as
|
||||
possible.
|
||||
|
||||
After the external is fixed, one could add the changes with
|
||||
|
||||
```sh
|
||||
git add path/to/submodule
|
||||
```
|
||||
|
||||
outside the submodule.
|
||||
|
||||
In order to prepare your tool-fixing PR, you can run the build locally by doing
|
||||
`./x.py build src/tools/TOOL`. If you will be editing the sources
|
||||
there, you may wish to set `submodules = false` in the `config.toml`
|
||||
to prevent `x.py` from resetting to the original branch.
|
||||
|
||||
Breakage is not allowed in the beta and stable channels, and must be addressed
|
||||
before the PR is merged.
|
||||
|
||||
#### Breaking Tools Built With The Compiler
|
||||
|
||||
Rust's build system builds a number of tools that make use of the
|
||||
internals of the compiler. This includes
|
||||
[RLS](https://github.com/rust-lang/rls) and
|
||||
[rustfmt](https://github.com/rust-lang/rustfmt). If these tools
|
||||
break because of your changes, you may run into a sort of "chicken and egg"
|
||||
problem. These tools rely on the latest compiler to be built so you can't update
|
||||
them to reflect your changes to the compiler until those changes are merged into
|
||||
the compiler. At the same time, you can't get your changes merged into the compiler
|
||||
because the rust-lang/rust build won't pass until those tools build and pass their
|
||||
tests.
|
||||
|
||||
That means that, in the default state, you can't update the compiler without first
|
||||
fixing rustfmt, rls and the other tools that the compiler builds.
|
||||
|
||||
Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/issues/45861)
|
||||
to make all of this easy to handle. The idea is that we allow these tools to be "broken",
|
||||
so that the rust-lang/rust build passes without trying to build them, then land the change
|
||||
in the compiler, wait for a nightly, and go update the tools that you broke. Once you're done
|
||||
and the tools are working again, you go back in the compiler and update the tools
|
||||
so they can be distributed again.
|
||||
|
||||
This should avoid a bunch of synchronization dances and is also much easier on contributors as
|
||||
there's no need to block on rls/rustfmt/other tools changes going upstream.
|
||||
|
||||
Here are those same steps in detail:
|
||||
|
||||
1. (optional) First, if it doesn't exist already, create a `config.toml` by copying
|
||||
`config.toml.example` in the root directory of the Rust repository.
|
||||
Set `submodules = false` in the `[build]` section. This will prevent `x.py`
|
||||
from resetting to the original branch after you make your changes. If you
|
||||
need to [update any submodules to their latest versions](#updating-submodules),
|
||||
see the section of this file about that for more information.
|
||||
2. (optional) Run `./x.py test src/tools/rustfmt` (substituting the submodule
|
||||
that broke for `rustfmt`). Fix any errors in the submodule (and possibly others).
|
||||
3. (optional) Make commits for your changes and send them to upstream repositories as a PR.
|
||||
4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be
|
||||
merged because CI will be broken. You'll want to write a message on the PR referencing
|
||||
your change, and how the PR should be merged once your change makes it into a nightly.
|
||||
5. Wait for your PR to merge.
|
||||
6. Wait for a nightly
|
||||
7. (optional) Help land your PR on the upstream repository now that your changes are in nightly.
|
||||
8. (optional) Send a PR to rust-lang/rust updating the submodule.
|
||||
|
||||
#### Updating submodules
|
||||
|
||||
These instructions are specific to updating `rustfmt`, however they may apply
|
||||
to the other submodules as well. Please help by improving these instructions
|
||||
if you find any discrepancies or special cases that need to be addressed.
|
||||
|
||||
To update the `rustfmt` submodule, start by running the appropriate
|
||||
[`git submodule` command](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
|
||||
For example, to update to the latest commit on the remote master branch,
|
||||
you may want to run:
|
||||
```
|
||||
git submodule update --remote src/tools/rustfmt
|
||||
```
|
||||
If you run `./x.py build` now, and you are lucky, it may just work. If you see
|
||||
an error message about patches that did not resolve to any crates, you will need
|
||||
to complete a few more steps which are outlined with their rationale below.
|
||||
|
||||
*(This error may change in the future to include more information.)*
|
||||
```
|
||||
error: failed to resolve patches for `https://github.com/rust-lang/rustfmt`
|
||||
|
||||
Caused by:
|
||||
patch for `rustfmt-nightly` in `https://github.com/rust-lang/rustfmt` did not resolve to any crates
|
||||
failed to run: ~/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path ~/rust/src/bootstrap/Cargo.toml
|
||||
```
|
||||
|
||||
If you haven't used the `[patch]`
|
||||
section of `Cargo.toml` before, there is [some relevant documentation about it
|
||||
in the cargo docs](http://doc.crates.io/manifest.html#the-patch-section). In
|
||||
addition to that, you should read the
|
||||
[Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#overriding-dependencies)
|
||||
section of the documentation as well.
|
||||
|
||||
Specifically, the following [section in Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#testing-a-bugfix) reveals what the problem is:
|
||||
|
||||
> Next up we need to ensure that our lock file is updated to use this new version of uuid so our project uses the locally checked out copy instead of one from crates.io. The way [patch] works is that it'll load the dependency at ../path/to/uuid and then whenever crates.io is queried for versions of uuid it'll also return the local version.
|
||||
>
|
||||
> This means that the version number of the local checkout is significant and will affect whether the patch is used. Our manifest declared uuid = "1.0" which means we'll only resolve to >= 1.0.0, < 2.0.0, and Cargo's greedy resolution algorithm also means that we'll resolve to the maximum version within that range. Typically this doesn't matter as the version of the git repository will already be greater or match the maximum version published on crates.io, but it's important to keep this in mind!
|
||||
|
||||
This says that when we updated the submodule, the version number in our
|
||||
`src/tools/rustfmt/Cargo.toml` changed. The new version is different from
|
||||
the version in `Cargo.lock`, so the build can no longer continue.
|
||||
|
||||
To resolve this, we need to update `Cargo.lock`. Luckily, cargo provides a
|
||||
command to do this easily.
|
||||
|
||||
```
|
||||
$ cargo update -p rustfmt-nightly
|
||||
```
|
||||
|
||||
This should change the version listed in `Cargo.lock` to the new version you updated
|
||||
the submodule to. Running `./x.py build` should work now.
|
||||
|
||||
## Writing Documentation
|
||||
|
||||
Documentation improvements are very welcome. The source of `doc.rust-lang.org`
|
||||
is located in `src/doc` in the tree, and standard API documentation is generated
|
||||
from the source code itself. Documentation pull requests function in the same way
|
||||
as other pull requests.
|
||||
|
||||
To find documentation-related issues, sort by the [T-doc label][tdoc].
|
||||
|
||||
[tdoc]: https://github.com/rust-lang/rust/issues?q=is%3Aopen%20is%3Aissue%20label%3AT-doc
|
||||
|
||||
You can find documentation style guidelines in [RFC 1574][rfc1574].
|
||||
|
||||
[rfc1574]: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
|
||||
|
||||
In many cases, you don't need a full `./x.py doc`, which will build the entire
|
||||
stage 2 compiler and compile the various books published on
|
||||
[doc.rust-lang.org]. When updating documentation for the standard library,
|
||||
first try `./x.py doc --stage 0 src/libstd`. If that fails, or if you need to
|
||||
see the output from the latest version of `rustdoc`, use `--stage 1` instead of
|
||||
`--stage 0`. Results should appear in `build/$TARGET/crate-docs`.
|
||||
|
||||
[doc.rust-lang.org]: htts://doc.rust-lang.org
|
||||
|
||||
You can also use `rustdoc` directly to check small fixes. For example,
|
||||
`rustdoc src/doc/reference.md` will render reference to `doc/reference.html`.
|
||||
The CSS might be messed up, but you can verify that the HTML is right.
|
||||
|
||||
Additionally, contributions to the [rustc-dev-guide] are always welcome. Contributions
|
||||
can be made directly at [the
|
||||
rust-lang/rustc-dev-guide](https://github.com/rust-lang/rustc-dev-guide) repo. The issue
|
||||
tracker in that repo is also a great way to find things that need doing. There
|
||||
are issues for beginners and advanced compiler devs alike!
|
||||
|
||||
## Issue Triage
|
||||
|
||||
Sometimes, an issue will stay open, even though the bug has been fixed. And
|
||||
sometimes, the original bug may go stale because something has changed in the
|
||||
meantime.
|
||||
|
||||
It can be helpful to go through older bug reports and make sure that they are
|
||||
still valid. Load up an older issue, double check that it's still true, and
|
||||
leave a comment letting us know if it is or is not. The [least recently
|
||||
updated sort][lru] is good for finding issues like this.
|
||||
|
||||
Contributors with sufficient permissions on the Rust repo can help by adding
|
||||
labels to triage issues:
|
||||
|
||||
* Yellow, **A**-prefixed labels state which **area** of the project an issue
|
||||
relates to.
|
||||
|
||||
* Magenta, **B**-prefixed labels identify bugs which are **blockers**.
|
||||
|
||||
* Dark blue, **beta-** labels track changes which need to be backported into
|
||||
the beta branches.
|
||||
|
||||
* Light purple, **C**-prefixed labels represent the **category** of an issue.
|
||||
|
||||
* Green, **E**-prefixed labels explain the level of **experience** necessary
|
||||
to fix the issue.
|
||||
|
||||
* The dark blue **final-comment-period** label marks bugs that are using the
|
||||
RFC signoff functionality of [rfcbot] and are currently in the final
|
||||
comment period.
|
||||
|
||||
* Red, **I**-prefixed labels indicate the **importance** of the issue. The
|
||||
[I-nominated][inom] label indicates that an issue has been nominated for
|
||||
prioritizing at the next triage meeting.
|
||||
|
||||
* The purple **metabug** label marks lists of bugs collected by other
|
||||
categories.
|
||||
|
||||
* Purple gray, **O**-prefixed labels are the **operating system** or platform
|
||||
that this issue is specific to.
|
||||
|
||||
* Orange, **P**-prefixed labels indicate a bug's **priority**. These labels
|
||||
are only assigned during triage meetings, and replace the [I-nominated][inom]
|
||||
label.
|
||||
|
||||
* The gray **proposed-final-comment-period** label marks bugs that are using
|
||||
the RFC signoff functionality of [rfcbot] and are currently awaiting
|
||||
signoff of all team members in order to enter the final comment period.
|
||||
|
||||
* Pink, **regression**-prefixed labels track regressions from stable to the
|
||||
release channels.
|
||||
|
||||
* The light orange **relnotes** label marks issues that should be documented in
|
||||
the release notes of the next release.
|
||||
|
||||
* Gray, **S**-prefixed labels are used for tracking the **status** of pull
|
||||
requests.
|
||||
|
||||
* Blue, **T**-prefixed bugs denote which **team** the issue belongs to.
|
||||
|
||||
If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
|
||||
|
||||
[inom]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AI-nominated
|
||||
[eeasy]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AE-easy
|
||||
[lru]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc
|
||||
[rfcbot]: https://github.com/anp/rfcbot-rs/
|
||||
|
||||
## Out-of-tree Contributions
|
||||
|
||||
There are a number of other ways to contribute to Rust that don't deal with
|
||||
this repository.
|
||||
|
||||
Answer questions in the _Get Help!_ channels from the [Rust Discord server][rust-discord], on [users.rust-lang.org][users],
|
||||
or on [StackOverflow][so].
|
||||
|
||||
Participate in the [RFC process](https://github.com/rust-lang/rfcs).
|
||||
|
||||
Find a [requested community library][community-library], build it, and publish
|
||||
it to [Crates.io](http://crates.io). Easier said than done, but very, very
|
||||
valuable!
|
||||
|
||||
[rust-discord]: https://discord.gg/rust-lang
|
||||
[users]: https://users.rust-lang.org/
|
||||
[so]: http://stackoverflow.com/questions/tagged/rust
|
||||
[community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library
|
||||
|
||||
## Helpful Links and Information
|
||||
|
||||
For people new to Rust, and just starting to contribute, or even for
|
||||
more seasoned developers, some useful places to look for information
|
||||
are:
|
||||
|
||||
* The [rustc dev guide] contains information about how various parts of the compiler work and how to contribute to the compiler
|
||||
* [Rust Forge][rustforge] contains additional documentation, including write-ups of how to achieve common tasks
|
||||
* The [Rust Internals forum][rif], a place to ask questions and
|
||||
discuss Rust's internals
|
||||
* The [generated documentation for rust's compiler][gdfrustc]
|
||||
* The [rust reference][rr], even though it doesn't specifically talk about Rust's internals, it's a great resource nonetheless
|
||||
* Although out of date, [Tom Lee's great blog article][tlgba] is very helpful
|
||||
* [rustaceans.org][ro] is helpful, but mostly dedicated to IRC
|
||||
* The [Rust Compiler Testing Docs][rctd]
|
||||
* For [@bors][bors], [this cheat sheet][cheatsheet] is helpful
|
||||
(though you'll need to replace `@homu` with `@bors` in any commands)
|
||||
* **Google!** ([search only in Rust Documentation][gsearchdocs] to find types, traits, etc. quickly)
|
||||
* Don't be afraid to ask! The Rust community is friendly and helpful.
|
||||
|
||||
[rustc dev guide]: https://rustc-dev-guide.rust-lang.org/about-this-guide.html
|
||||
[gdfrustc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/
|
||||
[gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
|
||||
[rif]: http://internals.rust-lang.org
|
||||
[rr]: https://doc.rust-lang.org/book/README.html
|
||||
[rustforge]: https://forge.rust-lang.org/
|
||||
[tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
|
||||
[ro]: http://www.rustaceans.org/
|
||||
[rctd]: https://rustc-dev-guide.rust-lang.org/tests/intro.html
|
||||
[cheatsheet]: https://buildbot2.rust-lang.org/homu/
|
||||
|
||||
953
Cargo.lock
generated
953
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
27
Cargo.toml
27
Cargo.toml
@ -33,14 +33,27 @@ exclude = [
|
||||
"obj",
|
||||
]
|
||||
|
||||
# These options are controlled from our rustc wrapper script, so turn them off
|
||||
# here and have them controlled elsewhere.
|
||||
[profile.dev]
|
||||
debug = false
|
||||
debug-assertions = false
|
||||
[profile.test]
|
||||
debug = false
|
||||
[profile.release.package.compiler_builtins]
|
||||
# The compiler-builtins crate cannot reference libcore, and it's own CI will
|
||||
# verify that this is the case. This requires, however, that the crate is built
|
||||
# without overflow checks and debug assertions. Forcefully disable debug
|
||||
# assertions and overflow checks here which should ensure that even if these
|
||||
# assertions are enabled for libstd we won't enable then for compiler_builtins
|
||||
# which should ensure we still link everything correctly.
|
||||
debug-assertions = false
|
||||
overflow-checks = false
|
||||
|
||||
# For compiler-builtins we always use a high number of codegen units.
|
||||
# The goal here is to place every single intrinsic into its own object
|
||||
# file to avoid symbol clashes with the system libgcc if possible. Note
|
||||
# that this number doesn't actually produce this many object files, we
|
||||
# just don't create more than this number of object files.
|
||||
#
|
||||
# It's a bit of a bummer that we have to pass this here, unfortunately.
|
||||
# Ideally this would be specified through an env var to Cargo so Cargo
|
||||
# knows how many CGUs are for this specific crate, but for now
|
||||
# per-crate configuration isn't specifiable in the environment.
|
||||
codegen-units = 10000
|
||||
|
||||
# We want the RLS to use the version of Cargo that we've got vendored in this
|
||||
# repository to ensure that the same exact version of Cargo is used by both the
|
||||
|
||||
52
README.md
52
README.md
@ -1,10 +1,14 @@
|
||||
# The Rust Programming Language
|
||||
<a href = "https://www.rust-lang.org/">
|
||||
<img width = "90%" height = "auto" src = "https://img.shields.io/badge/Rust-Programming%20Language-black?style=flat&logo=rust" alt = "The Rust Programming Language">
|
||||
</a>
|
||||
|
||||
This is the main source code repository for [Rust]. It contains the compiler,
|
||||
standard library, and documentation.
|
||||
standard library, and documentation.
|
||||
|
||||
[Rust]: https://www.rust-lang.org
|
||||
|
||||
**Note: this README is for _users_ rather than _contributors_.**
|
||||
|
||||
## Quick Start
|
||||
|
||||
Read ["Installation"] from [The Book].
|
||||
@ -14,16 +18,18 @@ Read ["Installation"] from [The Book].
|
||||
|
||||
## Installing from Source
|
||||
|
||||
_Note: If you wish to contribute to the compiler, you should read [this
|
||||
chapter][rustcguidebuild] of the rustc-dev-guide instead of this section._
|
||||
**Note: If you wish to _contribute_ to the compiler, you should read the
|
||||
[Getting Started][gettingstarted] of the rustc-dev-guide instead of this
|
||||
section.**
|
||||
|
||||
The Rust build system has a Python script called `x.py` to bootstrap building
|
||||
the compiler. More information about it may be found by running `./x.py --help`
|
||||
or reading the [rustc dev guide][rustcguidebuild].
|
||||
The Rust build system uses a Python script called `x.py` to build the compiler,
|
||||
which manages the bootstrapping process. More information about it can be found
|
||||
by running `./x.py --help` or reading the [rustc dev guide][rustcguidebuild].
|
||||
|
||||
[gettingstarted]: https://rustc-dev-guide.rust-lang.org/getting-started.html
|
||||
[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
|
||||
|
||||
### Building on Unix-like system
|
||||
### Building on a Unix-like system
|
||||
1. Make sure you have installed the dependencies:
|
||||
|
||||
* `g++` 5.1 or later or `clang++` 3.5 or later
|
||||
@ -54,9 +60,8 @@ or reading the [rustc dev guide][rustcguidebuild].
|
||||
$ cp config.toml.example config.toml
|
||||
```
|
||||
|
||||
It is recommended that if you plan to use the Rust build system to create
|
||||
an installation (using `./x.py install`) that you set the `prefix` value
|
||||
in the `[install]` section to a directory that you have write permissions.
|
||||
If you plan to use `x.py install` to create an installation, it is recommended
|
||||
that you set the `prefix` value in the `[install]` section to a directory.
|
||||
|
||||
Create install directory if you are not installing in default directory
|
||||
|
||||
@ -143,8 +148,8 @@ shell with:
|
||||
```
|
||||
|
||||
Currently, building Rust only works with some known versions of Visual Studio. If
|
||||
you have a more recent version installed the build system doesn't understand
|
||||
then you may need to force rustbuild to use an older version. This can be done
|
||||
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. This can be done
|
||||
by manually calling the appropriate vcvars file before running the bootstrap.
|
||||
|
||||
```batch
|
||||
@ -224,10 +229,6 @@ Snapshot binaries are currently built and tested on several platforms:
|
||||
You may find that other platforms work, but these are our officially
|
||||
supported build environments that are most likely to work.
|
||||
|
||||
There is more advice about hacking on Rust in [CONTRIBUTING.md].
|
||||
|
||||
[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
|
||||
|
||||
## Getting Help
|
||||
|
||||
The Rust community congregates in a few places:
|
||||
@ -242,21 +243,8 @@ The Rust community congregates in a few places:
|
||||
|
||||
## Contributing
|
||||
|
||||
To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
|
||||
|
||||
Most real-time collaboration happens in a variety of channels on the
|
||||
[Rust Discord server][rust-discord], with channels dedicated for getting help,
|
||||
community, documentation, and all major contribution areas in the Rust ecosystem.
|
||||
A good place to ask for help would be the #help channel.
|
||||
|
||||
The [rustc dev guide] might be a good place to start if you want to find out how
|
||||
various parts of the compiler work.
|
||||
|
||||
Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.
|
||||
|
||||
[rust-discord]: https://discord.gg/rust-lang
|
||||
[rustc dev guide]: https://rustc-dev-guide.rust-lang.org/about-this-guide.html
|
||||
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/
|
||||
If you are interested in contributing to the Rust project, please take a look
|
||||
at the [Getting Started][gettingstarted] guide in the [rustc-dev-guide].
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
# the same format as above, but since these targets are experimental, they are
|
||||
# not built by default and the experimental Rust compilation targets that depend
|
||||
# on them will not work unless the user opts in to building them.
|
||||
#experimental-targets = ""
|
||||
#experimental-targets = "AVR"
|
||||
|
||||
# Cap the number of parallel linker invocations when compiling LLVM.
|
||||
# This can be useful when building LLVM with debug info, which significantly
|
||||
@ -118,18 +118,24 @@
|
||||
# nightlies are already produced for. The current platform must be able to run
|
||||
# binaries of this build triple and the nightly will be used to bootstrap the
|
||||
# first compiler.
|
||||
#build = "x86_64-unknown-linux-gnu" # defaults to your host platform
|
||||
#
|
||||
# Defaults to host platform
|
||||
#build = "x86_64-unknown-linux-gnu"
|
||||
|
||||
# In addition to the build triple, other triples to produce full compiler
|
||||
# toolchains for. Each of these triples will be bootstrapped from the build
|
||||
# triple and then will continue to bootstrap themselves. This platform must
|
||||
# currently be able to run all of the triples provided here.
|
||||
#host = ["x86_64-unknown-linux-gnu"] # defaults to just the build triple
|
||||
#
|
||||
# Defaults to just the build triple
|
||||
#host = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
# In addition to all host triples, other triples to produce the standard library
|
||||
# for. Each host triple will be used to produce a copy of the standard library
|
||||
# for each target triple.
|
||||
#target = ["x86_64-unknown-linux-gnu"] # defaults to just the build triple
|
||||
#
|
||||
# Defaults to just the build triple
|
||||
#target = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
# Use this directory to store build artifacts.
|
||||
# You can use "$ROOT" to indicate the root of the git repository.
|
||||
@ -174,7 +180,7 @@
|
||||
# Python interpreter to use for various tasks throughout the build, notably
|
||||
# rustdoc tests, the lldb python interpreter, and some dist bits and pieces.
|
||||
#
|
||||
# Defaults to the Python interpreter used to execute x.py.
|
||||
# Defaults to the Python interpreter used to execute x.py
|
||||
#python = "python"
|
||||
|
||||
# Force Cargo to check that Cargo.lock describes the precise dependency
|
||||
@ -209,7 +215,8 @@
|
||||
# Build the sanitizer runtimes
|
||||
#sanitizers = false
|
||||
|
||||
# Build the profiler runtime
|
||||
# Build the profiler runtime (required when compiling with options that depend
|
||||
# on this runtime, such as `-C profile-generate` or `-Z instrument-coverage`).
|
||||
#profiler = false
|
||||
|
||||
# Indicates whether the native libraries linked into Cargo will be statically
|
||||
@ -311,30 +318,46 @@
|
||||
#codegen-units-std = 1
|
||||
|
||||
# Whether or not debug assertions are enabled for the compiler and standard
|
||||
# library.
|
||||
#debug-assertions = debug
|
||||
# library. Debug assertions control the maximum log level used by rustc. When
|
||||
# enabled calls to `trace!` and `debug!` macros are preserved in the compiled
|
||||
# binary, otherwise they are omitted.
|
||||
#
|
||||
# Defaults to rust.debug value
|
||||
#debug-assertions = false
|
||||
|
||||
# Whether or not debug assertions are enabled for the standard library.
|
||||
# Overrides the `debug-assertions` option, if defined.
|
||||
#debug-assertions-std = debug-assertions
|
||||
#
|
||||
# Defaults to rust.debug-assertions value
|
||||
#debug-assertions-std = false
|
||||
|
||||
# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`.
|
||||
# `0` - no debug info
|
||||
# `1` - line tables only
|
||||
# `1` - line tables only - sufficient to generate backtraces that include line
|
||||
# information and inlined functions, set breakpoints at source code
|
||||
# locations, and step through execution in a debugger.
|
||||
# `2` - full debug info with variable and type information
|
||||
# Can be overridden for specific subsets of Rust code (rustc, std or tools).
|
||||
# Debuginfo for tests run with compiletest is not controlled by this option
|
||||
# and needs to be enabled separately with `debuginfo-level-tests`.
|
||||
#debuginfo-level = if debug { 2 } else { 0 }
|
||||
#
|
||||
# Defaults to 2 if debug is true
|
||||
#debuginfo-level = 0
|
||||
|
||||
# Debuginfo level for the compiler.
|
||||
#debuginfo-level-rustc = debuginfo-level
|
||||
#
|
||||
# Defaults to rust.debuginfo-level value
|
||||
#debuginfo-level-rustc = 0
|
||||
|
||||
# Debuginfo level for the standard library.
|
||||
#debuginfo-level-std = debuginfo-level
|
||||
#
|
||||
# Defaults to rust.debuginfo-level value
|
||||
#debuginfo-level-std = 0
|
||||
|
||||
# Debuginfo level for the tools.
|
||||
#debuginfo-level-tools = debuginfo-level
|
||||
#
|
||||
# Defaults to rust.debuginfo-level value
|
||||
#debuginfo-level-tools = 0
|
||||
|
||||
# Debuginfo level for the test suites run with compiletest.
|
||||
# FIXME(#61117): Some tests fail when this option is enabled.
|
||||
@ -359,7 +382,7 @@
|
||||
# nightly features
|
||||
#channel = "dev"
|
||||
|
||||
# The root location of the MUSL installation directory.
|
||||
# The root location of the musl installation directory.
|
||||
#musl-root = "..."
|
||||
|
||||
# By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix
|
||||
@ -502,12 +525,15 @@
|
||||
# only use static libraries. If unset, the target's default linkage is used.
|
||||
#crt-static = false
|
||||
|
||||
# The root location of the MUSL installation directory. The library directory
|
||||
# The root location of the musl installation directory. The library directory
|
||||
# will also need to contain libunwind.a for an unwinding implementation. Note
|
||||
# that this option only makes sense for MUSL targets that produce statically
|
||||
# that this option only makes sense for musl targets that produce statically
|
||||
# linked binaries
|
||||
#musl-root = "..."
|
||||
|
||||
# The full path to the musl libdir.
|
||||
#musl-libdir = musl-root/lib
|
||||
|
||||
# The root location of the `wasm32-wasi` sysroot.
|
||||
#wasi-root = "..."
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
5c1f21c3b82297671ad3ae1e8c942d2ca92e84f2
|
||||
6f959902b3103c49ca981fbc01871589c3498489
|
||||
@ -76,6 +76,10 @@ fn main() {
|
||||
cmd.env("RUST_BACKTRACE", "1");
|
||||
}
|
||||
|
||||
if let Ok(lint_flags) = env::var("RUSTC_LINT_FLAGS") {
|
||||
cmd.args(lint_flags.split_whitespace());
|
||||
}
|
||||
|
||||
if target.is_some() {
|
||||
// The stage0 compiler has a special sysroot distinct from what we
|
||||
// actually downloaded, so we just always pass the `--sysroot` option,
|
||||
@ -101,44 +105,6 @@ fn main() {
|
||||
{
|
||||
cmd.arg("-C").arg("panic=abort");
|
||||
}
|
||||
|
||||
// Set various options from config.toml to configure how we're building
|
||||
// code.
|
||||
let debug_assertions = match env::var("RUSTC_DEBUG_ASSERTIONS") {
|
||||
Ok(s) => {
|
||||
if s == "true" {
|
||||
"y"
|
||||
} else {
|
||||
"n"
|
||||
}
|
||||
}
|
||||
Err(..) => "n",
|
||||
};
|
||||
|
||||
// The compiler builtins are pretty sensitive to symbols referenced in
|
||||
// libcore and such, so we never compile them with debug assertions.
|
||||
//
|
||||
// FIXME(rust-lang/cargo#7253) we should be doing this in `builder.rs`
|
||||
// with env vars instead of doing it here in this script.
|
||||
if crate_name == Some("compiler_builtins") {
|
||||
cmd.arg("-C").arg("debug-assertions=no");
|
||||
} else {
|
||||
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
|
||||
}
|
||||
|
||||
// For compiler-builtins we always use a high number of codegen units.
|
||||
// The goal here is to place every single intrinsic into its own object
|
||||
// file to avoid symbol clashes with the system libgcc if possible. Note
|
||||
// that this number doesn't actually produce this many object files, we
|
||||
// just don't create more than this number of object files.
|
||||
//
|
||||
// It's a bit of a bummer that we have to pass this here, unfortunately.
|
||||
// Ideally this would be specified through an env var to Cargo so Cargo
|
||||
// knows how many CGUs are for this specific crate, but for now
|
||||
// per-crate configuration isn't specifiable in the environment.
|
||||
if crate_name == Some("compiler_builtins") {
|
||||
cmd.arg("-Ccodegen-units=10000");
|
||||
}
|
||||
} else {
|
||||
// FIXME(rust-lang/cargo#5754) we shouldn't be using special env vars
|
||||
// here, but rather Cargo should know what flags to pass rustc itself.
|
||||
|
||||
@ -13,7 +13,6 @@ fn main() {
|
||||
let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
|
||||
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
|
||||
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
|
||||
let mut has_unstable = false;
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
@ -55,22 +54,10 @@ fn main() {
|
||||
cmd.arg("--crate-version").arg(version);
|
||||
}
|
||||
|
||||
// Needed to be able to run all rustdoc tests.
|
||||
if env::var_os("RUSTDOC_GENERATE_REDIRECT_PAGES").is_some() {
|
||||
// This "unstable-options" can be removed when `--generate-redirect-pages` is stabilized
|
||||
if !has_unstable {
|
||||
cmd.arg("-Z").arg("unstable-options");
|
||||
}
|
||||
cmd.arg("--generate-redirect-pages");
|
||||
has_unstable = true;
|
||||
}
|
||||
|
||||
// Needed to be able to run all rustdoc tests.
|
||||
if let Some(ref x) = env::var_os("RUSTDOC_RESOURCE_SUFFIX") {
|
||||
// This "unstable-options" can be removed when `--resource-suffix` is stabilized
|
||||
if !has_unstable {
|
||||
cmd.arg("-Z").arg("unstable-options");
|
||||
}
|
||||
cmd.arg("-Z").arg("unstable-options");
|
||||
cmd.arg("--resource-suffix").arg(x);
|
||||
}
|
||||
|
||||
|
||||
@ -184,6 +184,7 @@ def default_build_triple():
|
||||
ostype = require(["uname", "-s"], exit=required)
|
||||
cputype = require(['uname', '-m'], exit=required)
|
||||
|
||||
# If we do not have `uname`, assume Windows.
|
||||
if ostype is None or cputype is None:
|
||||
return 'x86_64-pc-windows-msvc'
|
||||
|
||||
@ -236,6 +237,11 @@ def default_build_triple():
|
||||
if ostype.endswith('WOW64'):
|
||||
cputype = 'x86_64'
|
||||
ostype = 'pc-windows-gnu'
|
||||
elif sys.platform == 'win32':
|
||||
# Some Windows platforms might have a `uname` command that returns a
|
||||
# non-standard string (e.g. gnuwin32 tools returns `windows32`). In
|
||||
# these cases, fall back to using sys.platform.
|
||||
return 'x86_64-pc-windows-msvc'
|
||||
else:
|
||||
err = "unknown OS type: {}".format(ostype)
|
||||
sys.exit(err)
|
||||
@ -863,7 +869,7 @@ class RustBuild(object):
|
||||
# the rust git repository is updated. Normal development usually does
|
||||
# not use vendoring, so hopefully this isn't too much of a problem.
|
||||
if self.use_vendored_sources and not os.path.exists(vendor_dir):
|
||||
run([self.cargo(), "vendor"],
|
||||
run([self.cargo(), "vendor", "--sync=./src/tools/rust-analyzer/Cargo.toml"],
|
||||
verbose=self.verbose, cwd=self.rust_root)
|
||||
|
||||
|
||||
@ -893,15 +899,18 @@ def bootstrap(help_triggered):
|
||||
build.verbose = args.verbose
|
||||
build.clean = args.clean
|
||||
|
||||
try:
|
||||
toml_path = args.config or 'config.toml'
|
||||
# Read from `RUST_BOOTSTRAP_CONFIG`, then `--config`, then fallback to `config.toml` (if it
|
||||
# exists).
|
||||
toml_path = os.getenv('RUST_BOOTSTRAP_CONFIG') or args.config
|
||||
if not toml_path and os.path.exists('config.toml'):
|
||||
toml_path = 'config.toml'
|
||||
|
||||
if toml_path:
|
||||
if not os.path.exists(toml_path):
|
||||
toml_path = os.path.join(build.rust_root, toml_path)
|
||||
|
||||
with open(toml_path) as config:
|
||||
build.config_toml = config.read()
|
||||
except (OSError, IOError):
|
||||
pass
|
||||
|
||||
config_verbose = build.get_toml('verbose', 'build')
|
||||
if config_verbose is not None:
|
||||
@ -951,6 +960,8 @@ def bootstrap(help_triggered):
|
||||
env["RUSTC_BOOTSTRAP"] = '1'
|
||||
env["CARGO"] = build.cargo()
|
||||
env["RUSTC"] = build.rustc()
|
||||
if toml_path:
|
||||
env["BOOTSTRAP_CONFIG"] = toml_path
|
||||
if build.rustfmt():
|
||||
env["RUSTFMT"] = build.rustfmt()
|
||||
run(args, env=env, verbose=build.verbose)
|
||||
|
||||
@ -23,7 +23,7 @@ use crate::install;
|
||||
use crate::native;
|
||||
use crate::run;
|
||||
use crate::test;
|
||||
use crate::tool;
|
||||
use crate::tool::{self, SourceType};
|
||||
use crate::util::{self, add_dylib_path, add_link_lib_path, exe, libdir};
|
||||
use crate::{Build, DocTests, GitRepo, Mode};
|
||||
|
||||
@ -52,6 +52,8 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
|
||||
/// it's been assembled.
|
||||
type Output: Clone;
|
||||
|
||||
/// Whether this step is run by default as part of its respective phase.
|
||||
/// `true` here can still be overwritten by `should_run` calling `default_condition`.
|
||||
const DEFAULT: bool = false;
|
||||
|
||||
/// If true, then this rule should be skipped if --target was specified, but --host was not
|
||||
@ -97,9 +99,21 @@ struct StepDescription {
|
||||
name: &'static str,
|
||||
}
|
||||
|
||||
/// Collection of paths used to match a task rule.
|
||||
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
|
||||
pub enum PathSet {
|
||||
/// A collection of individual paths.
|
||||
///
|
||||
/// These are generally matched as a path suffix. For example, a
|
||||
/// command-line value of `libstd` will match if `src/libstd` is in the
|
||||
/// set.
|
||||
Set(BTreeSet<PathBuf>),
|
||||
/// A "suite" of paths.
|
||||
///
|
||||
/// These can match as a path suffix (like `Set`), or as a prefix. For
|
||||
/// example, a command-line value of `src/test/ui/abi/variadic-ffi.rs`
|
||||
/// will match `src/test/ui`. A command-line value of `ui` would also
|
||||
/// match `src/test/ui`.
|
||||
Suite(PathBuf),
|
||||
}
|
||||
|
||||
@ -249,21 +263,33 @@ impl<'a> ShouldRun<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
// Unlike `krate` this will create just one pathset. As such, it probably shouldn't actually
|
||||
// ever be used, but as we transition to having all rules properly handle passing krate(...) by
|
||||
// actually doing something different for every crate passed.
|
||||
/// Indicates it should run if the command-line selects the given crate or
|
||||
/// any of its (local) dependencies.
|
||||
///
|
||||
/// Compared to `krate`, this treats the dependencies as aliases for the
|
||||
/// same job. Generally it is preferred to use `krate`, and treat each
|
||||
/// individual path separately. For example `./x.py test src/liballoc`
|
||||
/// (which uses `krate`) will test just `liballoc`. However, `./x.py check
|
||||
/// src/liballoc` (which uses `all_krates`) will check all of `libtest`.
|
||||
/// `all_krates` should probably be removed at some point.
|
||||
pub fn all_krates(mut self, name: &str) -> Self {
|
||||
let mut set = BTreeSet::new();
|
||||
for krate in self.builder.in_tree_crates(name) {
|
||||
set.insert(PathBuf::from(&krate.path));
|
||||
let path = krate.local_path(self.builder);
|
||||
set.insert(path);
|
||||
}
|
||||
self.paths.insert(PathSet::Set(set));
|
||||
self
|
||||
}
|
||||
|
||||
/// Indicates it should run if the command-line selects the given crate or
|
||||
/// any of its (local) dependencies.
|
||||
///
|
||||
/// `make_run` will be called separately for each matching command-line path.
|
||||
pub fn krate(mut self, name: &str) -> Self {
|
||||
for krate in self.builder.in_tree_crates(name) {
|
||||
self.paths.insert(PathSet::one(&krate.path));
|
||||
let path = krate.local_path(self.builder);
|
||||
self.paths.insert(PathSet::one(path));
|
||||
}
|
||||
self
|
||||
}
|
||||
@ -342,6 +368,7 @@ impl<'a> Builder<'a> {
|
||||
tool::RustInstaller,
|
||||
tool::Cargo,
|
||||
tool::Rls,
|
||||
tool::RustAnalyzer,
|
||||
tool::Rustdoc,
|
||||
tool::Clippy,
|
||||
tool::CargoClippy,
|
||||
@ -371,7 +398,6 @@ impl<'a> Builder<'a> {
|
||||
test::UiFullDeps,
|
||||
test::Rustdoc,
|
||||
test::Pretty,
|
||||
test::RunPassValgrindPretty,
|
||||
test::Crate,
|
||||
test::CrateLibrustc,
|
||||
test::CrateRustdoc,
|
||||
@ -437,6 +463,7 @@ impl<'a> Builder<'a> {
|
||||
dist::PlainSourceTarball,
|
||||
dist::Cargo,
|
||||
dist::Rls,
|
||||
dist::RustAnalyzer,
|
||||
dist::Rustfmt,
|
||||
dist::Clippy,
|
||||
dist::Miri,
|
||||
@ -449,6 +476,7 @@ impl<'a> Builder<'a> {
|
||||
install::Std,
|
||||
install::Cargo,
|
||||
install::Rls,
|
||||
install::RustAnalyzer,
|
||||
install::Rustfmt,
|
||||
install::Clippy,
|
||||
install::Miri,
|
||||
@ -487,13 +515,19 @@ impl<'a> Builder<'a> {
|
||||
should_run = (desc.should_run)(should_run);
|
||||
}
|
||||
let mut help = String::from("Available paths:\n");
|
||||
let mut add_path = |path: &Path| {
|
||||
help.push_str(&format!(" ./x.py {} {}\n", subcommand, path.display()));
|
||||
};
|
||||
for pathset in should_run.paths {
|
||||
if let PathSet::Set(set) = pathset {
|
||||
set.iter().for_each(|path| {
|
||||
help.push_str(
|
||||
format!(" ./x.py {} {}\n", subcommand, path.display()).as_str(),
|
||||
)
|
||||
})
|
||||
match pathset {
|
||||
PathSet::Set(set) => {
|
||||
for path in set {
|
||||
add_path(&path);
|
||||
}
|
||||
}
|
||||
PathSet::Suite(path) => {
|
||||
add_path(&path.join("..."));
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(help)
|
||||
@ -728,6 +762,7 @@ impl<'a> Builder<'a> {
|
||||
&self,
|
||||
compiler: Compiler,
|
||||
mode: Mode,
|
||||
source_type: SourceType,
|
||||
target: Interned<String>,
|
||||
cmd: &str,
|
||||
) -> Cargo {
|
||||
@ -918,14 +953,6 @@ impl<'a> Builder<'a> {
|
||||
.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
|
||||
.env("RUSTC_REAL", self.rustc(compiler))
|
||||
.env("RUSTC_STAGE", stage.to_string())
|
||||
.env(
|
||||
"RUSTC_DEBUG_ASSERTIONS",
|
||||
if mode == Mode::Std {
|
||||
self.config.rust_debug_assertions_std.to_string()
|
||||
} else {
|
||||
self.config.rust_debug_assertions.to_string()
|
||||
},
|
||||
)
|
||||
.env("RUSTC_SYSROOT", &sysroot)
|
||||
.env("RUSTC_LIBDIR", &libdir)
|
||||
.env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
|
||||
@ -949,7 +976,7 @@ impl<'a> Builder<'a> {
|
||||
// we're gated on RUSTC_RPATH here.
|
||||
//
|
||||
// Ok, so the astute might be wondering "why isn't `-C rpath` used
|
||||
// here?" and that is indeed a good question to task. This codegen
|
||||
// here?" and that is indeed a good question to ask. This codegen
|
||||
// option is the compiler's current interface to generating an rpath.
|
||||
// Unfortunately it doesn't quite suffice for us. The flag currently
|
||||
// takes no value as an argument, so the compiler calculates what it
|
||||
@ -1009,6 +1036,14 @@ impl<'a> Builder<'a> {
|
||||
}
|
||||
};
|
||||
cargo.env(profile_var("DEBUG"), debuginfo_level.to_string());
|
||||
cargo.env(
|
||||
profile_var("DEBUG_ASSERTIONS"),
|
||||
if mode == Mode::Std {
|
||||
self.config.rust_debug_assertions_std.to_string()
|
||||
} else {
|
||||
self.config.rust_debug_assertions.to_string()
|
||||
},
|
||||
);
|
||||
|
||||
if !mode.is_tool() {
|
||||
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
|
||||
@ -1094,23 +1129,33 @@ impl<'a> Builder<'a> {
|
||||
|
||||
cargo.env("RUSTC_VERBOSE", self.verbosity.to_string());
|
||||
|
||||
if !mode.is_tool() {
|
||||
if source_type == SourceType::InTree {
|
||||
let mut lint_flags = Vec::new();
|
||||
// When extending this list, add the new lints to the RUSTFLAGS of the
|
||||
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
|
||||
// some code doesn't go through this `rustc` wrapper.
|
||||
rustflags.arg("-Wrust_2018_idioms");
|
||||
rustflags.arg("-Wunused_lifetimes");
|
||||
lint_flags.push("-Wrust_2018_idioms");
|
||||
lint_flags.push("-Wunused_lifetimes");
|
||||
|
||||
if self.config.deny_warnings {
|
||||
rustflags.arg("-Dwarnings");
|
||||
lint_flags.push("-Dwarnings");
|
||||
}
|
||||
|
||||
// FIXME(#58633) hide "unused attribute" errors in incremental
|
||||
// builds of the standard library, as the underlying checks are
|
||||
// not yet properly integrated with incremental recompilation.
|
||||
if mode == Mode::Std && compiler.stage == 0 && self.config.incremental {
|
||||
rustflags.arg("-Aunused-attributes");
|
||||
lint_flags.push("-Aunused-attributes");
|
||||
}
|
||||
// This does not use RUSTFLAGS due to caching issues with Cargo.
|
||||
// Clippy is treated as an "in tree" tool, but shares the same
|
||||
// cache as other "submodule" tools. With these options set in
|
||||
// RUSTFLAGS, that causes *every* shared dependency to be rebuilt.
|
||||
// By injecting this into the rustc wrapper, this circumvents
|
||||
// Cargo's fingerprint detection. This is fine because lint flags
|
||||
// are always ignored in dependencies. Eventually this should be
|
||||
// fixed via better support from Cargo.
|
||||
cargo.env("RUSTC_LINT_FLAGS", lint_flags.join(" "));
|
||||
}
|
||||
|
||||
if let Mode::Rustc | Mode::Codegen = mode {
|
||||
@ -1175,7 +1220,7 @@ impl<'a> Builder<'a> {
|
||||
);
|
||||
}
|
||||
|
||||
// If Control Flow Guard is enabled, pass the `control_flow_guard=checks` flag to rustc
|
||||
// If Control Flow Guard is enabled, pass the `control-flow-guard` flag to rustc
|
||||
// when compiling the standard library, since this might be linked into the final outputs
|
||||
// produced by rustc. Since this mitigation is only available on Windows, only enable it
|
||||
// for the standard library in case the compiler is run on a non-Windows platform.
|
||||
@ -1186,7 +1231,7 @@ impl<'a> Builder<'a> {
|
||||
&& self.config.control_flow_guard
|
||||
&& compiler.stage >= 1
|
||||
{
|
||||
rustflags.arg("-Zcontrol_flow_guard=checks");
|
||||
rustflags.arg("-Zcontrol-flow-guard");
|
||||
}
|
||||
|
||||
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
|
||||
|
||||
@ -54,6 +54,11 @@ fn dist_baseline() {
|
||||
&[dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },]
|
||||
);
|
||||
assert_eq!(first(builder.cache.all::<dist::Src>()), &[dist::Src]);
|
||||
// Make sure rustdoc is only built once.
|
||||
assert_eq!(
|
||||
first(builder.cache.all::<tool::Rustdoc>()),
|
||||
&[tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -414,3 +419,77 @@ fn test_exclude() {
|
||||
// Ensure other tests are not affected.
|
||||
assert!(builder.cache.contains::<test::RustdocUi>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn doc_default() {
|
||||
let mut config = configure(&[], &[]);
|
||||
config.compiler_docs = true;
|
||||
config.cmd = Subcommand::Doc { paths: Vec::new(), open: false };
|
||||
let build = Build::new(config);
|
||||
let mut builder = Builder::new(&build);
|
||||
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &[]);
|
||||
let a = INTERNER.intern_str("A");
|
||||
|
||||
// error_index_generator uses stage 1 to share rustdoc artifacts with the
|
||||
// rustdoc tool.
|
||||
assert_eq!(
|
||||
first(builder.cache.all::<doc::ErrorIndex>()),
|
||||
&[doc::ErrorIndex { compiler: Compiler { host: a, stage: 1 }, target: a },]
|
||||
);
|
||||
assert_eq!(
|
||||
first(builder.cache.all::<tool::ErrorIndex>()),
|
||||
&[tool::ErrorIndex { compiler: Compiler { host: a, stage: 1 } }]
|
||||
);
|
||||
// This is actually stage 1, but Rustdoc::run swaps out the compiler with
|
||||
// stage minus 1 if --stage is not 0. Very confusing!
|
||||
assert_eq!(
|
||||
first(builder.cache.all::<tool::Rustdoc>()),
|
||||
&[tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_docs() {
|
||||
// Behavior of `x.py test` doing various documentation tests.
|
||||
let mut config = configure(&[], &[]);
|
||||
config.cmd = Subcommand::Test {
|
||||
paths: vec![],
|
||||
test_args: vec![],
|
||||
rustc_args: vec![],
|
||||
fail_fast: true,
|
||||
doc_tests: DocTests::Yes,
|
||||
bless: false,
|
||||
compare_mode: None,
|
||||
rustfix_coverage: false,
|
||||
pass: None,
|
||||
};
|
||||
let build = Build::new(config);
|
||||
let mut builder = Builder::new(&build);
|
||||
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]);
|
||||
let a = INTERNER.intern_str("A");
|
||||
|
||||
// error_index_generator uses stage 1 to share rustdoc artifacts with the
|
||||
// rustdoc tool.
|
||||
assert_eq!(
|
||||
first(builder.cache.all::<doc::ErrorIndex>()),
|
||||
&[doc::ErrorIndex { compiler: Compiler { host: a, stage: 1 }, target: a },]
|
||||
);
|
||||
assert_eq!(
|
||||
first(builder.cache.all::<tool::ErrorIndex>()),
|
||||
&[tool::ErrorIndex { compiler: Compiler { host: a, stage: 1 } }]
|
||||
);
|
||||
// Unfortunately rustdoc is built twice. Once from stage1 for compiletest
|
||||
// (and other things), and once from stage0 for std crates. Ideally it
|
||||
// would only be built once. If someone wants to fix this, it might be
|
||||
// worth investigating if it would be possible to test std from stage1.
|
||||
// Note that the stages here are +1 than what they actually are because
|
||||
// Rustdoc::run swaps out the compiler with stage minus 1 if --stage is
|
||||
// not 0.
|
||||
assert_eq!(
|
||||
first(builder.cache.all::<tool::Rustdoc>()),
|
||||
&[
|
||||
tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
|
||||
tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -37,7 +37,9 @@ use crate::{Build, GitRepo};
|
||||
// try to infer the archiver path from the C compiler path.
|
||||
// In the future this logic should be replaced by calling into the `cc` crate.
|
||||
fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
|
||||
if let Some(ar) = env::var_os("AR") {
|
||||
if let Some(ar) = env::var_os(format!("AR_{}", target.replace("-", "_"))) {
|
||||
Some(PathBuf::from(ar))
|
||||
} else if let Some(ar) = env::var_os("AR") {
|
||||
Some(PathBuf::from(ar))
|
||||
} else if target.contains("msvc") {
|
||||
None
|
||||
|
||||
@ -13,7 +13,7 @@ use build_helper::output;
|
||||
use crate::Build;
|
||||
|
||||
// The version number
|
||||
pub const CFG_RELEASE_NUM: &str = "1.45.0";
|
||||
pub const CFG_RELEASE_NUM: &str = "1.46.0";
|
||||
|
||||
pub struct GitInfo {
|
||||
inner: Option<Info>,
|
||||
|
||||
@ -44,7 +44,13 @@ impl Step for Std {
|
||||
let target = self.target;
|
||||
let compiler = builder.compiler(0, builder.config.build);
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Std, target, cargo_subcommand(builder.kind));
|
||||
let mut cargo = builder.cargo(
|
||||
compiler,
|
||||
Mode::Std,
|
||||
SourceType::InTree,
|
||||
target,
|
||||
cargo_subcommand(builder.kind),
|
||||
);
|
||||
std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||
|
||||
builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target));
|
||||
@ -92,8 +98,13 @@ impl Step for Rustc {
|
||||
|
||||
builder.ensure(Std { target });
|
||||
|
||||
let mut cargo =
|
||||
builder.cargo(compiler, Mode::Rustc, target, cargo_subcommand(builder.kind));
|
||||
let mut cargo = builder.cargo(
|
||||
compiler,
|
||||
Mode::Rustc,
|
||||
SourceType::InTree,
|
||||
target,
|
||||
cargo_subcommand(builder.kind),
|
||||
);
|
||||
rustc_cargo(builder, &mut cargo, target);
|
||||
|
||||
builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target));
|
||||
@ -113,7 +124,7 @@ impl Step for Rustc {
|
||||
}
|
||||
|
||||
macro_rules! tool_check_step {
|
||||
($name:ident, $path:expr) => {
|
||||
($name:ident, $path:expr, $source_type:expr) => {
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct $name {
|
||||
pub target: Interned<String>,
|
||||
@ -145,7 +156,7 @@ macro_rules! tool_check_step {
|
||||
target,
|
||||
cargo_subcommand(builder.kind),
|
||||
$path,
|
||||
SourceType::InTree,
|
||||
$source_type,
|
||||
&[],
|
||||
);
|
||||
|
||||
@ -184,8 +195,12 @@ macro_rules! tool_check_step {
|
||||
};
|
||||
}
|
||||
|
||||
tool_check_step!(Rustdoc, "src/tools/rustdoc");
|
||||
tool_check_step!(Clippy, "src/tools/clippy");
|
||||
tool_check_step!(Rustdoc, "src/tools/rustdoc", SourceType::InTree);
|
||||
// Clippy is a hybrid. It is an external tool, but uses a git subtree instead
|
||||
// of a submodule. Since the SourceType only drives the deny-warnings
|
||||
// behavior, treat it as in-tree so that any new warnings in clippy will be
|
||||
// rejected.
|
||||
tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
|
||||
|
||||
/// Cargo's output path for the standard library in a given stage, compiled
|
||||
/// by a particular compiler for the specified target.
|
||||
|
||||
@ -20,13 +20,13 @@ use filetime::FileTime;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::builder::Cargo;
|
||||
use crate::dist;
|
||||
use crate::native;
|
||||
use crate::util::{exe, is_dylib, symlink_dir};
|
||||
use crate::{Compiler, GitRepo, Mode};
|
||||
|
||||
use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
|
||||
use crate::cache::{Interned, INTERNER};
|
||||
use crate::dist;
|
||||
use crate::native;
|
||||
use crate::tool::SourceType;
|
||||
use crate::util::{exe, is_dylib, symlink_dir};
|
||||
use crate::{Compiler, DependencyType, GitRepo, Mode};
|
||||
|
||||
#[derive(Debug, PartialOrd, Ord, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Std {
|
||||
@ -74,6 +74,7 @@ impl Step for Std {
|
||||
// Even if we're not building std this stage, the new sysroot must
|
||||
// still contain the third party objects needed by various targets.
|
||||
copy_third_party_objects(builder, &compiler, target);
|
||||
copy_self_contained_objects(builder, &compiler, target);
|
||||
|
||||
builder.ensure(StdLink {
|
||||
compiler: compiler_to_use,
|
||||
@ -83,9 +84,10 @@ impl Step for Std {
|
||||
return;
|
||||
}
|
||||
|
||||
target_deps.extend(copy_third_party_objects(builder, &compiler, target).into_iter());
|
||||
target_deps.extend(copy_third_party_objects(builder, &compiler, target));
|
||||
target_deps.extend(copy_self_contained_objects(builder, &compiler, target));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Std, target, "build");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "build");
|
||||
std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||
|
||||
builder.info(&format!(
|
||||
@ -109,21 +111,63 @@ impl Step for Std {
|
||||
}
|
||||
}
|
||||
|
||||
fn copy_and_stamp(
|
||||
builder: &Builder<'_>,
|
||||
libdir: &Path,
|
||||
sourcedir: &Path,
|
||||
name: &str,
|
||||
target_deps: &mut Vec<(PathBuf, DependencyType)>,
|
||||
dependency_type: DependencyType,
|
||||
) {
|
||||
let target = libdir.join(name);
|
||||
builder.copy(&sourcedir.join(name), &target);
|
||||
|
||||
target_deps.push((target, dependency_type));
|
||||
}
|
||||
|
||||
/// Copies third party objects needed by various targets.
|
||||
fn copy_third_party_objects(
|
||||
builder: &Builder<'_>,
|
||||
compiler: &Compiler,
|
||||
target: Interned<String>,
|
||||
) -> Vec<PathBuf> {
|
||||
let libdir = builder.sysroot_libdir(*compiler, target);
|
||||
|
||||
) -> Vec<(PathBuf, DependencyType)> {
|
||||
let mut target_deps = vec![];
|
||||
|
||||
let mut copy_and_stamp = |sourcedir: &Path, name: &str| {
|
||||
let target = libdir.join(name);
|
||||
builder.copy(&sourcedir.join(name), &target);
|
||||
target_deps.push(target);
|
||||
// FIXME: remove this in 2021
|
||||
if target == "x86_64-fortanix-unknown-sgx" {
|
||||
if env::var_os("X86_FORTANIX_SGX_LIBS").is_some() {
|
||||
builder.info("Warning: X86_FORTANIX_SGX_LIBS environment variable is ignored, libunwind is now compiled as part of rustbuild");
|
||||
}
|
||||
}
|
||||
|
||||
if builder.config.sanitizers && compiler.stage != 0 {
|
||||
// The sanitizers are only copied in stage1 or above,
|
||||
// to avoid creating dependency on LLVM.
|
||||
target_deps.extend(
|
||||
copy_sanitizers(builder, &compiler, target)
|
||||
.into_iter()
|
||||
.map(|d| (d, DependencyType::Target)),
|
||||
);
|
||||
}
|
||||
|
||||
target_deps
|
||||
}
|
||||
|
||||
/// Copies third party objects needed by various targets for self-contained linkage.
|
||||
fn copy_self_contained_objects(
|
||||
builder: &Builder<'_>,
|
||||
compiler: &Compiler,
|
||||
target: Interned<String>,
|
||||
) -> Vec<(PathBuf, DependencyType)> {
|
||||
// cfg(bootstrap)
|
||||
// Remove when upgrading bootstrap compiler.
|
||||
let libdir_self_contained = if compiler.stage == 0 {
|
||||
builder.sysroot_libdir(*compiler, target).to_path_buf()
|
||||
} else {
|
||||
builder.sysroot_libdir(*compiler, target).join("self-contained")
|
||||
};
|
||||
t!(fs::create_dir_all(&libdir_self_contained));
|
||||
let mut target_deps = vec![];
|
||||
|
||||
// Copies the CRT objects.
|
||||
//
|
||||
@ -133,31 +177,34 @@ fn copy_third_party_objects(
|
||||
// To do that we have to distribute musl startup objects as a part of Rust toolchain
|
||||
// and link with them manually in the self-contained mode.
|
||||
if target.contains("musl") {
|
||||
let srcdir = builder.musl_root(target).unwrap().join("lib");
|
||||
let srcdir = builder.musl_libdir(target).unwrap();
|
||||
for &obj in &["crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
|
||||
copy_and_stamp(&srcdir, obj);
|
||||
copy_and_stamp(
|
||||
builder,
|
||||
&libdir_self_contained,
|
||||
&srcdir,
|
||||
obj,
|
||||
&mut target_deps,
|
||||
DependencyType::TargetSelfContained,
|
||||
);
|
||||
}
|
||||
} else if target.ends_with("-wasi") {
|
||||
let srcdir = builder.wasi_root(target).unwrap().join("lib/wasm32-wasi");
|
||||
copy_and_stamp(&srcdir, "crt1.o");
|
||||
}
|
||||
|
||||
// Copies libunwind.a compiled to be linked with x86_64-fortanix-unknown-sgx.
|
||||
//
|
||||
// This target needs to be linked to Fortanix's port of llvm's libunwind.
|
||||
// libunwind requires support for rwlock and printing to stderr,
|
||||
// which is provided by std for this target.
|
||||
if target == "x86_64-fortanix-unknown-sgx" {
|
||||
let src_path_env = "X86_FORTANIX_SGX_LIBS";
|
||||
let src =
|
||||
env::var(src_path_env).unwrap_or_else(|_| panic!("{} not found in env", src_path_env));
|
||||
copy_and_stamp(Path::new(&src), "libunwind.a");
|
||||
}
|
||||
|
||||
if builder.config.sanitizers && compiler.stage != 0 {
|
||||
// The sanitizers are only copied in stage1 or above,
|
||||
// to avoid creating dependency on LLVM.
|
||||
target_deps.extend(copy_sanitizers(builder, &compiler, target));
|
||||
copy_and_stamp(
|
||||
builder,
|
||||
&libdir_self_contained,
|
||||
&srcdir,
|
||||
"crt1.o",
|
||||
&mut target_deps,
|
||||
DependencyType::TargetSelfContained,
|
||||
);
|
||||
} else if target.contains("windows-gnu") {
|
||||
for obj in ["crt2.o", "dllcrt2.o"].iter() {
|
||||
let src = compiler_file(builder, builder.cc(target), target, obj);
|
||||
let target = libdir_self_contained.join(obj);
|
||||
builder.copy(&src, &target);
|
||||
target_deps.push((target, DependencyType::TargetSelfContained));
|
||||
}
|
||||
}
|
||||
|
||||
target_deps
|
||||
@ -219,8 +266,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: Interned<String>, stage: u32, ca
|
||||
// Help the libc crate compile by assisting it in finding various
|
||||
// sysroot native libraries.
|
||||
if target.contains("musl") {
|
||||
if let Some(p) = builder.musl_root(target) {
|
||||
let root = format!("native={}/lib", p.to_str().unwrap());
|
||||
if let Some(p) = builder.musl_libdir(target) {
|
||||
let root = format!("native={}", p.to_str().unwrap());
|
||||
cargo.rustflag("-L").rustflag(&root);
|
||||
}
|
||||
}
|
||||
@ -244,6 +291,16 @@ pub fn std_cargo(builder: &Builder<'_>, target: Interned<String>, stage: u32, ca
|
||||
if stage >= 1 {
|
||||
cargo.rustflag("-Cembed-bitcode=yes");
|
||||
}
|
||||
|
||||
// By default, rustc does not include unwind tables unless they are required
|
||||
// for a particular target. They are not required by RISC-V targets, but
|
||||
// compiling the standard library with them means that users can get
|
||||
// backtraces without having to recompile the standard library themselves.
|
||||
//
|
||||
// This choice was discussed in https://github.com/rust-lang/rust/pull/69890
|
||||
if target.contains("riscv") {
|
||||
cargo.rustflag("-Cforce-unwind-tables=yes");
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
@ -325,7 +382,7 @@ pub struct StartupObjects {
|
||||
}
|
||||
|
||||
impl Step for StartupObjects {
|
||||
type Output = Vec<PathBuf>;
|
||||
type Output = Vec<(PathBuf, DependencyType)>;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.path("src/rtstartup")
|
||||
@ -344,7 +401,7 @@ impl Step for StartupObjects {
|
||||
/// They don't require any library support as they're just plain old object
|
||||
/// files, so we just use the nightly snapshot compiler to always build them (as
|
||||
/// no other compilers are guaranteed to be available).
|
||||
fn run(self, builder: &Builder<'_>) -> Vec<PathBuf> {
|
||||
fn run(self, builder: &Builder<'_>) -> Vec<(PathBuf, DependencyType)> {
|
||||
let for_compiler = self.compiler;
|
||||
let target = self.target;
|
||||
if !target.contains("windows-gnu") {
|
||||
@ -378,14 +435,7 @@ impl Step for StartupObjects {
|
||||
|
||||
let target = sysroot_dir.join((*file).to_string() + ".o");
|
||||
builder.copy(dst_file, &target);
|
||||
target_deps.push(target);
|
||||
}
|
||||
|
||||
for obj in ["crt2.o", "dllcrt2.o"].iter() {
|
||||
let src = compiler_file(builder, builder.cc(target), target, obj);
|
||||
let target = sysroot_dir.join(obj);
|
||||
builder.copy(&src, &target);
|
||||
target_deps.push(target);
|
||||
target_deps.push((target, DependencyType::Target));
|
||||
}
|
||||
|
||||
target_deps
|
||||
@ -450,7 +500,7 @@ impl Step for Rustc {
|
||||
target: builder.config.build,
|
||||
});
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "build");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "build");
|
||||
rustc_cargo(builder, &mut cargo, target);
|
||||
|
||||
builder.info(&format!(
|
||||
@ -798,14 +848,17 @@ pub fn add_to_sysroot(
|
||||
sysroot_host_dst: &Path,
|
||||
stamp: &Path,
|
||||
) {
|
||||
let self_contained_dst = &sysroot_dst.join("self-contained");
|
||||
t!(fs::create_dir_all(&sysroot_dst));
|
||||
t!(fs::create_dir_all(&sysroot_host_dst));
|
||||
for (path, host) in builder.read_stamp_file(stamp) {
|
||||
if host {
|
||||
builder.copy(&path, &sysroot_host_dst.join(path.file_name().unwrap()));
|
||||
} else {
|
||||
builder.copy(&path, &sysroot_dst.join(path.file_name().unwrap()));
|
||||
}
|
||||
t!(fs::create_dir_all(&self_contained_dst));
|
||||
for (path, dependency_type) in builder.read_stamp_file(stamp) {
|
||||
let dst = match dependency_type {
|
||||
DependencyType::Host => sysroot_host_dst,
|
||||
DependencyType::Target => sysroot_dst,
|
||||
DependencyType::TargetSelfContained => self_contained_dst,
|
||||
};
|
||||
builder.copy(&path, &dst.join(path.file_name().unwrap()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -814,7 +867,7 @@ pub fn run_cargo(
|
||||
cargo: Cargo,
|
||||
tail_args: Vec<String>,
|
||||
stamp: &Path,
|
||||
additional_target_deps: Vec<PathBuf>,
|
||||
additional_target_deps: Vec<(PathBuf, DependencyType)>,
|
||||
is_check: bool,
|
||||
) -> Vec<PathBuf> {
|
||||
if builder.config.dry_run {
|
||||
@ -865,7 +918,7 @@ pub fn run_cargo(
|
||||
if filename.starts_with(&host_root_dir) {
|
||||
// Unless it's a proc macro used in the compiler
|
||||
if crate_types.iter().any(|t| t == "proc-macro") {
|
||||
deps.push((filename.to_path_buf(), true));
|
||||
deps.push((filename.to_path_buf(), DependencyType::Host));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -873,7 +926,7 @@ pub fn run_cargo(
|
||||
// If this was output in the `deps` dir then this is a precise file
|
||||
// name (hash included) so we start tracking it.
|
||||
if filename.starts_with(&target_deps_dir) {
|
||||
deps.push((filename.to_path_buf(), false));
|
||||
deps.push((filename.to_path_buf(), DependencyType::Target));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -910,10 +963,11 @@ pub fn run_cargo(
|
||||
.collect::<Vec<_>>();
|
||||
for (prefix, extension, expected_len) in toplevel {
|
||||
let candidates = contents.iter().filter(|&&(_, ref filename, ref meta)| {
|
||||
filename.starts_with(&prefix[..])
|
||||
&& filename[prefix.len()..].starts_with('-')
|
||||
&& filename.ends_with(&extension[..])
|
||||
&& meta.len() == expected_len
|
||||
meta.len() == expected_len
|
||||
&& filename
|
||||
.strip_prefix(&prefix[..])
|
||||
.map(|s| s.starts_with('-') && s.ends_with(&extension[..]))
|
||||
.unwrap_or(false)
|
||||
});
|
||||
let max = candidates
|
||||
.max_by_key(|&&(_, _, ref metadata)| FileTime::from_last_modification_time(metadata));
|
||||
@ -925,17 +979,21 @@ pub fn run_cargo(
|
||||
let candidate = format!("{}.lib", path_to_add);
|
||||
let candidate = PathBuf::from(candidate);
|
||||
if candidate.exists() {
|
||||
deps.push((candidate, false));
|
||||
deps.push((candidate, DependencyType::Target));
|
||||
}
|
||||
}
|
||||
deps.push((path_to_add.into(), false));
|
||||
deps.push((path_to_add.into(), DependencyType::Target));
|
||||
}
|
||||
|
||||
deps.extend(additional_target_deps.into_iter().map(|d| (d, false)));
|
||||
deps.extend(additional_target_deps);
|
||||
deps.sort();
|
||||
let mut new_contents = Vec::new();
|
||||
for (dep, proc_macro) in deps.iter() {
|
||||
new_contents.extend(if *proc_macro { b"h" } else { b"t" });
|
||||
for (dep, dependency_type) in deps.iter() {
|
||||
new_contents.extend(match *dependency_type {
|
||||
DependencyType::Host => b"h",
|
||||
DependencyType::Target => b"t",
|
||||
DependencyType::TargetSelfContained => b"s",
|
||||
});
|
||||
new_contents.extend(dep.to_str().unwrap().as_bytes());
|
||||
new_contents.extend(b"\0");
|
||||
}
|
||||
@ -983,7 +1041,13 @@ pub fn stream_cargo(
|
||||
for line in stdout.lines() {
|
||||
let line = t!(line);
|
||||
match serde_json::from_str::<CargoMessage<'_>>(&line) {
|
||||
Ok(msg) => cb(msg),
|
||||
Ok(msg) => {
|
||||
if builder.config.json_output {
|
||||
// Forward JSON to stdout.
|
||||
println!("{}", line);
|
||||
}
|
||||
cb(msg)
|
||||
}
|
||||
// If this was informational, just print it out and continue
|
||||
Err(_) => println!("{}", line),
|
||||
}
|
||||
|
||||
@ -173,6 +173,7 @@ pub struct Target {
|
||||
pub ndk: Option<PathBuf>,
|
||||
pub crt_static: Option<bool>,
|
||||
pub musl_root: Option<PathBuf>,
|
||||
pub musl_libdir: Option<PathBuf>,
|
||||
pub wasi_root: Option<PathBuf>,
|
||||
pub qemu_rootfs: Option<PathBuf>,
|
||||
pub no_std: bool,
|
||||
@ -363,6 +364,7 @@ struct TomlTarget {
|
||||
android_ndk: Option<String>,
|
||||
crt_static: Option<bool>,
|
||||
musl_root: Option<String>,
|
||||
musl_libdir: Option<String>,
|
||||
wasi_root: Option<String>,
|
||||
qemu_rootfs: Option<String>,
|
||||
no_std: Option<bool>,
|
||||
@ -631,6 +633,7 @@ impl Config {
|
||||
target.linker = cfg.linker.clone().map(PathBuf::from);
|
||||
target.crt_static = cfg.crt_static;
|
||||
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
|
||||
target.musl_libdir = cfg.musl_libdir.clone().map(PathBuf::from);
|
||||
target.wasi_root = cfg.wasi_root.clone().map(PathBuf::from);
|
||||
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
|
||||
|
||||
|
||||
@ -141,6 +141,8 @@ v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
|
||||
"rootfs in qemu testing, you probably don't want to use this")
|
||||
v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
|
||||
"rootfs in qemu testing, you probably don't want to use this")
|
||||
v("qemu-riscv64-rootfs", "target.riscv64gc-unknown-linux-gnu.qemu-rootfs",
|
||||
"rootfs in qemu testing, you probably don't want to use this")
|
||||
v("experimental-targets", "llvm.experimental-targets",
|
||||
"experimental LLVM targets to build")
|
||||
v("release-channel", "rust.channel", "the name of the release channel to build")
|
||||
|
||||
@ -22,7 +22,7 @@ use crate::channel;
|
||||
use crate::compile;
|
||||
use crate::tool::{self, Tool};
|
||||
use crate::util::{exe, is_dylib, timeit};
|
||||
use crate::{Compiler, Mode, LLVM_TOOLS};
|
||||
use crate::{Compiler, DependencyType, Mode, LLVM_TOOLS};
|
||||
use time::{self, Timespec};
|
||||
|
||||
pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
|
||||
@ -30,6 +30,8 @@ pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
|
||||
format!("{}-{}", component, builder.cargo_package_vers())
|
||||
} else if component == "rls" {
|
||||
format!("{}-{}", component, builder.rls_package_vers())
|
||||
} else if component == "rust-analyzer" {
|
||||
format!("{}-{}", component, builder.rust_analyzer_package_vers())
|
||||
} else if component == "clippy" {
|
||||
format!("{}-{}", component, builder.clippy_package_vers())
|
||||
} else if component == "miri" {
|
||||
@ -306,7 +308,12 @@ fn make_win_dist(
|
||||
}
|
||||
|
||||
//Copy platform tools to platform-specific bin directory
|
||||
let target_bin_dir = plat_root.join("lib").join("rustlib").join(target_triple).join("bin");
|
||||
let target_bin_dir = plat_root
|
||||
.join("lib")
|
||||
.join("rustlib")
|
||||
.join(target_triple)
|
||||
.join("bin")
|
||||
.join("self-contained");
|
||||
fs::create_dir_all(&target_bin_dir).expect("creating target_bin_dir failed");
|
||||
for src in target_tools {
|
||||
builder.copy_to_folder(&src, &target_bin_dir);
|
||||
@ -321,7 +328,12 @@ fn make_win_dist(
|
||||
);
|
||||
|
||||
//Copy platform libs to platform-specific lib directory
|
||||
let target_lib_dir = plat_root.join("lib").join("rustlib").join(target_triple).join("lib");
|
||||
let target_lib_dir = plat_root
|
||||
.join("lib")
|
||||
.join("rustlib")
|
||||
.join(target_triple)
|
||||
.join("lib")
|
||||
.join("self-contained");
|
||||
fs::create_dir_all(&target_lib_dir).expect("creating target_lib_dir failed");
|
||||
for src in target_libs {
|
||||
builder.copy_to_folder(&src, &target_lib_dir);
|
||||
@ -619,19 +631,21 @@ impl Step for DebuggerScripts {
|
||||
cp_debugger_script("natvis/libcore.natvis");
|
||||
cp_debugger_script("natvis/libstd.natvis");
|
||||
} else {
|
||||
cp_debugger_script("debugger_pretty_printers_common.py");
|
||||
cp_debugger_script("rust_types.py");
|
||||
|
||||
// gdb debugger scripts
|
||||
builder.install(&builder.src.join("src/etc/rust-gdb"), &sysroot.join("bin"), 0o755);
|
||||
builder.install(&builder.src.join("src/etc/rust-gdbgui"), &sysroot.join("bin"), 0o755);
|
||||
|
||||
cp_debugger_script("gdb_load_rust_pretty_printers.py");
|
||||
cp_debugger_script("gdb_rust_pretty_printing.py");
|
||||
cp_debugger_script("gdb_lookup.py");
|
||||
cp_debugger_script("gdb_providers.py");
|
||||
|
||||
// lldb debugger scripts
|
||||
builder.install(&builder.src.join("src/etc/rust-lldb"), &sysroot.join("bin"), 0o755);
|
||||
|
||||
cp_debugger_script("lldb_rust_formatters.py");
|
||||
cp_debugger_script("lldb_lookup.py");
|
||||
cp_debugger_script("lldb_providers.py");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -650,9 +664,13 @@ fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
|
||||
/// Copy stamped files into an image's `target/lib` directory.
|
||||
fn copy_target_libs(builder: &Builder<'_>, target: &str, image: &Path, stamp: &Path) {
|
||||
let dst = image.join("lib/rustlib").join(target).join("lib");
|
||||
let self_contained_dst = dst.join("self-contained");
|
||||
t!(fs::create_dir_all(&dst));
|
||||
for (path, host) in builder.read_stamp_file(stamp) {
|
||||
if !host || builder.config.build == target {
|
||||
t!(fs::create_dir_all(&self_contained_dst));
|
||||
for (path, dependency_type) in builder.read_stamp_file(stamp) {
|
||||
if dependency_type == DependencyType::TargetSelfContained {
|
||||
builder.copy(&path, &self_contained_dst.join(path.file_name().unwrap()));
|
||||
} else if dependency_type == DependencyType::Target || builder.config.build == target {
|
||||
builder.copy(&path, &dst.join(path.file_name().unwrap()));
|
||||
}
|
||||
}
|
||||
@ -1091,7 +1109,10 @@ impl Step for PlainSourceTarball {
|
||||
if builder.rust_info.is_git() {
|
||||
// Vendor all Cargo dependencies
|
||||
let mut cmd = Command::new(&builder.initial_cargo);
|
||||
cmd.arg("vendor").current_dir(&plain_dst_src);
|
||||
cmd.arg("vendor")
|
||||
.arg("--sync")
|
||||
.arg(builder.src.join("./src/tools/rust-analyzer/Cargo.toml"))
|
||||
.current_dir(&plain_dst_src);
|
||||
builder.run(&mut cmd);
|
||||
}
|
||||
|
||||
@ -1321,6 +1342,93 @@ impl Step for Rls {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct RustAnalyzer {
|
||||
pub compiler: Compiler,
|
||||
pub target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for RustAnalyzer {
|
||||
type Output = PathBuf;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.path("rust-analyzer")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
run.builder.ensure(RustAnalyzer {
|
||||
compiler: run.builder.compiler_for(
|
||||
run.builder.top_stage,
|
||||
run.builder.config.build,
|
||||
run.target,
|
||||
),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) -> PathBuf {
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
assert!(builder.config.extended);
|
||||
|
||||
let src = builder.src.join("src/tools/rust-analyzer");
|
||||
let release_num = builder.release_num("rust-analyzer/crates/rust-analyzer");
|
||||
let name = pkgname(builder, "rust-analyzer");
|
||||
let version = builder.rust_analyzer_info.version(builder, &release_num);
|
||||
|
||||
let tmp = tmpdir(builder);
|
||||
let image = tmp.join("rust-analyzer-image");
|
||||
drop(fs::remove_dir_all(&image));
|
||||
builder.create_dir(&image);
|
||||
|
||||
// Prepare the image directory
|
||||
// We expect rust-analyer to always build, as it doesn't depend on rustc internals
|
||||
// and doesn't have associated toolstate.
|
||||
let rust_analyzer = builder
|
||||
.ensure(tool::RustAnalyzer { compiler, target, extra_features: Vec::new() })
|
||||
.expect("rust-analyzer always builds");
|
||||
|
||||
builder.install(&rust_analyzer, &image.join("bin"), 0o755);
|
||||
let doc = image.join("share/doc/rust-analyzer");
|
||||
builder.install(&src.join("README.md"), &doc, 0o644);
|
||||
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
|
||||
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
|
||||
|
||||
// Prepare the overlay
|
||||
let overlay = tmp.join("rust-analyzer-overlay");
|
||||
drop(fs::remove_dir_all(&overlay));
|
||||
t!(fs::create_dir_all(&overlay));
|
||||
builder.install(&src.join("README.md"), &overlay, 0o644);
|
||||
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
|
||||
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
|
||||
builder.create(&overlay.join("version"), &version);
|
||||
|
||||
// Generate the installer tarball
|
||||
let mut cmd = rust_installer(builder);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=rust-analyzer-ready-to-serve.")
|
||||
.arg("--image-dir")
|
||||
.arg(&image)
|
||||
.arg("--work-dir")
|
||||
.arg(&tmpdir(builder))
|
||||
.arg("--output-dir")
|
||||
.arg(&distdir(builder))
|
||||
.arg("--non-installed-overlay")
|
||||
.arg(&overlay)
|
||||
.arg(format!("--package-name={}-{}", name, target))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo")
|
||||
.arg("--component-name=rust-analyzer-preview");
|
||||
|
||||
builder.info(&format!("Dist rust-analyzer stage{} ({})", compiler.stage, target));
|
||||
let _time = timeit(builder);
|
||||
builder.run(&mut cmd);
|
||||
distdir(builder).join(format!("{}-{}.tar.gz", name, target))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Clippy {
|
||||
pub compiler: Compiler,
|
||||
@ -1640,6 +1748,7 @@ impl Step for Extended {
|
||||
let cargo_installer = builder.ensure(Cargo { compiler, target });
|
||||
let rustfmt_installer = builder.ensure(Rustfmt { compiler, target });
|
||||
let rls_installer = builder.ensure(Rls { compiler, target });
|
||||
let rust_analyzer_installer = builder.ensure(RustAnalyzer { compiler, target });
|
||||
let llvm_tools_installer = builder.ensure(LlvmTools { target });
|
||||
let clippy_installer = builder.ensure(Clippy { compiler, target });
|
||||
let miri_installer = builder.ensure(Miri { compiler, target });
|
||||
@ -1674,6 +1783,7 @@ impl Step for Extended {
|
||||
tarballs.push(rustc_installer);
|
||||
tarballs.push(cargo_installer);
|
||||
tarballs.extend(rls_installer.clone());
|
||||
tarballs.push(rust_analyzer_installer.clone());
|
||||
tarballs.push(clippy_installer);
|
||||
tarballs.extend(miri_installer.clone());
|
||||
tarballs.extend(rustfmt_installer.clone());
|
||||
@ -1751,6 +1861,7 @@ impl Step for Extended {
|
||||
if rls_installer.is_none() {
|
||||
contents = filter(&contents, "rls");
|
||||
}
|
||||
contents = filter(&contents, "rust-analyzer");
|
||||
if miri_installer.is_none() {
|
||||
contents = filter(&contents, "miri");
|
||||
}
|
||||
@ -1797,6 +1908,7 @@ impl Step for Extended {
|
||||
if rls_installer.is_some() {
|
||||
prepare("rls");
|
||||
}
|
||||
prepare("rust-analyzer");
|
||||
if miri_installer.is_some() {
|
||||
prepare("miri");
|
||||
}
|
||||
@ -1830,6 +1942,8 @@ impl Step for Extended {
|
||||
format!("{}-{}", name, target)
|
||||
} else if name == "rls" {
|
||||
"rls-preview".to_string()
|
||||
} else if name == "rust-analyzer" {
|
||||
"rust-analyzer-preview".to_string()
|
||||
} else if name == "clippy" {
|
||||
"clippy-preview".to_string()
|
||||
} else if name == "miri" {
|
||||
@ -1852,6 +1966,7 @@ impl Step for Extended {
|
||||
if rls_installer.is_some() {
|
||||
prepare("rls");
|
||||
}
|
||||
prepare("rust-analyzer");
|
||||
if miri_installer.is_some() {
|
||||
prepare("miri");
|
||||
}
|
||||
@ -1859,28 +1974,7 @@ impl Step for Extended {
|
||||
prepare("rust-mingw");
|
||||
}
|
||||
|
||||
builder.install(&xform(&etc.join("exe/rust.iss")), &exe, 0o644);
|
||||
builder.install(&etc.join("exe/modpath.iss"), &exe, 0o644);
|
||||
builder.install(&etc.join("exe/upgrade.iss"), &exe, 0o644);
|
||||
builder.install(&etc.join("gfx/rust-logo.ico"), &exe, 0o644);
|
||||
builder.create(&exe.join("LICENSE.txt"), &license);
|
||||
|
||||
// Generate exe installer
|
||||
builder.info("building `exe` installer with `iscc`");
|
||||
let mut cmd = Command::new("iscc");
|
||||
cmd.arg("rust.iss").arg("/Q").current_dir(&exe);
|
||||
if target.contains("windows-gnu") {
|
||||
cmd.arg("/dMINGW");
|
||||
}
|
||||
add_env(builder, &mut cmd, target);
|
||||
let time = timeit(builder);
|
||||
builder.run(&mut cmd);
|
||||
drop(time);
|
||||
builder.install(
|
||||
&exe.join(format!("{}-{}.exe", pkgname(builder, "rust"), target)),
|
||||
&distdir(builder),
|
||||
0o755,
|
||||
);
|
||||
|
||||
// Generate msi installer
|
||||
let wix = PathBuf::from(env::var_os("WIX").unwrap());
|
||||
@ -1972,6 +2066,23 @@ impl Step for Extended {
|
||||
.arg(etc.join("msi/remove-duplicates.xsl")),
|
||||
);
|
||||
}
|
||||
builder.run(
|
||||
Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
.arg("dir")
|
||||
.arg("rust-analyzer")
|
||||
.args(&heat_flags)
|
||||
.arg("-cg")
|
||||
.arg("RustAnalyzerGroup")
|
||||
.arg("-dr")
|
||||
.arg("RustAnalyzer")
|
||||
.arg("-var")
|
||||
.arg("var.RustAnalyzerDir")
|
||||
.arg("-out")
|
||||
.arg(exe.join("RustAnalyzerGroup.wxs"))
|
||||
.arg("-t")
|
||||
.arg(etc.join("msi/remove-duplicates.xsl")),
|
||||
);
|
||||
builder.run(
|
||||
Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
@ -2065,6 +2176,7 @@ impl Step for Extended {
|
||||
if rls_installer.is_some() {
|
||||
cmd.arg("-dRlsDir=rls");
|
||||
}
|
||||
cmd.arg("-dRustAnalyzerDir=rust-analyzer");
|
||||
if miri_installer.is_some() {
|
||||
cmd.arg("-dMiriDir=miri");
|
||||
}
|
||||
@ -2084,6 +2196,7 @@ impl Step for Extended {
|
||||
if rls_installer.is_some() {
|
||||
candle("RlsGroup.wxs".as_ref());
|
||||
}
|
||||
candle("RustAnalyzerGroup.wxs".as_ref());
|
||||
if miri_installer.is_some() {
|
||||
candle("MiriGroup.wxs".as_ref());
|
||||
}
|
||||
@ -2121,6 +2234,7 @@ impl Step for Extended {
|
||||
if rls_installer.is_some() {
|
||||
cmd.arg("RlsGroup.wixobj");
|
||||
}
|
||||
cmd.arg("RustAnalyzerGroup.wixobj");
|
||||
if miri_installer.is_some() {
|
||||
cmd.arg("MiriGroup.wixobj");
|
||||
}
|
||||
@ -2214,6 +2328,7 @@ impl Step for HashSign {
|
||||
cmd.arg(addr);
|
||||
cmd.arg(builder.package_vers(&builder.release_num("cargo")));
|
||||
cmd.arg(builder.package_vers(&builder.release_num("rls")));
|
||||
cmd.arg(builder.package_vers(&builder.release_num("rust-analyzer/crates/rust-analyzer")));
|
||||
cmd.arg(builder.package_vers(&builder.release_num("clippy")));
|
||||
cmd.arg(builder.package_vers(&builder.release_num("miri")));
|
||||
cmd.arg(builder.package_vers(&builder.release_num("rustfmt")));
|
||||
|
||||
@ -156,7 +156,7 @@ impl Step for RustbookSrc {
|
||||
let index = out.join("index.html");
|
||||
let rustbook = builder.tool_exe(Tool::Rustbook);
|
||||
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
|
||||
if up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
|
||||
if builder.config.dry_run || up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
|
||||
return;
|
||||
}
|
||||
builder.info(&format!("Rustbook ({}) - {}", target, name));
|
||||
@ -435,11 +435,10 @@ impl Step for Std {
|
||||
t!(fs::copy(builder.src.join("src/doc/rust.css"), out.join("rust.css")));
|
||||
|
||||
let run_cargo_rustdoc_for = |package: &str| {
|
||||
let mut cargo = builder.cargo(compiler, Mode::Std, target, "rustdoc");
|
||||
let mut cargo =
|
||||
builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "rustdoc");
|
||||
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||
|
||||
// Keep a whitelist so we do not build internal stdlib crates, these will be
|
||||
// build by the rustc step later if enabled.
|
||||
cargo.arg("-p").arg(package);
|
||||
// Create all crate output directories first to make sure rustdoc uses
|
||||
// relative links.
|
||||
@ -450,7 +449,6 @@ impl Step for Std {
|
||||
.arg("--markdown-css")
|
||||
.arg("rust.css")
|
||||
.arg("--markdown-no-toc")
|
||||
.arg("--generate-redirect-pages")
|
||||
.arg("-Z")
|
||||
.arg("unstable-options")
|
||||
.arg("--resource-suffix")
|
||||
@ -460,6 +458,10 @@ impl Step for Std {
|
||||
|
||||
builder.run(&mut cargo.into());
|
||||
};
|
||||
// Only build the following crates. While we could just iterate over the
|
||||
// folder structure, that would also build internal crates that we do
|
||||
// not want to show in documentation. These crates will later be visited
|
||||
// by the rustc step, so internal documentation will show them.
|
||||
let krates = ["alloc", "core", "std", "proc_macro", "test"];
|
||||
for krate in &krates {
|
||||
run_cargo_rustdoc_for(krate);
|
||||
@ -517,8 +519,7 @@ impl Step for Rustc {
|
||||
let out = builder.compiler_doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
// Get the correct compiler for this stage.
|
||||
let compiler = builder.compiler_for(stage, builder.config.build, target);
|
||||
let compiler = builder.compiler(stage, builder.config.build);
|
||||
|
||||
if !builder.config.compiler_docs {
|
||||
builder.info("\tskipping - compiler/librustdoc docs disabled");
|
||||
@ -534,7 +535,7 @@ impl Step for Rustc {
|
||||
t!(symlink_dir_force(&builder.config, &out, &out_dir));
|
||||
|
||||
// Build cargo command.
|
||||
let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "doc");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");
|
||||
cargo.env(
|
||||
"RUSTDOCFLAGS",
|
||||
"--document-private-items \
|
||||
@ -548,8 +549,8 @@ impl Step for Rustc {
|
||||
// Find dependencies for top level crates.
|
||||
let mut compiler_crates = HashSet::new();
|
||||
for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] {
|
||||
let interned_root_crate = INTERNER.intern_str(root_crate);
|
||||
find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
|
||||
compiler_crates
|
||||
.extend(builder.in_tree_crates(root_crate).into_iter().map(|krate| krate.name));
|
||||
}
|
||||
|
||||
for krate in &compiler_crates {
|
||||
@ -564,22 +565,6 @@ impl Step for Rustc {
|
||||
}
|
||||
}
|
||||
|
||||
fn find_compiler_crates(
|
||||
builder: &Builder<'_>,
|
||||
name: &Interned<String>,
|
||||
crates: &mut HashSet<Interned<String>>,
|
||||
) {
|
||||
// Add current crate.
|
||||
crates.insert(*name);
|
||||
|
||||
// Look for dependencies.
|
||||
for dep in builder.crates.get(name).unwrap().deps.iter() {
|
||||
if builder.crates.get(dep).unwrap().is_local(builder) {
|
||||
find_compiler_crates(builder, dep, crates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Rustdoc {
|
||||
stage: u32,
|
||||
@ -614,8 +599,7 @@ impl Step for Rustdoc {
|
||||
let out = builder.compiler_doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
// Get the correct compiler for this stage.
|
||||
let compiler = builder.compiler_for(stage, builder.config.build, target);
|
||||
let compiler = builder.compiler(stage, builder.config.build);
|
||||
|
||||
if !builder.config.compiler_docs {
|
||||
builder.info("\tskipping - compiler/librustdoc docs disabled");
|
||||
@ -654,9 +638,10 @@ impl Step for Rustdoc {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct ErrorIndex {
|
||||
target: Interned<String>,
|
||||
pub compiler: Compiler,
|
||||
pub target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for ErrorIndex {
|
||||
@ -670,26 +655,26 @@ impl Step for ErrorIndex {
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
run.builder.ensure(ErrorIndex { target: run.target });
|
||||
let target = run.target;
|
||||
// error_index_generator depends on librustdoc. Use the compiler that
|
||||
// is normally used to build rustdoc for other documentation so that
|
||||
// it shares the same artifacts.
|
||||
let compiler =
|
||||
run.builder.compiler_for(run.builder.top_stage, run.builder.config.build, target);
|
||||
run.builder.ensure(ErrorIndex { compiler, target });
|
||||
}
|
||||
|
||||
/// Generates the HTML rendered error-index by running the
|
||||
/// `error_index_generator` tool.
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let target = self.target;
|
||||
|
||||
builder.info(&format!("Documenting error index ({})", target));
|
||||
let out = builder.doc_out(target);
|
||||
builder.info(&format!("Documenting error index ({})", self.target));
|
||||
let out = builder.doc_out(self.target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
let compiler = builder.compiler(2, builder.config.build);
|
||||
let mut index = tool::ErrorIndex::command(builder, compiler);
|
||||
let mut index = tool::ErrorIndex::command(builder, self.compiler);
|
||||
index.arg("html");
|
||||
index.arg(out.join("error-index.html"));
|
||||
index.arg(crate::channel::CFG_RELEASE_NUM);
|
||||
|
||||
// FIXME: shouldn't have to pass this env var
|
||||
index.env("CFG_BUILD", &builder.config.build);
|
||||
|
||||
builder.run(&mut index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,18 +3,16 @@
|
||||
//! This module implements the command-line parsing of the build system which
|
||||
//! has various flags to configure how it's run.
|
||||
|
||||
use std::fs;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
|
||||
use getopts::Options;
|
||||
|
||||
use crate::builder::Builder;
|
||||
use crate::config::Config;
|
||||
use crate::metadata;
|
||||
use crate::{Build, DocTests};
|
||||
|
||||
use crate::cache::{Interned, INTERNER};
|
||||
use crate::config::Config;
|
||||
use crate::{Build, DocTests};
|
||||
|
||||
/// Deserialized version of all flags for this compile.
|
||||
pub struct Flags {
|
||||
@ -149,7 +147,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
|
||||
"N",
|
||||
);
|
||||
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
|
||||
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
|
||||
let j_msg = format!(
|
||||
"number of jobs to run in parallel; \
|
||||
defaults to {} (this host's logical CPU count)",
|
||||
num_cpus::get()
|
||||
);
|
||||
opts.optopt("j", "jobs", &j_msg, "JOBS");
|
||||
opts.optflag("h", "help", "print this help message");
|
||||
opts.optopt(
|
||||
"",
|
||||
@ -433,19 +436,12 @@ Arguments:
|
||||
// Get any optional paths which occur after the subcommand
|
||||
let paths = matches.free[1..].iter().map(|p| p.into()).collect::<Vec<PathBuf>>();
|
||||
|
||||
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
|
||||
if fs::metadata("config.toml").is_ok() {
|
||||
Some(PathBuf::from("config.toml"))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
let cfg_file = env::var_os("BOOTSTRAP_CONFIG").map(PathBuf::from);
|
||||
|
||||
// All subcommands except `clean` can have an optional "Available paths" section
|
||||
if matches.opt_present("verbose") {
|
||||
let config = Config::parse(&["build".to_string()]);
|
||||
let mut build = Build::new(config);
|
||||
metadata::build(&mut build);
|
||||
let build = Build::new(config);
|
||||
|
||||
let maybe_rules_help = Builder::get_help(&build, subcommand.as_str());
|
||||
extra_help.push_str(maybe_rules_help.unwrap_or_default().as_str());
|
||||
|
||||
@ -32,6 +32,9 @@ pub fn install_cargo(builder: &Builder<'_>, stage: u32, host: Interned<String>)
|
||||
pub fn install_rls(builder: &Builder<'_>, stage: u32, host: Interned<String>) {
|
||||
install_sh(builder, "rls", "rls", stage, Some(host));
|
||||
}
|
||||
pub fn install_rust_analyzer(builder: &Builder<'_>, stage: u32, host: Interned<String>) {
|
||||
install_sh(builder, "rust-analyzer", "rust-analyzer", stage, Some(host));
|
||||
}
|
||||
pub fn install_clippy(builder: &Builder<'_>, stage: u32, host: Interned<String>) {
|
||||
install_sh(builder, "clippy", "clippy", stage, Some(host));
|
||||
}
|
||||
@ -70,7 +73,10 @@ fn install_sh(
|
||||
let libdir_default = PathBuf::from("lib");
|
||||
let mandir_default = datadir_default.join("man");
|
||||
let prefix = builder.config.prefix.as_ref().map_or(prefix_default, |p| {
|
||||
fs::canonicalize(p).unwrap_or_else(|_| panic!("could not canonicalize {}", p.display()))
|
||||
fs::create_dir_all(p)
|
||||
.unwrap_or_else(|err| panic!("could not create {}: {}", p.display(), err));
|
||||
fs::canonicalize(p)
|
||||
.unwrap_or_else(|err| panic!("could not canonicalize {}: {}", p.display(), err))
|
||||
});
|
||||
let sysconfdir = builder.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
|
||||
let datadir = builder.config.datadir.as_ref().unwrap_or(&datadir_default);
|
||||
@ -213,6 +219,16 @@ install!((self, builder, _config),
|
||||
);
|
||||
}
|
||||
};
|
||||
RustAnalyzer, "rust-analyzer", Self::should_build(_config), only_hosts: true, {
|
||||
builder.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target });
|
||||
if Self::should_install(builder) {
|
||||
install_rust_analyzer(builder, self.compiler.stage, self.target);
|
||||
} else {
|
||||
builder.info(
|
||||
&format!("skipping Install rust-analyzer stage{} ({})", self.compiler.stage, self.target),
|
||||
);
|
||||
}
|
||||
};
|
||||
Clippy, "clippy", Self::should_build(_config), only_hosts: true, {
|
||||
builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target });
|
||||
if Self::should_install(builder) {
|
||||
|
||||
@ -225,6 +225,7 @@ pub struct Build {
|
||||
rust_info: channel::GitInfo,
|
||||
cargo_info: channel::GitInfo,
|
||||
rls_info: channel::GitInfo,
|
||||
rust_analyzer_info: channel::GitInfo,
|
||||
clippy_info: channel::GitInfo,
|
||||
miri_info: channel::GitInfo,
|
||||
rustfmt_info: channel::GitInfo,
|
||||
@ -270,16 +271,22 @@ struct Crate {
|
||||
}
|
||||
|
||||
impl Crate {
|
||||
fn is_local(&self, build: &Build) -> bool {
|
||||
self.path.starts_with(&build.config.src) && !self.path.to_string_lossy().ends_with("_shim")
|
||||
}
|
||||
|
||||
fn local_path(&self, build: &Build) -> PathBuf {
|
||||
assert!(self.is_local(build));
|
||||
self.path.strip_prefix(&build.config.src).unwrap().into()
|
||||
}
|
||||
}
|
||||
|
||||
/// When building Rust various objects are handled differently.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum DependencyType {
|
||||
/// Libraries originating from proc-macros.
|
||||
Host,
|
||||
/// Typical Rust libraries.
|
||||
Target,
|
||||
/// Non Rust libraries and objects shipped to ease usage of certain targets.
|
||||
TargetSelfContained,
|
||||
}
|
||||
|
||||
/// The various "modes" of invoking Cargo.
|
||||
///
|
||||
/// These entries currently correspond to the various output directories of the
|
||||
@ -295,16 +302,21 @@ pub enum Mode {
|
||||
/// Build codegen libraries, placing output in the "stageN-codegen" directory
|
||||
Codegen,
|
||||
|
||||
/// Build some tools, placing output in the "stageN-tools" directory. The
|
||||
/// "other" here is for miscellaneous sets of tools that are built using the
|
||||
/// bootstrap compiler in its entirety (target libraries and all).
|
||||
/// Typically these tools compile with stable Rust.
|
||||
/// Build a tool, placing output in the "stage0-bootstrap-tools"
|
||||
/// directory. This is for miscellaneous sets of tools that are built
|
||||
/// using the bootstrap stage0 compiler in its entirety (target libraries
|
||||
/// and all). Typically these tools compile with stable Rust.
|
||||
ToolBootstrap,
|
||||
|
||||
/// Compile a tool which uses all libraries we compile (up to rustc).
|
||||
/// Doesn't use the stage0 compiler libraries like "other", and includes
|
||||
/// tools like rustdoc, cargo, rls, etc.
|
||||
/// Build a tool which uses the locally built std, placing output in the
|
||||
/// "stageN-tools" directory. Its usage is quite rare, mainly used by
|
||||
/// compiletest which needs libtest.
|
||||
ToolStd,
|
||||
|
||||
/// Build a tool which uses the locally built rustc and the target std,
|
||||
/// placing the output in the "stageN-tools" directory. This is used for
|
||||
/// anything that needs a fully functional rustc, such as rustdoc, clippy,
|
||||
/// cargo, rls, rustfmt, miri, etc.
|
||||
ToolRustc,
|
||||
}
|
||||
|
||||
@ -338,6 +350,8 @@ impl Build {
|
||||
let rust_info = channel::GitInfo::new(ignore_git, &src);
|
||||
let cargo_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/cargo"));
|
||||
let rls_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/rls"));
|
||||
let rust_analyzer_info =
|
||||
channel::GitInfo::new(ignore_git, &src.join("src/tools/rust-analyzer"));
|
||||
let clippy_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/clippy"));
|
||||
let miri_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/miri"));
|
||||
let rustfmt_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/rustfmt"));
|
||||
@ -394,6 +408,7 @@ impl Build {
|
||||
rust_info,
|
||||
cargo_info,
|
||||
rls_info,
|
||||
rust_analyzer_info,
|
||||
clippy_info,
|
||||
miri_info,
|
||||
rustfmt_info,
|
||||
@ -421,10 +436,9 @@ impl Build {
|
||||
output(Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
|
||||
let local_release = local_version_verbose
|
||||
.lines()
|
||||
.filter(|x| x.starts_with("release:"))
|
||||
.filter_map(|x| x.strip_prefix("release:"))
|
||||
.next()
|
||||
.unwrap()
|
||||
.trim_start_matches("release:")
|
||||
.trim();
|
||||
let my_version = channel::CFG_RELEASE_NUM;
|
||||
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
|
||||
@ -877,6 +891,15 @@ impl Build {
|
||||
.map(|p| &**p)
|
||||
}
|
||||
|
||||
/// Returns the "musl libdir" for this `target`.
|
||||
fn musl_libdir(&self, target: Interned<String>) -> Option<PathBuf> {
|
||||
let t = self.config.target_config.get(&target)?;
|
||||
if let libdir @ Some(_) = &t.musl_libdir {
|
||||
return libdir.clone();
|
||||
}
|
||||
self.musl_root(target).map(|root| root.join("lib"))
|
||||
}
|
||||
|
||||
/// Returns the sysroot for the wasi target, if defined
|
||||
fn wasi_root(&self, target: Interned<String>) -> Option<&Path> {
|
||||
self.config.target_config.get(&target).and_then(|t| t.wasi_root.as_ref()).map(|p| &**p)
|
||||
@ -963,29 +986,15 @@ impl Build {
|
||||
return s;
|
||||
}
|
||||
|
||||
let beta = output(
|
||||
Command::new("git").arg("ls-remote").arg("origin").arg("beta").current_dir(&self.src),
|
||||
);
|
||||
let beta = beta.trim().split_whitespace().next().unwrap();
|
||||
let master = output(
|
||||
Command::new("git").arg("ls-remote").arg("origin").arg("master").current_dir(&self.src),
|
||||
);
|
||||
let master = master.trim().split_whitespace().next().unwrap();
|
||||
|
||||
// Figure out where the current beta branch started.
|
||||
let base = output(
|
||||
Command::new("git").arg("merge-base").arg(beta).arg(master).current_dir(&self.src),
|
||||
);
|
||||
let base = base.trim();
|
||||
|
||||
// Next figure out how many merge commits happened since we branched off
|
||||
// beta. That's our beta number!
|
||||
// Figure out how many merge commits happened since we branched off master.
|
||||
// That's our beta number!
|
||||
// (Note that we use a `..` range, not the `...` symmetric difference.)
|
||||
let count = output(
|
||||
Command::new("git")
|
||||
.arg("rev-list")
|
||||
.arg("--count")
|
||||
.arg("--merges")
|
||||
.arg(format!("{}...HEAD", base))
|
||||
.arg("refs/remotes/origin/master..HEAD")
|
||||
.current_dir(&self.src),
|
||||
);
|
||||
let n = count.trim().parse().unwrap();
|
||||
@ -1028,6 +1037,11 @@ impl Build {
|
||||
self.package_vers(&self.release_num("rls"))
|
||||
}
|
||||
|
||||
/// Returns the value of `package_vers` above for rust-analyzer
|
||||
fn rust_analyzer_package_vers(&self) -> String {
|
||||
self.package_vers(&self.release_num("rust-analyzer/crates/rust-analyzer"))
|
||||
}
|
||||
|
||||
/// Returns the value of `package_vers` above for clippy
|
||||
fn clippy_package_vers(&self) -> String {
|
||||
self.package_vers(&self.release_num("clippy"))
|
||||
@ -1074,10 +1088,10 @@ impl Build {
|
||||
let toml_file_name = self.src.join(&format!("src/tools/{}/Cargo.toml", package));
|
||||
let toml = t!(fs::read_to_string(&toml_file_name));
|
||||
for line in toml.lines() {
|
||||
let prefix = "version = \"";
|
||||
let suffix = "\"";
|
||||
if line.starts_with(prefix) && line.ends_with(suffix) {
|
||||
return line[prefix.len()..line.len() - suffix.len()].to_string();
|
||||
if let Some(stripped) =
|
||||
line.strip_prefix("version = \"").and_then(|s| s.strip_suffix("\""))
|
||||
{
|
||||
return stripped.to_owned();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1093,17 +1107,29 @@ impl Build {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a Vec of all the dependencies of the given root crate,
|
||||
/// including transitive dependencies and the root itself. Only includes
|
||||
/// "local" crates (those in the local source tree, not from a registry).
|
||||
fn in_tree_crates(&self, root: &str) -> Vec<&Crate> {
|
||||
let mut ret = Vec::new();
|
||||
let mut list = vec![INTERNER.intern_str(root)];
|
||||
let mut visited = HashSet::new();
|
||||
while let Some(krate) = list.pop() {
|
||||
let krate = &self.crates[&krate];
|
||||
if krate.is_local(self) {
|
||||
ret.push(krate);
|
||||
}
|
||||
ret.push(krate);
|
||||
for dep in &krate.deps {
|
||||
if visited.insert(dep) && dep != "build_helper" {
|
||||
// Don't include optional deps if their features are not
|
||||
// enabled. Ideally this would be computed from `cargo
|
||||
// metadata --features …`, but that is somewhat slow. Just
|
||||
// skip `build_helper` since there aren't any operations we
|
||||
// want to perform on it. In the future, we may want to
|
||||
// consider just filtering all build and dev dependencies in
|
||||
// metadata::build.
|
||||
if visited.insert(dep)
|
||||
&& dep != "build_helper"
|
||||
&& (dep != "profiler_builtins" || self.config.profiler)
|
||||
&& (dep != "rustc_codegen_llvm" || self.config.llvm_enabled())
|
||||
{
|
||||
list.push(*dep);
|
||||
}
|
||||
}
|
||||
@ -1111,7 +1137,7 @@ impl Build {
|
||||
ret
|
||||
}
|
||||
|
||||
fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, bool)> {
|
||||
fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, DependencyType)> {
|
||||
if self.config.dry_run {
|
||||
return Vec::new();
|
||||
}
|
||||
@ -1124,9 +1150,14 @@ impl Build {
|
||||
if part.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let host = part[0] as char == 'h';
|
||||
let dependency_type = match part[0] as char {
|
||||
'h' => DependencyType::Host,
|
||||
's' => DependencyType::TargetSelfContained,
|
||||
't' => DependencyType::Target,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let path = PathBuf::from(t!(str::from_utf8(&part[1..])));
|
||||
paths.push((path, host));
|
||||
paths.push((path, dependency_type));
|
||||
}
|
||||
paths
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
@ -12,7 +10,6 @@ use crate::{Build, Crate};
|
||||
#[derive(Deserialize)]
|
||||
struct Output {
|
||||
packages: Vec<Package>,
|
||||
resolve: Resolve,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@ -21,63 +18,25 @@ struct Package {
|
||||
name: String,
|
||||
source: Option<String>,
|
||||
manifest_path: String,
|
||||
dependencies: Vec<Dependency>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Resolve {
|
||||
nodes: Vec<ResolveNode>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct ResolveNode {
|
||||
id: String,
|
||||
dependencies: Vec<String>,
|
||||
struct Dependency {
|
||||
name: String,
|
||||
source: Option<String>,
|
||||
}
|
||||
|
||||
pub fn build(build: &mut Build) {
|
||||
let mut resolves = Vec::new();
|
||||
build_krate(&build.std_features(), build, &mut resolves, "src/libstd");
|
||||
build_krate("", build, &mut resolves, "src/libtest");
|
||||
build_krate(&build.rustc_features(), build, &mut resolves, "src/rustc");
|
||||
|
||||
let mut id2name = HashMap::with_capacity(build.crates.len());
|
||||
for (name, krate) in build.crates.iter() {
|
||||
id2name.insert(krate.id.clone(), name.clone());
|
||||
}
|
||||
|
||||
for node in resolves {
|
||||
let name = match id2name.get(&node.id) {
|
||||
Some(name) => name,
|
||||
None => continue,
|
||||
};
|
||||
|
||||
let krate = build.crates.get_mut(name).unwrap();
|
||||
for dep in node.dependencies.iter() {
|
||||
let dep = match id2name.get(dep) {
|
||||
Some(dep) => dep,
|
||||
None => continue,
|
||||
};
|
||||
krate.deps.insert(*dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn build_krate(features: &str, build: &mut Build, resolves: &mut Vec<ResolveNode>, krate: &str) {
|
||||
// Run `cargo metadata` to figure out what crates we're testing.
|
||||
//
|
||||
// Down below we're going to call `cargo test`, but to test the right set
|
||||
// of packages we're going to have to know what `-p` arguments to pass it
|
||||
// to know what crates to test. Here we run `cargo metadata` to learn about
|
||||
// the dependency graph and what `-p` arguments there are.
|
||||
let mut cargo = Command::new(&build.initial_cargo);
|
||||
cargo
|
||||
.arg("metadata")
|
||||
.arg("--format-version")
|
||||
.arg("1")
|
||||
.arg("--features")
|
||||
.arg(features)
|
||||
.arg("--no-deps")
|
||||
.arg("--manifest-path")
|
||||
.arg(build.src.join(krate).join("Cargo.toml"));
|
||||
.arg(build.src.join("Cargo.toml"));
|
||||
let output = output(&mut cargo);
|
||||
let output: Output = serde_json::from_str(&output).unwrap();
|
||||
for package in output.packages {
|
||||
@ -85,8 +44,13 @@ fn build_krate(features: &str, build: &mut Build, resolves: &mut Vec<ResolveNode
|
||||
let name = INTERNER.intern_string(package.name);
|
||||
let mut path = PathBuf::from(package.manifest_path);
|
||||
path.pop();
|
||||
build.crates.insert(name, Crate { name, id: package.id, deps: HashSet::new(), path });
|
||||
let deps = package
|
||||
.dependencies
|
||||
.into_iter()
|
||||
.filter(|dep| dep.source.is_none())
|
||||
.map(|dep| INTERNER.intern_string(dep.name))
|
||||
.collect();
|
||||
build.crates.insert(name, Crate { name, id: package.id, deps, path });
|
||||
}
|
||||
}
|
||||
resolves.extend(output.resolve.nodes);
|
||||
}
|
||||
|
||||
@ -6,12 +6,6 @@ Q := @
|
||||
BOOTSTRAP_ARGS :=
|
||||
endif
|
||||
|
||||
ifdef EXCLUDE_CARGO
|
||||
AUX_ARGS :=
|
||||
else
|
||||
AUX_ARGS := src/tools/cargo src/tools/cargotest
|
||||
endif
|
||||
|
||||
BOOTSTRAP := $(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap.py
|
||||
|
||||
all:
|
||||
@ -48,8 +42,8 @@ check:
|
||||
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
|
||||
check-aux:
|
||||
$(Q)$(BOOTSTRAP) test \
|
||||
src/test/run-pass-valgrind/pretty \
|
||||
$(AUX_ARGS) \
|
||||
src/tools/cargo \
|
||||
src/tools/cargotest \
|
||||
$(BOOTSTRAP_ARGS)
|
||||
check-bootstrap:
|
||||
$(Q)$(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap_test.py
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
//! ensure that they're always in place if needed.
|
||||
|
||||
use std::env;
|
||||
use std::env::consts::EXE_EXTENSION;
|
||||
use std::ffi::OsString;
|
||||
use std::fs::{self, File};
|
||||
use std::io;
|
||||
@ -144,7 +145,7 @@ impl Step for Llvm {
|
||||
|
||||
let llvm_exp_targets = match builder.config.llvm_experimental_targets {
|
||||
Some(ref s) => s,
|
||||
None => "",
|
||||
None => "AVR",
|
||||
};
|
||||
|
||||
let assertions = if builder.config.llvm_assertions { "ON" } else { "OFF" };
|
||||
@ -158,7 +159,6 @@ impl Step for Llvm {
|
||||
.define("LLVM_INCLUDE_TESTS", "OFF")
|
||||
.define("LLVM_INCLUDE_DOCS", "OFF")
|
||||
.define("LLVM_INCLUDE_BENCHMARKS", "OFF")
|
||||
.define("LLVM_ENABLE_ZLIB", "OFF")
|
||||
.define("WITH_POLLY", "OFF")
|
||||
.define("LLVM_ENABLE_TERMINFO", "OFF")
|
||||
.define("LLVM_ENABLE_LIBEDIT", "OFF")
|
||||
@ -168,6 +168,25 @@ impl Step for Llvm {
|
||||
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
|
||||
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
|
||||
|
||||
if !target.contains("netbsd") {
|
||||
cfg.define("LLVM_ENABLE_ZLIB", "ON");
|
||||
} else {
|
||||
// FIXME: Enable zlib on NetBSD too
|
||||
// https://github.com/rust-lang/rust/pull/72696#issuecomment-641517185
|
||||
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
|
||||
}
|
||||
|
||||
// Are we compiling for iOS/tvOS?
|
||||
if target.contains("apple-ios") || target.contains("apple-tvos") {
|
||||
// These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error.
|
||||
cfg.define("CMAKE_OSX_SYSROOT", "/");
|
||||
cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", "");
|
||||
// Prevent cmake from adding -bundle to CFLAGS automatically, which leads to a compiler error because "-bitcode_bundle" also gets added.
|
||||
cfg.define("LLVM_ENABLE_PLUGINS", "OFF");
|
||||
// Zlib fails to link properly, leading to a compiler error.
|
||||
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
|
||||
}
|
||||
|
||||
if builder.config.llvm_thin_lto {
|
||||
cfg.define("LLVM_ENABLE_LTO", "Thin");
|
||||
if !target.contains("apple") {
|
||||
@ -234,8 +253,14 @@ impl Step for Llvm {
|
||||
// FIXME: if the llvm root for the build triple is overridden then we
|
||||
// should use llvm-tblgen from there, also should verify that it
|
||||
// actually exists most of the time in normal installs of LLVM.
|
||||
let host = builder.llvm_out(builder.config.build).join("bin/llvm-tblgen");
|
||||
cfg.define("CMAKE_CROSSCOMPILING", "True").define("LLVM_TABLEGEN", &host);
|
||||
let host_bin = builder.llvm_out(builder.config.build).join("bin");
|
||||
cfg.define("CMAKE_CROSSCOMPILING", "True");
|
||||
cfg.define("LLVM_TABLEGEN", host_bin.join("llvm-tblgen").with_extension(EXE_EXTENSION));
|
||||
cfg.define("LLVM_NM", host_bin.join("llvm-nm").with_extension(EXE_EXTENSION));
|
||||
cfg.define(
|
||||
"LLVM_CONFIG_PATH",
|
||||
host_bin.join("llvm-config").with_extension(EXE_EXTENSION),
|
||||
);
|
||||
|
||||
if target.contains("netbsd") {
|
||||
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
|
||||
@ -244,8 +269,6 @@ impl Step for Llvm {
|
||||
} else if target.contains("windows") {
|
||||
cfg.define("CMAKE_SYSTEM_NAME", "Windows");
|
||||
}
|
||||
|
||||
cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
|
||||
}
|
||||
|
||||
if let Some(ref suffix) = builder.config.llvm_version_suffix {
|
||||
@ -405,6 +428,17 @@ fn configure_cmake(
|
||||
if let Some(ref s) = builder.config.llvm_cflags {
|
||||
cflags.push_str(&format!(" {}", s));
|
||||
}
|
||||
// Some compiler features used by LLVM (such as thread locals) will not work on a min version below iOS 10.
|
||||
if target.contains("apple-ios") {
|
||||
if target.contains("86-") {
|
||||
cflags.push_str(" -miphonesimulator-version-min=10.0");
|
||||
} else {
|
||||
cflags.push_str(" -miphoneos-version-min=10.0");
|
||||
}
|
||||
}
|
||||
if builder.config.llvm_clang_cl.is_some() {
|
||||
cflags.push_str(&format!(" --target={}", target))
|
||||
}
|
||||
cfg.define("CMAKE_C_FLAGS", cflags);
|
||||
let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" ");
|
||||
if builder.config.llvm_static_stdcpp && !target.contains("msvc") && !target.contains("netbsd") {
|
||||
@ -413,6 +447,9 @@ fn configure_cmake(
|
||||
if let Some(ref s) = builder.config.llvm_cxxflags {
|
||||
cxxflags.push_str(&format!(" {}", s));
|
||||
}
|
||||
if builder.config.llvm_clang_cl.is_some() {
|
||||
cxxflags.push_str(&format!(" --target={}", target))
|
||||
}
|
||||
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
|
||||
if let Some(ar) = builder.ar(target) {
|
||||
if ar.is_absolute() {
|
||||
@ -458,7 +495,7 @@ impl Step for Lld {
|
||||
run.builder.ensure(Lld { target: run.target });
|
||||
}
|
||||
|
||||
/// Compile LLVM for `target`.
|
||||
/// Compile LLD for `target`.
|
||||
fn run(self, builder: &Builder<'_>) -> PathBuf {
|
||||
if builder.config.dry_run {
|
||||
return PathBuf::from("lld-out-dir-test-gen");
|
||||
@ -495,6 +532,7 @@ impl Step for Lld {
|
||||
// can't build on a system where your paths require `\` on Windows, but
|
||||
// there's probably a lot of reasons you can't do that other than this.
|
||||
let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper");
|
||||
|
||||
cfg.out_dir(&out_dir)
|
||||
.profile("Release")
|
||||
.env("LLVM_CONFIG_REAL", &llvm_config)
|
||||
@ -517,7 +555,10 @@ impl Step for Lld {
|
||||
if target != builder.config.build {
|
||||
cfg.env("LLVM_CONFIG_SHIM_REPLACE", &builder.config.build)
|
||||
.env("LLVM_CONFIG_SHIM_REPLACE_WITH", &target)
|
||||
.define("LLVM_TABLEGEN_EXE", llvm_config.with_file_name("llvm-tblgen"));
|
||||
.define(
|
||||
"LLVM_TABLEGEN_EXE",
|
||||
llvm_config.with_file_name("llvm-tblgen").with_extension(EXE_EXTENSION),
|
||||
);
|
||||
}
|
||||
|
||||
// Explicitly set C++ standard, because upstream doesn't do so
|
||||
@ -569,8 +610,8 @@ impl Step for TestHelpers {
|
||||
}
|
||||
|
||||
// We may have found various cross-compilers a little differently due to our
|
||||
// extra configuration, so inform gcc of these compilers. Note, though, that
|
||||
// on MSVC we still need gcc's detection of env vars (ugh).
|
||||
// extra configuration, so inform cc of these compilers. Note, though, that
|
||||
// on MSVC we still need cc's detection of env vars (ugh).
|
||||
if !target.contains("msvc") {
|
||||
if let Some(ar) = builder.ar(target) {
|
||||
cfg.archiver(ar);
|
||||
@ -689,48 +730,41 @@ fn supported_sanitizers(
|
||||
target: Interned<String>,
|
||||
channel: &str,
|
||||
) -> Vec<SanitizerRuntime> {
|
||||
let mut result = Vec::new();
|
||||
let darwin_libs = |os: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
|
||||
components
|
||||
.into_iter()
|
||||
.map(move |c| SanitizerRuntime {
|
||||
cmake_target: format!("clang_rt.{}_{}_dynamic", c, os),
|
||||
path: out_dir
|
||||
.join(&format!("build/lib/darwin/libclang_rt.{}_{}_dynamic.dylib", c, os)),
|
||||
name: format!("librustc-{}_rt.{}.dylib", channel, c),
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
|
||||
let common_libs = |os: &str, arch: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
|
||||
components
|
||||
.into_iter()
|
||||
.map(move |c| SanitizerRuntime {
|
||||
cmake_target: format!("clang_rt.{}-{}", c, arch),
|
||||
path: out_dir.join(&format!("build/lib/{}/libclang_rt.{}-{}.a", os, c, arch)),
|
||||
name: format!("librustc-{}_rt.{}.a", channel, c),
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
|
||||
match &*target {
|
||||
"x86_64-apple-darwin" => {
|
||||
for s in &["asan", "lsan", "tsan"] {
|
||||
result.push(SanitizerRuntime {
|
||||
cmake_target: format!("clang_rt.{}_osx_dynamic", s),
|
||||
path: out_dir
|
||||
.join(&format!("build/lib/darwin/libclang_rt.{}_osx_dynamic.dylib", s)),
|
||||
name: format!("librustc-{}_rt.{}.dylib", channel, s),
|
||||
});
|
||||
}
|
||||
"aarch64-fuchsia" => common_libs("fuchsia", "aarch64", &["asan"]),
|
||||
"aarch64-unknown-linux-gnu" => {
|
||||
common_libs("linux", "aarch64", &["asan", "lsan", "msan", "tsan"])
|
||||
}
|
||||
"x86_64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]),
|
||||
"x86_64-fuchsia" => common_libs("fuchsia", "x86_64", &["asan"]),
|
||||
"x86_64-unknown-linux-gnu" => {
|
||||
for s in &["asan", "lsan", "msan", "tsan"] {
|
||||
result.push(SanitizerRuntime {
|
||||
cmake_target: format!("clang_rt.{}-x86_64", s),
|
||||
path: out_dir.join(&format!("build/lib/linux/libclang_rt.{}-x86_64.a", s)),
|
||||
name: format!("librustc-{}_rt.{}.a", channel, s),
|
||||
});
|
||||
}
|
||||
common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
|
||||
}
|
||||
"x86_64-fuchsia" => {
|
||||
for s in &["asan"] {
|
||||
result.push(SanitizerRuntime {
|
||||
cmake_target: format!("clang_rt.{}-x86_64", s),
|
||||
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-x86_64.a", s)),
|
||||
name: format!("librustc-{}_rt.{}.a", channel, s),
|
||||
});
|
||||
}
|
||||
}
|
||||
"aarch64-fuchsia" => {
|
||||
for s in &["asan"] {
|
||||
result.push(SanitizerRuntime {
|
||||
cmake_target: format!("clang_rt.{}-aarch64", s),
|
||||
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-aarch64.a", s)),
|
||||
name: format!("librustc-{}_rt.{}.a", channel, s),
|
||||
});
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
_ => Vec::new(),
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
struct HashStamp {
|
||||
|
||||
@ -199,10 +199,10 @@ pub fn check(build: &mut Build) {
|
||||
let target = build.config.target_config.entry(target.clone()).or_default();
|
||||
target.musl_root = Some("/usr".into());
|
||||
}
|
||||
match build.musl_root(*target) {
|
||||
Some(root) => {
|
||||
if fs::metadata(root.join("lib/libc.a")).is_err() {
|
||||
panic!("couldn't find libc.a in musl dir: {}", root.join("lib").display());
|
||||
match build.musl_libdir(*target) {
|
||||
Some(libdir) => {
|
||||
if fs::metadata(libdir.join("libc.a")).is_err() {
|
||||
panic!("couldn't find libc.a in musl libdir: {}", libdir.display());
|
||||
}
|
||||
}
|
||||
None => panic!(
|
||||
|
||||
@ -154,6 +154,7 @@ impl Step for Cargotest {
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let compiler = builder.compiler(self.stage, self.host);
|
||||
builder.ensure(compile::Rustc { compiler, target: compiler.host });
|
||||
let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host });
|
||||
|
||||
// Note that this is a short, cryptic, and not scoped directory name. This
|
||||
// is currently to minimize the length of path on Windows where we otherwise
|
||||
@ -165,7 +166,7 @@ impl Step for Cargotest {
|
||||
let mut cmd = builder.tool_cmd(Tool::CargoTest);
|
||||
try_run(
|
||||
builder,
|
||||
cmd.arg(&builder.initial_cargo)
|
||||
cmd.arg(&cargo)
|
||||
.arg(&out_dir)
|
||||
.env("RUSTC", builder.rustc(compiler))
|
||||
.env("RUSTDOC", builder.rustdoc(compiler)),
|
||||
@ -366,7 +367,8 @@ impl Step for Miri {
|
||||
extra_features: Vec::new(),
|
||||
});
|
||||
if let (Some(miri), Some(_cargo_miri)) = (miri, cargo_miri) {
|
||||
let mut cargo = builder.cargo(compiler, Mode::ToolRustc, host, "install");
|
||||
let mut cargo =
|
||||
builder.cargo(compiler, Mode::ToolRustc, SourceType::Submodule, host, "install");
|
||||
cargo.arg("xargo");
|
||||
// Configure `cargo install` path. cargo adds a `bin/`.
|
||||
cargo.env("CARGO_INSTALL_ROOT", &builder.out);
|
||||
@ -395,8 +397,6 @@ impl Step for Miri {
|
||||
cargo.env("MIRI", &miri);
|
||||
// Debug things.
|
||||
cargo.env("RUST_BACKTRACE", "1");
|
||||
// Overwrite bootstrap's `rustc` wrapper overwriting our flags.
|
||||
cargo.env("RUSTC_DEBUG_ASSERTIONS", "true");
|
||||
// Let cargo-miri know where xargo ended up.
|
||||
cargo.env("XARGO_CHECK", builder.out.join("bin").join("xargo-check"));
|
||||
|
||||
@ -553,7 +553,7 @@ impl Step for Clippy {
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
try_run(builder, &mut cargo.into());
|
||||
builder.run(&mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
@ -929,13 +929,6 @@ host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-ful
|
||||
host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" });
|
||||
|
||||
host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" });
|
||||
test!(RunPassValgrindPretty {
|
||||
path: "src/test/run-pass-valgrind/pretty",
|
||||
mode: "pretty",
|
||||
suite: "run-pass-valgrind",
|
||||
default: false,
|
||||
host: true
|
||||
});
|
||||
|
||||
default_test!(RunMake { path: "src/test/run-make", mode: "run-make", suite: "run-make" });
|
||||
|
||||
@ -1459,8 +1452,11 @@ impl Step for ErrorIndex {
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
run.builder
|
||||
.ensure(ErrorIndex { compiler: run.builder.compiler(run.builder.top_stage, run.host) });
|
||||
// error_index_generator depends on librustdoc. Use the compiler that
|
||||
// is normally used to build rustdoc for other tests (like compiletest
|
||||
// tests in src/test/rustdoc) so that it shares the same artifacts.
|
||||
let compiler = run.builder.compiler_for(run.builder.top_stage, run.host, run.host);
|
||||
run.builder.ensure(ErrorIndex { compiler });
|
||||
}
|
||||
|
||||
/// Runs the error index generator tool to execute the tests located in the error
|
||||
@ -1472,22 +1468,23 @@ impl Step for ErrorIndex {
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let compiler = self.compiler;
|
||||
|
||||
builder.ensure(compile::Std { compiler, target: compiler.host });
|
||||
|
||||
let dir = testdir(builder, compiler.host);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
let output = dir.join("error-index.md");
|
||||
|
||||
let mut tool = tool::ErrorIndex::command(
|
||||
builder,
|
||||
builder.compiler(compiler.stage, builder.config.build),
|
||||
);
|
||||
tool.arg("markdown").arg(&output).env("CFG_BUILD", &builder.config.build);
|
||||
let mut tool = tool::ErrorIndex::command(builder, compiler);
|
||||
tool.arg("markdown").arg(&output);
|
||||
|
||||
builder.info(&format!("Testing error-index stage{}", compiler.stage));
|
||||
// Use the rustdoc that was built by self.compiler. This copy of
|
||||
// rustdoc is shared with other tests (like compiletest tests in
|
||||
// src/test/rustdoc). This helps avoid building rustdoc multiple
|
||||
// times.
|
||||
let rustdoc_compiler = builder.compiler(builder.top_stage, builder.config.build);
|
||||
builder.info(&format!("Testing error-index stage{}", rustdoc_compiler.stage));
|
||||
let _time = util::timeit(&builder);
|
||||
builder.run_quiet(&mut tool);
|
||||
markdown_test(builder, compiler, &output);
|
||||
builder.ensure(compile::Std { compiler: rustdoc_compiler, target: rustdoc_compiler.host });
|
||||
markdown_test(builder, rustdoc_compiler, &output);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1565,7 +1562,7 @@ impl Step for CrateLibrustc {
|
||||
let compiler = builder.compiler(builder.top_stage, run.host);
|
||||
|
||||
for krate in builder.in_tree_crates("rustc-main") {
|
||||
if run.path.ends_with(&krate.path) {
|
||||
if krate.path.ends_with(&run.path) {
|
||||
let test_kind = builder.kind.into();
|
||||
|
||||
builder.ensure(CrateLibrustc {
|
||||
@ -1651,14 +1648,8 @@ impl Step for Crate {
|
||||
type Output = ();
|
||||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(mut run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
let builder = run.builder;
|
||||
for krate in run.builder.in_tree_crates("test") {
|
||||
if !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) {
|
||||
run = run.path(krate.local_path(&builder).to_str().unwrap());
|
||||
}
|
||||
}
|
||||
run
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.krate("test")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
@ -1678,7 +1669,7 @@ impl Step for Crate {
|
||||
};
|
||||
|
||||
for krate in builder.in_tree_crates("test") {
|
||||
if run.path.ends_with(&krate.local_path(&builder)) {
|
||||
if krate.path.ends_with(&run.path) {
|
||||
make(Mode::Std, krate);
|
||||
}
|
||||
}
|
||||
@ -1708,7 +1699,8 @@ impl Step for Crate {
|
||||
// we're working with automatically.
|
||||
let compiler = builder.compiler_for(compiler.stage, compiler.host, target);
|
||||
|
||||
let mut cargo = builder.cargo(compiler, mode, target, test_kind.subcommand());
|
||||
let mut cargo =
|
||||
builder.cargo(compiler, mode, SourceType::InTree, target, test_kind.subcommand());
|
||||
match mode {
|
||||
Mode::Std => {
|
||||
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||
@ -1807,9 +1799,13 @@ impl Step for CrateRustdoc {
|
||||
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let test_kind = self.test_kind;
|
||||
let target = self.host;
|
||||
|
||||
let compiler = builder.compiler(builder.top_stage, self.host);
|
||||
let target = compiler.host;
|
||||
// Use the previous stage compiler to reuse the artifacts that are
|
||||
// created when running compiletest for src/test/rustdoc. If this used
|
||||
// `compiler`, then it would cause rustdoc to be built *again*, which
|
||||
// isn't really necessary.
|
||||
let compiler = builder.compiler_for(builder.top_stage, target, target);
|
||||
builder.ensure(compile::Rustc { compiler, target });
|
||||
|
||||
let mut cargo = tool::prepare_tool_cargo(
|
||||
@ -1835,6 +1831,32 @@ impl Step for CrateRustdoc {
|
||||
cargo.arg("'-Ctarget-feature=-crt-static'");
|
||||
}
|
||||
|
||||
// This is needed for running doctests on librustdoc. This is a bit of
|
||||
// an unfortunate interaction with how bootstrap works and how cargo
|
||||
// sets up the dylib path, and the fact that the doctest (in
|
||||
// html/markdown.rs) links to rustc-private libs. For stage1, the
|
||||
// compiler host dylibs (in stage1/lib) are not the same as the target
|
||||
// dylibs (in stage1/lib/rustlib/...). This is different from a normal
|
||||
// rust distribution where they are the same.
|
||||
//
|
||||
// On the cargo side, normal tests use `target_process` which handles
|
||||
// setting up the dylib for a *target* (stage1/lib/rustlib/... in this
|
||||
// case). However, for doctests it uses `rustdoc_process` which only
|
||||
// sets up the dylib path for the *host* (stage1/lib), which is the
|
||||
// wrong directory.
|
||||
//
|
||||
// It should be considered to just stop running doctests on
|
||||
// librustdoc. There is only one test, and it doesn't look too
|
||||
// important. There might be other ways to avoid this, but it seems
|
||||
// pretty convoluted.
|
||||
//
|
||||
// See also https://github.com/rust-lang/rust/issues/13983 where the
|
||||
// host vs target dylibs for rustdoc are consistently tricky to deal
|
||||
// with.
|
||||
let mut dylib_path = dylib_path();
|
||||
dylib_path.insert(0, PathBuf::from(&*builder.sysroot_libdir(compiler, target)));
|
||||
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
|
||||
if !builder.config.verbose_tests {
|
||||
cargo.arg("--quiet");
|
||||
}
|
||||
|
||||
@ -12,11 +12,11 @@ use crate::channel;
|
||||
use crate::channel::GitInfo;
|
||||
use crate::compile;
|
||||
use crate::toolstate::ToolState;
|
||||
use crate::util::{add_dylib_path, exe, CiEnv};
|
||||
use crate::util::{add_dylib_path, exe};
|
||||
use crate::Compiler;
|
||||
use crate::Mode;
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub enum SourceType {
|
||||
InTree,
|
||||
Submodule,
|
||||
@ -226,21 +226,16 @@ pub fn prepare_tool_cargo(
|
||||
source_type: SourceType,
|
||||
extra_features: &[String],
|
||||
) -> CargoCommand {
|
||||
let mut cargo = builder.cargo(compiler, mode, target, command);
|
||||
let mut cargo = builder.cargo(compiler, mode, source_type, target, command);
|
||||
let dir = builder.src.join(path);
|
||||
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
|
||||
|
||||
if source_type == SourceType::Submodule {
|
||||
cargo.env("RUSTC_EXTERNAL_TOOL", "1");
|
||||
}
|
||||
|
||||
let mut features = extra_features.to_vec();
|
||||
if builder.build.config.cargo_native_static {
|
||||
if path.ends_with("cargo")
|
||||
|| path.ends_with("rls")
|
||||
|| path.ends_with("clippy")
|
||||
|| path.ends_with("miri")
|
||||
|| path.ends_with("rustbook")
|
||||
|| path.ends_with("rustfmt")
|
||||
{
|
||||
cargo.env("LIBZ_SYS_STATIC", "1");
|
||||
@ -276,20 +271,6 @@ pub fn prepare_tool_cargo(
|
||||
cargo
|
||||
}
|
||||
|
||||
fn rustbook_features() -> Vec<String> {
|
||||
let mut features = Vec::new();
|
||||
|
||||
// Due to CI budged and risk of spurious failures we want to limit jobs running this check.
|
||||
// At same time local builds should run it regardless of the platform.
|
||||
// `CiEnv::None` means it's local build and `CHECK_LINKS` is defined in x86_64-gnu-tools to
|
||||
// explicitly enable it on single job
|
||||
if CiEnv::current() == CiEnv::None || env::var("CHECK_LINKS").is_ok() {
|
||||
features.push("linkcheck".to_string());
|
||||
}
|
||||
|
||||
features
|
||||
}
|
||||
|
||||
macro_rules! bootstrap_tool {
|
||||
($(
|
||||
$name:ident, $path:expr, $tool_name:expr
|
||||
@ -372,7 +353,7 @@ macro_rules! bootstrap_tool {
|
||||
}
|
||||
|
||||
bootstrap_tool!(
|
||||
Rustbook, "src/tools/rustbook", "rustbook", features = rustbook_features();
|
||||
Rustbook, "src/tools/rustbook", "rustbook";
|
||||
UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
|
||||
Tidy, "src/tools/tidy", "tidy";
|
||||
Linkchecker, "src/tools/linkchecker", "linkchecker";
|
||||
@ -385,7 +366,7 @@ bootstrap_tool!(
|
||||
ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors";
|
||||
);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct ErrorIndex {
|
||||
pub compiler: Compiler,
|
||||
}
|
||||
@ -411,9 +392,9 @@ impl Step for ErrorIndex {
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
// Compile the error-index in the same stage as rustdoc to avoid
|
||||
// recompiling rustdoc twice if we can.
|
||||
let stage = if run.builder.top_stage >= 2 { run.builder.top_stage } else { 0 };
|
||||
run.builder
|
||||
.ensure(ErrorIndex { compiler: run.builder.compiler(stage, run.builder.config.build) });
|
||||
let host = run.builder.config.build;
|
||||
let compiler = run.builder.compiler_for(run.builder.top_stage, host, host);
|
||||
run.builder.ensure(ErrorIndex { compiler });
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) -> PathBuf {
|
||||
@ -468,7 +449,7 @@ impl Step for RemoteTestServer {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct Rustdoc {
|
||||
/// This should only ever be 0 or 2.
|
||||
/// We sometimes want to reference the "bootstrap" rustdoc, which is why this option is here.
|
||||
@ -481,7 +462,7 @@ impl Step for Rustdoc {
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.path("src/tools/rustdoc")
|
||||
run.path("src/tools/rustdoc").path("src/librustdoc")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
@ -595,6 +576,8 @@ macro_rules! tool_extended {
|
||||
$toolstate:ident,
|
||||
$path:expr,
|
||||
$tool_name:expr,
|
||||
stable = $stable:expr,
|
||||
$(in_tree = $in_tree:expr,)*
|
||||
$extra_deps:block;)+) => {
|
||||
$(
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
@ -606,17 +589,22 @@ macro_rules! tool_extended {
|
||||
|
||||
impl Step for $name {
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const DEFAULT: bool = true; // Overwritten below
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
let builder = run.builder;
|
||||
run.path($path).default_condition(
|
||||
builder.config.extended
|
||||
&& builder.config.tools.as_ref().map_or(true, |tools| {
|
||||
tools.iter().any(|tool| match tool.as_ref() {
|
||||
"clippy" => $tool_name == "clippy-driver",
|
||||
x => $tool_name == x,
|
||||
&& builder.config.tools.as_ref().map_or(
|
||||
// By default, on nightly/dev enable all tools, else only
|
||||
// build stable tools.
|
||||
$stable || builder.build.unstable_features(),
|
||||
// If `tools` is set, search list for this tool.
|
||||
|tools| {
|
||||
tools.iter().any(|tool| match tool.as_ref() {
|
||||
"clippy" => $tool_name == "clippy-driver",
|
||||
x => $tool_name == x,
|
||||
})
|
||||
}),
|
||||
)
|
||||
@ -641,7 +629,11 @@ macro_rules! tool_extended {
|
||||
path: $path,
|
||||
extra_features: $sel.extra_features,
|
||||
is_optional_tool: true,
|
||||
source_type: SourceType::Submodule,
|
||||
source_type: if false $(|| $in_tree)* {
|
||||
SourceType::InTree
|
||||
} else {
|
||||
SourceType::Submodule
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -649,15 +641,15 @@ macro_rules! tool_extended {
|
||||
}
|
||||
}
|
||||
|
||||
// Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs`
|
||||
// Note: tools need to be also added to `Builder::get_step_descriptions` in `builder.rs`
|
||||
// to make `./x.py build <tool>` work.
|
||||
tool_extended!((self, builder),
|
||||
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
|
||||
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {};
|
||||
Clippy, clippy, "src/tools/clippy", "clippy-driver", {};
|
||||
Miri, miri, "src/tools/miri", "miri", {};
|
||||
CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", {};
|
||||
Rls, rls, "src/tools/rls", "rls", {
|
||||
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
|
||||
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, in_tree=true, {};
|
||||
Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, in_tree=true, {};
|
||||
Miri, miri, "src/tools/miri", "miri", stable=false, {};
|
||||
CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {};
|
||||
Rls, rls, "src/tools/rls", "rls", stable=true, {
|
||||
builder.ensure(Clippy {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
@ -665,7 +657,8 @@ tool_extended!((self, builder),
|
||||
});
|
||||
self.extra_features.push("clippy".to_owned());
|
||||
};
|
||||
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
|
||||
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
|
||||
RustAnalyzer, rust_analyzer, "src/tools/rust-analyzer/crates/rust-analyzer", "rust-analyzer", stable=false, {};
|
||||
);
|
||||
|
||||
impl<'a> Builder<'a> {
|
||||
|
||||
@ -272,6 +272,18 @@ impl Builder<'_> {
|
||||
/// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be
|
||||
/// done. The file is updated immediately after this function completes.
|
||||
pub fn save_toolstate(&self, tool: &str, state: ToolState) {
|
||||
// If we're in a dry run setting we don't want to save toolstates as
|
||||
// that means if we e.g. panic down the line it'll look like we tested
|
||||
// everything (but we actually haven't).
|
||||
if self.config.dry_run {
|
||||
return;
|
||||
}
|
||||
// Toolstate isn't tracked for clippy, but since most tools do, we avoid
|
||||
// checking in all the places we could save toolstate and just do so
|
||||
// here.
|
||||
if tool == "clippy-driver" {
|
||||
return;
|
||||
}
|
||||
if let Some(ref path) = self.config.save_toolstates {
|
||||
if let Some(parent) = path.parent() {
|
||||
// Ensure the parent directory always exists
|
||||
|
||||
@ -142,10 +142,6 @@ jobs:
|
||||
# FIXME(#59637)
|
||||
NO_DEBUG_ASSERTIONS: 1
|
||||
NO_LLVM_ASSERTIONS: 1
|
||||
# MSVC aux tests
|
||||
x86_64-msvc-aux:
|
||||
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
|
||||
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
|
||||
x86_64-msvc-cargo:
|
||||
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
|
||||
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
|
||||
@ -155,7 +151,7 @@ jobs:
|
||||
NO_LLVM_ASSERTIONS: 1
|
||||
# MSVC tools tests
|
||||
x86_64-msvc-tools:
|
||||
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py
|
||||
SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py
|
||||
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
|
||||
|
||||
# 32/64-bit MinGW builds.
|
||||
|
||||
@ -66,10 +66,6 @@ steps:
|
||||
displayName: Install wix
|
||||
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||
|
||||
- bash: src/ci/scripts/install-innosetup.sh
|
||||
displayName: Install InnoSetup
|
||||
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||
|
||||
- bash: src/ci/scripts/symlink-build-dir.sh
|
||||
displayName: Ensure the build happens on a partition with enough space
|
||||
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||
@ -82,10 +78,6 @@ steps:
|
||||
displayName: Install msys2
|
||||
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||
|
||||
- bash: src/ci/scripts/install-msys2-packages.sh
|
||||
displayName: Install msys2 packages
|
||||
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||
|
||||
- bash: src/ci/scripts/install-mingw.sh
|
||||
displayName: Install MinGW
|
||||
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||
|
||||
@ -26,8 +26,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
dist-x86_64-linux: {}
|
||||
dist-x86_64-linux-alt:
|
||||
IMAGE: dist-x86_64-linux
|
||||
|
||||
# The macOS and Windows builds here are currently disabled due to them not being
|
||||
# overly necessary on `try` builds. We also don't actually have anything that
|
||||
|
||||
@ -25,9 +25,11 @@ before running your command.
|
||||
|
||||
## Filesystem layout
|
||||
|
||||
- Each directory, excluding `scripts` and `disabled`, corresponds to a docker image
|
||||
- `scripts` contains files shared by docker images
|
||||
- `disabled` contains images that are not built on CI
|
||||
- Each host architecture has its own `host-{arch}` directory, and those
|
||||
directories contain a subdirectory for each Docker image (plus the `disabled`
|
||||
subdirectory).
|
||||
- `host-{arch}/disabled` contains images that are not built on CI.
|
||||
- `scripts` contains files shared by multiple Docker images.
|
||||
|
||||
## Docker Toolbox on Windows
|
||||
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/android-base-apt-get.sh /scripts/
|
||||
RUN sh /scripts/android-base-apt-get.sh
|
||||
|
||||
COPY scripts/android-ndk.sh /scripts/
|
||||
RUN . /scripts/android-ndk.sh && \
|
||||
download_and_make_toolchain android-ndk-r15c-linux-x86_64.zip arm 14
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libgl1-mesa-glx \
|
||||
libpulse0 \
|
||||
libstdc++6:i386 \
|
||||
openjdk-9-jre-headless \
|
||||
tzdata \
|
||||
wget \
|
||||
python3
|
||||
|
||||
COPY scripts/android-sdk.sh /scripts/
|
||||
COPY scripts/android-sdk-manager.py /scripts/
|
||||
COPY arm-android/android-sdk.lock /android/sdk/android-sdk.lock
|
||||
RUN /scripts/android-sdk.sh
|
||||
|
||||
ENV PATH=$PATH:/android/sdk/emulator
|
||||
ENV PATH=$PATH:/android/sdk/tools
|
||||
ENV PATH=$PATH:/android/sdk/platform-tools
|
||||
|
||||
ENV TARGETS=arm-linux-androideabi
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/arm-14
|
||||
|
||||
ENV SCRIPT python3 ../x.py test --target $TARGETS
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
COPY scripts/android-start-emulator.sh /scripts/
|
||||
ENTRYPOINT ["/scripts/android-start-emulator.sh"]
|
||||
@ -1,83 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update -y && apt-get install -y --no-install-recommends \
|
||||
bc \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
cpio \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
git \
|
||||
libc6-dev \
|
||||
libc6-dev-armhf-cross \
|
||||
make \
|
||||
python3 \
|
||||
qemu-system-arm \
|
||||
xz-utils
|
||||
|
||||
ENV ARCH=arm \
|
||||
CROSS_COMPILE=arm-linux-gnueabihf-
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Compile the kernel that we're going to run and be emulating with. This is
|
||||
# basically just done to be compatible with the QEMU target that we're going
|
||||
# to be using when running tests. If any other kernel works or if any
|
||||
# other QEMU target works with some other stock kernel, we can use that too!
|
||||
#
|
||||
# The `vexpress_config` config file was a previously generated config file for
|
||||
# the kernel. This file was generated by running `make vexpress_defconfig`
|
||||
# followed by `make menuconfig` and then enabling the IPv6 protocol page.
|
||||
COPY armhf-gnu/vexpress_config /build/.config
|
||||
RUN curl https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.42.tar.xz | \
|
||||
tar xJf - && \
|
||||
cd /build/linux-4.4.42 && \
|
||||
cp /build/.config . && \
|
||||
make -j$(nproc) all && \
|
||||
cp arch/arm/boot/zImage /tmp && \
|
||||
cd /build && \
|
||||
rm -rf linux-4.4.42
|
||||
|
||||
# Compile an instance of busybox as this provides a lightweight system and init
|
||||
# binary which we will boot into. Only trick here is configuring busybox to
|
||||
# build static binaries.
|
||||
RUN curl https://www.busybox.net/downloads/busybox-1.21.1.tar.bz2 | tar xjf - && \
|
||||
cd busybox-1.21.1 && \
|
||||
make defconfig && \
|
||||
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
mv _install /tmp/rootfs && \
|
||||
cd /build && \
|
||||
rm -rf busybox-1.12.1
|
||||
|
||||
# Download the ubuntu rootfs, which we'll use as a chroot for all our tests.
|
||||
WORKDIR /tmp
|
||||
RUN mkdir rootfs/ubuntu
|
||||
RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-armhf.tar.gz | \
|
||||
tar xzf - -C rootfs/ubuntu && \
|
||||
cd rootfs && mkdir proc sys dev etc etc/init.d
|
||||
|
||||
# Copy over our init script, which starts up our test server and also a few
|
||||
# other misc tasks.
|
||||
COPY scripts/qemu-bare-bones-rcS rootfs/etc/init.d/rcS
|
||||
RUN chmod +x rootfs/etc/init.d/rcS
|
||||
|
||||
# Helper to quickly fill the entropy pool in the kernel.
|
||||
COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c
|
||||
RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
|
||||
|
||||
# TODO: What is this?!
|
||||
# Source of the file: https://github.com/vfdev-5/qemu-rpi2-vexpress/raw/master/vexpress-v2p-ca15-tc1.dtb
|
||||
RUN curl -O https://ci-mirrors.rust-lang.org/rustc/vexpress-v2p-ca15-tc1.dtb
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --qemu-armhf-rootfs=/tmp/rootfs
|
||||
ENV SCRIPT python3 ../x.py test --target arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV NO_CHANGE_USER=1
|
||||
@ -1,79 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update -y && apt-get install -y --no-install-recommends \
|
||||
bc \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
cpio \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gcc-aarch64-linux-gnu \
|
||||
git \
|
||||
libc6-dev \
|
||||
libc6-dev-arm64-cross \
|
||||
make \
|
||||
python3 \
|
||||
qemu-system-aarch64 \
|
||||
xz-utils
|
||||
|
||||
ENV ARCH=arm64 \
|
||||
CROSS_COMPILE=aarch64-linux-gnu-
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Compile the kernel that we're going to run and be emulating with. This is
|
||||
# basically just done to be compatible with the QEMU target that we're going
|
||||
# to be using when running tests. If any other kernel works or if any
|
||||
# other QEMU target works with some other stock kernel, we can use that too!
|
||||
#
|
||||
# The `config` config file was a previously generated config file for
|
||||
# the kernel. This file was generated by running `make defconfig`
|
||||
# followed by `make menuconfig` and then enabling the IPv6 protocol page.
|
||||
COPY aarch64-gnu/config /build/.config
|
||||
RUN curl https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.42.tar.xz | \
|
||||
tar xJf - && \
|
||||
cd /build/linux-4.4.42 && \
|
||||
cp /build/.config . && \
|
||||
make -j$(nproc) all && \
|
||||
cp arch/arm64/boot/Image /tmp && \
|
||||
cd /build && \
|
||||
rm -rf linux-4.4.42
|
||||
|
||||
# Compile an instance of busybox as this provides a lightweight system and init
|
||||
# binary which we will boot into. Only trick here is configuring busybox to
|
||||
# build static binaries.
|
||||
RUN curl https://www.busybox.net/downloads/busybox-1.21.1.tar.bz2 | tar xjf - && \
|
||||
cd busybox-1.21.1 && \
|
||||
make defconfig && \
|
||||
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
mv _install /tmp/rootfs && \
|
||||
cd /build && \
|
||||
rm -rf busybox-1.12.1
|
||||
|
||||
# Download the ubuntu rootfs, which we'll use as a chroot for all our tests.
|
||||
WORKDIR /tmp
|
||||
RUN mkdir rootfs/ubuntu
|
||||
RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-arm64.tar.gz | \
|
||||
tar xzf - -C rootfs/ubuntu && \
|
||||
cd rootfs && mkdir proc sys dev etc etc/init.d
|
||||
|
||||
# Copy over our init script, which starts up our test server and also a few
|
||||
# other misc tasks.
|
||||
COPY scripts/qemu-bare-bones-rcS rootfs/etc/init.d/rcS
|
||||
RUN chmod +x rootfs/etc/init.d/rcS
|
||||
|
||||
# Helper to quickly fill the entropy pool in the kernel.
|
||||
COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c
|
||||
RUN aarch64-linux-gnu-gcc addentropy.c -o rootfs/addentropy -static
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--qemu-aarch64-rootfs=/tmp/rootfs
|
||||
ENV SCRIPT python3 ../x.py test --target aarch64-unknown-linux-gnu
|
||||
ENV NO_CHANGE_USER=1
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python3 \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
bzip2 \
|
||||
xz-utils \
|
||||
wget \
|
||||
libssl-dev \
|
||||
bsdtar \
|
||||
pkg-config
|
||||
|
||||
|
||||
COPY dist-x86_64-dragonfly/build-toolchain.sh /tmp/
|
||||
COPY dist-x86_64-dragonfly/patch-toolchain /tmp/
|
||||
RUN /tmp/build-toolchain.sh /tmp/patch-toolchain
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-ar \
|
||||
CC_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-gcc \
|
||||
CXX_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-dragonfly
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,49 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
autoconf \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
git \
|
||||
libcurl4-openssl-dev \
|
||||
libssl-dev \
|
||||
make \
|
||||
nasm \
|
||||
pkg-config \
|
||||
python3 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
zlib1g-dev
|
||||
|
||||
COPY dist-x86_64-haiku/llvm-config.sh /bin/llvm-config-haiku
|
||||
|
||||
ENV ARCH=x86_64
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY dist-x86_64-haiku/build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh $ARCH
|
||||
|
||||
COPY dist-x86_64-haiku/fetch-packages.sh /tmp/
|
||||
RUN /tmp/fetch-packages.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV HOST=x86_64-unknown-haiku
|
||||
ENV TARGET=target.$HOST
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --disable-jemalloc \
|
||||
--set=$TARGET.cc=x86_64-unknown-haiku-gcc \
|
||||
--set=$TARGET.cxx=x86_64-unknown-haiku-g++ \
|
||||
--set=$TARGET.llvm-config=/bin/llvm-config-haiku
|
||||
ENV SCRIPT python3 ../x.py dist --host=$HOST --target=$HOST
|
||||
@ -1,22 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY dist-various-1/install-x86_64-redox.sh /scripts/
|
||||
RUN sh /scripts/install-x86_64-redox.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_redox=x86_64-unknown-redox-ar \
|
||||
CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \
|
||||
CXX_x86_64_unknown_redox=x86_64-unknown-redox-g++
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended
|
||||
ENV SCRIPT python3 ../x.py dist --target x86_64-unknown-redox
|
||||
@ -1,39 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
# Ubuntu 16.04 (this container) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
COPY scripts/make3.sh /scripts/
|
||||
RUN sh /scripts/make3.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-aarch64-linux/aarch64-linux-gnu.config dist-aarch64-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/aarch64-unknown-linux-gnueabi/bin
|
||||
|
||||
ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \
|
||||
AR_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-ar \
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=aarch64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-full-tools \
|
||||
--enable-profiler \
|
||||
--disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,31 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng-1.24.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng-1.24.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-arm-linux/arm-linux-gnueabi.config dist-arm-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabi/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \
|
||||
AR_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-ar \
|
||||
CXX_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabi
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-full-tools --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,31 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng-1.24.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng-1.24.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-armhf-linux/arm-linux-gnueabihf.config dist-armhf-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
|
||||
AR_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-ar \
|
||||
CXX_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-full-tools --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,31 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng-1.24.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng-1.24.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-armv7-linux/build-toolchains.sh dist-armv7-linux/armv7-linux-gnueabihf.config /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
|
||||
AR_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-ar \
|
||||
CXX_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=armv7-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-full-tools --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,120 +0,0 @@
|
||||
FROM centos:5
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
|
||||
# to http://vault.centos.org/
|
||||
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
|
||||
RUN sed -i 's|#\(baseurl.*\)mirror.centos.org/centos/$releasever|\1vault.centos.org/5.11|' /etc/yum.repos.d/*.repo
|
||||
|
||||
RUN yum upgrade -y && yum install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
glibc-devel \
|
||||
perl \
|
||||
zlib-devel \
|
||||
file \
|
||||
xz \
|
||||
which \
|
||||
pkgconfig \
|
||||
wget \
|
||||
autoconf \
|
||||
gettext
|
||||
|
||||
ENV PATH=/rustroot/bin:$PATH
|
||||
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
|
||||
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
|
||||
WORKDIR /tmp
|
||||
COPY dist-x86_64-linux/shared.sh /tmp/
|
||||
|
||||
# We need a build of openssl which supports SNI to download artifacts from
|
||||
# static.rust-lang.org. This'll be used to link into libcurl below (and used
|
||||
# later as well), so build a copy of OpenSSL with dynamic libraries into our
|
||||
# generic root.
|
||||
COPY dist-x86_64-linux/build-openssl.sh /tmp/
|
||||
RUN ./build-openssl.sh
|
||||
|
||||
# The `curl` binary on CentOS doesn't support SNI which is needed for fetching
|
||||
# some https urls we have, so install a new version of libcurl + curl which is
|
||||
# using the openssl we just built previously.
|
||||
#
|
||||
# Note that we also disable a bunch of optional features of curl that we don't
|
||||
# really need.
|
||||
COPY dist-x86_64-linux/build-curl.sh /tmp/
|
||||
RUN ./build-curl.sh
|
||||
|
||||
# binutils < 2.22 has a bug where the 32-bit executables it generates
|
||||
# immediately segfault in Rust, so we need to install our own binutils.
|
||||
#
|
||||
# See https://github.com/rust-lang/rust/issues/20440 for more info
|
||||
COPY dist-x86_64-linux/build-binutils.sh /tmp/
|
||||
RUN ./build-binutils.sh
|
||||
|
||||
# libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
|
||||
# only has 2.6.4, so build our own
|
||||
COPY dist-x86_64-linux/build-cmake.sh /tmp/
|
||||
RUN ./build-cmake.sh
|
||||
|
||||
# Need a newer version of gcc than centos has to compile LLVM nowadays
|
||||
COPY dist-x86_64-linux/build-gcc.sh /tmp/
|
||||
RUN ./build-gcc.sh
|
||||
|
||||
# CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
|
||||
COPY dist-x86_64-linux/build-python.sh /tmp/
|
||||
RUN ./build-python.sh
|
||||
|
||||
# Now build LLVM+Clang 7, afterwards configuring further compilations to use the
|
||||
# clang/clang++ compilers.
|
||||
COPY dist-x86_64-linux/build-clang.sh dist-x86_64-linux/llvm-project-centos.patch /tmp/
|
||||
RUN ./build-clang.sh
|
||||
ENV CC=clang CXX=clang++
|
||||
|
||||
# Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
|
||||
# cloning, so download and build it here.
|
||||
COPY dist-x86_64-linux/build-git.sh /tmp/
|
||||
RUN ./build-git.sh
|
||||
|
||||
# for sanitizers, we need kernel headers files newer than the ones CentOS ships
|
||||
# with so we install newer ones here
|
||||
COPY dist-x86_64-linux/build-headers.sh /tmp/
|
||||
RUN ./build-headers.sh
|
||||
|
||||
# OpenSSL requires a more recent version of perl
|
||||
# with so we install newer ones here
|
||||
COPY dist-x86_64-linux/build-perl.sh /tmp/
|
||||
RUN ./build-perl.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV HOSTS=i686-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-full-tools \
|
||||
--enable-sanitizers \
|
||||
--enable-profiler \
|
||||
--set target.i686-unknown-linux-gnu.linker=clang \
|
||||
--build=i686-unknown-linux-gnu \
|
||||
--set rust.jemalloc
|
||||
ENV SCRIPT python2.7 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS
|
||||
ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang
|
||||
|
||||
# This was added when we switched from gcc to clang. It's not clear why this is
|
||||
# needed unfortunately, but without this the stage1 bootstrap segfaults
|
||||
# somewhere inside of a build script. The build ends up just hanging instead of
|
||||
# actually killing the process that segfaulted, but if the process is run
|
||||
# manually in a debugger the segfault is immediately seen as well as the
|
||||
# misaligned stack access.
|
||||
#
|
||||
# Added in #50200 there's some more logs there
|
||||
ENV CFLAGS -mstackrealign
|
||||
|
||||
# When we build cargo in this container, we don't want it to use the system
|
||||
# libcurl, instead it should compile its own.
|
||||
ENV LIBCURL_NO_PKG_CONFIG 1
|
||||
|
||||
ENV DIST_REQUIRE_ALL_TOOLS 1
|
||||
@ -1,38 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
# Ubuntu 16.04 (this container) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
COPY scripts/make3.sh /scripts/
|
||||
RUN sh /scripts/make3.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-powerpc-linux/patches/ /tmp/patches/
|
||||
COPY dist-powerpc-linux/powerpc-linux-gnu.config dist-powerpc-linux/build-powerpc-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
CC_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-gcc \
|
||||
AR_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-ar \
|
||||
CXX_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,39 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
|
||||
# Ubuntu 16.04 (this container) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
COPY scripts/make3.sh /scripts/
|
||||
RUN sh /scripts/make3.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-powerpc64-linux/patches/ /tmp/patches/
|
||||
COPY dist-powerpc64-linux/shared.sh dist-powerpc64-linux/powerpc64-linux-gnu.config dist-powerpc64-linux/build-powerpc64-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc64-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
AR_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-ar \
|
||||
CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc \
|
||||
CXX_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,36 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
# Ubuntu 16.04 (this container) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
COPY scripts/make3.sh /scripts/
|
||||
RUN sh /scripts/make3.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get install -y --no-install-recommends rpm2cpio cpio
|
||||
COPY dist-powerpc64le-linux/shared.sh dist-powerpc64le-linux/build-powerpc64le-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc64le-toolchain.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
|
||||
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
|
||||
CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc64le-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,38 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
# Ubuntu 16.04 (this container) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
COPY scripts/make3.sh /scripts/
|
||||
RUN sh /scripts/make3.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-s390x-linux/patches/ /tmp/patches/
|
||||
COPY dist-s390x-linux/s390x-linux-gnu.config dist-s390x-linux/build-s390x-toolchain.sh /tmp/
|
||||
RUN ./build-s390x-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc \
|
||||
AR_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-ar \
|
||||
CXX_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=s390x-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -1,216 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
flex \
|
||||
help2man \
|
||||
libtool-bin \
|
||||
texinfo \
|
||||
unzip \
|
||||
wget \
|
||||
xz-utils \
|
||||
libncurses-dev \
|
||||
gawk \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python3 \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
xz-utils \
|
||||
zlib1g-dev \
|
||||
g++-arm-linux-gnueabi \
|
||||
g++-arm-linux-gnueabihf \
|
||||
g++-aarch64-linux-gnu \
|
||||
g++-mips64-linux-gnuabi64 \
|
||||
g++-mips64el-linux-gnuabi64 \
|
||||
gcc-sparc64-linux-gnu \
|
||||
libc6-dev-sparc64-cross \
|
||||
bzip2 \
|
||||
patch \
|
||||
libssl-dev \
|
||||
pkg-config \
|
||||
libnewlib-arm-none-eabi \
|
||||
qemu-system-arm \
|
||||
# software-properties-common for the add-apt-repository command
|
||||
software-properties-common
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Use the team-gcc-arm-embedded PPA for a newer version of Arm GCC
|
||||
RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends gcc-arm-embedded
|
||||
|
||||
COPY scripts/rustbuild-setup.sh dist-various-1/build-riscv-toolchain.sh dist-various-1/riscv64-unknown-linux-gnu.config dist-various-1/crosstool-ng.sh /build/
|
||||
RUN ./crosstool-ng.sh
|
||||
|
||||
# Crosstool-ng will refuse to build as root
|
||||
RUN sh ./rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
|
||||
RUN ./build-riscv-toolchain.sh
|
||||
|
||||
USER root
|
||||
ENV PATH=/x-tools/riscv64-unknown-linux-gnu/bin:$PATH
|
||||
|
||||
COPY dist-various-1/build-rumprun.sh /build
|
||||
RUN ./build-rumprun.sh
|
||||
|
||||
COPY dist-various-1/install-x86_64-redox.sh /build
|
||||
RUN ./install-x86_64-redox.sh
|
||||
|
||||
COPY dist-various-1/install-mips-musl.sh /build
|
||||
RUN ./install-mips-musl.sh
|
||||
|
||||
COPY dist-various-1/install-mipsel-musl.sh /build
|
||||
RUN ./install-mipsel-musl.sh
|
||||
|
||||
COPY dist-various-1/install-aarch64-none-elf.sh /build
|
||||
RUN ./install-aarch64-none-elf.sh
|
||||
|
||||
# Suppress some warnings in the openwrt toolchains we downloaded
|
||||
ENV STAGING_DIR=/tmp
|
||||
|
||||
COPY scripts/musl.sh /build
|
||||
RUN env \
|
||||
CC=arm-linux-gnueabi-gcc CFLAGS="-march=armv5te -marm -mfloat-abi=soft" \
|
||||
CXX=arm-linux-gnueabi-g++ CXXFLAGS="-march=armv5te -marm -mfloat-abi=soft" \
|
||||
bash musl.sh armv5te && \
|
||||
env \
|
||||
CC=arm-linux-gnueabi-gcc CFLAGS="-march=armv6 -marm" \
|
||||
CXX=arm-linux-gnueabi-g++ CXXFLAGS="-march=armv6 -marm" \
|
||||
bash musl.sh arm && \
|
||||
env \
|
||||
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm -mfpu=vfp" \
|
||||
CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv6 -marm -mfpu=vfp" \
|
||||
bash musl.sh armhf && \
|
||||
env \
|
||||
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv7-a" \
|
||||
CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv7-a" \
|
||||
bash musl.sh armv7hf && \
|
||||
env \
|
||||
CC=aarch64-linux-gnu-gcc \
|
||||
CXX=aarch64-linux-gnu-g++ \
|
||||
bash musl.sh aarch64 && \
|
||||
env \
|
||||
CC=mips-openwrt-linux-gcc \
|
||||
CXX=mips-openwrt-linux-g++ \
|
||||
bash musl.sh mips && \
|
||||
env \
|
||||
CC=mipsel-openwrt-linux-gcc \
|
||||
CXX=mipsel-openwrt-linux-g++ \
|
||||
bash musl.sh mipsel && \
|
||||
env \
|
||||
CC=mips64-linux-gnuabi64-gcc \
|
||||
CXX=mips64-linux-gnuabi64-g++ \
|
||||
bash musl.sh mips64 && \
|
||||
env \
|
||||
CC=mips64el-linux-gnuabi64-gcc \
|
||||
CXX=mips64el-linux-gnuabi64-g++ \
|
||||
bash musl.sh mips64el && \
|
||||
rm -rf /build/*
|
||||
|
||||
# FIXME(mozilla/sccache#235) this shouldn't be necessary but is currently
|
||||
# necessary to disambiguate the mips compiler with the mipsel compiler. We want
|
||||
# to give these two wrapper scripts (currently identical ones) different hashes
|
||||
# to ensure that sccache understands that they're different compilers.
|
||||
RUN \
|
||||
echo "# a" >> /usr/local/mips-linux-musl/bin/mips-openwrt-linux-musl-wrapper.sh && \
|
||||
echo "# b" >> /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-musl-wrapper.sh
|
||||
|
||||
ENV RUN_MAKE_TARGETS=thumbv6m-none-eabi
|
||||
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7m-none-eabi
|
||||
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabi
|
||||
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabihf
|
||||
|
||||
ENV TARGETS=asmjs-unknown-emscripten
|
||||
ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
|
||||
ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
|
||||
ENV TARGETS=$TARGETS,mips-unknown-linux-musl
|
||||
ENV TARGETS=$TARGETS,mipsel-unknown-linux-musl
|
||||
ENV TARGETS=$TARGETS,mips64-unknown-linux-muslabi64
|
||||
ENV TARGETS=$TARGETS,mips64el-unknown-linux-muslabi64
|
||||
ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi
|
||||
ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf
|
||||
ENV TARGETS=$TARGETS,armv5te-unknown-linux-gnueabi
|
||||
ENV TARGETS=$TARGETS,armv5te-unknown-linux-musleabi
|
||||
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-linux-musl
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-none
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-none-softfloat
|
||||
ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu
|
||||
ENV TARGETS=$TARGETS,x86_64-unknown-redox
|
||||
ENV TARGETS=$TARGETS,thumbv6m-none-eabi
|
||||
ENV TARGETS=$TARGETS,thumbv7m-none-eabi
|
||||
ENV TARGETS=$TARGETS,thumbv7em-none-eabi
|
||||
ENV TARGETS=$TARGETS,thumbv7em-none-eabihf
|
||||
ENV TARGETS=$TARGETS,thumbv8m.base-none-eabi
|
||||
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi
|
||||
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabihf
|
||||
ENV TARGETS=$TARGETS,riscv32i-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv64gc-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-gnu
|
||||
ENV TARGETS=$TARGETS,armebv7r-none-eabi
|
||||
ENV TARGETS=$TARGETS,armebv7r-none-eabihf
|
||||
ENV TARGETS=$TARGETS,armv7r-none-eabi
|
||||
ENV TARGETS=$TARGETS,armv7r-none-eabihf
|
||||
ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf
|
||||
ENV TARGETS=$TARGETS,armv7a-none-eabi
|
||||
|
||||
# riscv targets currently do not need a C compiler, as compiler_builtins
|
||||
# doesn't currently have it enabled, and the riscv gcc compiler is not
|
||||
# installed.
|
||||
ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
|
||||
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
|
||||
CC_mips64el_unknown_linux_muslabi64=mips64el-linux-gnuabi64-gcc \
|
||||
CC_mips64_unknown_linux_muslabi64=mips64-linux-gnuabi64-gcc \
|
||||
CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \
|
||||
CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \
|
||||
CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
|
||||
AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \
|
||||
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ \
|
||||
CC_armv7a_none_eabi=arm-none-eabi-gcc \
|
||||
CC_armv7a_none_eabihf=arm-none-eabi-gcc \
|
||||
CFLAGS_armv7a_none_eabi=-march=armv7-a \
|
||||
CFLAGS_armv7a_none_eabihf=-march=armv7-a+vfpv3 \
|
||||
CC_aarch64_unknown_none_softfloat=aarch64-none-elf-gcc \
|
||||
CFLAGS_aarch64_unknown_none_softfloat=-mstrict-align -march=armv8-a+nofp+nosimd \
|
||||
CC_aarch64_unknown_none=aarch64-none-elf-gcc \
|
||||
CFLAGS_aarch64_unknown_none=-mstrict-align -march=armv8-a+fp+simd \
|
||||
CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \
|
||||
AR_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-ar \
|
||||
CXX_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-g++ \
|
||||
CC_riscv32i_unknown_none_elf=false \
|
||||
CC_riscv32imc_unknown_none_elf=false \
|
||||
CC_riscv32imac_unknown_none_elf=false \
|
||||
CC_riscv64imac_unknown_none_elf=false \
|
||||
CC_riscv64gc_unknown_none_elf=false
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--musl-root-armv5te=/musl-armv5te \
|
||||
--musl-root-arm=/musl-arm \
|
||||
--musl-root-armhf=/musl-armhf \
|
||||
--musl-root-armv7hf=/musl-armv7hf \
|
||||
--musl-root-aarch64=/musl-aarch64 \
|
||||
--musl-root-mips=/musl-mips \
|
||||
--musl-root-mipsel=/musl-mipsel \
|
||||
--musl-root-mips64=/musl-mips64 \
|
||||
--musl-root-mips64el=/musl-mips64el \
|
||||
--disable-docs
|
||||
|
||||
ENV SCRIPT \
|
||||
python3 ../x.py test --target $RUN_MAKE_TARGETS src/test/run-make && \
|
||||
python3 ../x.py dist --target $TARGETS
|
||||
|
||||
# sccache
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
@ -1,113 +0,0 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
# Enable source repositories, which are disabled by default on Ubuntu >= 18.04
|
||||
RUN sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
|
||||
|
||||
RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
# gcc-multilib can not be installed together with gcc-arm-linux-gnueabi
|
||||
gcc-7-multilib \
|
||||
libedit-dev \
|
||||
libgmp-dev \
|
||||
libisl-dev \
|
||||
libmpc-dev \
|
||||
libmpfr-dev \
|
||||
ninja-build \
|
||||
nodejs \
|
||||
python3-dev \
|
||||
software-properties-common \
|
||||
unzip \
|
||||
# Needed for apt-key to work:
|
||||
dirmngr \
|
||||
gpg-agent \
|
||||
g++-7-arm-linux-gnueabi
|
||||
|
||||
RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
|
||||
RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main'
|
||||
|
||||
WORKDIR /build
|
||||
COPY scripts/musl.sh /build
|
||||
RUN env \
|
||||
CC=arm-linux-gnueabi-gcc-7 CFLAGS="-march=armv7-a" \
|
||||
CXX=arm-linux-gnueabi-g++-7 CXXFLAGS="-march=armv7-a" \
|
||||
bash musl.sh armv7 && \
|
||||
rm -rf /build/*
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY dist-various-2/shared.sh /tmp/
|
||||
COPY dist-various-2/build-cloudabi-toolchain.sh /tmp/
|
||||
RUN /tmp/build-cloudabi-toolchain.sh x86_64-unknown-cloudabi
|
||||
COPY dist-various-2/build-fuchsia-toolchain.sh /tmp/
|
||||
RUN /tmp/build-fuchsia-toolchain.sh
|
||||
COPY dist-various-2/build-solaris-toolchain.sh /tmp/
|
||||
RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386
|
||||
RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc
|
||||
COPY dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
|
||||
# We pass the commit id of the port of LLVM's libunwind to the build script.
|
||||
# Any update to the commit id here, should cause the container image to be re-built from this point on.
|
||||
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "5125c169b30837208a842f85f7ae44a83533bd0e"
|
||||
|
||||
COPY dist-various-2/build-wasi-toolchain.sh /tmp/
|
||||
RUN /tmp/build-wasi-toolchain.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_fuchsia=x86_64-fuchsia-ar \
|
||||
CC_x86_64_fuchsia=x86_64-fuchsia-clang \
|
||||
CXX_x86_64_fuchsia=x86_64-fuchsia-clang++ \
|
||||
AR_aarch64_fuchsia=aarch64-fuchsia-ar \
|
||||
CC_aarch64_fuchsia=aarch64-fuchsia-clang \
|
||||
CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \
|
||||
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
|
||||
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
|
||||
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
|
||||
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
|
||||
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
|
||||
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \
|
||||
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-7 \
|
||||
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-7 \
|
||||
CC=gcc-7 \
|
||||
CXX=g++-7
|
||||
|
||||
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar
|
||||
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \
|
||||
-C link-arg=--sysroot=/usr/local/x86_64-fuchsia \
|
||||
-C link-arg=-L/usr/local/x86_64-fuchsia/lib \
|
||||
-C link-arg=-L/usr/local/lib/x86_64-fuchsia/lib
|
||||
ENV CARGO_TARGET_AARCH64_FUCHSIA_AR /usr/local/bin/llvm-ar
|
||||
ENV CARGO_TARGET_AARCH64_FUCHSIA_RUSTFLAGS \
|
||||
-C link-arg=--sysroot=/usr/local/aarch64-fuchsia \
|
||||
-C link-arg=-L/usr/local/aarch64-fuchsia/lib \
|
||||
-C link-arg=-L/usr/local/lib/aarch64-fuchsia/lib
|
||||
|
||||
ENV TARGETS=x86_64-fuchsia
|
||||
ENV TARGETS=$TARGETS,aarch64-fuchsia
|
||||
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
|
||||
ENV TARGETS=$TARGETS,wasm32-wasi
|
||||
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
|
||||
ENV TARGETS=$TARGETS,x86_64-sun-solaris
|
||||
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
|
||||
ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi
|
||||
ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
|
||||
ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
|
||||
ENV TARGETS=$TARGETS,armv7-unknown-linux-gnueabi
|
||||
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabi
|
||||
|
||||
ENV X86_FORTANIX_SGX_LIBS="/x86_64-fortanix-unknown-sgx/lib/"
|
||||
|
||||
# As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211
|
||||
# we need asm in the search path for gcc-7 (for gnux32) but not in the search path of the
|
||||
# cross compilers.
|
||||
# Luckily one of the folders is /usr/local/include so symlink /usr/include/asm-generic there
|
||||
RUN ln -s /usr/include/asm-generic /usr/local/include/asm
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \
|
||||
--set target.wasm32-wasi.wasi-root=/wasm32-wasi \
|
||||
--musl-root-armv7=/musl-armv7
|
||||
|
||||
ENV SCRIPT python3 ../x.py dist --target $TARGETS
|
||||
@ -1,52 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
source shared.sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ${0} <commit_id>"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
target="x86_64-fortanix-unknown-sgx"
|
||||
url="https://github.com/fortanix/llvm-project/archive/${1}.tar.gz"
|
||||
repo_name="llvm-project"
|
||||
|
||||
install_prereq() {
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
git
|
||||
}
|
||||
|
||||
build_unwind() {
|
||||
set -x
|
||||
dir_name="${target}_temp"
|
||||
rm -rf ${dir_name}
|
||||
mkdir -p ${dir_name}
|
||||
pushd ${dir_name}
|
||||
|
||||
# Clone Fortanix's fork of llvm-project which has a port of libunwind
|
||||
fetch_github_commit_archive "$repo_name" "$url"
|
||||
cd "${repo_name}/libunwind"
|
||||
|
||||
# Build libunwind
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE="RELEASE" -DRUST_SGX=1 -G "Unix Makefiles" \
|
||||
-DLLVM_ENABLE_WARNINGS=1 -DLIBUNWIND_ENABLE_WERROR=1 -DLIBUNWIND_ENABLE_PEDANTIC=0 \
|
||||
-DLLVM_PATH=../../llvm/ ../
|
||||
make unwind_static
|
||||
install -D "lib/libunwind.a" "/${target}/lib/libunwind.a"
|
||||
|
||||
popd
|
||||
rm -rf ${dir_name}
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
}
|
||||
|
||||
set -x
|
||||
hide_output install_prereq
|
||||
build_unwind
|
||||
@ -1,116 +0,0 @@
|
||||
FROM centos:5
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
|
||||
# to http://vault.centos.org/
|
||||
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
|
||||
RUN sed -i 's|#\(baseurl.*\)mirror.centos.org/centos/$releasever|\1vault.centos.org/5.11|' /etc/yum.repos.d/*.repo
|
||||
|
||||
RUN yum upgrade -y && yum install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
glibc-devel \
|
||||
perl \
|
||||
zlib-devel \
|
||||
file \
|
||||
xz \
|
||||
which \
|
||||
pkgconfig \
|
||||
wget \
|
||||
autoconf \
|
||||
gettext
|
||||
|
||||
ENV PATH=/rustroot/bin:$PATH
|
||||
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
|
||||
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
|
||||
WORKDIR /tmp
|
||||
COPY dist-x86_64-linux/shared.sh /tmp/
|
||||
|
||||
# We need a build of openssl which supports SNI to download artifacts from
|
||||
# static.rust-lang.org. This'll be used to link into libcurl below (and used
|
||||
# later as well), so build a copy of OpenSSL with dynamic libraries into our
|
||||
# generic root.
|
||||
COPY dist-x86_64-linux/build-openssl.sh /tmp/
|
||||
RUN ./build-openssl.sh
|
||||
|
||||
# The `curl` binary on CentOS doesn't support SNI which is needed for fetching
|
||||
# some https urls we have, so install a new version of libcurl + curl which is
|
||||
# using the openssl we just built previously.
|
||||
#
|
||||
# Note that we also disable a bunch of optional features of curl that we don't
|
||||
# really need.
|
||||
COPY dist-x86_64-linux/build-curl.sh /tmp/
|
||||
RUN ./build-curl.sh
|
||||
|
||||
# binutils < 2.22 has a bug where the 32-bit executables it generates
|
||||
# immediately segfault in Rust, so we need to install our own binutils.
|
||||
#
|
||||
# See https://github.com/rust-lang/rust/issues/20440 for more info
|
||||
COPY dist-x86_64-linux/build-binutils.sh /tmp/
|
||||
RUN ./build-binutils.sh
|
||||
|
||||
# libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
|
||||
# only has 2.6.4, so build our own
|
||||
COPY dist-x86_64-linux/build-cmake.sh /tmp/
|
||||
RUN ./build-cmake.sh
|
||||
|
||||
# Build a version of gcc capable of building LLVM 6
|
||||
COPY dist-x86_64-linux/build-gcc.sh /tmp/
|
||||
RUN ./build-gcc.sh
|
||||
|
||||
# CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
|
||||
COPY dist-x86_64-linux/build-python.sh /tmp/
|
||||
RUN ./build-python.sh
|
||||
|
||||
# Now build LLVM+Clang 7, afterwards configuring further compilations to use the
|
||||
# clang/clang++ compilers.
|
||||
COPY dist-x86_64-linux/build-clang.sh dist-x86_64-linux/llvm-project-centos.patch /tmp/
|
||||
RUN ./build-clang.sh
|
||||
ENV CC=clang CXX=clang++
|
||||
|
||||
# Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
|
||||
# cloning, so download and build it here.
|
||||
COPY dist-x86_64-linux/build-git.sh /tmp/
|
||||
RUN ./build-git.sh
|
||||
|
||||
# for sanitizers, we need kernel headers files newer than the ones CentOS ships
|
||||
# with so we install newer ones here
|
||||
COPY dist-x86_64-linux/build-headers.sh /tmp/
|
||||
RUN ./build-headers.sh
|
||||
|
||||
# OpenSSL requires a more recent version of perl
|
||||
# with so we install newer ones here
|
||||
COPY dist-x86_64-linux/build-perl.sh /tmp/
|
||||
RUN ./build-perl.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV HOSTS=x86_64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-full-tools \
|
||||
--enable-sanitizers \
|
||||
--enable-profiler \
|
||||
--enable-compiler-docs \
|
||||
--set target.x86_64-unknown-linux-gnu.linker=clang \
|
||||
--set target.x86_64-unknown-linux-gnu.ar=/rustroot/bin/llvm-ar \
|
||||
--set target.x86_64-unknown-linux-gnu.ranlib=/rustroot/bin/llvm-ranlib \
|
||||
--set llvm.thin-lto=true \
|
||||
--set rust.jemalloc
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang
|
||||
|
||||
# This is the only builder which will create source tarballs
|
||||
ENV DIST_SRC 1
|
||||
|
||||
# When we build cargo in this container, we don't want it to use the system
|
||||
# libcurl, instead it should compile its own.
|
||||
ENV LIBCURL_NO_PKG_CONFIG 1
|
||||
|
||||
ENV DIST_REQUIRE_ALL_TOOLS 1
|
||||
@ -1,22 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY dist-x86_64-netbsd/build-netbsd-toolchain.sh /tmp/
|
||||
RUN /tmp/build-netbsd-toolchain.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/x86_64-unknown-netbsd/bin
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_netbsd=x86_64--netbsd-ar \
|
||||
CC_x86_64_unknown_netbsd=x86_64--netbsd-gcc-sysroot \
|
||||
CXX_x86_64_unknown_netbsd=x86_64--netbsd-g++-sysroot
|
||||
|
||||
ENV HOSTS=x86_64-unknown-netbsd
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
26
src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile
Normal file
26
src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python3 \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
gdb \
|
||||
libssl-dev \
|
||||
pkg-config \
|
||||
xz-utils
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--build=aarch64-unknown-linux-gnu \
|
||||
--enable-sanitizers \
|
||||
--enable-profiler \
|
||||
--enable-compiler-docs
|
||||
ENV SCRIPT python3 ../x.py test
|
||||
40
src/ci/docker/host-x86_64/arm-android/Dockerfile
Normal file
40
src/ci/docker/host-x86_64/arm-android/Dockerfile
Normal file
@ -0,0 +1,40 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/android-base-apt-get.sh /scripts/
|
||||
RUN sh /scripts/android-base-apt-get.sh
|
||||
|
||||
COPY scripts/android-ndk.sh /scripts/
|
||||
RUN . /scripts/android-ndk.sh && \
|
||||
download_and_make_toolchain android-ndk-r15c-linux-x86_64.zip arm 14
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libgl1-mesa-glx \
|
||||
libpulse0 \
|
||||
libstdc++6:i386 \
|
||||
openjdk-9-jre-headless \
|
||||
tzdata \
|
||||
wget \
|
||||
python3
|
||||
|
||||
COPY scripts/android-sdk.sh /scripts/
|
||||
COPY scripts/android-sdk-manager.py /scripts/
|
||||
COPY host-x86_64/arm-android/android-sdk.lock /android/sdk/android-sdk.lock
|
||||
RUN /scripts/android-sdk.sh
|
||||
|
||||
ENV PATH=$PATH:/android/sdk/emulator
|
||||
ENV PATH=$PATH:/android/sdk/tools
|
||||
ENV PATH=$PATH:/android/sdk/platform-tools
|
||||
|
||||
ENV TARGETS=arm-linux-androideabi
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/arm-14
|
||||
|
||||
ENV SCRIPT python3 ../x.py test --target $TARGETS
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
COPY scripts/android-start-emulator.sh /scripts/
|
||||
ENTRYPOINT ["/scripts/android-start-emulator.sh"]
|
||||
83
src/ci/docker/host-x86_64/armhf-gnu/Dockerfile
Normal file
83
src/ci/docker/host-x86_64/armhf-gnu/Dockerfile
Normal file
@ -0,0 +1,83 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update -y && apt-get install -y --no-install-recommends \
|
||||
bc \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
cpio \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
git \
|
||||
libc6-dev \
|
||||
libc6-dev-armhf-cross \
|
||||
make \
|
||||
python3 \
|
||||
qemu-system-arm \
|
||||
xz-utils
|
||||
|
||||
ENV ARCH=arm \
|
||||
CROSS_COMPILE=arm-linux-gnueabihf-
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Compile the kernel that we're going to run and be emulating with. This is
|
||||
# basically just done to be compatible with the QEMU target that we're going
|
||||
# to be using when running tests. If any other kernel works or if any
|
||||
# other QEMU target works with some other stock kernel, we can use that too!
|
||||
#
|
||||
# The `vexpress_config` config file was a previously generated config file for
|
||||
# the kernel. This file was generated by running `make vexpress_defconfig`
|
||||
# followed by `make menuconfig` and then enabling the IPv6 protocol page.
|
||||
COPY host-x86_64/armhf-gnu/vexpress_config /build/.config
|
||||
RUN curl https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.42.tar.xz | \
|
||||
tar xJf - && \
|
||||
cd /build/linux-4.4.42 && \
|
||||
cp /build/.config . && \
|
||||
make -j$(nproc) all && \
|
||||
cp arch/arm/boot/zImage /tmp && \
|
||||
cd /build && \
|
||||
rm -rf linux-4.4.42
|
||||
|
||||
# Compile an instance of busybox as this provides a lightweight system and init
|
||||
# binary which we will boot into. Only trick here is configuring busybox to
|
||||
# build static binaries.
|
||||
RUN curl https://www.busybox.net/downloads/busybox-1.21.1.tar.bz2 | tar xjf - && \
|
||||
cd busybox-1.21.1 && \
|
||||
make defconfig && \
|
||||
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
mv _install /tmp/rootfs && \
|
||||
cd /build && \
|
||||
rm -rf busybox-1.12.1
|
||||
|
||||
# Download the ubuntu rootfs, which we'll use as a chroot for all our tests.
|
||||
WORKDIR /tmp
|
||||
RUN mkdir rootfs/ubuntu
|
||||
RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-armhf.tar.gz | \
|
||||
tar xzf - -C rootfs/ubuntu && \
|
||||
cd rootfs && mkdir proc sys dev etc etc/init.d
|
||||
|
||||
# Copy over our init script, which starts up our test server and also a few
|
||||
# other misc tasks.
|
||||
COPY scripts/qemu-bare-bones-rcS rootfs/etc/init.d/rcS
|
||||
RUN chmod +x rootfs/etc/init.d/rcS
|
||||
|
||||
# Helper to quickly fill the entropy pool in the kernel.
|
||||
COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c
|
||||
RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
|
||||
|
||||
# TODO: What is this?!
|
||||
# Source of the file: https://github.com/vfdev-5/qemu-rpi2-vexpress/raw/master/vexpress-v2p-ca15-tc1.dtb
|
||||
RUN curl -O https://ci-mirrors.rust-lang.org/rustc/vexpress-v2p-ca15-tc1.dtb
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --qemu-armhf-rootfs=/tmp/rootfs
|
||||
ENV SCRIPT python3 ../x.py test --target arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV NO_CHANGE_USER=1
|
||||
@ -0,0 +1,36 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python3 \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
bzip2 \
|
||||
xz-utils \
|
||||
wget \
|
||||
libssl-dev \
|
||||
bsdtar \
|
||||
pkg-config
|
||||
|
||||
|
||||
COPY host-x86_64/dist-x86_64-dragonfly/build-toolchain.sh /tmp/
|
||||
COPY host-x86_64/dist-x86_64-dragonfly/patch-toolchain /tmp/
|
||||
RUN /tmp/build-toolchain.sh /tmp/patch-toolchain
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-ar \
|
||||
CC_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-gcc \
|
||||
CXX_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-dragonfly
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
@ -0,0 +1,49 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
autoconf \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
git \
|
||||
libcurl4-openssl-dev \
|
||||
libssl-dev \
|
||||
make \
|
||||
nasm \
|
||||
pkg-config \
|
||||
python3 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
zlib1g-dev
|
||||
|
||||
COPY host-x86_64/dist-x86_64-haiku/llvm-config.sh /bin/llvm-config-haiku
|
||||
|
||||
ENV ARCH=x86_64
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY host-x86_64/dist-x86_64-haiku/build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh $ARCH
|
||||
|
||||
COPY host-x86_64/dist-x86_64-haiku/fetch-packages.sh /tmp/
|
||||
RUN /tmp/fetch-packages.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV HOST=x86_64-unknown-haiku
|
||||
ENV TARGET=target.$HOST
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --disable-jemalloc \
|
||||
--set=$TARGET.cc=x86_64-unknown-haiku-gcc \
|
||||
--set=$TARGET.cxx=x86_64-unknown-haiku-g++ \
|
||||
--set=$TARGET.llvm-config=/bin/llvm-config-haiku
|
||||
ENV SCRIPT python3 ../x.py dist --host=$HOST --target=$HOST
|
||||
@ -0,0 +1,22 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY host-x86_64/dist-various-1/install-x86_64-redox.sh /scripts/
|
||||
RUN sh /scripts/install-x86_64-redox.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_redox=x86_64-unknown-redox-ar \
|
||||
CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \
|
||||
CXX_x86_64_unknown_redox=x86_64-unknown-redox-g++
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended
|
||||
ENV SCRIPT python3 ../x.py dist --target x86_64-unknown-redox
|
||||
@ -0,0 +1,96 @@
|
||||
From c820da85c65c7f3aa9e9cb3ed71ada69bf9b783e Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Francis <alistair.francis@wdc.com>
|
||||
Date: Tue, 19 Nov 2019 13:06:40 +0100
|
||||
Subject: [PATCH] Remove stime() function calls
|
||||
|
||||
stime() has been deprecated in glibc 2.31 and replaced with
|
||||
clock_settime(). Let's replace the stime() function calls with
|
||||
clock_settime() in preperation.
|
||||
|
||||
function old new delta
|
||||
rdate_main 197 224 +27
|
||||
clock_settime - 27 +27
|
||||
date_main 926 941 +15
|
||||
stime 37 - -37
|
||||
------------------------------------------------------------------------------
|
||||
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37) Total: 32 bytes
|
||||
|
||||
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
|
||||
[Tom Eccles: adjust patch context to apply on top of 1.31.1-stable]
|
||||
Signed-off-by: Tom Eccles <tom.eccles@codethink.co.uk>
|
||||
---
|
||||
coreutils/date.c | 6 +++++-
|
||||
libbb/missing_syscalls.c | 8 --------
|
||||
util-linux/rdate.c | 8 ++++++--
|
||||
3 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/coreutils/date.c b/coreutils/date.c
|
||||
index 3414d38ae..4ade6abb4 100644
|
||||
--- a/coreutils/date.c
|
||||
+++ b/coreutils/date.c
|
||||
@@ -279,6 +279,9 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
time(&ts.tv_sec);
|
||||
#endif
|
||||
}
|
||||
+#if !ENABLE_FEATURE_DATE_NANO
|
||||
+ ts.tv_nsec = 0;
|
||||
+#endif
|
||||
localtime_r(&ts.tv_sec, &tm_time);
|
||||
|
||||
/* If date string is given, update tm_time, and maybe set date */
|
||||
@@ -301,9 +304,10 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (date_str[0] != '@')
|
||||
tm_time.tm_isdst = -1;
|
||||
ts.tv_sec = validate_tm_time(date_str, &tm_time);
|
||||
+ ts.tv_nsec = 0;
|
||||
|
||||
/* if setting time, set it */
|
||||
- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
|
||||
+ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
|
||||
bb_perror_msg("can't set date");
|
||||
}
|
||||
}
|
||||
diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
|
||||
index 87cf59b3d..dc40d9155 100644
|
||||
--- a/libbb/missing_syscalls.c
|
||||
+++ b/libbb/missing_syscalls.c
|
||||
@@ -15,14 +15,6 @@ pid_t getsid(pid_t pid)
|
||||
return syscall(__NR_getsid, pid);
|
||||
}
|
||||
|
||||
-int stime(const time_t *t)
|
||||
-{
|
||||
- struct timeval tv;
|
||||
- tv.tv_sec = *t;
|
||||
- tv.tv_usec = 0;
|
||||
- return settimeofday(&tv, NULL);
|
||||
-}
|
||||
-
|
||||
int sethostname(const char *name, size_t len)
|
||||
{
|
||||
return syscall(__NR_sethostname, name, len);
|
||||
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
|
||||
index 70f829e7f..878375d78 100644
|
||||
--- a/util-linux/rdate.c
|
||||
+++ b/util-linux/rdate.c
|
||||
@@ -95,9 +95,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (!(flags & 2)) { /* no -p (-s may be present) */
|
||||
if (time(NULL) == remote_time)
|
||||
bb_error_msg("current time matches remote time");
|
||||
- else
|
||||
- if (stime(&remote_time) < 0)
|
||||
+ else {
|
||||
+ struct timespec ts;
|
||||
+ ts.tv_sec = remote_time;
|
||||
+ ts.tv_nsec = 0;
|
||||
+ if (clock_settime(CLOCK_REALTIME, &ts) < 0)
|
||||
bb_perror_msg_and_die("can't set time of day");
|
||||
+ }
|
||||
}
|
||||
|
||||
if (flags != 1) /* not lone -s */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
102
src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile
Normal file
102
src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile
Normal file
@ -0,0 +1,102 @@
|
||||
# based on armhf-gnu/Dockerfile
|
||||
FROM ubuntu:20.04
|
||||
|
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
RUN apt-get update -y && apt-get install -y --no-install-recommends \
|
||||
bc \
|
||||
bison \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
cpio \
|
||||
curl \
|
||||
debian-ports-archive-keyring \
|
||||
debootstrap \
|
||||
flex \
|
||||
gcc \
|
||||
gcc-riscv64-linux-gnu \
|
||||
git \
|
||||
g++-riscv64-linux-gnu \
|
||||
g++ \
|
||||
libc6-dev \
|
||||
libc6-dev-riscv64-cross \
|
||||
make \
|
||||
patch \
|
||||
python3 \
|
||||
qemu-system-misc \
|
||||
xz-utils
|
||||
|
||||
ENV ARCH=riscv
|
||||
ENV CROSS_COMPILE=riscv64-linux-gnu-
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# From https://github.com/michaeljclark/busybear-linux/blob/master/conf/linux.config
|
||||
COPY host-x86_64/riscv64gc-linux/linux.config /build
|
||||
|
||||
# Compile the kernel that we're going to be emulating with. This is
|
||||
# basically just done to be compatible with the QEMU target that we're going
|
||||
# to be using when running tests.
|
||||
RUN curl https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.xz | tar xJf - && \
|
||||
cp linux.config linux-5.6.16/.config && \
|
||||
cd /build/linux-5.6.16 && \
|
||||
make olddefconfig && \
|
||||
make -j$(nproc) vmlinux && \
|
||||
cp vmlinux /tmp && \
|
||||
rm -rf linux-5.6.16
|
||||
|
||||
# Compile an instance of busybox as this provides a lightweight system and init
|
||||
# binary which we will boot into. Only trick here is configuring busybox to
|
||||
# build static binaries.
|
||||
RUN curl https://busybox.net/downloads/busybox-1.31.1.tar.bz2 | tar xjf -
|
||||
COPY host-x86_64/riscv64gc-linux/0001-Remove-stime-function-calls.patch /build/busybox-1.31.1/
|
||||
RUN cd /build/busybox-1.31.1 && \
|
||||
patch -p1 -i 0001-Remove-stime-function-calls.patch && \
|
||||
make defconfig && \
|
||||
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
mv _install /tmp/rootfs && \
|
||||
cd /build && \
|
||||
rm -rf busybox-1.31.1
|
||||
|
||||
# Download the ubuntu rootfs, which we'll use as a chroot for all our tests
|
||||
# This is only needed to provide /lib/* and /usr/lib/*
|
||||
WORKDIR /tmp
|
||||
RUN debootstrap --variant=minbase --arch=riscv64 --foreign focal /tmp/rootfs/ubuntu
|
||||
RUN cd rootfs && mkdir proc sys dev etc etc/init.d
|
||||
# rootfs/ubuntu/proc is in a weird state (access fails with ELOOP) until
|
||||
# rootfs/ubuntu/debootstrap/debootstrap --second-stage is run (under emulation),
|
||||
# but this takes ages. Instead hack it into a good enough state.
|
||||
# /proc is used by std::env::current_exe() (which is roughly
|
||||
# `readlink /proc/self/exe`)
|
||||
RUN cd rootfs/ubuntu && rm -rf proc && mkdir proc
|
||||
|
||||
# Copy over our init script, which starts up our test server and also a few other
|
||||
# misc tasks
|
||||
COPY scripts/qemu-bare-bones-rcS rootfs/etc/init.d/rcS
|
||||
RUN chmod +x rootfs/etc/init.d/rcS
|
||||
|
||||
# Helper to quickly fill the entropy pool in the kernel
|
||||
COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c
|
||||
RUN riscv64-linux-gnu-gcc addentropy.c -o rootfs/addentropy -static
|
||||
|
||||
# download and build the riscv bootloader
|
||||
RUN git clone https://github.com/riscv/riscv-pk
|
||||
WORKDIR /tmp/riscv-pk
|
||||
# nothing special about this revision: it is just master at the time of writing
|
||||
# v1.0.0 doesn't build
|
||||
RUN git checkout 5d9ed238e1cabfbca3c47f50d32894ce94bfc304
|
||||
RUN mkdir build && cd build && \
|
||||
../configure --with-payload=/tmp/vmlinux --host=riscv64-linux-gnu && \
|
||||
make -j$(nproc) && \
|
||||
cp bbl /tmp
|
||||
WORKDIR /tmp
|
||||
RUN rm -rf /tmp/riscv-pk
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --qemu-riscv64-rootfs=/tmp/rootfs
|
||||
ENV SCRIPT python3 ../x.py test --target riscv64gc-unknown-linux-gnu
|
||||
|
||||
ENV NO_CHANGE_USER=1
|
||||
@ -0,0 +1,51 @@
|
||||
CONFIG_DEFAULT_HOSTNAME="busybear"
|
||||
CONFIG_SYSVIPC=y
|
||||
CONFIG_POSIX_MQUEUE=y
|
||||
CONFIG_IKCONFIG=y
|
||||
CONFIG_IKCONFIG_PROC=y
|
||||
CONFIG_CGROUPS=y
|
||||
CONFIG_CGROUP_SCHED=y
|
||||
CONFIG_CFS_BANDWIDTH=y
|
||||
CONFIG_CGROUP_BPF=y
|
||||
CONFIG_NAMESPACES=y
|
||||
CONFIG_USER_NS=y
|
||||
CONFIG_CHECKPOINT_RESTORE=y
|
||||
CONFIG_BLK_DEV_INITRD=y
|
||||
CONFIG_EXPERT=y
|
||||
CONFIG_BPF_SYSCALL=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
CONFIG_PACKET_DIAG=y
|
||||
CONFIG_UNIX=y
|
||||
CONFIG_INET=y
|
||||
CONFIG_NETLINK_DIAG=y
|
||||
# CONFIG_WIRELESS is not set
|
||||
CONFIG_PCI=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
CONFIG_NETDEVICES=y
|
||||
CONFIG_VIRTIO_NET=y
|
||||
# CONFIG_ETHERNET is not set
|
||||
# CONFIG_WLAN is not set
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
CONFIG_HVC_RISCV_SBI=y
|
||||
# CONFIG_HW_RANDOM is not set
|
||||
# CONFIG_USB_SUPPORT is not set
|
||||
CONFIG_VIRTIO_MMIO=y
|
||||
CONFIG_SIFIVE_PLIC=y
|
||||
CONFIG_RAS=y
|
||||
CONFIG_EXT2_FS=y
|
||||
CONFIG_EXT3_FS=y
|
||||
CONFIG_EXT4_FS_POSIX_ACL=y
|
||||
CONFIG_AUTOFS4_FS=y
|
||||
CONFIG_MSDOS_FS=y
|
||||
CONFIG_VFAT_FS=y
|
||||
CONFIG_TMPFS=y
|
||||
# CONFIG_CRYPTO_ECHAINIV is not set
|
||||
# CONFIG_CRYPTO_HW is not set
|
||||
CONFIG_PRINTK_TIME=y
|
||||
40
src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile
Normal file
40
src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile
Normal file
@ -0,0 +1,40 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
# Ubuntu 16.04 (this container) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
COPY scripts/make3.sh /scripts/
|
||||
RUN sh /scripts/make3.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.config host-x86_64/dist-aarch64-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/aarch64-unknown-linux-gnueabi/bin
|
||||
|
||||
ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \
|
||||
AR_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-ar \
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=aarch64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-full-tools \
|
||||
--enable-profiler \
|
||||
--enable-sanitizers \
|
||||
--disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
31
src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile
Normal file
31
src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng-1.24.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng-1.24.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY host-x86_64/dist-arm-linux/arm-linux-gnueabi.config host-x86_64/dist-arm-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabi/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \
|
||||
AR_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-ar \
|
||||
CXX_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabi
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-full-tools --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
31
src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile
Normal file
31
src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng-1.24.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng-1.24.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.config host-x86_64/dist-armhf-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
|
||||
AR_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-ar \
|
||||
CXX_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-full-tools --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
31
src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile
Normal file
31
src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
COPY scripts/crosstool-ng-1.24.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng-1.24.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY host-x86_64/dist-armv7-linux/build-toolchains.sh host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.config /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
|
||||
AR_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-ar \
|
||||
CXX_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=armv7-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-full-tools --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
120
src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile
Normal file
120
src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile
Normal file
@ -0,0 +1,120 @@
|
||||
FROM centos:5
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
|
||||
# to http://vault.centos.org/
|
||||
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
|
||||
RUN sed -i 's|#\(baseurl.*\)mirror.centos.org/centos/$releasever|\1vault.centos.org/5.11|' /etc/yum.repos.d/*.repo
|
||||
|
||||
RUN yum upgrade -y && yum install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
glibc-devel \
|
||||
perl \
|
||||
zlib-devel \
|
||||
file \
|
||||
xz \
|
||||
which \
|
||||
pkgconfig \
|
||||
wget \
|
||||
autoconf \
|
||||
gettext
|
||||
|
||||
ENV PATH=/rustroot/bin:$PATH
|
||||
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
|
||||
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
|
||||
WORKDIR /tmp
|
||||
COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
|
||||
|
||||
# We need a build of openssl which supports SNI to download artifacts from
|
||||
# static.rust-lang.org. This'll be used to link into libcurl below (and used
|
||||
# later as well), so build a copy of OpenSSL with dynamic libraries into our
|
||||
# generic root.
|
||||
COPY host-x86_64/dist-x86_64-linux/build-openssl.sh /tmp/
|
||||
RUN ./build-openssl.sh
|
||||
|
||||
# The `curl` binary on CentOS doesn't support SNI which is needed for fetching
|
||||
# some https urls we have, so install a new version of libcurl + curl which is
|
||||
# using the openssl we just built previously.
|
||||
#
|
||||
# Note that we also disable a bunch of optional features of curl that we don't
|
||||
# really need.
|
||||
COPY host-x86_64/dist-x86_64-linux/build-curl.sh /tmp/
|
||||
RUN ./build-curl.sh
|
||||
|
||||
# binutils < 2.22 has a bug where the 32-bit executables it generates
|
||||
# immediately segfault in Rust, so we need to install our own binutils.
|
||||
#
|
||||
# See https://github.com/rust-lang/rust/issues/20440 for more info
|
||||
COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/
|
||||
RUN ./build-binutils.sh
|
||||
|
||||
# libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
|
||||
# only has 2.6.4, so build our own
|
||||
COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/
|
||||
RUN ./build-cmake.sh
|
||||
|
||||
# Need a newer version of gcc than centos has to compile LLVM nowadays
|
||||
COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/
|
||||
RUN ./build-gcc.sh
|
||||
|
||||
# CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
|
||||
COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/
|
||||
RUN ./build-python.sh
|
||||
|
||||
# Now build LLVM+Clang 7, afterwards configuring further compilations to use the
|
||||
# clang/clang++ compilers.
|
||||
COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/
|
||||
RUN ./build-clang.sh
|
||||
ENV CC=clang CXX=clang++
|
||||
|
||||
# Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
|
||||
# cloning, so download and build it here.
|
||||
COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/
|
||||
RUN ./build-git.sh
|
||||
|
||||
# for sanitizers, we need kernel headers files newer than the ones CentOS ships
|
||||
# with so we install newer ones here
|
||||
COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/
|
||||
RUN ./build-headers.sh
|
||||
|
||||
# OpenSSL requires a more recent version of perl
|
||||
# with so we install newer ones here
|
||||
COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/
|
||||
RUN ./build-perl.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV HOSTS=i686-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-full-tools \
|
||||
--enable-sanitizers \
|
||||
--enable-profiler \
|
||||
--set target.i686-unknown-linux-gnu.linker=clang \
|
||||
--build=i686-unknown-linux-gnu \
|
||||
--set rust.jemalloc
|
||||
ENV SCRIPT python2.7 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS
|
||||
ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang
|
||||
|
||||
# This was added when we switched from gcc to clang. It's not clear why this is
|
||||
# needed unfortunately, but without this the stage1 bootstrap segfaults
|
||||
# somewhere inside of a build script. The build ends up just hanging instead of
|
||||
# actually killing the process that segfaulted, but if the process is run
|
||||
# manually in a debugger the segfault is immediately seen as well as the
|
||||
# misaligned stack access.
|
||||
#
|
||||
# Added in #50200 there's some more logs there
|
||||
ENV CFLAGS -mstackrealign
|
||||
|
||||
# When we build cargo in this container, we don't want it to use the system
|
||||
# libcurl, instead it should compile its own.
|
||||
ENV LIBCURL_NO_PKG_CONFIG 1
|
||||
|
||||
ENV DIST_REQUIRE_ALL_TOOLS 1
|
||||
38
src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile
Normal file
38
src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile
Normal file
@ -0,0 +1,38 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
# Ubuntu 16.04 (this container) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
COPY scripts/make3.sh /scripts/
|
||||
RUN sh /scripts/make3.sh
|
||||
|
||||
COPY scripts/crosstool-ng.sh /scripts/
|
||||
RUN sh /scripts/crosstool-ng.sh
|
||||
|
||||
COPY scripts/rustbuild-setup.sh /scripts/
|
||||
RUN sh /scripts/rustbuild-setup.sh
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY host-x86_64/dist-powerpc-linux/patches/ /tmp/patches/
|
||||
COPY host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.config host-x86_64/dist-powerpc-linux/build-powerpc-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
CC_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-gcc \
|
||||
AR_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-ar \
|
||||
CXX_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user