mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 04:14:28 +00:00
Update miri to rustc changes
This commit is contained in:
parent
d4c442d65c
commit
acdf83f228
@ -1,25 +0,0 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.rs]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.toml]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -95,7 +95,6 @@ config.stamp
|
||||
keywords.md
|
||||
lexer.ml
|
||||
src/etc/dl
|
||||
src/librustc_llvm/llvmdeps.rs
|
||||
tmp.*.rs
|
||||
version.md
|
||||
version.ml
|
||||
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -42,3 +42,9 @@
|
||||
[submodule "src/tools/miri"]
|
||||
path = src/tools/miri
|
||||
url = https://github.com/solson/miri.git
|
||||
[submodule "src/dlmalloc"]
|
||||
path = src/dlmalloc
|
||||
url = https://github.com/alexcrichton/dlmalloc-rs.git
|
||||
[submodule "src/binaryen"]
|
||||
path = src/binaryen
|
||||
url = https://github.com/alexcrichton/binaryen.git
|
||||
|
88
.travis.yml
88
.travis.yml
@ -12,18 +12,17 @@ matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
# Images used in testing PR and try-build should be run first.
|
||||
- env: IMAGE=x86_64-gnu-llvm-3.7 RUST_BACKTRACE=1
|
||||
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1
|
||||
if: type = pull_request OR branch = auto
|
||||
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY=1
|
||||
if: branch = try OR branch = auto
|
||||
|
||||
# "alternate" deployments, these are "nightlies" but don't have assertions
|
||||
# turned on, they're deployed to a different location primarily for projects
|
||||
# which are stuck on nightly and don't want llvm assertions in the artifacts
|
||||
# that they use.
|
||||
# "alternate" deployments, these are "nightlies" but have LLVM assertions
|
||||
# turned on, they're deployed to a different location primarily for
|
||||
# additional testing.
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
|
||||
if: branch = auto
|
||||
if: branch = try OR branch = auto
|
||||
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
@ -36,7 +35,7 @@ matrix:
|
||||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
osx_image: xcode7.3
|
||||
if: branch = auto
|
||||
|
||||
# macOS builders. These are placed near the beginning because they are very
|
||||
@ -57,7 +56,7 @@ matrix:
|
||||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
osx_image: xcode8.3
|
||||
if: branch = auto
|
||||
|
||||
- env: >
|
||||
@ -71,7 +70,7 @@ matrix:
|
||||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
osx_image: xcode8.3
|
||||
if: branch = auto
|
||||
|
||||
# OSX builders producing releases. These do not run the full test suite and
|
||||
@ -91,7 +90,7 @@ matrix:
|
||||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
osx_image: xcode7.3
|
||||
if: branch = auto
|
||||
|
||||
- env: >
|
||||
@ -105,7 +104,7 @@ matrix:
|
||||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
osx_image: xcode7.3
|
||||
if: branch = auto
|
||||
|
||||
# Linux builders, remaining docker images
|
||||
@ -113,7 +112,9 @@ matrix:
|
||||
if: branch = auto
|
||||
- env: IMAGE=armhf-gnu
|
||||
if: branch = auto
|
||||
- env: IMAGE=cross DEPLOY=1
|
||||
- env: IMAGE=dist-various-1 DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-various-2 DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-aarch64-linux DEPLOY=1
|
||||
if: branch = auto
|
||||
@ -125,8 +126,6 @@ matrix:
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-armv7-linux DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-fuchsia DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-i686-freebsd DEPLOY=1
|
||||
@ -161,14 +160,16 @@ matrix:
|
||||
if: branch = auto
|
||||
- env: IMAGE=i686-gnu-nopt
|
||||
if: branch = auto
|
||||
# - env: IMAGE=wasm32 issue 42646
|
||||
# if: branch = auto
|
||||
- env: IMAGE=wasm32-unknown
|
||||
if: branch = auto
|
||||
- env: IMAGE=x86_64-gnu
|
||||
if: branch = auto
|
||||
- env: IMAGE=x86_64-gnu-full-bootstrap
|
||||
if: branch = auto
|
||||
- env: IMAGE=x86_64-gnu-aux
|
||||
if: branch = auto
|
||||
- env: IMAGE=x86_64-gnu-tools
|
||||
if: branch = auto
|
||||
- env: IMAGE=x86_64-gnu-debug
|
||||
if: branch = auto
|
||||
- env: IMAGE=x86_64-gnu-nopt
|
||||
@ -251,7 +252,14 @@ after_failure:
|
||||
|
||||
# Random attempt at debugging currently. Just poking around in here to see if
|
||||
# anything shows up.
|
||||
- ls $HOME/Library/Logs/DiagnosticReports/
|
||||
- ls -lat $HOME/Library/Logs/DiagnosticReports/
|
||||
- find $HOME/Library/Logs/DiagnosticReports
|
||||
-type f
|
||||
-not -name '*.stage2-*.crash'
|
||||
-not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash'
|
||||
-exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \;
|
||||
-exec head -750 {} \;
|
||||
-exec echo travis_fold":"end:crashlog \;
|
||||
|
||||
# attempt to debug anything killed by the oom killer on linux, just to see if
|
||||
# it happened
|
||||
@ -284,6 +292,7 @@ before_deploy:
|
||||
rm -rf obj/build/dist/doc &&
|
||||
cp -r obj/build/dist/* deploy/$TRAVIS_COMMIT;
|
||||
fi
|
||||
- travis_retry gem update --system
|
||||
|
||||
deploy:
|
||||
- provider: s3
|
||||
@ -300,20 +309,6 @@ deploy:
|
||||
branch: auto
|
||||
condition: $DEPLOY = 1
|
||||
|
||||
- provider: s3
|
||||
bucket: rust-lang-ci2
|
||||
skip_cleanup: true
|
||||
local_dir: deploy
|
||||
upload_dir: rustc-builds-try
|
||||
acl: public_read
|
||||
region: us-west-1
|
||||
access_key_id: AKIAJVBODR3IA4O72THQ
|
||||
secret_access_key:
|
||||
secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
|
||||
on:
|
||||
branch: try
|
||||
condition: $DEPLOY = 1
|
||||
|
||||
# this is the same as the above deployment provider except that it uploads to
|
||||
# a slightly different directory and has a different trigger
|
||||
- provider: s3
|
||||
@ -329,3 +324,34 @@ deploy:
|
||||
on:
|
||||
branch: auto
|
||||
condition: $DEPLOY_ALT = 1
|
||||
|
||||
# These two providers are the same as the two above, except deploy on the
|
||||
# try branch. Travis does not appear to provide a way to use "or" in these
|
||||
# conditions.
|
||||
- provider: s3
|
||||
bucket: rust-lang-ci2
|
||||
skip_cleanup: true
|
||||
local_dir: deploy
|
||||
upload_dir: rustc-builds
|
||||
acl: public_read
|
||||
region: us-west-1
|
||||
access_key_id: AKIAJVBODR3IA4O72THQ
|
||||
secret_access_key:
|
||||
secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
|
||||
on:
|
||||
branch: try
|
||||
condition: $DEPLOY = 1
|
||||
|
||||
- provider: s3
|
||||
bucket: rust-lang-ci2
|
||||
skip_cleanup: true
|
||||
local_dir: deploy
|
||||
upload_dir: rustc-builds-alt
|
||||
acl: public_read
|
||||
region: us-west-1
|
||||
access_key_id: AKIAJVBODR3IA4O72THQ
|
||||
secret_access_key:
|
||||
secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
|
||||
on:
|
||||
branch: try
|
||||
condition: $DEPLOY_ALT = 1
|
||||
|
@ -6,7 +6,7 @@ A version of this document [can be found online](https://www.rust-lang.org/condu
|
||||
|
||||
**Contact**: [rust-mods@rust-lang.org](mailto:rust-mods@rust-lang.org)
|
||||
|
||||
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
|
||||
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
|
||||
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
|
||||
* Please be kind and courteous. There's no need to be mean or rude.
|
||||
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
|
||||
|
150
CONTRIBUTING.md
150
CONTRIBUTING.md
@ -1,4 +1,5 @@
|
||||
# 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
|
||||
@ -18,11 +19,12 @@ hop on [#rust-internals][pound-rust-internals].
|
||||
|
||||
As a reminder, all contributors are expected to follow our [Code of Conduct][coc].
|
||||
|
||||
[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
|
||||
[pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
|
||||
[internals]: https://internals.rust-lang.org
|
||||
[coc]: https://www.rust-lang.org/conduct.html
|
||||
|
||||
## Feature Requests
|
||||
[feature-requests]: #feature-requests
|
||||
|
||||
To request a change to the way that the Rust language works, please open an
|
||||
issue in the [RFCs repository](https://github.com/rust-lang/rfcs/issues/new)
|
||||
@ -30,6 +32,7 @@ rather than this one. New features and other significant language changes
|
||||
must go through the RFC process.
|
||||
|
||||
## 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
|
||||
@ -80,6 +83,7 @@ $ RUST_BACKTRACE=1 rustc ...
|
||||
```
|
||||
|
||||
## The Build System
|
||||
[the-build-system]: #the-build-system
|
||||
|
||||
Rust's build system allows you to bootstrap the compiler, run tests &
|
||||
benchmarks, generate documentation, install a fresh build of Rust, and more.
|
||||
@ -94,6 +98,7 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals].
|
||||
[bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/
|
||||
|
||||
### Configuration
|
||||
[configuration]: #configuration
|
||||
|
||||
Before you can start building the compiler you need to configure the build for
|
||||
your system. In most cases, that will just mean using the defaults provided
|
||||
@ -125,6 +130,11 @@ file. If you still have a `config.mk` file in your directory - from
|
||||
`./configure` - you may need to delete it for `config.toml` to work.
|
||||
|
||||
### Building
|
||||
[building]: #building
|
||||
|
||||
Dependencies
|
||||
- [build dependencies](README.md#building-from-source)
|
||||
- `gdb` 6.2.0 minimum, 7.1 or later recommended for test builds
|
||||
|
||||
The build system uses the `x.py` script to control the build process. This script
|
||||
is used to build, test, and document various parts of the compiler. You can
|
||||
@ -194,6 +204,7 @@ Note: Previously `./configure` and `make` were used to build this project.
|
||||
They are still available, but `x.py` is the recommended build system.
|
||||
|
||||
### Useful commands
|
||||
[useful-commands]: #useful-commands
|
||||
|
||||
Some common invocations of `x.py` are:
|
||||
|
||||
@ -234,6 +245,7 @@ Some common invocations of `x.py` are:
|
||||
code.
|
||||
|
||||
### Using your local build
|
||||
[using-local-build]: #using-local-build
|
||||
|
||||
If you use Rustup to manage your rust install, it has a feature called ["custom
|
||||
toolchains"][toolchain-link] that you can use to access your newly-built compiler
|
||||
@ -262,6 +274,7 @@ stage 1. `python x.py build --stage 1 src/libstd src/tools/rustdoc` will build
|
||||
rustdoc and libstd, which will allow rustdoc to be run with that toolchain.)
|
||||
|
||||
## Pull Requests
|
||||
[pull-requests]: #pull-requests
|
||||
|
||||
Pull requests are the primary mechanism we use to change Rust. GitHub itself
|
||||
has some [great documentation][pull-requests] on using the Pull Request feature.
|
||||
@ -326,6 +339,7 @@ it can be found
|
||||
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).
|
||||
|
||||
### External Dependencies
|
||||
[external-dependencies]: #external-dependencies
|
||||
|
||||
Currently building Rust will also build the following external projects:
|
||||
|
||||
@ -333,13 +347,136 @@ Currently building Rust will also build the following external projects:
|
||||
* [miri](https://github.com/solson/miri)
|
||||
|
||||
If your changes break one of these projects, you need to fix them by opening
|
||||
a pull request against the broken project. When you have opened a pull request,
|
||||
you can disable the tool via `src/tools/toolstate.toml`.
|
||||
a pull request against the broken project asking to put the fix on a branch.
|
||||
Then you can disable the tool building via `src/tools/toolstate.toml`.
|
||||
Once the branch containing your fix is likely to be merged, you can point
|
||||
the affected submodule at this branch.
|
||||
|
||||
It can also be more convenient during development to set `submodules = false`
|
||||
in the `config.toml` to prevent `x.py` from resetting to the original branch.
|
||||
Don't forget to also add your changes with
|
||||
|
||||
```
|
||||
git add path/to/submodule
|
||||
```
|
||||
|
||||
outside the submodule.
|
||||
|
||||
In order to prepare your 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.
|
||||
|
||||
#### Breaking Tools Built With The Compiler
|
||||
[breaking-tools-built-with-the-compiler]: #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 clippy,
|
||||
[RLS](https://github.com/rust-lang-nursery/rls) and
|
||||
[rustfmt](https://github.com/rust-lang-nursery/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/pull/45243)
|
||||
to make all of this easy to handle. The idea is that you mark the tools as "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 change the tools back
|
||||
from "broken".
|
||||
|
||||
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. Update `src/tools/toolstate.toml` to indicate that the tool in question is "broken",
|
||||
that will disable building it on CI. See the documentation in that file for the exact
|
||||
configuration values you can use.
|
||||
6. Commit the changes to `src/tools/toolstate.toml`, **do not update submodules in your commit**,
|
||||
and then update the PR you have for rust-lang/rust.
|
||||
7. Wait for your PR to merge.
|
||||
8. Wait for a nightly
|
||||
9. (optional) Help land your PR on the upstream repository now that your changes are in nightly.
|
||||
10. (optional) Send a PR to rust-lang/rust updating the submodule, reverting `src/tools/toolstate.toml` back to a "building" or "testing" state.
|
||||
|
||||
#### Updating submodules
|
||||
[updating-submodules]: #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-nursery/rustfmt`
|
||||
|
||||
Caused by:
|
||||
patch for `rustfmt-nightly` in `https://github.com/rust-lang-nursery/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.
|
||||
|
||||
First, go into the `src/` directory since that is where `Cargo.toml` is in
|
||||
the rust repository. Then run, `cargo update -p rustfmt-nightly` to solve
|
||||
the problem.
|
||||
|
||||
```
|
||||
$ cd src
|
||||
$ cargo update -p rustfmt-nightly
|
||||
```
|
||||
|
||||
This should change the version listed in `src/Cargo.lock` to the new version you updated
|
||||
the submodule to. Running `./x.py build` should work now.
|
||||
|
||||
## Writing Documentation
|
||||
[writing-documentation]: #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
|
||||
@ -370,6 +507,7 @@ reference to `doc/reference.html`. The CSS might be messed up, but you can
|
||||
verify that the HTML is right.
|
||||
|
||||
## Issue Triage
|
||||
[issue-triage]: #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
|
||||
@ -437,6 +575,7 @@ If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
|
||||
[rfcbot]: https://github.com/dikaiosune/rust-dashboard/blob/master/RFCBOT.md
|
||||
|
||||
## Out-of-tree Contributions
|
||||
[out-of-tree-contributions]: #out-of-tree-contributions
|
||||
|
||||
There are a number of other ways to contribute to Rust that don't deal with
|
||||
this repository.
|
||||
@ -456,6 +595,7 @@ valuable!
|
||||
[community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library
|
||||
|
||||
## Helpful Links and Information
|
||||
[helpful-info]: #helpful-info
|
||||
|
||||
For people new to Rust, and just starting to contribute, or even for
|
||||
more seasoned developers, some useful places to look for information
|
||||
|
18
README.md
18
README.md
@ -6,6 +6,7 @@ standard library, and documentation.
|
||||
[Rust]: https://www.rust-lang.org
|
||||
|
||||
## Quick Start
|
||||
[quick-start]: #quick-start
|
||||
|
||||
Read ["Installation"] from [The Book].
|
||||
|
||||
@ -13,7 +14,9 @@ Read ["Installation"] from [The Book].
|
||||
[The Book]: https://doc.rust-lang.org/book/index.html
|
||||
|
||||
## Building from Source
|
||||
[building-from-source]: #building-from-source
|
||||
|
||||
### Building on *nix
|
||||
1. Make sure you have installed the dependencies:
|
||||
|
||||
* `g++` 4.7 or later or `clang++` 3.x or later
|
||||
@ -52,6 +55,7 @@ Read ["Installation"] from [The Book].
|
||||
[Cargo]: https://github.com/rust-lang/cargo
|
||||
|
||||
### Building on Windows
|
||||
[building-on-windows]: #building-on-windows
|
||||
|
||||
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
|
||||
Visual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust
|
||||
@ -61,6 +65,7 @@ for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU
|
||||
build.
|
||||
|
||||
#### MinGW
|
||||
[windows-mingw]: #windows-mingw
|
||||
|
||||
[MSYS2][msys2] can be used to easily build Rust on Windows:
|
||||
|
||||
@ -101,6 +106,7 @@ build.
|
||||
```
|
||||
|
||||
#### MSVC
|
||||
[windows-msvc]: #windows-msvc
|
||||
|
||||
MSVC builds of Rust additionally require an installation of Visual Studio 2013
|
||||
(or later) so `rustc` can use its linker. Make sure to check the “C++ tools”
|
||||
@ -123,7 +129,11 @@ CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.
|
||||
python x.py build
|
||||
```
|
||||
|
||||
If you are seeing build failure when compiling `rustc_binaryen`, make sure the path
|
||||
length of the rust folder is not longer than 22 characters.
|
||||
|
||||
#### Specifying an ABI
|
||||
[specifying-an-abi]: #specifying-an-abi
|
||||
|
||||
Each specific ABI can also be used from either environment (for example, using
|
||||
the GNU ABI in powershell) by using an explicit build triple. The available
|
||||
@ -141,6 +151,7 @@ in Building From Source), and modifying the `build` option under the `[build]`
|
||||
section.
|
||||
|
||||
### Configure and Make
|
||||
[configure-and-make]: #configure-and-make
|
||||
|
||||
While it's not the recommended build system, this project also provides a
|
||||
configure script and makefile (the latter of which just invokes `x.py`).
|
||||
@ -155,6 +166,7 @@ When using the configure script, the generated `config.mk` file may override the
|
||||
`config.mk` file.
|
||||
|
||||
## Building Documentation
|
||||
[building-documentation]: #building-documentation
|
||||
|
||||
If you’d like to build the documentation, it’s almost the same:
|
||||
|
||||
@ -167,6 +179,7 @@ the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will
|
||||
`build\x86_64-pc-windows-msvc\doc`.
|
||||
|
||||
## Notes
|
||||
[notes]: #notes
|
||||
|
||||
Since the Rust compiler is written in Rust, it must be built by a
|
||||
precompiled "snapshot" version of itself (made in an earlier state of
|
||||
@ -184,7 +197,7 @@ 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.
|
||||
|
||||
Rust currently needs between 600MiB and 1.5GiB to build, depending on platform.
|
||||
Rust currently needs between 600MiB and 1.5GiB of RAM to build, depending on platform.
|
||||
If it hits swap, it will take a very long time to build.
|
||||
|
||||
There is more advice about hacking on Rust in [CONTRIBUTING.md].
|
||||
@ -192,6 +205,7 @@ 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
|
||||
[getting-help]: #getting-help
|
||||
|
||||
The Rust community congregates in a few places:
|
||||
|
||||
@ -204,6 +218,7 @@ The Rust community congregates in a few places:
|
||||
[users.rust-lang.org]: https://users.rust-lang.org/
|
||||
|
||||
## Contributing
|
||||
[contributing]: #contributing
|
||||
|
||||
To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
|
||||
|
||||
@ -217,6 +232,7 @@ Rust. And a good place to ask for help would be [#rust-beginners].
|
||||
[#rust-beginners]: irc://irc.mozilla.org/rust-beginners
|
||||
|
||||
## License
|
||||
[license]: #license
|
||||
|
||||
Rust is primarily distributed under the terms of both the MIT license
|
||||
and the Apache License (Version 2.0), with portions covered by various
|
||||
|
212
RELEASES.md
212
RELEASES.md
@ -1,3 +1,193 @@
|
||||
Version 1.22.1 (2017-11-22)
|
||||
==========================
|
||||
|
||||
- [Update Cargo to fix an issue with macOS 10.13 "High Sierra"][46183]
|
||||
|
||||
[46183]: https://github.com/rust-lang/rust/pull/46183
|
||||
|
||||
Version 1.22.0 (2017-11-22)
|
||||
==========================
|
||||
|
||||
Language
|
||||
--------
|
||||
- [`non_snake_case` lint now allows extern no-mangle functions][44966]
|
||||
- [Now accepts underscores in unicode escapes][43716]
|
||||
- [`T op= &T` now works for numeric types.][44287] eg. `let mut x = 2; x += &8;`
|
||||
- [types that impl `Drop` are now allowed in `const` and `static` types][44456]
|
||||
|
||||
Compiler
|
||||
--------
|
||||
- [rustc now defaults to having 16 codegen units at debug on supported platforms.][45064]
|
||||
- [rustc will no longer inline in codegen units when compiling for debug][45075]
|
||||
This should decrease compile times for debug builds.
|
||||
- [strict memory alignment now enabled on ARMv6][45094]
|
||||
- [Remove support for the PNaCl target `le32-unknown-nacl`][45041]
|
||||
|
||||
Libraries
|
||||
---------
|
||||
- [Allow atomic operations up to 32 bits
|
||||
on `armv5te_unknown_linux_gnueabi`][44978]
|
||||
- [`Box<Error>` now impls `From<Cow<str>>`][44466]
|
||||
- [`std::mem::Discriminant` is now guaranteed to be `Send + Sync`][45095]
|
||||
- [`fs::copy` now returns the length of the main stream on NTFS.][44895]
|
||||
- [Properly detect overflow in `Instant += Duration`.][44220]
|
||||
- [impl `Hasher` for `{&mut Hasher, Box<Hasher>}`][44015]
|
||||
- [impl `fmt::Debug` for `SplitWhitespace`.][44303]
|
||||
- [`Option<T>` now impls `Try`][42526] This allows for using `?` with `Option` types.
|
||||
|
||||
Stabilized APIs
|
||||
---------------
|
||||
|
||||
Cargo
|
||||
-----
|
||||
- [Cargo will now build multi file examples in subdirectories of the `examples`
|
||||
folder that have a `main.rs` file.][cargo/4496]
|
||||
- [Changed `[root]` to `[package]` in `Cargo.lock`][cargo/4571] Packages with
|
||||
the old format will continue to work and can be updated with `cargo update`.
|
||||
- [Now supports vendoring git repositories][cargo/3992]
|
||||
|
||||
Misc
|
||||
----
|
||||
- [`libbacktrace` is now available on Apple platforms.][44251]
|
||||
- [Stabilised the `compile_fail` attribute for code fences in doc-comments.][43949]
|
||||
This now lets you specify that a given code example will fail to compile.
|
||||
|
||||
Compatibility Notes
|
||||
-------------------
|
||||
- [The minimum Android version that rustc can build for has been bumped
|
||||
to `4.0` from `2.3`][45656]
|
||||
- [Allowing `T op= &T` for numeric types has broken some type
|
||||
inference cases][45480]
|
||||
|
||||
|
||||
[42526]: https://github.com/rust-lang/rust/pull/42526
|
||||
[43017]: https://github.com/rust-lang/rust/pull/43017
|
||||
[43716]: https://github.com/rust-lang/rust/pull/43716
|
||||
[43949]: https://github.com/rust-lang/rust/pull/43949
|
||||
[44015]: https://github.com/rust-lang/rust/pull/44015
|
||||
[44220]: https://github.com/rust-lang/rust/pull/44220
|
||||
[44251]: https://github.com/rust-lang/rust/pull/44251
|
||||
[44287]: https://github.com/rust-lang/rust/pull/44287
|
||||
[44303]: https://github.com/rust-lang/rust/pull/44303
|
||||
[44456]: https://github.com/rust-lang/rust/pull/44456
|
||||
[44466]: https://github.com/rust-lang/rust/pull/44466
|
||||
[44895]: https://github.com/rust-lang/rust/pull/44895
|
||||
[44966]: https://github.com/rust-lang/rust/pull/44966
|
||||
[44978]: https://github.com/rust-lang/rust/pull/44978
|
||||
[45041]: https://github.com/rust-lang/rust/pull/45041
|
||||
[45064]: https://github.com/rust-lang/rust/pull/45064
|
||||
[45075]: https://github.com/rust-lang/rust/pull/45075
|
||||
[45094]: https://github.com/rust-lang/rust/pull/45094
|
||||
[45095]: https://github.com/rust-lang/rust/pull/45095
|
||||
[45480]: https://github.com/rust-lang/rust/issues/45480
|
||||
[45656]: https://github.com/rust-lang/rust/pull/45656
|
||||
[cargo/3992]: https://github.com/rust-lang/cargo/pull/3992
|
||||
[cargo/4496]: https://github.com/rust-lang/cargo/pull/4496
|
||||
[cargo/4571]: https://github.com/rust-lang/cargo/pull/4571
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Version 1.21.0 (2017-10-12)
|
||||
==========================
|
||||
|
||||
Language
|
||||
--------
|
||||
- [You can now use static references for literals.][43838]
|
||||
Example:
|
||||
```rust
|
||||
fn main() {
|
||||
let x: &'static u32 = &0;
|
||||
}
|
||||
```
|
||||
- [Relaxed path syntax. Optional `::` before `<` is now allowed in all contexts.][43540]
|
||||
Example:
|
||||
```rust
|
||||
my_macro!(Vec<i32>::new); // Always worked
|
||||
my_macro!(Vec::<i32>::new); // Now works
|
||||
```
|
||||
|
||||
Compiler
|
||||
--------
|
||||
- [Upgraded jemalloc to 4.5.0][43911]
|
||||
- [Enabled unwinding panics on Redox][43917]
|
||||
- [Now runs LLVM in parallel during translation phase.][43506]
|
||||
This should reduce peak memory usage.
|
||||
|
||||
Libraries
|
||||
---------
|
||||
- [Generate builtin impls for `Clone` for all arrays and tuples that
|
||||
are `T: Clone`][43690]
|
||||
- [`Stdin`, `Stdout`, and `Stderr` now implement `AsRawFd`.][43459]
|
||||
- [`Rc` and `Arc` now implement `From<&[T]> where T: Clone`, `From<str>`,
|
||||
`From<String>`, `From<Box<T>> where T: ?Sized`, and `From<Vec<T>>`.][42565]
|
||||
|
||||
Stabilized APIs
|
||||
---------------
|
||||
|
||||
[`std::mem::discriminant`]
|
||||
|
||||
Cargo
|
||||
-----
|
||||
- [You can now call `cargo install` with multiple package names][cargo/4216]
|
||||
- [Cargo commands inside a virtual workspace will now implicitly
|
||||
pass `--all`][cargo/4335]
|
||||
- [Added a `[patch]` section to `Cargo.toml` to handle
|
||||
prepublication dependencies][cargo/4123] [RFC 1969]
|
||||
- [`include` & `exclude` fields in `Cargo.toml` now accept gitignore
|
||||
like patterns][cargo/4270]
|
||||
- [Added the `--all-targets` option][cargo/4400]
|
||||
- [Using required dependencies as a feature is now deprecated and emits
|
||||
a warning][cargo/4364]
|
||||
|
||||
|
||||
Misc
|
||||
----
|
||||
- [Cargo docs are moving][43916]
|
||||
to [doc.rust-lang.org/cargo](https://doc.rust-lang.org/cargo)
|
||||
- [The rustdoc book is now available][43863]
|
||||
at [doc.rust-lang.org/rustdoc](https://doc.rust-lang.org/rustdoc)
|
||||
- [Added a preview of RLS has been made available through rustup][44204]
|
||||
Install with `rustup component add rls-preview`
|
||||
- [`std::os` documentation for Unix, Linux, and Windows now appears on doc.rust-lang.org][43348]
|
||||
Previously only showed `std::os::unix`.
|
||||
|
||||
Compatibility Notes
|
||||
-------------------
|
||||
- [Changes in method matching against higher-ranked types][43880] This may cause
|
||||
breakage in subtyping corner cases. [A more in-depth explanation is available.][info/43880]
|
||||
- [rustc's JSON error output's byte position start at top of file.][42973]
|
||||
Was previously relative to the rustc's internal `CodeMap` struct which
|
||||
required the unstable library `libsyntax` to correctly use.
|
||||
- [`unused_results` lint no longer ignores booleans][43728]
|
||||
|
||||
[42565]: https://github.com/rust-lang/rust/pull/42565
|
||||
[42973]: https://github.com/rust-lang/rust/pull/42973
|
||||
[43348]: https://github.com/rust-lang/rust/pull/43348
|
||||
[43459]: https://github.com/rust-lang/rust/pull/43459
|
||||
[43506]: https://github.com/rust-lang/rust/pull/43506
|
||||
[43540]: https://github.com/rust-lang/rust/pull/43540
|
||||
[43690]: https://github.com/rust-lang/rust/pull/43690
|
||||
[43728]: https://github.com/rust-lang/rust/pull/43728
|
||||
[43838]: https://github.com/rust-lang/rust/pull/43838
|
||||
[43863]: https://github.com/rust-lang/rust/pull/43863
|
||||
[43880]: https://github.com/rust-lang/rust/pull/43880
|
||||
[43911]: https://github.com/rust-lang/rust/pull/43911
|
||||
[43916]: https://github.com/rust-lang/rust/pull/43916
|
||||
[43917]: https://github.com/rust-lang/rust/pull/43917
|
||||
[44204]: https://github.com/rust-lang/rust/pull/44204
|
||||
[cargo/4123]: https://github.com/rust-lang/cargo/pull/4123
|
||||
[cargo/4216]: https://github.com/rust-lang/cargo/pull/4216
|
||||
[cargo/4270]: https://github.com/rust-lang/cargo/pull/4270
|
||||
[cargo/4335]: https://github.com/rust-lang/cargo/pull/4335
|
||||
[cargo/4364]: https://github.com/rust-lang/cargo/pull/4364
|
||||
[cargo/4400]: https://github.com/rust-lang/cargo/pull/4400
|
||||
[RFC 1969]: https://github.com/rust-lang/rfcs/pull/1969
|
||||
[info/43880]: https://github.com/rust-lang/rust/issues/44224#issuecomment-330058902
|
||||
[`std::mem::discriminant`]: https://doc.rust-lang.org/std/mem/fn.discriminant.html
|
||||
|
||||
Version 1.20.0 (2017-08-31)
|
||||
===========================
|
||||
|
||||
@ -110,7 +300,7 @@ Compatibility Notes
|
||||
- [Functions with `'static` in their return types will now not be as usable as
|
||||
if they were using lifetime parameters instead.][42417]
|
||||
- [The reimplementation of `{f32, f64}::is_sign_{negative, positive}` now
|
||||
takes the sign of NaN into account where previously didn't.][42430]
|
||||
takes the sign of NaN into account where previously didn't.][42430]
|
||||
|
||||
[42033]: https://github.com/rust-lang/rust/pull/42033
|
||||
[42155]: https://github.com/rust-lang/rust/pull/42155
|
||||
@ -438,7 +628,7 @@ Misc
|
||||
----
|
||||
|
||||
- [rustdoc can now use pulldown-cmark with the `--enable-commonmark` flag][40338]
|
||||
- [Added rust-winbg script for better debugging on Windows][39983]
|
||||
- [Added rust-windbg script for better debugging on Windows][39983]
|
||||
- [Rust now uses the official cross compiler for NetBSD][40612]
|
||||
- [rustdoc now accepts `#` at the start of files][40828]
|
||||
- [Fixed jemalloc support for musl][41168]
|
||||
@ -1472,7 +1662,7 @@ Diagnostics
|
||||
-----------
|
||||
|
||||
* [Replace macro backtraces with labeled local uses][35702]
|
||||
* [Improve error message for missplaced doc comments][33922]
|
||||
* [Improve error message for misplaced doc comments][33922]
|
||||
* [Buffer unix and lock windows to prevent message interleaving][35975]
|
||||
* [Update lifetime errors to specifically note temporaries][36171]
|
||||
* [Special case a few colors for Windows][36178]
|
||||
@ -1780,7 +1970,7 @@ Language
|
||||
useful](https://github.com/rust-lang/rust/pull/34908)
|
||||
* [`macro_rules!` `stmt` matchers correctly consume the entire contents when
|
||||
inside non-braces invocations](https://github.com/rust-lang/rust/pull/34886)
|
||||
* [Semicolons are properly required as statement delimeters inside
|
||||
* [Semicolons are properly required as statement delimiters inside
|
||||
`macro_rules!` invocations](https://github.com/rust-lang/rust/pull/34660)
|
||||
* [`cfg_attr` works on `path` attributes](https://github.com/rust-lang/rust/pull/34546)
|
||||
|
||||
@ -2005,7 +2195,7 @@ Compatibility Notes
|
||||
* [`const`s and `static`s may not have unsized types](https://github.com/rust-lang/rust/pull/34443)
|
||||
* [The new follow-set rules that place restrictions on `macro_rules!`
|
||||
in order to ensure syntax forward-compatibility have been enabled](https://github.com/rust-lang/rust/pull/33982)
|
||||
This was an [ammendment to RFC 550](https://github.com/rust-lang/rfcs/pull/1384),
|
||||
This was an [amendment to RFC 550](https://github.com/rust-lang/rfcs/pull/1384),
|
||||
and has been a warning since 1.10.
|
||||
* [`cfg` attribute process has been refactored to fix various bugs](https://github.com/rust-lang/rust/pull/33706).
|
||||
This causes breakage in some corner cases.
|
||||
@ -3162,7 +3352,7 @@ Libraries
|
||||
* `FromStr` is [implemented for `SockAddrV4` and `SockAddrV6`][1.5s].
|
||||
* There are now `From` conversions [between floating point
|
||||
types][1.5f] where the conversions are lossless.
|
||||
* Thera are now `From` conversions [between integer types][1.5i] where
|
||||
* There are now `From` conversions [between integer types][1.5i] where
|
||||
the conversions are lossless.
|
||||
* [`fs::Metadata` implements `Clone`][1.5fs].
|
||||
* The `parse` method [accepts a leading "+" when parsing
|
||||
@ -3362,7 +3552,7 @@ Libraries
|
||||
* [`IntoIterator` is implemented for references to `Option` and
|
||||
`Result`][into2].
|
||||
* [`HashMap` and `HashSet` implement `Extend<&T>` where `T:
|
||||
Copy`][ext] as part of [RFC 839]. This will cause type inferance
|
||||
Copy`][ext] as part of [RFC 839]. This will cause type inference
|
||||
breakage in rare situations.
|
||||
* [`BinaryHeap` implements `Debug`][bh2].
|
||||
* [`Borrow` and `BorrowMut` are implemented for fixed-size
|
||||
@ -3373,7 +3563,7 @@ Libraries
|
||||
* `&mut T` where `T: std::fmt::Write` [also implements
|
||||
`std::fmt::Write`][mutw].
|
||||
* [A stable regression in `VecDeque::push_back` and other
|
||||
capicity-altering methods that caused panics for zero-sized types
|
||||
capacity-altering methods that caused panics for zero-sized types
|
||||
was fixed][vd].
|
||||
* [Function pointers implement traits for up to 12 parameters][fp2].
|
||||
|
||||
@ -3560,7 +3750,7 @@ Libraries
|
||||
[better for long data][sh].
|
||||
* [`AtomicPtr`] implements [`Send`].
|
||||
* The [`read_to_end`] implementations for [`Stdin`] and [`File`]
|
||||
are now [specialized to use uninitalized buffers for increased
|
||||
are now [specialized to use uninitialized buffers for increased
|
||||
performance][rte].
|
||||
* Lifetime parameters of foreign functions [are now resolved
|
||||
properly][f].
|
||||
@ -3689,7 +3879,7 @@ Highlights
|
||||
* This is the first release with [experimental support for linking
|
||||
with the MSVC linker and lib C on Windows (instead of using the GNU
|
||||
variants via MinGW)][win]. It is yet recommended only for the most
|
||||
intrepid Rusticians.
|
||||
intrepid Rustaceans.
|
||||
* Benchmark compilations are showing a 30% improvement in
|
||||
bootstrapping over 1.1.
|
||||
|
||||
@ -4555,7 +4745,7 @@ Version 0.11.0 (2014-07-02)
|
||||
* Libraries
|
||||
* The standard library is now a "facade" over a number of underlying
|
||||
libraries. This means that development on the standard library should
|
||||
be speeder due to smaller crates, as well as a clearer line between
|
||||
be speedier due to smaller crates, as well as a clearer line between
|
||||
all dependencies.
|
||||
* A new library, libcore, lives under the standard library's facade
|
||||
which is Rust's "0-assumption" library, suitable for embedded and
|
||||
|
@ -25,6 +25,11 @@ environment:
|
||||
RUST_CHECK_TARGET: check-aux
|
||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
|
||||
|
||||
# MSVC tools tests
|
||||
- MSYS_BITS: 64
|
||||
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py toolstates.json
|
||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=toolstates.json
|
||||
|
||||
# 32/64-bit MinGW builds.
|
||||
#
|
||||
# We are using MinGW with posix threads since LLVM does not compile with
|
||||
|
@ -35,7 +35,7 @@
|
||||
# If an external LLVM root is specified, we automatically check the version by
|
||||
# default to make sure it's within the range that we're expecting, but setting
|
||||
# this flag will indicate that this version check should not be done.
|
||||
#version-check = false
|
||||
#version-check = true
|
||||
|
||||
# Link libstdc++ statically into the librustc_llvm instead of relying on a
|
||||
# dynamic version to be available.
|
||||
@ -60,10 +60,9 @@
|
||||
# LLVM experimental targets to build support for. These targets are specified in
|
||||
# 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. Possible
|
||||
# experimental LLVM targets include WebAssembly for the
|
||||
# wasm32-experimental-emscripten Rust target.
|
||||
#experimental-targets = ""
|
||||
# on them will not work unless the user opts in to building them. By default the
|
||||
# `WebAssembly` target is enabled when compiling LLVM from scratch.
|
||||
#experimental-targets = "WebAssembly"
|
||||
|
||||
# Cap the number of parallel linker invocations when compiling LLVM.
|
||||
# This can be useful when building LLVM with debug info, which significantly
|
||||
@ -203,6 +202,16 @@
|
||||
# Where to install man pages in `prefix` above
|
||||
#mandir = "share/man"
|
||||
|
||||
# Where to install data in `prefix` above (currently unused)
|
||||
#datadir = "share"
|
||||
|
||||
# Where to install additional info in `prefix` above (currently unused)
|
||||
#infodir = "share/info"
|
||||
|
||||
# Where to install local state (currently unused)
|
||||
# If this is a relative path, it will get installed in `prefix` above
|
||||
#localstatedir = "/var/lib"
|
||||
|
||||
# =============================================================================
|
||||
# Options for compiling Rust code itself
|
||||
# =============================================================================
|
||||
@ -250,14 +259,11 @@
|
||||
# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
|
||||
#backtrace = true
|
||||
|
||||
# The default linker that will be used by the generated compiler. Note that this
|
||||
# is not the linker used to link said compiler.
|
||||
# The default linker that will be hard-coded into the generated compiler for
|
||||
# targets that don't specify linker explicitly in their target specifications.
|
||||
# Note that this is not the linker used to link said compiler.
|
||||
#default-linker = "cc"
|
||||
|
||||
# The default ar utility that will be used by the generated compiler if LLVM
|
||||
# cannot be used. Note that this is not used to assemble said compiler.
|
||||
#default-ar = "ar"
|
||||
|
||||
# The "channel" for the Rust build to produce. The stable/beta channels only
|
||||
# allow using stable features, whereas the nightly and dev channels allow using
|
||||
# nightly features
|
||||
@ -295,6 +301,10 @@
|
||||
# As a side-effect also generates MIR for all libraries.
|
||||
#test-miri = false
|
||||
|
||||
# After building or testing extended tools (e.g. clippy and rustfmt), append the
|
||||
# result (broken, compiling, testing) into this JSON file.
|
||||
#save-toolstates = "/path/to/toolstates.json"
|
||||
|
||||
# =============================================================================
|
||||
# Options for specific targets
|
||||
#
|
||||
@ -303,7 +313,7 @@
|
||||
# =============================================================================
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
|
||||
# C compiler to be used to compiler C code and link Rust code. Note that the
|
||||
# C compiler to be used to compiler C code. Note that the
|
||||
# default value is platform specific, and if not specified it may also depend on
|
||||
# what platform is crossing to what platform.
|
||||
#cc = "cc"
|
||||
@ -312,6 +322,15 @@
|
||||
# This is only used for host targets.
|
||||
#cxx = "c++"
|
||||
|
||||
# Archiver to be used to assemble static libraries compiled from C/C++ code.
|
||||
# Note: an absolute path should be used, otherwise LLVM build will break.
|
||||
#ar = "ar"
|
||||
|
||||
# Linker to be used to link Rust code. Note that the
|
||||
# default value is platform specific, and if not specified it may also depend on
|
||||
# what platform is crossing to what platform.
|
||||
#linker = "cc"
|
||||
|
||||
# Path to the `llvm-config` binary of the installation of a custom LLVM to link
|
||||
# against. Note that if this is specifed we don't compile LLVM at all for this
|
||||
# target.
|
||||
|
1162
src/Cargo.lock
generated
1162
src/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@ members = [
|
||||
"libstd",
|
||||
"libtest",
|
||||
"tools/cargotest",
|
||||
"tools/clippy",
|
||||
"tools/compiletest",
|
||||
"tools/error_index_generator",
|
||||
"tools/linkchecker",
|
||||
@ -20,25 +21,19 @@ members = [
|
||||
"tools/rls",
|
||||
"tools/rustfmt",
|
||||
# FIXME(https://github.com/rust-lang/cargo/issues/4089): move these to exclude
|
||||
"tools/rls/test_data/borrow_error",
|
||||
"tools/rls/test_data/completion",
|
||||
"tools/rls/test_data/find_all_refs",
|
||||
"tools/rls/test_data/find_all_refs_no_cfg_test",
|
||||
"tools/rls/test_data/goto_def",
|
||||
"tools/rls/test_data/highlight",
|
||||
"tools/rls/test_data/hover",
|
||||
"tools/rls/test_data/rename",
|
||||
"tools/rls/test_data/reformat",
|
||||
"tools/rls/test_data/bin_lib_no_cfg_test",
|
||||
"tools/rls/test_data/multiple_bins",
|
||||
"tools/rls/test_data/bin_lib",
|
||||
"tools/rls/test_data/reformat_with_range",
|
||||
"tools/rls/test_data/borrow_error",
|
||||
"tools/rls/test_data/common",
|
||||
"tools/rls/test_data/deglob",
|
||||
"tools/rls/test_data/features",
|
||||
"tools/rls/test_data/find_all_refs_no_cfg_test",
|
||||
"tools/rls/test_data/find_impls",
|
||||
"tools/rls/test_data/infer_bin",
|
||||
"tools/rls/test_data/infer_custom_bin",
|
||||
"tools/rls/test_data/infer_lib",
|
||||
"tools/rls/test_data/omit_init_build",
|
||||
"tools/rls/test_data/unicødë",
|
||||
"tools/rls/test_data/multiple_bins",
|
||||
"tools/rls/test_data/reformat",
|
||||
"tools/rls/test_data/reformat_with_range",
|
||||
"tools/rls/test_data/workspace_symbol",
|
||||
]
|
||||
|
||||
|
1
src/binaryen
Submodule
1
src/binaryen
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 1c9bf65aa0e371b84755a8ddd6e79497fac57171
|
@ -34,7 +34,7 @@ cmake = "0.1.23"
|
||||
filetime = "0.1"
|
||||
num_cpus = "1.0"
|
||||
getopts = "0.2"
|
||||
cc = "1.0"
|
||||
cc = "1.0.1"
|
||||
libc = "0.2"
|
||||
serde = "1.0.8"
|
||||
serde_derive = "1.0.8"
|
||||
|
@ -39,7 +39,7 @@ The script accepts commands, flags, and arguments to determine what to do:
|
||||
```
|
||||
|
||||
If files are dirty that would normally be rebuilt from stage 0, that can be
|
||||
overidden using `--keep-stage 0`. Using `--keep-stage n` will skip all steps
|
||||
overridden using `--keep-stage 0`. Using `--keep-stage n` will skip all steps
|
||||
that belong to stage n or earlier:
|
||||
|
||||
```
|
||||
@ -126,17 +126,17 @@ install a nightly, presumably using `rustup`. You will then want to
|
||||
configure your directory to use this build, like so:
|
||||
|
||||
```
|
||||
# configure to use local rust instead of downloding a beta.
|
||||
# configure to use local rust instead of downloading a beta.
|
||||
# `--local-rust-root` is optional here. If elided, we will
|
||||
# use whatever rustc we find on your PATH.
|
||||
> configure --enable-rustbuild --local-rust-root=~/.cargo/ --enable-local-rebuild
|
||||
> ./configure --local-rust-root=~/.cargo/ --enable-local-rebuild
|
||||
```
|
||||
|
||||
After that, you can use the `--incremental` flag to actually do
|
||||
incremental builds:
|
||||
|
||||
```
|
||||
> ../x.py build --incremental
|
||||
> ./x.py build --incremental
|
||||
```
|
||||
|
||||
The `--incremental` flag will store incremental compilation artifacts
|
||||
|
@ -31,8 +31,6 @@ extern crate bootstrap;
|
||||
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::io;
|
||||
use std::io::prelude::*;
|
||||
use std::str::FromStr;
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Command, ExitStatus};
|
||||
@ -122,19 +120,14 @@ fn main() {
|
||||
cmd.arg("-L").arg(&root);
|
||||
}
|
||||
|
||||
// Pass down extra flags, commonly used to configure `-Clinker` when
|
||||
// cross compiling.
|
||||
if let Ok(s) = env::var("RUSTC_FLAGS") {
|
||||
cmd.args(&s.split(" ").filter(|s| !s.is_empty()).collect::<Vec<_>>());
|
||||
// Override linker if necessary.
|
||||
if let Ok(target_linker) = env::var("RUSTC_TARGET_LINKER") {
|
||||
cmd.arg(format!("-Clinker={}", target_linker));
|
||||
}
|
||||
|
||||
// Pass down incremental directory, if any.
|
||||
if let Ok(dir) = env::var("RUSTC_INCREMENTAL") {
|
||||
cmd.arg(format!("-Zincremental={}", dir));
|
||||
|
||||
if verbose > 0 {
|
||||
cmd.arg("-Zincremental-info");
|
||||
}
|
||||
}
|
||||
|
||||
let crate_name = args.windows(2)
|
||||
@ -182,12 +175,16 @@ fn main() {
|
||||
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
|
||||
cmd.arg("-C").arg(format!("codegen-units={}", s));
|
||||
}
|
||||
if env::var("RUSTC_THINLTO").is_ok() {
|
||||
cmd.arg("-Ccodegen-units=16").arg("-Zthinlto");
|
||||
}
|
||||
|
||||
// Emit save-analysis info.
|
||||
if env::var("RUSTC_SAVE_ANALYSIS") == Ok("api".to_string()) {
|
||||
cmd.arg("-Zsave-analysis");
|
||||
cmd.env("RUST_SAVE_ANALYSIS_CONFIG",
|
||||
"{\"output_file\": null,\"full_docs\": false,\"pub_only\": true,\
|
||||
"{\"output_file\": null,\"full_docs\": false,\
|
||||
\"pub_only\": true,\"reachable_only\": false,\
|
||||
\"distro_crate\": true,\"signatures\": false,\"borrow_data\": false}");
|
||||
}
|
||||
|
||||
@ -258,6 +255,11 @@ fn main() {
|
||||
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
|
||||
cmd.arg("-Z").arg("force-unstable-if-unmarked");
|
||||
}
|
||||
} else {
|
||||
// Override linker if necessary.
|
||||
if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") {
|
||||
cmd.arg(format!("-Clinker={}", host_linker));
|
||||
}
|
||||
}
|
||||
|
||||
let color = match env::var("RUSTC_COLOR") {
|
||||
@ -270,7 +272,7 @@ fn main() {
|
||||
}
|
||||
|
||||
if verbose > 1 {
|
||||
writeln!(&mut io::stderr(), "rustc command: {:?}", cmd).unwrap();
|
||||
eprintln!("rustc command: {:?}", cmd);
|
||||
}
|
||||
|
||||
// Actually run the compiler!
|
||||
|
@ -47,6 +47,17 @@ fn main() {
|
||||
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
|
||||
cmd.arg("-Z").arg("force-unstable-if-unmarked");
|
||||
}
|
||||
if let Some(linker) = env::var_os("RUSTC_TARGET_LINKER") {
|
||||
cmd.arg("--linker").arg(linker).arg("-Z").arg("unstable-options");
|
||||
}
|
||||
|
||||
// Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick
|
||||
// it up so we can make rustdoc print this into the docs
|
||||
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
|
||||
// This "unstable-options" can be removed when `--crate-version` is stabilized
|
||||
cmd.arg("-Z").arg("unstable-options")
|
||||
.arg("--crate-version").arg(version);
|
||||
}
|
||||
|
||||
std::process::exit(match cmd.status() {
|
||||
Ok(s) => s.code().unwrap_or(1),
|
||||
|
@ -8,7 +8,7 @@
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import argparse
|
||||
import contextlib
|
||||
import datetime
|
||||
@ -294,7 +294,7 @@ def default_build_triple():
|
||||
raise ValueError('unknown byteorder: {}'.format(sys.byteorder))
|
||||
# only the n64 ABI is supported, indicate it
|
||||
ostype += 'abi64'
|
||||
elif cputype == 'sparcv9':
|
||||
elif cputype == 'sparcv9' or cputype == 'sparc64':
|
||||
pass
|
||||
else:
|
||||
err = "unknown cpu type: {}".format(cputype)
|
||||
@ -302,6 +302,7 @@ def default_build_triple():
|
||||
|
||||
return "{}-{}".format(cputype, ostype)
|
||||
|
||||
|
||||
class RustBuild(object):
|
||||
"""Provide all the methods required to build Rust"""
|
||||
def __init__(self):
|
||||
@ -498,7 +499,7 @@ class RustBuild(object):
|
||||
|
||||
If the key does not exists, the result is None:
|
||||
|
||||
>>> rb.get_toml("key3") == None
|
||||
>>> rb.get_toml("key3") is None
|
||||
True
|
||||
"""
|
||||
for line in self.config_toml.splitlines():
|
||||
@ -531,7 +532,7 @@ class RustBuild(object):
|
||||
"""
|
||||
config = self.get_toml(program)
|
||||
if config:
|
||||
return config
|
||||
return os.path.expanduser(config)
|
||||
return os.path.join(self.bin_root(), "bin", "{}{}".format(
|
||||
program, self.exe_suffix()))
|
||||
|
||||
@ -647,7 +648,8 @@ class RustBuild(object):
|
||||
if not ((module.endswith("llvm") and
|
||||
self.get_toml('llvm-config')) or
|
||||
(module.endswith("jemalloc") and
|
||||
self.get_toml('jemalloc')))]
|
||||
(self.get_toml('use-jemalloc') == "false" or
|
||||
self.get_toml('jemalloc'))))]
|
||||
run(["git", "submodule", "update",
|
||||
"--init", "--recursive"] + submodules,
|
||||
cwd=self.rust_root, verbose=self.verbose)
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
"""Bootstrap tests"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import os
|
||||
import doctest
|
||||
import unittest
|
||||
|
@ -261,9 +261,10 @@ impl<'a> Builder<'a> {
|
||||
doc::Reference, doc::Rustdoc, doc::CargoBook),
|
||||
Kind::Dist => describe!(dist::Docs, dist::Mingw, dist::Rustc, dist::DebuggerScripts,
|
||||
dist::Std, dist::Analysis, dist::Src, dist::PlainSourceTarball, dist::Cargo,
|
||||
dist::Rls, dist::Extended, dist::HashSign, dist::DontDistWithMiriEnabled),
|
||||
dist::Rls, dist::Rustfmt, dist::Extended, dist::HashSign,
|
||||
dist::DontDistWithMiriEnabled),
|
||||
Kind::Install => describe!(install::Docs, install::Std, install::Cargo, install::Rls,
|
||||
install::Analysis, install::Src, install::Rustc),
|
||||
install::Rustfmt, install::Analysis, install::Src, install::Rustc),
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,7 +307,7 @@ impl<'a> Builder<'a> {
|
||||
Subcommand::Bench { ref paths, .. } => (Kind::Bench, &paths[..]),
|
||||
Subcommand::Dist { ref paths } => (Kind::Dist, &paths[..]),
|
||||
Subcommand::Install { ref paths } => (Kind::Install, &paths[..]),
|
||||
Subcommand::Clean => panic!(),
|
||||
Subcommand::Clean { .. } => panic!(),
|
||||
};
|
||||
|
||||
let builder = Builder {
|
||||
@ -413,12 +414,15 @@ impl<'a> Builder<'a> {
|
||||
pub fn rustdoc_cmd(&self, host: Interned<String>) -> Command {
|
||||
let mut cmd = Command::new(&self.out.join("bootstrap/debug/rustdoc"));
|
||||
let compiler = self.compiler(self.top_stage, host);
|
||||
cmd
|
||||
.env("RUSTC_STAGE", compiler.stage.to_string())
|
||||
.env("RUSTC_SYSROOT", self.sysroot(compiler))
|
||||
.env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
|
||||
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
|
||||
.env("RUSTDOC_REAL", self.rustdoc(host));
|
||||
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
|
||||
.env("RUSTC_SYSROOT", self.sysroot(compiler))
|
||||
.env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
|
||||
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
|
||||
.env("RUSTDOC_REAL", self.rustdoc(host))
|
||||
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
|
||||
if let Some(linker) = self.build.linker(host) {
|
||||
cmd.env("RUSTC_TARGET_LINKER", linker);
|
||||
}
|
||||
cmd
|
||||
}
|
||||
|
||||
@ -468,8 +472,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_CODEGEN_UNITS",
|
||||
self.config.rust_codegen_units.to_string())
|
||||
.env("RUSTC_DEBUG_ASSERTIONS",
|
||||
self.config.rust_debug_assertions.to_string())
|
||||
.env("RUSTC_SYSROOT", self.sysroot(compiler))
|
||||
@ -481,15 +483,23 @@ impl<'a> Builder<'a> {
|
||||
} else {
|
||||
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
|
||||
})
|
||||
.env("TEST_MIRI", self.config.test_miri.to_string())
|
||||
.env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));
|
||||
.env("TEST_MIRI", self.config.test_miri.to_string());
|
||||
|
||||
if let Some(n) = self.config.rust_codegen_units {
|
||||
cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
|
||||
}
|
||||
|
||||
if let Some(host_linker) = self.build.linker(compiler.host) {
|
||||
cargo.env("RUSTC_HOST_LINKER", host_linker);
|
||||
}
|
||||
if let Some(target_linker) = self.build.linker(target) {
|
||||
cargo.env("RUSTC_TARGET_LINKER", target_linker);
|
||||
}
|
||||
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
|
||||
.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
|
||||
|
||||
if mode != Mode::Tool {
|
||||
// Tools don't get debuginfo right now, e.g. cargo and rls don't
|
||||
// get compiled with debuginfo.
|
||||
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
|
||||
.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string())
|
||||
.env("RUSTC_FORCE_UNSTABLE", "1");
|
||||
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
|
||||
|
||||
// Currently the compiler depends on crates from crates.io, and
|
||||
// then other crates can depend on the compiler (e.g. proc-macro
|
||||
@ -556,17 +566,35 @@ impl<'a> Builder<'a> {
|
||||
|
||||
cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));
|
||||
|
||||
// Specify some various options for build scripts used throughout
|
||||
// the build.
|
||||
// Throughout the build Cargo can execute a number of build scripts
|
||||
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
|
||||
// obtained previously to those build scripts.
|
||||
// Build scripts use either the `cc` crate or `configure/make` so we pass
|
||||
// the options through environment variables that are fetched and understood by both.
|
||||
//
|
||||
// FIXME: the guard against msvc shouldn't need to be here
|
||||
if !target.contains("msvc") {
|
||||
cargo.env(format!("CC_{}", target), self.cc(target))
|
||||
.env(format!("AR_{}", target), self.ar(target).unwrap()) // only msvc is None
|
||||
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
|
||||
let cc = self.cc(target);
|
||||
cargo.env(format!("CC_{}", target), cc)
|
||||
.env("CC", cc);
|
||||
|
||||
let cflags = self.cflags(target).join(" ");
|
||||
cargo.env(format!("CFLAGS_{}", target), cflags.clone())
|
||||
.env("CFLAGS", cflags.clone());
|
||||
|
||||
if let Some(ar) = self.ar(target) {
|
||||
let ranlib = format!("{} s", ar.display());
|
||||
cargo.env(format!("AR_{}", target), ar)
|
||||
.env("AR", ar)
|
||||
.env(format!("RANLIB_{}", target), ranlib.clone())
|
||||
.env("RANLIB", ranlib);
|
||||
}
|
||||
|
||||
if let Ok(cxx) = self.cxx(target) {
|
||||
cargo.env(format!("CXX_{}", target), cxx);
|
||||
cargo.env(format!("CXX_{}", target), cxx)
|
||||
.env("CXX", cxx)
|
||||
.env(format!("CXXFLAGS_{}", target), cflags.clone())
|
||||
.env("CXXFLAGS", cflags);
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,6 +602,9 @@ impl<'a> Builder<'a> {
|
||||
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
|
||||
}
|
||||
|
||||
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
|
||||
cargo.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
|
||||
|
||||
// Environment variables *required* throughout the build
|
||||
//
|
||||
// FIXME: should update code to not require this env var
|
||||
@ -582,12 +613,20 @@ impl<'a> Builder<'a> {
|
||||
// Set this for all builds to make sure doc builds also get it.
|
||||
cargo.env("CFG_RELEASE_CHANNEL", &self.build.config.channel);
|
||||
|
||||
if self.is_verbose() {
|
||||
if self.is_very_verbose() {
|
||||
cargo.arg("-v");
|
||||
}
|
||||
// FIXME: cargo bench does not accept `--release`
|
||||
if self.config.rust_optimize && cmd != "bench" {
|
||||
cargo.arg("--release");
|
||||
if self.config.rust_optimize {
|
||||
// FIXME: cargo bench does not accept `--release`
|
||||
if cmd != "bench" {
|
||||
cargo.arg("--release");
|
||||
}
|
||||
|
||||
if self.config.rust_codegen_units.is_none() &&
|
||||
self.build.is_rust_llvm(compiler.host)
|
||||
{
|
||||
cargo.env("RUSTC_THINLTO", "1");
|
||||
}
|
||||
}
|
||||
if self.config.locked_deps {
|
||||
cargo.arg("--locked");
|
||||
|
@ -31,20 +31,51 @@
|
||||
//! ever be probed for. Instead the compilers found here will be used for
|
||||
//! everything.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::{env, iter};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::iter;
|
||||
|
||||
use build_helper::{cc2ar, output};
|
||||
use build_helper::output;
|
||||
use cc;
|
||||
|
||||
use Build;
|
||||
use config::Target;
|
||||
use cache::Interned;
|
||||
|
||||
// The `cc` crate doesn't provide a way to obtain a path to the detected archiver,
|
||||
// so use some simplified logic here. First we respect the environment variable `AR`, then
|
||||
// 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") {
|
||||
Some(PathBuf::from(ar))
|
||||
} else if target.contains("msvc") {
|
||||
None
|
||||
} else if target.contains("musl") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else if target.contains("openbsd") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else {
|
||||
let parent = cc.parent().unwrap();
|
||||
let file = cc.file_name().unwrap().to_str().unwrap();
|
||||
for suffix in &["gcc", "cc", "clang"] {
|
||||
if let Some(idx) = file.rfind(suffix) {
|
||||
let mut file = file[..idx].to_owned();
|
||||
file.push_str("ar");
|
||||
return Some(parent.join(&file));
|
||||
}
|
||||
}
|
||||
Some(parent.join(file))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find(build: &mut Build) {
|
||||
// For all targets we're going to need a C compiler for building some shims
|
||||
// and such as well as for being a linker for Rust code.
|
||||
for target in build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build)) {
|
||||
let targets = build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build))
|
||||
.collect::<HashSet<_>>();
|
||||
for target in targets.into_iter() {
|
||||
let mut cfg = cc::Build::new();
|
||||
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false)
|
||||
.target(&target).host(&build.build);
|
||||
@ -53,20 +84,27 @@ pub fn find(build: &mut Build) {
|
||||
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
|
||||
cfg.compiler(cc);
|
||||
} else {
|
||||
set_compiler(&mut cfg, "gcc", target, config, build);
|
||||
set_compiler(&mut cfg, Language::C, target, config, build);
|
||||
}
|
||||
|
||||
let compiler = cfg.get_compiler();
|
||||
let ar = cc2ar(compiler.path(), &target);
|
||||
let ar = if let ar @ Some(..) = config.and_then(|c| c.ar.clone()) {
|
||||
ar
|
||||
} else {
|
||||
cc2ar(compiler.path(), &target)
|
||||
};
|
||||
|
||||
build.verbose(&format!("CC_{} = {:?}", &target, compiler.path()));
|
||||
if let Some(ref ar) = ar {
|
||||
build.cc.insert(target, compiler);
|
||||
if let Some(ar) = ar {
|
||||
build.verbose(&format!("AR_{} = {:?}", &target, ar));
|
||||
build.ar.insert(target, ar);
|
||||
}
|
||||
build.cc.insert(target, (compiler, ar));
|
||||
}
|
||||
|
||||
// For all host triples we need to find a C++ compiler as well
|
||||
for host in build.hosts.iter().cloned().chain(iter::once(build.build)) {
|
||||
let hosts = build.hosts.iter().cloned().chain(iter::once(build.build)).collect::<HashSet<_>>();
|
||||
for host in hosts.into_iter() {
|
||||
let mut cfg = cc::Build::new();
|
||||
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false).cpp(true)
|
||||
.target(&host).host(&build.build);
|
||||
@ -74,7 +112,7 @@ pub fn find(build: &mut Build) {
|
||||
if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
|
||||
cfg.compiler(cxx);
|
||||
} else {
|
||||
set_compiler(&mut cfg, "g++", host, config, build);
|
||||
set_compiler(&mut cfg, Language::CPlusPlus, host, config, build);
|
||||
}
|
||||
let compiler = cfg.get_compiler();
|
||||
build.verbose(&format!("CXX_{} = {:?}", host, compiler.path()));
|
||||
@ -83,7 +121,7 @@ pub fn find(build: &mut Build) {
|
||||
}
|
||||
|
||||
fn set_compiler(cfg: &mut cc::Build,
|
||||
gnu_compiler: &str,
|
||||
compiler: Language,
|
||||
target: Interned<String>,
|
||||
config: Option<&Target>,
|
||||
build: &Build) {
|
||||
@ -94,7 +132,7 @@ fn set_compiler(cfg: &mut cc::Build,
|
||||
t if t.contains("android") => {
|
||||
if let Some(ndk) = config.and_then(|c| c.ndk.as_ref()) {
|
||||
let target = target.replace("armv7", "arm");
|
||||
let compiler = format!("{}-{}", target, gnu_compiler);
|
||||
let compiler = format!("{}-{}", target, compiler.clang());
|
||||
cfg.compiler(ndk.join("bin").join(compiler));
|
||||
}
|
||||
}
|
||||
@ -103,6 +141,7 @@ fn set_compiler(cfg: &mut cc::Build,
|
||||
// which is a gcc version from ports, if this is the case.
|
||||
t if t.contains("openbsd") => {
|
||||
let c = cfg.get_compiler();
|
||||
let gnu_compiler = compiler.gcc();
|
||||
if !c.path().ends_with(gnu_compiler) {
|
||||
return
|
||||
}
|
||||
@ -145,3 +184,29 @@ fn set_compiler(cfg: &mut cc::Build,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
/// The target programming language for a native compiler.
|
||||
enum Language {
|
||||
/// The compiler is targeting C.
|
||||
C,
|
||||
/// The compiler is targeting C++.
|
||||
CPlusPlus,
|
||||
}
|
||||
|
||||
impl Language {
|
||||
/// Obtains the name of a compiler in the GCC collection.
|
||||
fn gcc(self) -> &'static str {
|
||||
match self {
|
||||
Language::C => "gcc",
|
||||
Language::CPlusPlus => "g++",
|
||||
}
|
||||
}
|
||||
|
||||
/// Obtains the name of a compiler in the clang suite.
|
||||
fn clang(self) -> &'static str {
|
||||
match self {
|
||||
Language::C => "clang",
|
||||
Language::CPlusPlus => "clang++",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ use Build;
|
||||
use config::Config;
|
||||
|
||||
// The version number
|
||||
pub const CFG_RELEASE_NUM: &str = "1.22.0";
|
||||
pub const CFG_RELEASE_NUM: &str = "1.24.0";
|
||||
|
||||
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
|
||||
// Be sure to make this starts with a dot to conform to semver pre-release
|
||||
|
@ -65,19 +65,21 @@ impl fmt::Display for TestKind {
|
||||
}
|
||||
}
|
||||
|
||||
fn try_run_expecting(build: &Build, cmd: &mut Command, expect: BuildExpectation) {
|
||||
fn try_run_expecting(build: &Build, cmd: &mut Command, expect: BuildExpectation) -> bool {
|
||||
if !build.fail_fast {
|
||||
if !build.try_run(cmd, expect) {
|
||||
let mut failures = build.delayed_failures.borrow_mut();
|
||||
failures.push(format!("{:?}", cmd));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
build.run_expecting(cmd, expect);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn try_run(build: &Build, cmd: &mut Command) {
|
||||
try_run_expecting(build, cmd, BuildExpectation::None)
|
||||
try_run_expecting(build, cmd, BuildExpectation::None);
|
||||
}
|
||||
|
||||
fn try_run_quiet(build: &Build, cmd: &mut Command) {
|
||||
@ -246,19 +248,24 @@ impl Step for Rls {
|
||||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
builder.ensure(tool::Rls { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/rls/Cargo.toml"));
|
||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
||||
compiler,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/rls");
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
try_run_expecting(
|
||||
if try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.rls.passes(ToolState::Testing),
|
||||
);
|
||||
) {
|
||||
build.save_toolstate("rls", ToolState::Testing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,24 +298,30 @@ impl Step for Rustfmt {
|
||||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
builder.ensure(tool::Rustfmt { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/rustfmt/Cargo.toml"));
|
||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
||||
compiler,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/rustfmt");
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
try_run_expecting(
|
||||
if try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.rustfmt.passes(ToolState::Testing),
|
||||
);
|
||||
) {
|
||||
build.save_toolstate("rustfmt", ToolState::Testing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Miri {
|
||||
stage: u32,
|
||||
host: Interned<String>,
|
||||
}
|
||||
|
||||
@ -324,6 +337,7 @@ impl Step for Miri {
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Miri {
|
||||
stage: run.builder.top_stage,
|
||||
host: run.target,
|
||||
});
|
||||
}
|
||||
@ -331,33 +345,40 @@ impl Step for Miri {
|
||||
/// Runs `cargo test` for miri.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(1, host);
|
||||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
let miri = builder.ensure(tool::Miri { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/miri/Cargo.toml"));
|
||||
if let Some(miri) = builder.ensure(tool::Miri { compiler, target: self.host }) {
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/miri/Cargo.toml"));
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// miri tests need to know about the stage sysroot
|
||||
cargo.env("MIRI_SYSROOT", builder.sysroot(compiler));
|
||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
|
||||
cargo.env("MIRI_PATH", miri);
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// miri tests need to know about the stage sysroot
|
||||
cargo.env("MIRI_SYSROOT", builder.sysroot(compiler));
|
||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
|
||||
cargo.env("MIRI_PATH", miri);
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.miri.passes(ToolState::Testing),
|
||||
);
|
||||
if try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.miri.passes(ToolState::Testing),
|
||||
) {
|
||||
build.save_toolstate("miri", ToolState::Testing);
|
||||
}
|
||||
} else {
|
||||
eprintln!("failed to test miri: could not build");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Clippy {
|
||||
stage: u32,
|
||||
host: Interned<String>,
|
||||
}
|
||||
|
||||
@ -372,6 +393,7 @@ impl Step for Clippy {
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Clippy {
|
||||
stage: run.builder.top_stage,
|
||||
host: run.target,
|
||||
});
|
||||
}
|
||||
@ -379,25 +401,37 @@ impl Step for Clippy {
|
||||
/// Runs `cargo test` for clippy.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(1, host);
|
||||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
let _clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));
|
||||
if let Some(clippy) = builder.ensure(tool::Clippy { compiler, target: self.host }) {
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// clippy tests need to know about the stage sysroot
|
||||
cargo.env("SYSROOT", builder.sysroot(compiler));
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// clippy tests need to know about the stage sysroot
|
||||
cargo.env("SYSROOT", builder.sysroot(compiler));
|
||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
|
||||
let host_libs = builder.stage_out(compiler, Mode::Tool).join(builder.cargo_dir());
|
||||
cargo.env("HOST_LIBS", host_libs);
|
||||
// clippy tests need to find the driver
|
||||
cargo.env("CLIPPY_DRIVER_PATH", clippy);
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.clippy.passes(ToolState::Testing),
|
||||
);
|
||||
if try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.clippy.passes(ToolState::Testing),
|
||||
) {
|
||||
build.save_toolstate("clippy-driver", ToolState::Testing);
|
||||
}
|
||||
} else {
|
||||
eprintln!("failed to test clippy: could not build");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -736,12 +770,14 @@ impl Step for Compiletest {
|
||||
flags.push("-g".to_string());
|
||||
}
|
||||
|
||||
let mut hostflags = build.rustc_flags(compiler.host);
|
||||
hostflags.extend(flags.clone());
|
||||
if let Some(linker) = build.linker(target) {
|
||||
cmd.arg("--linker").arg(linker);
|
||||
}
|
||||
|
||||
let hostflags = flags.clone();
|
||||
cmd.arg("--host-rustcflags").arg(hostflags.join(" "));
|
||||
|
||||
let mut targetflags = build.rustc_flags(target);
|
||||
targetflags.extend(flags);
|
||||
let mut targetflags = flags.clone();
|
||||
targetflags.push(format!("-Lnative={}",
|
||||
build.test_helpers_out(target).display()));
|
||||
cmd.arg("--target-rustcflags").arg(targetflags.join(" "));
|
||||
@ -795,6 +831,9 @@ impl Step for Compiletest {
|
||||
.arg("--cflags").arg(build.cflags(target).join(" "))
|
||||
.arg("--llvm-components").arg(llvm_components.trim())
|
||||
.arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());
|
||||
if let Some(ar) = build.ar(target) {
|
||||
cmd.arg("--ar").arg(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
if suite == "run-make" && !build.config.llvm_enabled {
|
||||
@ -820,7 +859,7 @@ impl Step for Compiletest {
|
||||
// Note that if we encounter `PATH` we make sure to append to our own `PATH`
|
||||
// rather than stomp over it.
|
||||
if target.contains("msvc") {
|
||||
for &(ref k, ref v) in build.cc[&target].0.env() {
|
||||
for &(ref k, ref v) in build.cc[&target].env() {
|
||||
if k != "PATH" {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
@ -1185,7 +1224,8 @@ impl Step for Crate {
|
||||
// ends up messing with various mtime calculations and such.
|
||||
if !name.contains("jemalloc") &&
|
||||
*name != *"build_helper" &&
|
||||
!(name.starts_with("rustc_") && name.ends_with("san")) {
|
||||
!(name.starts_with("rustc_") && name.ends_with("san")) &&
|
||||
name != "dlmalloc" {
|
||||
cargo.arg("-p").arg(&format!("{}:0.0.0", name));
|
||||
}
|
||||
for dep in build.crates[&name].deps.iter() {
|
||||
@ -1218,6 +1258,17 @@ impl Step for Crate {
|
||||
if target.contains("emscripten") {
|
||||
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
|
||||
build.config.nodejs.as_ref().expect("nodejs not configured"));
|
||||
} else if target.starts_with("wasm32") {
|
||||
// On the wasm32-unknown-unknown target we're using LTO which is
|
||||
// incompatible with `-C prefer-dynamic`, so disable that here
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
let node = build.config.nodejs.as_ref()
|
||||
.expect("nodejs not configured");
|
||||
let runner = format!("{} {}/src/etc/wasm32-shim.js",
|
||||
node.display(),
|
||||
build.src.display());
|
||||
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), &runner);
|
||||
} else if build.remote_tested(target) {
|
||||
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
|
||||
format!("{} run",
|
||||
|
@ -13,7 +13,7 @@
|
||||
//! Responsible for cleaning out a build directory of all old and stale
|
||||
//! artifacts to prepare for a fresh build. Currently doesn't remove the
|
||||
//! `build/cache` directory (download cache) or the `build/$target/llvm`
|
||||
//! directory as we want that cached between builds.
|
||||
//! directory unless the --all flag is present.
|
||||
|
||||
use std::fs;
|
||||
use std::io::{self, ErrorKind};
|
||||
@ -21,24 +21,29 @@ use std::path::Path;
|
||||
|
||||
use Build;
|
||||
|
||||
pub fn clean(build: &Build) {
|
||||
pub fn clean(build: &Build, all: bool) {
|
||||
rm_rf("tmp".as_ref());
|
||||
rm_rf(&build.out.join("tmp"));
|
||||
rm_rf(&build.out.join("dist"));
|
||||
|
||||
for host in &build.hosts {
|
||||
let entries = match build.out.join(host).read_dir() {
|
||||
Ok(iter) => iter,
|
||||
Err(_) => continue,
|
||||
};
|
||||
if all {
|
||||
rm_rf(&build.out);
|
||||
} else {
|
||||
rm_rf(&build.out.join("tmp"));
|
||||
rm_rf(&build.out.join("dist"));
|
||||
|
||||
for entry in entries {
|
||||
let entry = t!(entry);
|
||||
if entry.file_name().to_str() == Some("llvm") {
|
||||
continue
|
||||
for host in &build.hosts {
|
||||
let entries = match build.out.join(host).read_dir() {
|
||||
Ok(iter) => iter,
|
||||
Err(_) => continue,
|
||||
};
|
||||
|
||||
for entry in entries {
|
||||
let entry = t!(entry);
|
||||
if entry.file_name().to_str() == Some("llvm") {
|
||||
continue
|
||||
}
|
||||
let path = t!(entry.path().canonicalize());
|
||||
rm_rf(&path);
|
||||
}
|
||||
let path = t!(entry.path().canonicalize());
|
||||
rm_rf(&path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ use build_helper::{output, mtime, up_to_date};
|
||||
use filetime::FileTime;
|
||||
use serde_json;
|
||||
|
||||
use util::{exe, libdir, is_dylib, copy};
|
||||
use util::{exe, libdir, is_dylib, copy, read_stamp_file, CiEnv};
|
||||
use {Build, Compiler, Mode};
|
||||
use native;
|
||||
use tool;
|
||||
@ -102,13 +102,13 @@ impl Step for Std {
|
||||
copy_musl_third_party_objects(build, target, &libdir);
|
||||
}
|
||||
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
|
||||
let out_dir = build.stage_out(compiler, Mode::Libstd);
|
||||
build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
|
||||
std_cargo(build, &compiler, target, &mut cargo);
|
||||
run_cargo(build,
|
||||
&mut cargo,
|
||||
&libstd_stamp(build, compiler, target));
|
||||
&mut cargo,
|
||||
&libstd_stamp(build, compiler, target));
|
||||
|
||||
builder.ensure(StdLink {
|
||||
compiler: builder.compiler(compiler.stage, build.build),
|
||||
@ -354,13 +354,13 @@ impl Step for Test {
|
||||
let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage));
|
||||
println!("Building stage{} test artifacts ({} -> {})", compiler.stage,
|
||||
&compiler.host, target);
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
|
||||
let out_dir = build.stage_out(compiler, Mode::Libtest);
|
||||
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build");
|
||||
test_cargo(build, &compiler, target, &mut cargo);
|
||||
run_cargo(build,
|
||||
&mut cargo,
|
||||
&libtest_stamp(build, compiler, target));
|
||||
&mut cargo,
|
||||
&libtest_stamp(build, compiler, target));
|
||||
|
||||
builder.ensure(TestLink {
|
||||
compiler: builder.compiler(compiler.stage, build.build),
|
||||
@ -480,8 +480,9 @@ impl Step for Rustc {
|
||||
println!("Building stage{} compiler artifacts ({} -> {})",
|
||||
compiler.stage, &compiler.host, target);
|
||||
|
||||
let out_dir = build.cargo_out(compiler, Mode::Librustc, target);
|
||||
build.clear_if_dirty(&out_dir, &libtest_stamp(build, compiler, target));
|
||||
let stage_out = builder.stage_out(compiler, Mode::Librustc);
|
||||
build.clear_if_dirty(&stage_out, &libstd_stamp(build, compiler, target));
|
||||
build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
|
||||
rustc_cargo(build, &compiler, target, &mut cargo);
|
||||
@ -560,9 +561,6 @@ pub fn rustc_cargo(build: &Build,
|
||||
if let Some(ref s) = build.config.rustc_default_linker {
|
||||
cargo.env("CFG_DEFAULT_LINKER", s);
|
||||
}
|
||||
if let Some(ref s) = build.config.rustc_default_ar {
|
||||
cargo.env("CFG_DEFAULT_AR", s);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
@ -760,15 +758,7 @@ impl Step for Assemble {
|
||||
/// `sysroot_dst` provided.
|
||||
fn add_to_sysroot(sysroot_dst: &Path, stamp: &Path) {
|
||||
t!(fs::create_dir_all(&sysroot_dst));
|
||||
let mut contents = Vec::new();
|
||||
t!(t!(File::open(stamp)).read_to_end(&mut contents));
|
||||
// This is the method we use for extracting paths from the stamp file passed to us. See
|
||||
// run_cargo for more information (in this file).
|
||||
for part in contents.split(|b| *b == 0) {
|
||||
if part.is_empty() {
|
||||
continue
|
||||
}
|
||||
let path = Path::new(t!(str::from_utf8(part)));
|
||||
for path in read_stamp_file(stamp) {
|
||||
copy(&path, &sysroot_dst.join(path.file_name().unwrap()));
|
||||
}
|
||||
}
|
||||
@ -802,7 +792,7 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
|
||||
cargo.arg("--message-format").arg("json")
|
||||
.stdout(Stdio::piped());
|
||||
|
||||
if stderr_isatty() {
|
||||
if stderr_isatty() && build.ci_env == CiEnv::None {
|
||||
// since we pass message-format=json to cargo, we need to tell the rustc
|
||||
// wrapper to give us colored output if necessary. This is because we
|
||||
// only want Cargo's JSON output, not rustcs.
|
||||
@ -870,10 +860,19 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
|
||||
// have a hash in the name, but there's a version of this file in
|
||||
// the `deps` folder which *does* have a hash in the name. That's
|
||||
// the one we'll want to we'll probe for it later.
|
||||
toplevel.push((filename.file_stem().unwrap()
|
||||
.to_str().unwrap().to_string(),
|
||||
filename.extension().unwrap().to_owned()
|
||||
.to_str().unwrap().to_string()));
|
||||
//
|
||||
// We do not use `Path::file_stem` or `Path::extension` here,
|
||||
// because some generated files may have multiple extensions e.g.
|
||||
// `std-<hash>.dll.lib` on Windows. The aforementioned methods only
|
||||
// split the file name by the last extension (`.lib`) while we need
|
||||
// to split by all extensions (`.dll.lib`).
|
||||
let expected_len = t!(filename.metadata()).len();
|
||||
let filename = filename.file_name().unwrap().to_str().unwrap();
|
||||
let mut parts = filename.splitn(2, '.');
|
||||
let file_stem = parts.next().unwrap().to_owned();
|
||||
let extension = parts.next().unwrap().to_owned();
|
||||
|
||||
toplevel.push((file_stem, extension, expected_len));
|
||||
}
|
||||
}
|
||||
|
||||
@ -893,11 +892,12 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
|
||||
.map(|e| t!(e))
|
||||
.map(|e| (e.path(), e.file_name().into_string().unwrap(), t!(e.metadata())))
|
||||
.collect::<Vec<_>>();
|
||||
for (prefix, extension) in toplevel {
|
||||
let candidates = contents.iter().filter(|&&(_, ref filename, _)| {
|
||||
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[..])
|
||||
filename.ends_with(&extension[..]) &&
|
||||
meta.len() == expected_len
|
||||
});
|
||||
let max = candidates.max_by_key(|&&(_, _, ref metadata)| {
|
||||
FileTime::from_last_modification_time(metadata)
|
||||
@ -941,6 +941,8 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
|
||||
let max = max.unwrap();
|
||||
let max_path = max_path.unwrap();
|
||||
if stamp_contents == new_contents && max <= stamp_mtime {
|
||||
build.verbose(&format!("not updating {:?}; contents equal and {} <= {}",
|
||||
stamp, max, stamp_mtime));
|
||||
return
|
||||
}
|
||||
if max > stamp_mtime {
|
||||
|
@ -76,19 +76,18 @@ pub struct Config {
|
||||
pub llvm_static_stdcpp: bool,
|
||||
pub llvm_link_shared: bool,
|
||||
pub llvm_targets: Option<String>,
|
||||
pub llvm_experimental_targets: Option<String>,
|
||||
pub llvm_experimental_targets: String,
|
||||
pub llvm_link_jobs: Option<u32>,
|
||||
|
||||
// rust codegen options
|
||||
pub rust_optimize: bool,
|
||||
pub rust_codegen_units: u32,
|
||||
pub rust_codegen_units: Option<u32>,
|
||||
pub rust_debug_assertions: bool,
|
||||
pub rust_debuginfo: bool,
|
||||
pub rust_debuginfo_lines: bool,
|
||||
pub rust_debuginfo_only_std: bool,
|
||||
pub rust_rpath: bool,
|
||||
pub rustc_default_linker: Option<String>,
|
||||
pub rustc_default_ar: Option<String>,
|
||||
pub rust_optimize_tests: bool,
|
||||
pub rust_debuginfo_tests: bool,
|
||||
pub rust_dist_src: bool,
|
||||
@ -113,6 +112,8 @@ pub struct Config {
|
||||
pub channel: String,
|
||||
pub quiet_tests: bool,
|
||||
pub test_miri: bool,
|
||||
pub save_toolstates: Option<PathBuf>,
|
||||
|
||||
// Fallback musl-root for all targets
|
||||
pub musl_root: Option<PathBuf>,
|
||||
pub prefix: Option<PathBuf>,
|
||||
@ -144,6 +145,8 @@ pub struct Target {
|
||||
pub jemalloc: Option<PathBuf>,
|
||||
pub cc: Option<PathBuf>,
|
||||
pub cxx: Option<PathBuf>,
|
||||
pub ar: Option<PathBuf>,
|
||||
pub linker: Option<PathBuf>,
|
||||
pub ndk: Option<PathBuf>,
|
||||
pub crt_static: Option<bool>,
|
||||
pub musl_root: Option<PathBuf>,
|
||||
@ -206,6 +209,11 @@ struct Install {
|
||||
bindir: Option<String>,
|
||||
libdir: Option<String>,
|
||||
mandir: Option<String>,
|
||||
|
||||
// standard paths, currently unused
|
||||
datadir: Option<String>,
|
||||
infodir: Option<String>,
|
||||
localstatedir: Option<String>,
|
||||
}
|
||||
|
||||
/// TOML representation of how the LLVM build is configured.
|
||||
@ -262,7 +270,6 @@ struct Rust {
|
||||
use_jemalloc: Option<bool>,
|
||||
backtrace: Option<bool>,
|
||||
default_linker: Option<String>,
|
||||
default_ar: Option<String>,
|
||||
channel: Option<String>,
|
||||
musl_root: Option<String>,
|
||||
rpath: Option<bool>,
|
||||
@ -274,6 +281,7 @@ struct Rust {
|
||||
dist_src: Option<bool>,
|
||||
quiet_tests: Option<bool>,
|
||||
test_miri: Option<bool>,
|
||||
save_toolstates: Option<String>,
|
||||
}
|
||||
|
||||
/// TOML representation of how each build target is configured.
|
||||
@ -284,6 +292,8 @@ struct TomlTarget {
|
||||
jemalloc: Option<String>,
|
||||
cc: Option<String>,
|
||||
cxx: Option<String>,
|
||||
ar: Option<String>,
|
||||
linker: Option<String>,
|
||||
android_ndk: Option<String>,
|
||||
crt_static: Option<bool>,
|
||||
musl_root: Option<String>,
|
||||
@ -297,6 +307,7 @@ impl Config {
|
||||
let mut config = Config::default();
|
||||
config.llvm_enabled = true;
|
||||
config.llvm_optimize = true;
|
||||
config.llvm_version_check = true;
|
||||
config.use_jemalloc = true;
|
||||
config.backtrace = true;
|
||||
config.rust_optimize = true;
|
||||
@ -304,7 +315,6 @@ impl Config {
|
||||
config.submodules = true;
|
||||
config.docs = true;
|
||||
config.rust_rpath = true;
|
||||
config.rust_codegen_units = 1;
|
||||
config.channel = "dev".to_string();
|
||||
config.codegen_tests = true;
|
||||
config.ignore_git = false;
|
||||
@ -440,7 +450,8 @@ impl Config {
|
||||
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
||||
set(&mut config.llvm_link_shared, llvm.link_shared);
|
||||
config.llvm_targets = llvm.targets.clone();
|
||||
config.llvm_experimental_targets = llvm.experimental_targets.clone();
|
||||
config.llvm_experimental_targets = llvm.experimental_targets.clone()
|
||||
.unwrap_or("WebAssembly".to_string());
|
||||
config.llvm_link_jobs = llvm.link_jobs;
|
||||
}
|
||||
|
||||
@ -464,12 +475,12 @@ impl Config {
|
||||
set(&mut config.quiet_tests, rust.quiet_tests);
|
||||
set(&mut config.test_miri, rust.test_miri);
|
||||
config.rustc_default_linker = rust.default_linker.clone();
|
||||
config.rustc_default_ar = rust.default_ar.clone();
|
||||
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
|
||||
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
|
||||
|
||||
match rust.codegen_units {
|
||||
Some(0) => config.rust_codegen_units = num_cpus::get() as u32,
|
||||
Some(n) => config.rust_codegen_units = n,
|
||||
Some(0) => config.rust_codegen_units = Some(num_cpus::get() as u32),
|
||||
Some(n) => config.rust_codegen_units = Some(n),
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
@ -487,8 +498,10 @@ impl Config {
|
||||
if let Some(ref s) = cfg.android_ndk {
|
||||
target.ndk = Some(env::current_dir().unwrap().join(s));
|
||||
}
|
||||
target.cxx = cfg.cxx.clone().map(PathBuf::from);
|
||||
target.cc = cfg.cc.clone().map(PathBuf::from);
|
||||
target.cxx = cfg.cxx.clone().map(PathBuf::from);
|
||||
target.ar = cfg.ar.clone().map(PathBuf::from);
|
||||
target.linker = cfg.linker.clone().map(PathBuf::from);
|
||||
target.crt_static = cfg.crt_static.clone();
|
||||
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
|
||||
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
|
||||
@ -520,7 +533,7 @@ impl Config {
|
||||
// Now that we've reached the end of our configuration, infer the
|
||||
// default values for all options that we haven't otherwise stored yet.
|
||||
|
||||
let default = config.channel == "nightly";
|
||||
let default = false;
|
||||
config.llvm_assertions = llvm_assertions.unwrap_or(default);
|
||||
|
||||
let default = match &config.channel[..] {
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
# ignore-tidy-linelength
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import os
|
||||
rust_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
@ -19,21 +20,26 @@ rust_dir = os.path.dirname(rust_dir)
|
||||
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
|
||||
import bootstrap
|
||||
|
||||
class Option:
|
||||
|
||||
class Option(object):
|
||||
def __init__(self, name, rustbuild, desc, value):
|
||||
self.name = name
|
||||
self.rustbuild = rustbuild
|
||||
self.desc = desc
|
||||
self.value = value
|
||||
|
||||
|
||||
options = []
|
||||
|
||||
|
||||
def o(*args):
|
||||
options.append(Option(*args, value=False))
|
||||
|
||||
|
||||
def v(*args):
|
||||
options.append(Option(*args, value=True))
|
||||
|
||||
|
||||
o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given")
|
||||
o("docs", "build.docs", "build standard library documentation")
|
||||
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
|
||||
@ -71,6 +77,7 @@ o("debuginfo", "rust.debuginfo", "build with debugger metadata")
|
||||
o("debuginfo-lines", "rust.debuginfo-lines", "build with line number debugger metadata")
|
||||
o("debuginfo-only-std", "rust.debuginfo-only-std", "build only libstd with debugging information")
|
||||
o("debug-jemalloc", "rust.debug-jemalloc", "build jemalloc with --enable-debug --enable-fill")
|
||||
v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file")
|
||||
|
||||
v("prefix", "install.prefix", "set installation prefix")
|
||||
v("localstatedir", "install.localstatedir", "local state directory")
|
||||
@ -119,9 +126,8 @@ v("experimental-targets", "llvm.experimental-targets",
|
||||
"experimental LLVM targets to build")
|
||||
v("release-channel", "rust.channel", "the name of the release channel to build")
|
||||
|
||||
# Used on systems where "cc" and "ar" are unavailable
|
||||
# Used on systems where "cc" is unavailable
|
||||
v("default-linker", "rust.default-linker", "the default linker")
|
||||
v("default-ar", "rust.default-ar", "the default ar")
|
||||
|
||||
# Many of these are saved below during the "writing configuration" step
|
||||
# (others are conditionally saved).
|
||||
@ -136,13 +142,16 @@ v("target", None, "GNUs ./configure syntax LLVM target triples")
|
||||
|
||||
v("set", None, "set arbitrary key/value pairs in TOML configuration")
|
||||
|
||||
|
||||
def p(msg):
|
||||
print("configure: " + msg)
|
||||
|
||||
|
||||
def err(msg):
|
||||
print("configure: error: " + msg)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if '--help' in sys.argv or '-h' in sys.argv:
|
||||
print('Usage: ./configure [options]')
|
||||
print('')
|
||||
@ -208,7 +217,7 @@ while i < len(sys.argv):
|
||||
continue
|
||||
|
||||
found = True
|
||||
if not option.name in known_args:
|
||||
if option.name not in known_args:
|
||||
known_args[option.name] = []
|
||||
known_args[option.name].append((option, value))
|
||||
break
|
||||
@ -217,7 +226,12 @@ while i < len(sys.argv):
|
||||
unknown_args.append(arg)
|
||||
p("")
|
||||
|
||||
if 'option-checking' not in known_args or known_args['option-checking'][1]:
|
||||
# Note: here and a few other places, we use [-1] to apply the *last* value
|
||||
# passed. But if option-checking is enabled, then the known_args loop will
|
||||
# also assert that options are only passed once.
|
||||
option_checking = ('option-checking' not in known_args
|
||||
or known_args['option-checking'][-1][1])
|
||||
if option_checking:
|
||||
if len(unknown_args) > 0:
|
||||
err("Option '" + unknown_args[0] + "' is not recognized")
|
||||
if len(need_value_args) > 0:
|
||||
@ -227,27 +241,30 @@ if 'option-checking' not in known_args or known_args['option-checking'][1]:
|
||||
# TOML we're going to write out
|
||||
config = {}
|
||||
|
||||
|
||||
def build():
|
||||
if 'build' in known_args:
|
||||
return known_args['build'][0][1]
|
||||
return known_args['build'][-1][1]
|
||||
return bootstrap.default_build_triple()
|
||||
|
||||
def set(key, value):
|
||||
s = "{:20} := {}".format(key, value)
|
||||
if len(s) < 70:
|
||||
p(s)
|
||||
else:
|
||||
p(s[:70] + " ...")
|
||||
|
||||
arr = config
|
||||
parts = key.split('.')
|
||||
for i, part in enumerate(parts):
|
||||
if i == len(parts) - 1:
|
||||
arr[part] = value
|
||||
else:
|
||||
if not part in arr:
|
||||
arr[part] = {}
|
||||
arr = arr[part]
|
||||
def set(key, value):
|
||||
s = "{:20} := {}".format(key, value)
|
||||
if len(s) < 70:
|
||||
p(s)
|
||||
else:
|
||||
p(s[:70] + " ...")
|
||||
|
||||
arr = config
|
||||
parts = key.split('.')
|
||||
for i, part in enumerate(parts):
|
||||
if i == len(parts) - 1:
|
||||
arr[part] = value
|
||||
else:
|
||||
if part not in arr:
|
||||
arr[part] = {}
|
||||
arr = arr[part]
|
||||
|
||||
|
||||
for key in known_args:
|
||||
# The `set` option is special and can be passed a bunch of times
|
||||
@ -265,9 +282,9 @@ for key in known_args:
|
||||
|
||||
# Ensure each option is only passed once
|
||||
arr = known_args[key]
|
||||
if len(arr) > 1:
|
||||
if option_checking and len(arr) > 1:
|
||||
err("Option '{}' provided more than once".format(key))
|
||||
option, value = arr[0]
|
||||
option, value = arr[-1]
|
||||
|
||||
# If we have a clear avenue to set our value in rustbuild, do so
|
||||
if option.rustbuild is not None:
|
||||
@ -345,8 +362,9 @@ for target in configured_targets:
|
||||
targets[target] = sections['target'][:]
|
||||
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
|
||||
|
||||
|
||||
# Here we walk through the constructed configuration we have from the parsed
|
||||
# command line arguemnts. We then apply each piece of configuration by
|
||||
# command line arguments. We then apply each piece of configuration by
|
||||
# basically just doing a `sed` to change the various configuration line to what
|
||||
# we've got configure.
|
||||
def to_toml(value):
|
||||
@ -360,7 +378,8 @@ def to_toml(value):
|
||||
elif isinstance(value, str):
|
||||
return "'" + value + "'"
|
||||
else:
|
||||
raise 'no toml'
|
||||
raise RuntimeError('no toml')
|
||||
|
||||
|
||||
def configure_section(lines, config):
|
||||
for key in config:
|
||||
@ -375,10 +394,11 @@ def configure_section(lines, config):
|
||||
if not found:
|
||||
raise RuntimeError("failed to find config line for {}".format(key))
|
||||
|
||||
|
||||
for section_key in config:
|
||||
section_config = config[section_key]
|
||||
if not section_key in sections:
|
||||
raise RuntimeError("config key {} not in sections".format(key))
|
||||
if section_key not in sections:
|
||||
raise RuntimeError("config key {} not in sections".format(section_key))
|
||||
|
||||
if section_key == 'target':
|
||||
for target in section_config:
|
||||
@ -407,11 +427,6 @@ with open('Makefile', 'w') as f:
|
||||
contents = contents.replace("$(CFG_PYTHON)", sys.executable)
|
||||
f.write(contents)
|
||||
|
||||
# Finally, clean up with a bit of a help message
|
||||
relpath = os.path.dirname(__file__)
|
||||
if relpath == '':
|
||||
relpath = '.'
|
||||
|
||||
p("")
|
||||
p("run `python {}/x.py --help`".format(relpath))
|
||||
p("run `python {}/x.py --help`".format(rust_dir))
|
||||
p("")
|
||||
|
@ -39,6 +39,8 @@ pub fn pkgname(build: &Build, component: &str) -> String {
|
||||
format!("{}-{}", component, build.cargo_package_vers())
|
||||
} else if component == "rls" {
|
||||
format!("{}-{}", component, build.rls_package_vers())
|
||||
} else if component == "rustfmt" {
|
||||
format!("{}-{}", component, build.rustfmt_package_vers())
|
||||
} else {
|
||||
assert!(component.starts_with("rust"));
|
||||
format!("{}-{}", component, build.rust_package_vers())
|
||||
@ -176,7 +178,7 @@ fn make_win_dist(
|
||||
}
|
||||
}
|
||||
|
||||
let target_tools = ["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe", "libwinpthread-1.dll"];
|
||||
let target_tools = ["gcc.exe", "ld.exe", "dlltool.exe", "libwinpthread-1.dll"];
|
||||
let mut rustc_dlls = vec!["libstdc++-6.dll", "libwinpthread-1.dll"];
|
||||
if target_triple.starts_with("i686-") {
|
||||
rustc_dlls.push("libgcc_s_dw2-1.dll");
|
||||
@ -630,7 +632,7 @@ impl Step for Analysis {
|
||||
let image = tmpdir(build).join(format!("{}-{}-image", name, target));
|
||||
|
||||
let src = build.stage_out(compiler, Mode::Libstd)
|
||||
.join(target).join("release").join("deps");
|
||||
.join(target).join(build.cargo_dir()).join("deps");
|
||||
|
||||
let image_src = src.join("save-analysis");
|
||||
let dst = image.join("lib/rustlib").join(target).join("analysis");
|
||||
@ -670,6 +672,9 @@ fn copy_src_dirs(build: &Build, src_dirs: &[&str], exclude_dirs: &[&str], dst_di
|
||||
spath.ends_with(".s")) {
|
||||
return false
|
||||
}
|
||||
if spath.contains("test/emscripten") || spath.contains("test\\emscripten") {
|
||||
return false
|
||||
}
|
||||
|
||||
let full_path = Path::new(dir).join(path);
|
||||
if exclude_dirs.iter().any(|excl| full_path == Path::new(excl)) {
|
||||
@ -734,17 +739,16 @@ impl Step for Src {
|
||||
// (essentially libstd and all of its path dependencies)
|
||||
let std_src_dirs = [
|
||||
"src/build_helper",
|
||||
"src/dlmalloc",
|
||||
"src/liballoc",
|
||||
"src/liballoc_jemalloc",
|
||||
"src/liballoc_system",
|
||||
"src/libbacktrace",
|
||||
"src/libcollections",
|
||||
"src/libcompiler_builtins",
|
||||
"src/libcore",
|
||||
"src/liblibc",
|
||||
"src/libpanic_abort",
|
||||
"src/libpanic_unwind",
|
||||
"src/librand",
|
||||
"src/librustc_asan",
|
||||
"src/librustc_lsan",
|
||||
"src/librustc_msan",
|
||||
@ -754,6 +758,7 @@ impl Step for Src {
|
||||
"src/libunwind",
|
||||
"src/rustc/compiler_builtins_shim",
|
||||
"src/rustc/libc_shim",
|
||||
"src/rustc/dlmalloc_shim",
|
||||
"src/libtest",
|
||||
"src/libterm",
|
||||
"src/jemalloc",
|
||||
@ -1035,7 +1040,7 @@ pub struct Rls {
|
||||
}
|
||||
|
||||
impl Step for Rls {
|
||||
type Output = PathBuf;
|
||||
type Output = Option<PathBuf>;
|
||||
const ONLY_BUILD_TARGETS: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
@ -1050,12 +1055,17 @@ impl Step for Rls {
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let target = self.target;
|
||||
assert!(build.config.extended);
|
||||
|
||||
if !builder.config.toolstate.rls.testing() {
|
||||
println!("skipping Dist RLS stage{} ({})", stage, target);
|
||||
return None
|
||||
}
|
||||
|
||||
println!("Dist RLS stage{} ({})", stage, target);
|
||||
let src = build.src.join("src/tools/rls");
|
||||
let release_num = build.release_num("rls");
|
||||
@ -1068,10 +1078,13 @@ impl Step for Rls {
|
||||
t!(fs::create_dir_all(&image));
|
||||
|
||||
// Prepare the image directory
|
||||
// We expect RLS to build, because we've exited this step above if tool
|
||||
// state for RLS isn't testing.
|
||||
let rls = builder.ensure(tool::Rls {
|
||||
compiler: builder.compiler(stage, build.build),
|
||||
target
|
||||
});
|
||||
}).or_else(|| { println!("Unable to build RLS, skipping dist"); None })?;
|
||||
|
||||
install(&rls, &image.join("bin"), 0o755);
|
||||
let doc = image.join("share/doc/rls");
|
||||
install(&src.join("README.md"), &doc, 0o644);
|
||||
@ -1102,7 +1115,97 @@ impl Step for Rls {
|
||||
.arg("--component-name=rls-preview");
|
||||
|
||||
build.run(&mut cmd);
|
||||
distdir(build).join(format!("{}-{}.tar.gz", name, target))
|
||||
Some(distdir(build).join(format!("{}-{}.tar.gz", name, target)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Rustfmt {
|
||||
pub stage: u32,
|
||||
pub target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for Rustfmt {
|
||||
type Output = Option<PathBuf>;
|
||||
const ONLY_BUILD_TARGETS: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
run.path("rustfmt")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rustfmt {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let target = self.target;
|
||||
assert!(build.config.extended);
|
||||
|
||||
if !builder.config.toolstate.rustfmt.testing() {
|
||||
println!("skipping Dist Rustfmt stage{} ({})", stage, target);
|
||||
return None
|
||||
}
|
||||
|
||||
println!("Dist Rustfmt stage{} ({})", stage, target);
|
||||
let src = build.src.join("src/tools/rustfmt");
|
||||
let release_num = build.release_num("rustfmt");
|
||||
let name = pkgname(build, "rustfmt");
|
||||
let version = build.rustfmt_info.version(build, &release_num);
|
||||
|
||||
let tmp = tmpdir(build);
|
||||
let image = tmp.join("rustfmt-image");
|
||||
drop(fs::remove_dir_all(&image));
|
||||
t!(fs::create_dir_all(&image));
|
||||
|
||||
// Prepare the image directory
|
||||
let rustfmt = builder.ensure(tool::Rustfmt {
|
||||
compiler: builder.compiler(stage, build.build),
|
||||
target
|
||||
}).or_else(|| { println!("Unable to build Rustfmt, skipping dist"); None })?;
|
||||
let cargofmt = builder.ensure(tool::Cargofmt {
|
||||
compiler: builder.compiler(stage, build.build),
|
||||
target
|
||||
}).or_else(|| { println!("Unable to build Cargofmt, skipping dist"); None })?;
|
||||
|
||||
install(&rustfmt, &image.join("bin"), 0o755);
|
||||
install(&cargofmt, &image.join("bin"), 0o755);
|
||||
let doc = image.join("share/doc/rustfmt");
|
||||
install(&src.join("README.md"), &doc, 0o644);
|
||||
install(&src.join("LICENSE-MIT"), &doc, 0o644);
|
||||
install(&src.join("LICENSE-APACHE"), &doc, 0o644);
|
||||
|
||||
// Prepare the overlay
|
||||
let overlay = tmp.join("rustfmt-overlay");
|
||||
drop(fs::remove_dir_all(&overlay));
|
||||
t!(fs::create_dir_all(&overlay));
|
||||
install(&src.join("README.md"), &overlay, 0o644);
|
||||
install(&src.join("LICENSE-MIT"), &overlay, 0o644);
|
||||
install(&src.join("LICENSE-APACHE"), &overlay, 0o644);
|
||||
t!(t!(File::create(overlay.join("version"))).write_all(version.as_bytes()));
|
||||
|
||||
// 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=rustfmt-ready-to-fmt.")
|
||||
.arg("--image-dir").arg(&image)
|
||||
.arg("--work-dir").arg(&tmpdir(build))
|
||||
.arg("--output-dir").arg(&distdir(build))
|
||||
.arg("--non-installed-overlay").arg(&overlay)
|
||||
.arg(format!("--package-name={}-{}", name, target))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo")
|
||||
.arg("--component-name=rustfmt-preview");
|
||||
|
||||
build.run(&mut cmd);
|
||||
Some(distdir(build).join(format!("{}-{}.tar.gz", name, target)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -1169,6 +1272,7 @@ impl Step for Extended {
|
||||
compiler: builder.compiler(stage, target),
|
||||
});
|
||||
let cargo_installer = builder.ensure(Cargo { stage, target });
|
||||
let rustfmt_installer = builder.ensure(Rustfmt { stage, target });
|
||||
let rls_installer = builder.ensure(Rls { stage, target });
|
||||
let mingw_installer = builder.ensure(Mingw { host: target });
|
||||
let analysis_installer = builder.ensure(Analysis {
|
||||
@ -1202,8 +1306,13 @@ impl Step for Extended {
|
||||
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
|
||||
// the std files during uninstall. To do this ensure that rustc comes
|
||||
// before rust-std in the list below.
|
||||
let mut tarballs = vec![rustc_installer, cargo_installer, rls_installer,
|
||||
analysis_installer, std_installer];
|
||||
let mut tarballs = Vec::new();
|
||||
tarballs.push(rustc_installer);
|
||||
tarballs.push(cargo_installer);
|
||||
tarballs.extend(rls_installer.clone());
|
||||
tarballs.extend(rustfmt_installer.clone());
|
||||
tarballs.push(analysis_installer);
|
||||
tarballs.push(std_installer);
|
||||
if build.config.docs {
|
||||
tarballs.push(docs_installer);
|
||||
}
|
||||
@ -1245,35 +1354,41 @@ impl Step for Extended {
|
||||
}
|
||||
rtf.push_str("}");
|
||||
|
||||
fn filter(contents: &str, marker: &str) -> String {
|
||||
let start = format!("tool-{}-start", marker);
|
||||
let end = format!("tool-{}-end", marker);
|
||||
let mut lines = Vec::new();
|
||||
let mut omitted = false;
|
||||
for line in contents.lines() {
|
||||
if line.contains(&start) {
|
||||
omitted = true;
|
||||
} else if line.contains(&end) {
|
||||
omitted = false;
|
||||
} else if !omitted {
|
||||
lines.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
lines.join("\n")
|
||||
}
|
||||
|
||||
let xform = |p: &Path| {
|
||||
let mut contents = String::new();
|
||||
t!(t!(File::open(p)).read_to_string(&mut contents));
|
||||
if rls_installer.is_none() {
|
||||
contents = filter(&contents, "rls");
|
||||
}
|
||||
if rustfmt_installer.is_none() {
|
||||
contents = filter(&contents, "rustfmt");
|
||||
}
|
||||
let ret = tmp.join(p.file_name().unwrap());
|
||||
t!(t!(File::create(&ret)).write_all(contents.as_bytes()));
|
||||
return ret
|
||||
};
|
||||
|
||||
if target.contains("apple-darwin") {
|
||||
let pkg = tmp.join("pkg");
|
||||
let _ = fs::remove_dir_all(&pkg);
|
||||
t!(fs::create_dir_all(pkg.join("rustc")));
|
||||
t!(fs::create_dir_all(pkg.join("cargo")));
|
||||
t!(fs::create_dir_all(pkg.join("rust-docs")));
|
||||
t!(fs::create_dir_all(pkg.join("rust-std")));
|
||||
t!(fs::create_dir_all(pkg.join("rls")));
|
||||
t!(fs::create_dir_all(pkg.join("rust-analysis")));
|
||||
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)),
|
||||
&pkg.join("rustc"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)),
|
||||
&pkg.join("cargo"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)),
|
||||
&pkg.join("rust-docs"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target)),
|
||||
&pkg.join("rust-std"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rls"), target)),
|
||||
&pkg.join("rls"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target)),
|
||||
&pkg.join("rust-analysis"));
|
||||
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rustc"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("cargo"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rust-docs"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rust-std"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rls"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rust-analysis"), 0o755);
|
||||
|
||||
let pkgbuild = |component: &str| {
|
||||
let mut cmd = Command::new("pkgbuild");
|
||||
@ -1283,12 +1398,23 @@ impl Step for Extended {
|
||||
.arg(pkg.join(component).with_extension("pkg"));
|
||||
build.run(&mut cmd);
|
||||
};
|
||||
pkgbuild("rustc");
|
||||
pkgbuild("cargo");
|
||||
pkgbuild("rust-docs");
|
||||
pkgbuild("rust-std");
|
||||
pkgbuild("rls");
|
||||
pkgbuild("rust-analysis");
|
||||
|
||||
let prepare = |name: &str| {
|
||||
t!(fs::create_dir_all(pkg.join(name)));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, name), target)),
|
||||
&pkg.join(name));
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join(name), 0o755);
|
||||
pkgbuild(name);
|
||||
};
|
||||
prepare("rustc");
|
||||
prepare("cargo");
|
||||
prepare("rust-docs");
|
||||
prepare("rust-std");
|
||||
prepare("rust-analysis");
|
||||
|
||||
if rls_installer.is_some() {
|
||||
prepare("rls");
|
||||
}
|
||||
|
||||
// create an 'uninstall' package
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("uninstall"), 0o755);
|
||||
@ -1298,7 +1424,7 @@ impl Step for Extended {
|
||||
t!(t!(File::create(pkg.join("res/LICENSE.txt"))).write_all(license.as_bytes()));
|
||||
install(&etc.join("gfx/rust-logo.png"), &pkg.join("res"), 0o644);
|
||||
let mut cmd = Command::new("productbuild");
|
||||
cmd.arg("--distribution").arg(etc.join("pkg/Distribution.xml"))
|
||||
cmd.arg("--distribution").arg(xform(&etc.join("pkg/Distribution.xml")))
|
||||
.arg("--resources").arg(pkg.join("res"))
|
||||
.arg(distdir(build).join(format!("{}-{}.pkg",
|
||||
pkgname(build, "rust"),
|
||||
@ -1310,46 +1436,34 @@ impl Step for Extended {
|
||||
if target.contains("windows") {
|
||||
let exe = tmp.join("exe");
|
||||
let _ = fs::remove_dir_all(&exe);
|
||||
t!(fs::create_dir_all(exe.join("rustc")));
|
||||
t!(fs::create_dir_all(exe.join("cargo")));
|
||||
t!(fs::create_dir_all(exe.join("rls")));
|
||||
t!(fs::create_dir_all(exe.join("rust-analysis")));
|
||||
t!(fs::create_dir_all(exe.join("rust-docs")));
|
||||
t!(fs::create_dir_all(exe.join("rust-std")));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target))
|
||||
.join("rustc"),
|
||||
&exe.join("rustc"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target))
|
||||
.join("cargo"),
|
||||
&exe.join("cargo"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target))
|
||||
.join("rust-docs"),
|
||||
&exe.join("rust-docs"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target))
|
||||
.join(format!("rust-std-{}", target)),
|
||||
&exe.join("rust-std"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rls"), target)).join("rls-preview"),
|
||||
&exe.join("rls"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target))
|
||||
.join(format!("rust-analysis-{}", target)),
|
||||
&exe.join("rust-analysis"));
|
||||
|
||||
t!(fs::remove_file(exe.join("rustc/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("cargo/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rust-docs/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rust-std/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rls/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rust-analysis/manifest.in")));
|
||||
|
||||
let prepare = |name: &str| {
|
||||
t!(fs::create_dir_all(exe.join(name)));
|
||||
let dir = if name == "rust-std" || name == "rust-analysis" {
|
||||
format!("{}-{}", name, target)
|
||||
} else if name == "rls" {
|
||||
"rls-preview".to_string()
|
||||
} else {
|
||||
name.to_string()
|
||||
};
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, name), target))
|
||||
.join(dir),
|
||||
&exe.join(name));
|
||||
t!(fs::remove_file(exe.join(name).join("manifest.in")));
|
||||
};
|
||||
prepare("rustc");
|
||||
prepare("cargo");
|
||||
prepare("rust-analysis");
|
||||
prepare("rust-docs");
|
||||
prepare("rust-std");
|
||||
if rls_installer.is_some() {
|
||||
prepare("rls");
|
||||
}
|
||||
if target.contains("windows-gnu") {
|
||||
t!(fs::create_dir_all(exe.join("rust-mingw")));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-mingw"), target))
|
||||
.join("rust-mingw"),
|
||||
&exe.join("rust-mingw"));
|
||||
t!(fs::remove_file(exe.join("rust-mingw/manifest.in")));
|
||||
prepare("rust-mingw");
|
||||
}
|
||||
|
||||
install(&etc.join("exe/rust.iss"), &exe, 0o644);
|
||||
install(&xform(&etc.join("exe/rust.iss")), &exe, 0o644);
|
||||
install(&etc.join("exe/modpath.iss"), &exe, 0o644);
|
||||
install(&etc.join("exe/upgrade.iss"), &exe, 0o644);
|
||||
install(&etc.join("gfx/rust-logo.ico"), &exe, 0o644);
|
||||
@ -1413,16 +1527,18 @@ impl Step for Extended {
|
||||
.arg("-dr").arg("Std")
|
||||
.arg("-var").arg("var.StdDir")
|
||||
.arg("-out").arg(exe.join("StdGroup.wxs")));
|
||||
build.run(Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
.arg("dir")
|
||||
.arg("rls")
|
||||
.args(&heat_flags)
|
||||
.arg("-cg").arg("RlsGroup")
|
||||
.arg("-dr").arg("Rls")
|
||||
.arg("-var").arg("var.RlsDir")
|
||||
.arg("-out").arg(exe.join("RlsGroup.wxs"))
|
||||
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
|
||||
if rls_installer.is_some() {
|
||||
build.run(Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
.arg("dir")
|
||||
.arg("rls")
|
||||
.args(&heat_flags)
|
||||
.arg("-cg").arg("RlsGroup")
|
||||
.arg("-dr").arg("Rls")
|
||||
.arg("-var").arg("var.RlsDir")
|
||||
.arg("-out").arg(exe.join("RlsGroup.wxs"))
|
||||
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
|
||||
}
|
||||
build.run(Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
.arg("dir")
|
||||
@ -1456,26 +1572,30 @@ impl Step for Extended {
|
||||
.arg("-dDocsDir=rust-docs")
|
||||
.arg("-dCargoDir=cargo")
|
||||
.arg("-dStdDir=rust-std")
|
||||
.arg("-dRlsDir=rls")
|
||||
.arg("-dAnalysisDir=rust-analysis")
|
||||
.arg("-arch").arg(&arch)
|
||||
.arg("-out").arg(&output)
|
||||
.arg(&input);
|
||||
add_env(build, &mut cmd, target);
|
||||
|
||||
if rls_installer.is_some() {
|
||||
cmd.arg("-dRlsDir=rls");
|
||||
}
|
||||
if target.contains("windows-gnu") {
|
||||
cmd.arg("-dGccDir=rust-mingw");
|
||||
}
|
||||
build.run(&mut cmd);
|
||||
};
|
||||
candle(&etc.join("msi/rust.wxs"));
|
||||
candle(&xform(&etc.join("msi/rust.wxs")));
|
||||
candle(&etc.join("msi/ui.wxs"));
|
||||
candle(&etc.join("msi/rustwelcomedlg.wxs"));
|
||||
candle("RustcGroup.wxs".as_ref());
|
||||
candle("DocsGroup.wxs".as_ref());
|
||||
candle("CargoGroup.wxs".as_ref());
|
||||
candle("StdGroup.wxs".as_ref());
|
||||
candle("RlsGroup.wxs".as_ref());
|
||||
if rls_installer.is_some() {
|
||||
candle("RlsGroup.wxs".as_ref());
|
||||
}
|
||||
candle("AnalysisGroup.wxs".as_ref());
|
||||
|
||||
if target.contains("windows-gnu") {
|
||||
@ -1499,10 +1619,13 @@ impl Step for Extended {
|
||||
.arg("DocsGroup.wixobj")
|
||||
.arg("CargoGroup.wixobj")
|
||||
.arg("StdGroup.wixobj")
|
||||
.arg("RlsGroup.wixobj")
|
||||
.arg("AnalysisGroup.wixobj")
|
||||
.current_dir(&exe);
|
||||
|
||||
if rls_installer.is_some() {
|
||||
cmd.arg("RlsGroup.wixobj");
|
||||
}
|
||||
|
||||
if target.contains("windows-gnu") {
|
||||
cmd.arg("GccGroup.wixobj");
|
||||
}
|
||||
@ -1586,6 +1709,7 @@ impl Step for HashSign {
|
||||
cmd.arg(build.rust_package_vers());
|
||||
cmd.arg(build.package_vers(&build.release_num("cargo")));
|
||||
cmd.arg(build.package_vers(&build.release_num("rls")));
|
||||
cmd.arg(build.package_vers(&build.release_num("rustfmt")));
|
||||
cmd.arg(addr);
|
||||
|
||||
t!(fs::create_dir_all(distdir(build)));
|
||||
|
@ -66,7 +66,7 @@ macro_rules! book {
|
||||
}
|
||||
|
||||
book!(
|
||||
Nomicon, "src/doc/book", "nomicon";
|
||||
Nomicon, "src/doc/nomicon", "nomicon";
|
||||
Reference, "src/doc/reference", "reference";
|
||||
Rustdoc, "src/doc/rustdoc", "rustdoc";
|
||||
);
|
||||
@ -132,6 +132,52 @@ impl Step for UnstableBook {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct CargoBook {
|
||||
target: Interned<String>,
|
||||
name: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for CargoBook {
|
||||
type Output = ();
|
||||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/cargo/src/doc/book").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(CargoBook {
|
||||
target: run.target,
|
||||
name: INTERNER.intern_str("cargo"),
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
|
||||
let target = self.target;
|
||||
let name = self.name;
|
||||
let src = build.src.join("src/tools/cargo/src/doc/book");
|
||||
|
||||
let out = build.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
let out = out.join(name);
|
||||
|
||||
println!("Cargo Book ({}) - {}", target, name);
|
||||
|
||||
let _ = fs::remove_dir_all(&out);
|
||||
|
||||
build.run(builder.tool_cmd(Tool::Rustbook)
|
||||
.arg("build")
|
||||
.arg(&src)
|
||||
.arg("-d")
|
||||
.arg(out));
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
struct RustbookSrc {
|
||||
target: Interned<String>,
|
||||
@ -205,10 +251,12 @@ impl Step for TheBook {
|
||||
///
|
||||
/// * Book (first edition)
|
||||
/// * Book (second edition)
|
||||
/// * Version info and CSS
|
||||
/// * Index page
|
||||
/// * Redirect pages
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let name = self.name;
|
||||
// build book first edition
|
||||
@ -223,10 +271,16 @@ impl Step for TheBook {
|
||||
name: INTERNER.intern_string(format!("{}/second-edition", name)),
|
||||
});
|
||||
|
||||
// build the version info page and CSS
|
||||
builder.ensure(Standalone {
|
||||
compiler,
|
||||
target,
|
||||
});
|
||||
|
||||
// build the index page
|
||||
let index = format!("{}/index.md", name);
|
||||
println!("Documenting book index ({})", target);
|
||||
invoke_rustdoc(builder, self.compiler, target, &index);
|
||||
invoke_rustdoc(builder, compiler, target, &index);
|
||||
|
||||
// build the redirect pages
|
||||
println!("Documenting book redirect pages ({})", target);
|
||||
@ -235,56 +289,11 @@ impl Step for TheBook {
|
||||
let path = file.path();
|
||||
let path = path.to_str().unwrap();
|
||||
|
||||
invoke_rustdoc(builder, self.compiler, target, path);
|
||||
invoke_rustdoc(builder, compiler, target, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct CargoBook {
|
||||
target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for CargoBook {
|
||||
type Output = ();
|
||||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/doc/cargo").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(CargoBook {
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a placeholder for the cargo documentation so that doc.rust-lang.org/cargo will
|
||||
/// redirect to doc.crates.io. We want to publish doc.rust-lang.org/cargo in the paper
|
||||
/// version of the book, but we don't want to rush the process of switching cargo's docs
|
||||
/// over to mdbook and deploying them. When the cargo book is ready, this implementation
|
||||
/// should build the mdbook instead of this redirect page.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let out = build.doc_out(self.target);
|
||||
|
||||
let cargo_dir = out.join("cargo");
|
||||
t!(fs::create_dir_all(&cargo_dir));
|
||||
|
||||
let index = cargo_dir.join("index.html");
|
||||
let redirect_html = r#"
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL='http://doc.crates.io'" />
|
||||
</head>
|
||||
</html>"#;
|
||||
|
||||
println!("Creating cargo book redirect page");
|
||||
t!(t!(File::create(&index)).write_all(redirect_html.as_bytes()));
|
||||
}
|
||||
}
|
||||
|
||||
fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String>, markdown: &str) {
|
||||
let build = builder.build;
|
||||
let out = build.doc_out(target);
|
||||
@ -293,25 +302,12 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
|
||||
|
||||
let favicon = build.src.join("src/doc/favicon.inc");
|
||||
let footer = build.src.join("src/doc/footer.inc");
|
||||
|
||||
let version_input = build.src.join("src/doc/version_info.html.template");
|
||||
let version_info = out.join("version_info.html");
|
||||
|
||||
if !up_to_date(&version_input, &version_info) {
|
||||
let mut info = String::new();
|
||||
t!(t!(File::open(&version_input)).read_to_string(&mut info));
|
||||
let info = info.replace("VERSION", &build.rust_release())
|
||||
.replace("SHORT_HASH", build.rust_info.sha_short().unwrap_or(""))
|
||||
.replace("STAMP", build.rust_info.sha().unwrap_or(""));
|
||||
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
|
||||
}
|
||||
|
||||
let mut cmd = builder.rustdoc_cmd(compiler.host);
|
||||
|
||||
let out = out.join("book");
|
||||
|
||||
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
|
||||
|
||||
cmd.arg("--html-after-content").arg(&footer)
|
||||
.arg("--html-before-content").arg(&version_info)
|
||||
.arg("--html-in-header").arg(&favicon)
|
||||
@ -320,7 +316,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
|
||||
.arg("-o").arg(&out)
|
||||
.arg(&path)
|
||||
.arg("--markdown-css")
|
||||
.arg("rust.css");
|
||||
.arg("../rust.css");
|
||||
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
@ -490,7 +486,7 @@ impl Step for Std {
|
||||
// for which docs must be built.
|
||||
if !build.config.compiler_docs {
|
||||
cargo.arg("--no-deps");
|
||||
for krate in &["alloc", "collections", "core", "std", "std_unicode"] {
|
||||
for krate in &["alloc", "core", "std", "std_unicode"] {
|
||||
cargo.arg("-p").arg(krate);
|
||||
// Create all crate output directories first to make sure rustdoc uses
|
||||
// relative links.
|
||||
@ -623,11 +619,9 @@ impl Step for Rustc {
|
||||
compile::rustc_cargo(build, &compiler, target, &mut cargo);
|
||||
|
||||
if build.config.compiler_docs {
|
||||
// src/rustc/Cargo.toml contains bin crates called rustc and rustdoc
|
||||
// which would otherwise overwrite the docs for the real rustc and
|
||||
// rustdoc lib crates.
|
||||
cargo.arg("-p").arg("rustc_driver")
|
||||
.arg("-p").arg("rustdoc");
|
||||
// src/rustc/Cargo.toml contains a bin crate called rustc which
|
||||
// would otherwise overwrite the docs for the real rustc lib crate.
|
||||
cargo.arg("-p").arg("rustc_driver");
|
||||
} else {
|
||||
// Like with libstd above if compiler docs aren't enabled then we're not
|
||||
// documenting internal dependencies, so we have a whitelist.
|
||||
|
@ -60,7 +60,9 @@ pub enum Subcommand {
|
||||
paths: Vec<PathBuf>,
|
||||
test_args: Vec<String>,
|
||||
},
|
||||
Clean,
|
||||
Clean {
|
||||
all: bool,
|
||||
},
|
||||
Dist {
|
||||
paths: Vec<PathBuf>,
|
||||
},
|
||||
@ -134,9 +136,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
|
||||
let subcommand = match subcommand {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
// No subcommand -- show the general usage and subcommand help
|
||||
// No or an invalid subcommand -- show the general usage and subcommand help
|
||||
// An exit code will be 0 when no subcommand is given, and 1 in case of an invalid
|
||||
// subcommand.
|
||||
println!("{}\n", subcommand_help);
|
||||
process::exit(1);
|
||||
let exit_code = if args.is_empty() { 0 } else { 1 };
|
||||
process::exit(exit_code);
|
||||
}
|
||||
};
|
||||
|
||||
@ -147,6 +152,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
|
||||
opts.optmulti("", "test-args", "extra arguments", "ARGS");
|
||||
},
|
||||
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
||||
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
|
||||
_ => { },
|
||||
};
|
||||
|
||||
@ -250,7 +256,7 @@ Arguments:
|
||||
}
|
||||
});
|
||||
|
||||
// All subcommands can have an optional "Available paths" section
|
||||
// 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);
|
||||
@ -258,9 +264,10 @@ Arguments:
|
||||
|
||||
let maybe_rules_help = Builder::get_help(&build, subcommand.as_str());
|
||||
extra_help.push_str(maybe_rules_help.unwrap_or_default().as_str());
|
||||
} else {
|
||||
extra_help.push_str(format!("Run `./x.py {} -h -v` to see a list of available paths.",
|
||||
subcommand).as_str());
|
||||
} else if subcommand.as_str() != "clean" {
|
||||
extra_help.push_str(format!(
|
||||
"Run `./x.py {} -h -v` to see a list of available paths.",
|
||||
subcommand).as_str());
|
||||
}
|
||||
|
||||
// User passed in -h/--help?
|
||||
@ -290,10 +297,13 @@ Arguments:
|
||||
}
|
||||
"clean" => {
|
||||
if paths.len() > 0 {
|
||||
println!("\nclean takes no arguments\n");
|
||||
println!("\nclean does not take a path argument\n");
|
||||
usage(1, &opts, &subcommand_help, &extra_help);
|
||||
}
|
||||
Subcommand::Clean
|
||||
|
||||
Subcommand::Clean {
|
||||
all: matches.opt_present("all"),
|
||||
}
|
||||
}
|
||||
"dist" => {
|
||||
Subcommand::Dist {
|
||||
|
@ -27,10 +27,8 @@ pub fn install_docs(builder: &Builder, stage: u32, host: Interned<String>) {
|
||||
install_sh(builder, "docs", "rust-docs", stage, Some(host));
|
||||
}
|
||||
|
||||
pub fn install_std(builder: &Builder, stage: u32) {
|
||||
for target in &builder.build.targets {
|
||||
install_sh(builder, "std", "rust-std", stage, Some(*target));
|
||||
}
|
||||
pub fn install_std(builder: &Builder, stage: u32, target: Interned<String>) {
|
||||
install_sh(builder, "std", "rust-std", stage, Some(target));
|
||||
}
|
||||
|
||||
pub fn install_cargo(builder: &Builder, stage: u32, host: Interned<String>) {
|
||||
@ -41,6 +39,10 @@ pub fn install_rls(builder: &Builder, stage: u32, host: Interned<String>) {
|
||||
install_sh(builder, "rls", "rls", stage, Some(host));
|
||||
}
|
||||
|
||||
pub fn install_rustfmt(builder: &Builder, stage: u32, host: Interned<String>) {
|
||||
install_sh(builder, "rustfmt", "rustfmt", stage, Some(host));
|
||||
}
|
||||
|
||||
pub fn install_analysis(builder: &Builder, stage: u32, host: Interned<String>) {
|
||||
install_sh(builder, "analysis", "rust-analysis", stage, Some(host));
|
||||
}
|
||||
@ -175,19 +177,31 @@ install!((self, builder, _config),
|
||||
install_docs(builder, self.stage, self.target);
|
||||
};
|
||||
Std, "src/libstd", true, only_hosts: true, {
|
||||
builder.ensure(dist::Std {
|
||||
compiler: builder.compiler(self.stage, self.host),
|
||||
target: self.target
|
||||
});
|
||||
install_std(builder, self.stage);
|
||||
for target in &builder.build.targets {
|
||||
builder.ensure(dist::Std {
|
||||
compiler: builder.compiler(self.stage, self.host),
|
||||
target: *target
|
||||
});
|
||||
install_std(builder, self.stage, *target);
|
||||
}
|
||||
};
|
||||
Cargo, "cargo", _config.extended, only_hosts: true, {
|
||||
builder.ensure(dist::Cargo { stage: self.stage, target: self.target });
|
||||
install_cargo(builder, self.stage, self.target);
|
||||
};
|
||||
Rls, "rls", _config.extended, only_hosts: true, {
|
||||
builder.ensure(dist::Rls { stage: self.stage, target: self.target });
|
||||
install_rls(builder, self.stage, self.target);
|
||||
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() {
|
||||
install_rls(builder, self.stage, self.target);
|
||||
} else {
|
||||
println!("skipping Install RLS stage{} ({})", self.stage, self.target);
|
||||
}
|
||||
};
|
||||
Rustfmt, "rustfmt", _config.extended, only_hosts: true, {
|
||||
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() {
|
||||
install_rustfmt(builder, self.stage, self.target);
|
||||
} else {
|
||||
println!("skipping Install Rustfmt stage{} ({})", self.stage, self.target);
|
||||
}
|
||||
};
|
||||
Analysis, "analysis", _config.extended, only_hosts: false, {
|
||||
builder.ensure(dist::Analysis {
|
||||
|
@ -185,7 +185,7 @@ pub unsafe fn setup(build: &mut Build) {
|
||||
0, FALSE, DUPLICATE_SAME_ACCESS);
|
||||
|
||||
// If this failed, well at least we tried! An example of DuplicateHandle
|
||||
// failing in the past has been when the wrong python2 package spawed this
|
||||
// failing in the past has been when the wrong python2 package spawned this
|
||||
// build system (e.g. the `python2` package in MSYS instead of
|
||||
// `mingw-w64-x86_64-python2`. Not sure why it failed, but the "failure
|
||||
// mode" here is that we only clean everything up when the build system
|
||||
|
@ -190,6 +190,7 @@ mod job {
|
||||
pub use config::Config;
|
||||
use flags::Subcommand;
|
||||
use cache::{Interned, INTERNER};
|
||||
use toolstate::ToolState;
|
||||
|
||||
/// A structure representing a Rust compiler.
|
||||
///
|
||||
@ -222,6 +223,7 @@ pub struct Build {
|
||||
rust_info: channel::GitInfo,
|
||||
cargo_info: channel::GitInfo,
|
||||
rls_info: channel::GitInfo,
|
||||
rustfmt_info: channel::GitInfo,
|
||||
local_rebuild: bool,
|
||||
fail_fast: bool,
|
||||
verbosity: usize,
|
||||
@ -240,10 +242,11 @@ pub struct Build {
|
||||
lldb_python_dir: Option<String>,
|
||||
|
||||
// Runtime state filled in later on
|
||||
// target -> (cc, ar)
|
||||
cc: HashMap<Interned<String>, (cc::Tool, Option<PathBuf>)>,
|
||||
// host -> (cc, ar)
|
||||
// C/C++ compilers and archiver for all targets
|
||||
cc: HashMap<Interned<String>, cc::Tool>,
|
||||
cxx: HashMap<Interned<String>, cc::Tool>,
|
||||
ar: HashMap<Interned<String>, PathBuf>,
|
||||
// Misc
|
||||
crates: HashMap<Interned<String>, Crate>,
|
||||
is_sudo: bool,
|
||||
ci_env: CiEnv,
|
||||
@ -303,6 +306,7 @@ impl Build {
|
||||
let rust_info = channel::GitInfo::new(&config, &src);
|
||||
let cargo_info = channel::GitInfo::new(&config, &src.join("src/tools/cargo"));
|
||||
let rls_info = channel::GitInfo::new(&config, &src.join("src/tools/rls"));
|
||||
let rustfmt_info = channel::GitInfo::new(&config, &src.join("src/tools/rustfmt"));
|
||||
|
||||
Build {
|
||||
initial_rustc: config.initial_rustc.clone(),
|
||||
@ -322,8 +326,10 @@ impl Build {
|
||||
rust_info,
|
||||
cargo_info,
|
||||
rls_info,
|
||||
rustfmt_info,
|
||||
cc: HashMap::new(),
|
||||
cxx: HashMap::new(),
|
||||
ar: HashMap::new(),
|
||||
crates: HashMap::new(),
|
||||
lldb_version: None,
|
||||
lldb_python_dir: None,
|
||||
@ -345,8 +351,8 @@ impl Build {
|
||||
job::setup(self);
|
||||
}
|
||||
|
||||
if let Subcommand::Clean = self.config.cmd {
|
||||
return clean::clean(self);
|
||||
if let Subcommand::Clean { all } = self.config.cmd {
|
||||
return clean::clean(self, all);
|
||||
}
|
||||
|
||||
self.verbose("finding compilers");
|
||||
@ -383,16 +389,19 @@ impl Build {
|
||||
/// Clear out `dir` if `input` is newer.
|
||||
///
|
||||
/// After this executes, it will also ensure that `dir` exists.
|
||||
fn clear_if_dirty(&self, dir: &Path, input: &Path) {
|
||||
fn clear_if_dirty(&self, dir: &Path, input: &Path) -> bool {
|
||||
let stamp = dir.join(".stamp");
|
||||
let mut cleared = false;
|
||||
if mtime(&stamp) < mtime(input) {
|
||||
self.verbose(&format!("Dirty - {}", dir.display()));
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
cleared = true;
|
||||
} else if stamp.exists() {
|
||||
return
|
||||
return cleared;
|
||||
}
|
||||
t!(fs::create_dir_all(dir));
|
||||
t!(File::create(stamp));
|
||||
cleared
|
||||
}
|
||||
|
||||
/// Get the space-separated set of activated features for the standard
|
||||
@ -433,6 +442,12 @@ impl Build {
|
||||
if self.config.rust_optimize {"release"} else {"debug"}
|
||||
}
|
||||
|
||||
fn tools_dir(&self, compiler: Compiler) -> PathBuf {
|
||||
let out = self.out.join(&*compiler.host).join(format!("stage{}-tools-bin", compiler.stage));
|
||||
t!(fs::create_dir_all(&out));
|
||||
out
|
||||
}
|
||||
|
||||
/// Get the directory for incremental by-products when using the
|
||||
/// given compiler.
|
||||
fn incremental_dir(&self, compiler: Compiler) -> PathBuf {
|
||||
@ -612,7 +627,7 @@ impl Build {
|
||||
|
||||
/// Returns the path to the C compiler for the target specified.
|
||||
fn cc(&self, target: Interned<String>) -> &Path {
|
||||
self.cc[&target].0.path()
|
||||
self.cc[&target].path()
|
||||
}
|
||||
|
||||
/// Returns a list of flags to pass to the C compiler for the target
|
||||
@ -620,7 +635,7 @@ impl Build {
|
||||
fn cflags(&self, target: Interned<String>) -> Vec<String> {
|
||||
// Filter out -O and /O (the optimization flags) that we picked up from
|
||||
// cc-rs because the build scripts will determine that for themselves.
|
||||
let mut base = self.cc[&target].0.args().iter()
|
||||
let mut base = self.cc[&target].args().iter()
|
||||
.map(|s| s.to_string_lossy().into_owned())
|
||||
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
|
||||
.collect::<Vec<_>>();
|
||||
@ -644,7 +659,7 @@ impl Build {
|
||||
|
||||
/// Returns the path to the `ar` archive utility for the target specified.
|
||||
fn ar(&self, target: Interned<String>) -> Option<&Path> {
|
||||
self.cc[&target].1.as_ref().map(|p| &**p)
|
||||
self.ar.get(&target).map(|p| &**p)
|
||||
}
|
||||
|
||||
/// Returns the path to the C++ compiler for the target specified.
|
||||
@ -657,21 +672,17 @@ impl Build {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns flags to pass to the compiler to generate code for `target`.
|
||||
fn rustc_flags(&self, target: Interned<String>) -> Vec<String> {
|
||||
// New flags should be added here with great caution!
|
||||
//
|
||||
// It's quite unfortunate to **require** flags to generate code for a
|
||||
// target, so it should only be passed here if absolutely necessary!
|
||||
// Most default configuration should be done through target specs rather
|
||||
// than an entry here.
|
||||
|
||||
let mut base = Vec::new();
|
||||
if target != self.config.build && !target.contains("msvc") &&
|
||||
!target.contains("emscripten") {
|
||||
base.push(format!("-Clinker={}", self.cc(target).display()));
|
||||
/// Returns the path to the linker for the given target if it needs to be overriden.
|
||||
fn linker(&self, target: Interned<String>) -> Option<&Path> {
|
||||
if let Some(linker) = self.config.target_config.get(&target)
|
||||
.and_then(|c| c.linker.as_ref()) {
|
||||
Some(linker)
|
||||
} else if target != self.config.build &&
|
||||
!target.contains("msvc") && !target.contains("emscripten") {
|
||||
Some(self.cc(target))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
base
|
||||
}
|
||||
|
||||
/// Returns if this target should statically link the C runtime, if specified
|
||||
@ -807,6 +818,11 @@ impl Build {
|
||||
self.package_vers(&self.release_num("rls"))
|
||||
}
|
||||
|
||||
/// Returns the value of `package_vers` above for rustfmt
|
||||
fn rustfmt_package_vers(&self) -> String {
|
||||
self.package_vers(&self.release_num("rustfmt"))
|
||||
}
|
||||
|
||||
/// Returns the `version` string associated with this compiler for Rust
|
||||
/// itself.
|
||||
///
|
||||
@ -859,6 +875,30 @@ impl Build {
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates the actual toolstate of a tool.
|
||||
///
|
||||
/// The toolstates are saved to the file specified by the key
|
||||
/// `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) {
|
||||
use std::io::{Seek, SeekFrom};
|
||||
|
||||
if let Some(ref path) = self.config.save_toolstates {
|
||||
let mut file = t!(fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open(path));
|
||||
|
||||
let mut current_toolstates: HashMap<Box<str>, ToolState> =
|
||||
serde_json::from_reader(&mut file).unwrap_or_default();
|
||||
current_toolstates.insert(tool.into(), state);
|
||||
t!(file.seek(SeekFrom::Start(0)));
|
||||
t!(file.set_len(0));
|
||||
t!(serde_json::to_writer(file, ¤t_toolstates));
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a list of crates from a root crate.
|
||||
///
|
||||
/// Returns Vec<(crate, path to crate, is_root_crate)>
|
||||
|
@ -52,11 +52,8 @@ check:
|
||||
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
|
||||
check-aux:
|
||||
$(Q)$(BOOTSTRAP) test \
|
||||
src/tools/cargotest \
|
||||
src/tools/cargo \
|
||||
src/tools/rls \
|
||||
src/tools/rustfmt \
|
||||
src/tools/miri \
|
||||
src/tools/cargotest \
|
||||
src/test/pretty \
|
||||
src/test/run-pass/pretty \
|
||||
src/test/run-fail/pretty \
|
||||
|
@ -110,10 +110,7 @@ impl Step for Llvm {
|
||||
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon",
|
||||
};
|
||||
|
||||
let llvm_exp_targets = match build.config.llvm_experimental_targets {
|
||||
Some(ref s) => s,
|
||||
None => "",
|
||||
};
|
||||
let llvm_exp_targets = &build.config.llvm_experimental_targets;
|
||||
|
||||
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
|
||||
|
||||
@ -227,6 +224,13 @@ impl Step for Llvm {
|
||||
cfg.build_arg("-j").build_arg(build.jobs().to_string());
|
||||
cfg.define("CMAKE_C_FLAGS", build.cflags(target).join(" "));
|
||||
cfg.define("CMAKE_CXX_FLAGS", build.cflags(target).join(" "));
|
||||
if let Some(ar) = build.ar(target) {
|
||||
if ar.is_absolute() {
|
||||
// LLVM build breaks if `CMAKE_AR` is a relative path, for some reason it
|
||||
// tries to resolve this path in the LLVM build directory.
|
||||
cfg.define("CMAKE_AR", sanitize_cc(ar));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
configure_compilers(&mut cfg);
|
||||
@ -252,11 +256,14 @@ fn check_llvm_version(build: &Build, llvm_config: &Path) {
|
||||
|
||||
let mut cmd = Command::new(llvm_config);
|
||||
let version = output(cmd.arg("--version"));
|
||||
if version.starts_with("3.5") || version.starts_with("3.6") ||
|
||||
version.starts_with("3.7") {
|
||||
return
|
||||
let mut parts = version.split('.').take(2)
|
||||
.filter_map(|s| s.parse::<u32>().ok());
|
||||
if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
|
||||
if major > 3 || (major == 3 && minor >= 9) {
|
||||
return
|
||||
}
|
||||
}
|
||||
panic!("\n\nbad LLVM version: {}, need >=3.5\n\n", version)
|
||||
panic!("\n\nbad LLVM version: {}, need >=3.9\n\n", version)
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
@ -309,13 +316,13 @@ impl Step for TestHelpers {
|
||||
.warnings(false)
|
||||
.debug(false)
|
||||
.file(build.src.join("src/rt/rust_test_helpers.c"))
|
||||
.compile("librust_test_helpers.a");
|
||||
.compile("rust_test_helpers");
|
||||
}
|
||||
}
|
||||
|
||||
const OPENSSL_VERS: &'static str = "1.0.2k";
|
||||
const OPENSSL_VERS: &'static str = "1.0.2m";
|
||||
const OPENSSL_SHA256: &'static str =
|
||||
"6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0";
|
||||
"8c6ff15ec6b319b50788f42c7abc2890c08ba5a1cdcd3810eb9092deada37b0f";
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Openssl {
|
||||
@ -352,34 +359,51 @@ impl Step for Openssl {
|
||||
// originally from https://www.openssl.org/source/...
|
||||
let url = format!("https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/{}",
|
||||
name);
|
||||
let mut ok = false;
|
||||
let mut last_error = None;
|
||||
for _ in 0..3 {
|
||||
let status = Command::new("curl")
|
||||
.arg("-o").arg(&tmp)
|
||||
.arg("-f") // make curl fail if the URL does not return HTTP 200
|
||||
.arg(&url)
|
||||
.status()
|
||||
.expect("failed to spawn curl");
|
||||
if status.success() {
|
||||
ok = true;
|
||||
break
|
||||
|
||||
// Retry if download failed.
|
||||
if !status.success() {
|
||||
last_error = Some(status.to_string());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ensure the hash is correct.
|
||||
let mut shasum = if target.contains("apple") || build.build.contains("netbsd") {
|
||||
let mut cmd = Command::new("shasum");
|
||||
cmd.arg("-a").arg("256");
|
||||
cmd
|
||||
} else {
|
||||
Command::new("sha256sum")
|
||||
};
|
||||
let output = output(&mut shasum.arg(&tmp));
|
||||
let found = output.split_whitespace().next().unwrap();
|
||||
|
||||
// If the hash is wrong, probably the download is incomplete or S3 served an error
|
||||
// page. In any case, retry.
|
||||
if found != OPENSSL_SHA256 {
|
||||
last_error = Some(format!(
|
||||
"downloaded openssl sha256 different\n\
|
||||
expected: {}\n\
|
||||
found: {}\n",
|
||||
OPENSSL_SHA256,
|
||||
found
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Everything is fine, so exit the retry loop.
|
||||
last_error = None;
|
||||
break;
|
||||
}
|
||||
if !ok {
|
||||
panic!("failed to download openssl source")
|
||||
}
|
||||
let mut shasum = if target.contains("apple") {
|
||||
let mut cmd = Command::new("shasum");
|
||||
cmd.arg("-a").arg("256");
|
||||
cmd
|
||||
} else {
|
||||
Command::new("sha256sum")
|
||||
};
|
||||
let output = output(&mut shasum.arg(&tmp));
|
||||
let found = output.split_whitespace().next().unwrap();
|
||||
if found != OPENSSL_SHA256 {
|
||||
panic!("downloaded openssl sha256 different\n\
|
||||
expected: {}\n\
|
||||
found: {}\n", OPENSSL_SHA256, found);
|
||||
if let Some(error) = last_error {
|
||||
panic!("failed to download openssl source: {}", error);
|
||||
}
|
||||
t!(fs::rename(&tmp, &tarball));
|
||||
}
|
||||
@ -387,7 +411,7 @@ impl Step for Openssl {
|
||||
let dst = build.openssl_install_dir(target).unwrap();
|
||||
drop(fs::remove_dir_all(&obj));
|
||||
drop(fs::remove_dir_all(&dst));
|
||||
build.run(Command::new("tar").arg("xf").arg(&tarball).current_dir(&out));
|
||||
build.run(Command::new("tar").arg("zxf").arg(&tarball).current_dir(&out));
|
||||
|
||||
let mut configure = Command::new("perl");
|
||||
configure.arg(obj.join("Configure"));
|
||||
@ -419,10 +443,12 @@ impl Step for Openssl {
|
||||
"powerpc64-unknown-linux-gnu" => "linux-ppc64",
|
||||
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
|
||||
"s390x-unknown-linux-gnu" => "linux64-s390x",
|
||||
"sparc64-unknown-linux-gnu" => "linux64-sparcv9",
|
||||
"sparc64-unknown-netbsd" => "BSD-sparc64",
|
||||
"x86_64-apple-darwin" => "darwin64-x86_64-cc",
|
||||
"x86_64-linux-android" => "linux-x86_64",
|
||||
"x86_64-unknown-freebsd" => "BSD-x86_64",
|
||||
"x86_64-unknown-dragonfly" => "BSD-x86_64",
|
||||
"x86_64-unknown-linux-gnu" => "linux-x86_64",
|
||||
"x86_64-unknown-linux-musl" => "linux-x86_64",
|
||||
"x86_64-unknown-netbsd" => "BSD-x86_64",
|
||||
|
@ -78,7 +78,7 @@ pub fn check(build: &mut Build) {
|
||||
}
|
||||
|
||||
let mut cmd_finder = Finder::new();
|
||||
// If we've got a git directory we're gona need git to update
|
||||
// If we've got a git directory we're gonna need git to update
|
||||
// submodules and learn about various other aspects.
|
||||
if build.rust_info.is_git() {
|
||||
cmd_finder.must_have("git");
|
||||
|
@ -11,7 +11,7 @@
|
||||
use std::fs;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::process::{Command, exit};
|
||||
|
||||
use Mode;
|
||||
use Compiler;
|
||||
@ -38,24 +38,40 @@ impl Step for CleanTools {
|
||||
run.never()
|
||||
}
|
||||
|
||||
/// Build a tool in `src/tools`
|
||||
///
|
||||
/// This will build the specified tool with the specified `host` compiler in
|
||||
/// `stage` into the normal cargo output directory.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let mode = self.mode;
|
||||
|
||||
let stamp = match mode {
|
||||
Mode::Libstd => libstd_stamp(build, compiler, target),
|
||||
Mode::Libtest => libtest_stamp(build, compiler, target),
|
||||
Mode::Librustc => librustc_stamp(build, compiler, target),
|
||||
_ => panic!(),
|
||||
// This is for the original compiler, but if we're forced to use stage 1, then
|
||||
// std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
|
||||
// we copy the libs forward.
|
||||
let tools_dir = build.stage_out(compiler, Mode::Tool);
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler
|
||||
};
|
||||
let out_dir = build.cargo_out(compiler, Mode::Tool, target);
|
||||
build.clear_if_dirty(&out_dir, &stamp);
|
||||
|
||||
for &cur_mode in &[Mode::Libstd, Mode::Libtest, Mode::Librustc] {
|
||||
let stamp = match cur_mode {
|
||||
Mode::Libstd => libstd_stamp(build, compiler, target),
|
||||
Mode::Libtest => libtest_stamp(build, compiler, target),
|
||||
Mode::Librustc => librustc_stamp(build, compiler, target),
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
if build.clear_if_dirty(&tools_dir, &stamp) {
|
||||
break;
|
||||
}
|
||||
|
||||
// If we are a rustc tool, and std changed, we also need to clear ourselves out -- our
|
||||
// dependencies depend on std. Therefore, we iterate up until our own mode.
|
||||
if mode == cur_mode {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +86,7 @@ struct ToolBuild {
|
||||
}
|
||||
|
||||
impl Step for ToolBuild {
|
||||
type Output = PathBuf;
|
||||
type Output = Option<PathBuf>;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
run.never()
|
||||
@ -80,7 +96,7 @@ impl Step for ToolBuild {
|
||||
///
|
||||
/// This will build the specified tool with the specified `host` compiler in
|
||||
/// `stage` into the normal cargo output directory.
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
@ -99,8 +115,35 @@ impl Step for ToolBuild {
|
||||
println!("Building stage{} tool {} ({})", compiler.stage, tool, target);
|
||||
|
||||
let mut cargo = prepare_tool_cargo(builder, compiler, target, "build", path);
|
||||
build.run_expecting(&mut cargo, expectation);
|
||||
build.cargo_out(compiler, Mode::Tool, target).join(exe(tool, &compiler.host))
|
||||
let is_expected = build.try_run(&mut cargo, expectation);
|
||||
// If the expectation is "Failing", `try_run` returning true actually
|
||||
// means a build-failure is successfully observed, i.e. the tool is
|
||||
// broken. Thus the XOR here.
|
||||
// Sorry for the complicated logic, but we can remove this expectation
|
||||
// logic after #45861 is fully fixed.
|
||||
build.save_toolstate(tool, if is_expected ^ (expectation == BuildExpectation::Failing) {
|
||||
ToolState::Compiling
|
||||
} else {
|
||||
ToolState::Broken
|
||||
});
|
||||
|
||||
if !is_expected {
|
||||
if expectation == BuildExpectation::None {
|
||||
exit(1);
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
if expectation == BuildExpectation::Succeeding || expectation == BuildExpectation::None {
|
||||
let cargo_out = build.cargo_out(compiler, Mode::Tool, target)
|
||||
.join(exe(tool, &compiler.host));
|
||||
let bin = build.tools_dir(compiler).join(exe(tool, &compiler.host));
|
||||
copy(&cargo_out, &bin);
|
||||
Some(bin)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,12 +212,12 @@ macro_rules! tool {
|
||||
}
|
||||
|
||||
pub fn tool_default_stage(&self, tool: Tool) -> u32 {
|
||||
// Compile the error-index in the top stage as it depends on
|
||||
// rustdoc, so we want to avoid recompiling rustdoc twice if we
|
||||
// can. Otherwise compile everything else in stage0 as there's
|
||||
// no need to rebootstrap everything
|
||||
// Compile the error-index in the same stage as rustdoc to avoid
|
||||
// recompiling rustdoc twice if we can. Otherwise compile
|
||||
// everything else in stage0 as there's no need to rebootstrap
|
||||
// everything.
|
||||
match tool {
|
||||
Tool::ErrorIndex => self.top_stage,
|
||||
Tool::ErrorIndex if self.top_stage >= 2 => self.top_stage,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
@ -209,7 +252,7 @@ macro_rules! tool {
|
||||
mode: $mode,
|
||||
path: $path,
|
||||
expectation: BuildExpectation::None,
|
||||
})
|
||||
}).expect("expected to build -- BuildExpectation::None")
|
||||
}
|
||||
}
|
||||
)+
|
||||
@ -257,7 +300,7 @@ impl Step for RemoteTestServer {
|
||||
mode: Mode::Libstd,
|
||||
path: "src/tools/remote-test-server",
|
||||
expectation: BuildExpectation::None,
|
||||
})
|
||||
}).expect("expected to build -- BuildExpectation::None")
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,74 +418,70 @@ impl Step for Cargo {
|
||||
mode: Mode::Librustc,
|
||||
path: "src/tools/cargo",
|
||||
expectation: BuildExpectation::None,
|
||||
})
|
||||
}).expect("BuildExpectation::None - expected to build")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Clippy {
|
||||
pub compiler: Compiler,
|
||||
pub target: Interned<String>,
|
||||
macro_rules! tool_extended {
|
||||
(($sel:ident, $builder:ident),
|
||||
$($name:ident,
|
||||
$toolstate:ident,
|
||||
$path:expr,
|
||||
$tool_name:expr,
|
||||
$extra_deps:block;)+) => {
|
||||
$(
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct $name {
|
||||
pub compiler: Compiler,
|
||||
pub target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for $name {
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path($path).default_condition(builder.build.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure($name {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
fn run($sel, $builder: &Builder) -> Option<PathBuf> {
|
||||
$extra_deps
|
||||
let toolstate = $builder.build.config.toolstate.$toolstate;
|
||||
$builder.ensure(ToolBuild {
|
||||
compiler: $sel.compiler,
|
||||
target: $sel.target,
|
||||
tool: $tool_name,
|
||||
mode: Mode::Librustc,
|
||||
path: $path,
|
||||
expectation: toolstate.passes(ToolState::Compiling),
|
||||
})
|
||||
}
|
||||
}
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
impl Step for Clippy {
|
||||
type Output = PathBuf;
|
||||
const DEFAULT: bool = false;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
run.path("src/tools/clippy")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Clippy {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
tool_extended!((self, builder),
|
||||
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
|
||||
Clippy, clippy, "src/tools/clippy", "clippy-driver", {
|
||||
// Clippy depends on procedural macros (serde), which requires a full host
|
||||
// compiler to be available, so we need to depend on that.
|
||||
builder.ensure(compile::Rustc {
|
||||
compiler: self.compiler,
|
||||
target: builder.build.build,
|
||||
});
|
||||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
tool: "clippy",
|
||||
mode: Mode::Librustc,
|
||||
path: "src/tools/clippy",
|
||||
expectation: builder.build.config.toolstate.clippy.passes(ToolState::Compiling),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Rls {
|
||||
pub compiler: Compiler,
|
||||
pub target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for Rls {
|
||||
type Output = PathBuf;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/rls").default_condition(builder.build.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rls {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
};
|
||||
Miri, miri, "src/tools/miri", "miri", {};
|
||||
Rls, rls, "src/tools/rls", "rls", {
|
||||
builder.ensure(native::Openssl {
|
||||
target: self.target,
|
||||
});
|
||||
@ -452,87 +491,9 @@ impl Step for Rls {
|
||||
compiler: self.compiler,
|
||||
target: builder.build.build,
|
||||
});
|
||||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
tool: "rls",
|
||||
mode: Mode::Librustc,
|
||||
path: "src/tools/rls",
|
||||
expectation: builder.build.config.toolstate.rls.passes(ToolState::Compiling),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Rustfmt {
|
||||
pub compiler: Compiler,
|
||||
pub target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for Rustfmt {
|
||||
type Output = PathBuf;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/rustfmt").default_condition(builder.build.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rustfmt {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
tool: "rustfmt",
|
||||
mode: Mode::Librustc,
|
||||
path: "src/tools/rustfmt",
|
||||
expectation: builder.build.config.toolstate.rustfmt.passes(ToolState::Compiling),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Miri {
|
||||
pub compiler: Compiler,
|
||||
pub target: Interned<String>,
|
||||
}
|
||||
|
||||
impl Step for Miri {
|
||||
type Output = PathBuf;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let build_miri = run.builder.build.config.test_miri;
|
||||
run.path("src/tools/miri").default_condition(build_miri)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Miri {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
tool: "miri",
|
||||
mode: Mode::Librustc,
|
||||
path: "src/tools/miri",
|
||||
expectation: builder.build.config.toolstate.miri.passes(ToolState::Compiling),
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
|
||||
);
|
||||
|
||||
impl<'a> Builder<'a> {
|
||||
/// Get a `Command` which is ready to run `tool` in `stage` built for
|
||||
@ -561,7 +522,7 @@ impl<'a> Builder<'a> {
|
||||
if compiler.host.contains("msvc") {
|
||||
let curpaths = env::var_os("PATH").unwrap_or_default();
|
||||
let curpaths = env::split_paths(&curpaths).collect::<Vec<_>>();
|
||||
for &(ref k, ref v) in self.cc[&compiler.host].0.env() {
|
||||
for &(ref k, ref v) in self.cc[&compiler.host].env() {
|
||||
if k != "PATH" {
|
||||
continue
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
use build_helper::BuildExpectation;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
/// Whether a tool can be compiled, tested or neither
|
||||
pub enum ToolState {
|
||||
/// The tool compiles successfully, but the test suite fails
|
||||
@ -31,6 +31,13 @@ impl ToolState {
|
||||
BuildExpectation::Failing
|
||||
}
|
||||
}
|
||||
|
||||
pub fn testing(&self) -> bool {
|
||||
match *self {
|
||||
ToolState::Testing => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ToolState {
|
||||
|
@ -14,8 +14,9 @@
|
||||
//! not a lot of interesting happenings here unfortunately.
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io::{self, Write};
|
||||
use std::str;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::time::{SystemTime, Instant};
|
||||
@ -50,6 +51,22 @@ pub fn copy(src: &Path, dst: &Path) {
|
||||
t!(filetime::set_file_times(dst, atime, mtime));
|
||||
}
|
||||
|
||||
pub fn read_stamp_file(stamp: &Path) -> Vec<PathBuf> {
|
||||
let mut paths = Vec::new();
|
||||
let mut contents = Vec::new();
|
||||
t!(t!(File::open(stamp)).read_to_end(&mut contents));
|
||||
// This is the method we use for extracting paths from the stamp file passed to us. See
|
||||
// run_cargo for more information (in compile.rs).
|
||||
for part in contents.split(|b| *b == 0) {
|
||||
if part.is_empty() {
|
||||
continue
|
||||
}
|
||||
let path = PathBuf::from(t!(str::from_utf8(part)));
|
||||
paths.push(path);
|
||||
}
|
||||
paths
|
||||
}
|
||||
|
||||
/// Copies the `src` directory recursively to `dst`. Both are assumed to exist
|
||||
/// when this function is called.
|
||||
pub fn cp_r(src: &Path, dst: &Path) {
|
||||
|
@ -138,27 +138,6 @@ pub fn gnu_target(target: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
|
||||
if target.contains("msvc") {
|
||||
None
|
||||
} else if target.contains("musl") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else if target.contains("openbsd") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else {
|
||||
let parent = cc.parent().unwrap();
|
||||
let file = cc.file_name().unwrap().to_str().unwrap();
|
||||
for suffix in &["gcc", "cc", "clang"] {
|
||||
if let Some(idx) = file.rfind(suffix) {
|
||||
let mut file = file[..idx].to_owned();
|
||||
file.push_str("ar");
|
||||
return Some(parent.join(&file));
|
||||
}
|
||||
}
|
||||
Some(parent.join(file))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make(host: &str) -> PathBuf {
|
||||
if host.contains("bitrig") || host.contains("dragonfly") ||
|
||||
host.contains("freebsd") || host.contains("netbsd") ||
|
||||
@ -211,6 +190,9 @@ pub fn mtime(path: &Path) -> FileTime {
|
||||
///
|
||||
/// Uses last-modified time checks to verify this.
|
||||
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
|
||||
if !dst.exists() {
|
||||
return false;
|
||||
}
|
||||
let threshold = mtime(dst);
|
||||
let meta = match fs::metadata(src) {
|
||||
Ok(meta) => meta,
|
||||
|
@ -22,6 +22,48 @@ Images will output artifacts in an `obj` dir at the root of a repository.
|
||||
- `scripts` contains files shared by docker images
|
||||
- `disabled` contains images that are not built on travis
|
||||
|
||||
## Docker Toolbox on Windows
|
||||
|
||||
For Windows before Windows 10, the docker images can be run on Windows via
|
||||
[Docker Toolbox]. There are several preparation needs to be made before running
|
||||
a Docker image.
|
||||
|
||||
1. Stop the virtual machine from the terminal with `docker-machine stop`
|
||||
|
||||
2. If your Rust source is placed outside of `C:\Users\**`, e.g. if you place the
|
||||
repository in the `E:\rust` folder, please add a shared folder from
|
||||
VirtualBox by:
|
||||
|
||||
1. Select the "default" virtual machine inside VirtualBox, then click
|
||||
"Settings"
|
||||
2. Go to "Shared Folders", click "Add shared folder" (the folder icon with
|
||||
a plus sign), fill in the following information, then click "OK":
|
||||
|
||||
* Folder path: `E:\rust`
|
||||
* Folder name: `e/rust`
|
||||
* Read-only: ☐ *unchecked*
|
||||
* Auto-mount: ☑ *checked*
|
||||
* Make Permanent: ☑ *checked*
|
||||
|
||||
3. VirtualBox might not support creating symbolic links inside a shared folder
|
||||
by default. You can enable it manually by running these from `cmd.exe`:
|
||||
|
||||
```bat
|
||||
cd "C:\Program Files\Oracle\VirtualBox"
|
||||
VBoxManage setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/e/rust 1
|
||||
:: ^~~~~~
|
||||
:: folder name
|
||||
```
|
||||
|
||||
4. Restart the virtual machine from terminal with `docker-machine start`.
|
||||
|
||||
To run the image,
|
||||
|
||||
1. Launch the "Docker Quickstart Terminal".
|
||||
2. Execute `./src/ci/docker/run.sh $image_name` as explained at the beginning.
|
||||
|
||||
[Docker Toolbox]: https://www.docker.com/products/docker-toolbox
|
||||
|
||||
## Cross toolchains
|
||||
|
||||
A number of these images take quite a long time to compile as they're building
|
||||
@ -137,7 +179,7 @@ For targets: `armv7-unknown-linux-gnueabihf`
|
||||
libraries like jemalloc. See the mk/cfg/arm(v7)-uknown-linux-gnueabi{,hf}.mk
|
||||
file in Rust's source code.
|
||||
|
||||
## `aarch64-linux-gnu.config`
|
||||
### `aarch64-linux-gnu.config`
|
||||
|
||||
For targets: `aarch64-unknown-linux-gnu`
|
||||
|
||||
@ -150,7 +192,7 @@ For targets: `aarch64-unknown-linux-gnu`
|
||||
- C compiler > gcc version = 5.2.0
|
||||
- C compiler > C++ = ENABLE -- to cross compile LLVM
|
||||
|
||||
## `powerpc-linux-gnu.config`
|
||||
### `powerpc-linux-gnu.config`
|
||||
|
||||
For targets: `powerpc-unknown-linux-gnu`
|
||||
|
||||
@ -165,7 +207,7 @@ For targets: `powerpc-unknown-linux-gnu`
|
||||
- C compiler > gcc version = 4.9.3
|
||||
- C compiler > C++ = ENABLE -- to cross compile LLVM
|
||||
|
||||
## `powerpc64-linux-gnu.config`
|
||||
### `powerpc64-linux-gnu.config`
|
||||
|
||||
For targets: `powerpc64-unknown-linux-gnu`
|
||||
|
||||
@ -184,7 +226,7 @@ For targets: `powerpc64-unknown-linux-gnu`
|
||||
|
||||
(+) These CPU options match the configuration of the toolchains in RHEL6.
|
||||
|
||||
## `s390x-linux-gnu.config`
|
||||
### `s390x-linux-gnu.config`
|
||||
|
||||
For targets: `s390x-unknown-linux-gnu`
|
||||
|
||||
|
@ -5,21 +5,27 @@ 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-r13b-linux-x86_64.zip arm 9
|
||||
download_and_make_toolchain android-ndk-r15c-linux-x86_64.zip arm 14
|
||||
|
||||
# Note:
|
||||
# Do not upgrade to `openjdk-9-jre-headless`, as it will cause certificate error
|
||||
# when installing the Android SDK (see PR #45193). This is unfortunate, but
|
||||
# every search result suggested either disabling HTTPS or replacing JDK 9 by
|
||||
# JDK 8 as the solution (e.g. https://stackoverflow.com/q/41421340). :|
|
||||
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 \
|
||||
openjdk-8-jre-headless \
|
||||
tzdata
|
||||
|
||||
COPY scripts/android-sdk.sh /scripts/
|
||||
RUN . /scripts/android-sdk.sh && \
|
||||
download_and_create_avd tools_r25.2.5-linux.zip armeabi-v7a 18
|
||||
download_and_create_avd 4333796 armeabi-v7a 18
|
||||
|
||||
ENV PATH=$PATH:/android/sdk/emulator
|
||||
ENV PATH=$PATH:/android/sdk/tools
|
||||
ENV PATH=$PATH:/android/sdk/platform-tools
|
||||
|
||||
@ -27,7 +33,7 @@ ENV TARGETS=arm-linux-androideabi
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--target=$TARGETS \
|
||||
--arm-linux-androideabi-ndk=/android/ndk/arm-9
|
||||
--arm-linux-androideabi-ndk=/android/ndk/arm-14
|
||||
|
||||
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
|
||||
|
||||
|
@ -16,6 +16,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
COPY scripts/emscripten.sh /scripts/
|
||||
RUN bash /scripts/emscripten.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/emsdk-portable
|
||||
ENV PATH=$PATH:/emsdk-portable/clang/e1.37.13_64bit/
|
||||
ENV PATH=$PATH:/emsdk-portable/emscripten/1.37.13/
|
||||
@ -29,6 +32,3 @@ ENV TARGETS=asmjs-unknown-emscripten
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS
|
||||
|
||||
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
@ -31,7 +31,7 @@ WORKDIR /build
|
||||
# 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 disabled/aarch64-gnu/config /build/.config
|
||||
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 && \
|
||||
|
@ -5,7 +5,7 @@ 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-r13b-linux-x86_64.zip arm64 21
|
||||
download_and_make_toolchain android-ndk-r15c-linux-x86_64.zip arm64 21
|
||||
|
||||
ENV PATH=$PATH:/android/ndk/arm64-21/bin
|
||||
|
||||
|
@ -5,17 +5,17 @@ RUN sh /scripts/android-base-apt-get.sh
|
||||
|
||||
COPY scripts/android-ndk.sh /scripts/
|
||||
RUN . /scripts/android-ndk.sh && \
|
||||
download_ndk android-ndk-r13b-linux-x86_64.zip && \
|
||||
make_standalone_toolchain arm 9 && \
|
||||
download_ndk android-ndk-r15c-linux-x86_64.zip && \
|
||||
make_standalone_toolchain arm 14 && \
|
||||
make_standalone_toolchain arm 21 && \
|
||||
remove_ndk
|
||||
|
||||
RUN chmod 777 /android/ndk && \
|
||||
ln -s /android/ndk/arm-21 /android/ndk/arm
|
||||
|
||||
ENV PATH=$PATH:/android/ndk/arm-9/bin
|
||||
ENV PATH=$PATH:/android/ndk/arm-14/bin
|
||||
|
||||
ENV DEP_Z_ROOT=/android/ndk/arm-9/sysroot/usr/
|
||||
ENV DEP_Z_ROOT=/android/ndk/arm-14/sysroot/usr/
|
||||
|
||||
ENV HOSTS=armv7-linux-androideabi
|
||||
|
||||
@ -27,18 +27,18 @@ ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-extended \
|
||||
--enable-cargo-openssl-static
|
||||
|
||||
# We support api level 9, but api level 21 is required to build llvm. To
|
||||
# We support api level 14, but api level 21 is required to build llvm. To
|
||||
# overcome this problem we use a ndk with api level 21 to build llvm and then
|
||||
# switch to a ndk with api level 9 to complete the build. When the linker is
|
||||
# switch to a ndk with api level 14 to complete the build. When the linker is
|
||||
# invoked there are missing symbols (like sigsetempty, not available with api
|
||||
# level 9), the default linker behavior is to generate an error, to allow the
|
||||
# level 14), the default linker behavior is to generate an error, to allow the
|
||||
# build to finish we use --warn-unresolved-symbols. Note that the missing
|
||||
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
|
||||
ENV SCRIPT \
|
||||
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
|
||||
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
|
||||
rm /android/ndk/arm && \
|
||||
ln -s /android/ndk/arm-9 /android/ndk/arm && \
|
||||
ln -s /android/ndk/arm-14 /android/ndk/arm && \
|
||||
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
|
@ -5,17 +5,17 @@ RUN sh /scripts/android-base-apt-get.sh
|
||||
|
||||
COPY scripts/android-ndk.sh /scripts/
|
||||
RUN . /scripts/android-ndk.sh && \
|
||||
download_ndk android-ndk-r13b-linux-x86_64.zip && \
|
||||
make_standalone_toolchain x86 9 && \
|
||||
download_ndk android-ndk-r15c-linux-x86_64.zip && \
|
||||
make_standalone_toolchain x86 14 && \
|
||||
make_standalone_toolchain x86 21 && \
|
||||
remove_ndk
|
||||
|
||||
RUN chmod 777 /android/ndk && \
|
||||
ln -s /android/ndk/x86-21 /android/ndk/x86
|
||||
|
||||
ENV PATH=$PATH:/android/ndk/x86-9/bin
|
||||
ENV PATH=$PATH:/android/ndk/x86-14/bin
|
||||
|
||||
ENV DEP_Z_ROOT=/android/ndk/x86-9/sysroot/usr/
|
||||
ENV DEP_Z_ROOT=/android/ndk/x86-14/sysroot/usr/
|
||||
|
||||
ENV HOSTS=i686-linux-android
|
||||
|
||||
@ -27,18 +27,18 @@ ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-extended \
|
||||
--enable-cargo-openssl-static
|
||||
|
||||
# We support api level 9, but api level 21 is required to build llvm. To
|
||||
# We support api level 14, but api level 21 is required to build llvm. To
|
||||
# overcome this problem we use a ndk with api level 21 to build llvm and then
|
||||
# switch to a ndk with api level 9 to complete the build. When the linker is
|
||||
# switch to a ndk with api level 14 to complete the build. When the linker is
|
||||
# invoked there are missing symbols (like sigsetempty, not available with api
|
||||
# level 9), the default linker behavior is to generate an error, to allow the
|
||||
# level 14), the default linker behavior is to generate an error, to allow the
|
||||
# build to finish we use --warn-unresolved-symbols. Note that the missing
|
||||
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
|
||||
ENV SCRIPT \
|
||||
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
|
||||
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
|
||||
rm /android/ndk/x86 && \
|
||||
ln -s /android/ndk/x86-9 /android/ndk/x86 && \
|
||||
ln -s /android/ndk/x86-14 /android/ndk/x86 && \
|
||||
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
|
@ -5,7 +5,7 @@ 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-r13b-linux-x86_64.zip x86_64 21
|
||||
download_and_make_toolchain android-ndk-r15c-linux-x86_64.zip x86_64 21
|
||||
|
||||
ENV PATH=$PATH:/android/ndk/x86_64-21/bin
|
||||
|
||||
|
36
src/ci/docker/disabled/dist-x86_64-dragonfly/Dockerfile
Normal file
36
src/ci/docker/disabled/dist-x86_64-dragonfly/Dockerfile
Normal file
@ -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 \
|
||||
python2.7 \
|
||||
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 --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
120
src/ci/docker/disabled/dist-x86_64-dragonfly/build-toolchain.sh
Executable file
120
src/ci/docker/disabled/dist-x86_64-dragonfly/build-toolchain.sh
Executable file
@ -0,0 +1,120 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
ARCH=x86_64
|
||||
PATCH_TOOLCHAIN=$1
|
||||
BINUTILS=2.25.1
|
||||
GCC=6.4.0
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
on_err="
|
||||
echo ERROR: An error was encountered with the build.
|
||||
cat /tmp/build.log
|
||||
exit 1
|
||||
"
|
||||
trap "$on_err" ERR
|
||||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
|
||||
PING_LOOP_PID=$!
|
||||
$@ &> /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
||||
|
||||
mkdir binutils
|
||||
cd binutils
|
||||
|
||||
# First up, build binutils
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-$BINUTILS/configure \
|
||||
--target=$ARCH-unknown-dragonfly
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
cd ../..
|
||||
rm -rf binutils
|
||||
|
||||
# Next, download the DragonFly libc and relevant header files
|
||||
|
||||
URL=http://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-5.0.0_REL.iso.bz2
|
||||
mkdir dragonfly
|
||||
curl $URL | bzcat | bsdtar xf - -C dragonfly ./usr/include ./usr/lib ./lib
|
||||
|
||||
dst=/usr/local/$ARCH-unknown-dragonfly
|
||||
|
||||
mkdir -p $dst/lib
|
||||
cp -r dragonfly/usr/include $dst/
|
||||
cp dragonfly/usr/lib/crt1.o $dst/lib
|
||||
cp dragonfly/usr/lib/Scrt1.o $dst/lib
|
||||
cp dragonfly/usr/lib/crti.o $dst/lib
|
||||
cp dragonfly/usr/lib/crtn.o $dst/lib
|
||||
cp dragonfly/usr/lib/libc.a $dst/lib
|
||||
cp dragonfly/usr/lib/libutil.a $dst/lib
|
||||
cp dragonfly/usr/lib/libm.a $dst/lib
|
||||
cp dragonfly/usr/lib/librt.so.0 $dst/lib
|
||||
cp dragonfly/usr/lib/libexecinfo.so.1 $dst/lib
|
||||
cp dragonfly/lib/libc.so.8 $dst/lib
|
||||
cp dragonfly/lib/libm.so.4 $dst/lib
|
||||
cp dragonfly/lib/libutil.so.4 $dst/lib
|
||||
cp dragonfly/usr/lib/libpthread.so $dst/lib/libpthread.so
|
||||
cp dragonfly/usr/lib/thread/libthread_xu.so.2 $dst/lib/libpthread.so.0
|
||||
|
||||
ln -s libc.so.8 $dst/lib/libc.so
|
||||
ln -s libm.so.4 $dst/lib/libm.so
|
||||
ln -s librt.so.0 $dst/lib/librt.so
|
||||
ln -s libutil.so.4 $dst/lib/libutil.so
|
||||
ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so
|
||||
rm -rf dragonfly
|
||||
|
||||
# Finally, download and build gcc to target DragonFly
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf -
|
||||
cd gcc-$GCC
|
||||
|
||||
# The following three patches are taken from DragonFly's dports collection:
|
||||
# https://github.com/DragonFlyBSD/DPorts/tree/master/lang/gcc5
|
||||
# The dports specification for gcc5 contains a few more patches, but they are
|
||||
# not relevant in this situation, as they are for a language we don't need
|
||||
# (e.g. java), or a platform which is not supported by DragonFly (e.g. i386,
|
||||
# powerpc64, ia64, arm).
|
||||
#
|
||||
# These patches probably only need to be updated in case the gcc version is
|
||||
# updated.
|
||||
|
||||
patch -p0 < $PATCH_TOOLCHAIN
|
||||
|
||||
./contrib/download_prerequisites
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=$ARCH-unknown-dragonfly \
|
||||
--disable-multilib \
|
||||
--disable-nls \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libcilkrts \
|
||||
--disable-libada \
|
||||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-lto
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
cd ../..
|
||||
rm -rf gcc
|
23
src/ci/docker/disabled/dist-x86_64-dragonfly/patch-toolchain
Normal file
23
src/ci/docker/disabled/dist-x86_64-dragonfly/patch-toolchain
Normal file
@ -0,0 +1,23 @@
|
||||
--- libstdc++-v3/config/os/bsd/dragonfly/os_defines.h.orig 2015-07-09 16:08:54 UTC
|
||||
+++ libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
|
||||
@@ -29,4 +29,9 @@
|
||||
// System-specific #define, typedefs, corrections, etc, go here. This
|
||||
// file will come before all others.
|
||||
|
||||
+#define _GLIBCXX_USE_C99_CHECK 1
|
||||
+#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
|
||||
+#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
|
||||
+#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)
|
||||
+
|
||||
#endif
|
||||
--- libstdc++-v3/configure.orig 2016-05-26 18:34:47.163132921 +0200
|
||||
+++ libstdc++-v3/configure 2016-05-26 18:35:29.594590648 +0200
|
||||
@@ -52013,7 +52013,7 @@
|
||||
|
||||
;;
|
||||
|
||||
- *-freebsd*)
|
||||
+ *-freebsd* | *-dragonfly*)
|
||||
SECTION_FLAGS='-ffunction-sections -fdata-sections'
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
# emscripten
|
||||
COPY scripts/emscripten-wasm.sh /scripts/
|
||||
COPY disabled/wasm32-exp/node.sh /usr/local/bin/node
|
||||
COPY wasm32-exp/node.sh /usr/local/bin/node
|
||||
RUN bash /scripts/emscripten-wasm.sh
|
||||
|
||||
# cache
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -6,9 +6,9 @@ RUN sh /scripts/android-base-apt-get.sh
|
||||
# ndk
|
||||
COPY scripts/android-ndk.sh /scripts/
|
||||
RUN . /scripts/android-ndk.sh && \
|
||||
download_ndk android-ndk-r13b-linux-x86_64.zip && \
|
||||
make_standalone_toolchain arm 9 && \
|
||||
make_standalone_toolchain x86 9 && \
|
||||
download_ndk android-ndk-r15c-linux-x86_64.zip && \
|
||||
make_standalone_toolchain arm 14 && \
|
||||
make_standalone_toolchain x86 14 && \
|
||||
make_standalone_toolchain arm64 21 && \
|
||||
make_standalone_toolchain x86_64 21 && \
|
||||
remove_ndk
|
||||
@ -23,9 +23,9 @@ ENV TARGETS=$TARGETS,x86_64-linux-android
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--target=$TARGETS \
|
||||
--enable-extended \
|
||||
--arm-linux-androideabi-ndk=/android/ndk/arm-9 \
|
||||
--armv7-linux-androideabi-ndk=/android/ndk/arm-9 \
|
||||
--i686-linux-android-ndk=/android/ndk/x86-9 \
|
||||
--arm-linux-androideabi-ndk=/android/ndk/arm-14 \
|
||||
--armv7-linux-androideabi-ndk=/android/ndk/arm-14 \
|
||||
--i686-linux-android-ndk=/android/ndk/x86-14 \
|
||||
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
|
||||
--x86_64-linux-android-ndk=/android/ndk/x86_64-21
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,41 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gdb \
|
||||
git \
|
||||
libedit-dev \
|
||||
make \
|
||||
ninja-build \
|
||||
nodejs \
|
||||
python2.7-dev \
|
||||
sudo \
|
||||
xz-utils \
|
||||
unzip
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
|
||||
CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \
|
||||
CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \
|
||||
AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \
|
||||
CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \
|
||||
CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++
|
||||
|
||||
ENV TARGETS=x86_64-unknown-fuchsia
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
@ -34,6 +34,7 @@ ENV RUST_CONFIGURE_ARGS \
|
||||
#
|
||||
# See: https://github.com/rust-lang/rust/issues/34978
|
||||
ENV CFLAGS_i686_unknown_linux_musl=-Wa,-mrelax-relocations=no
|
||||
ENV CFLAGS_i586_unknown_linux_gnu=-Wa,-mrelax-relocations=no
|
||||
|
||||
ENV SCRIPT \
|
||||
python2.7 ../x.py test \
|
||||
|
@ -15,7 +15,7 @@ set -ex
|
||||
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
|
||||
export CXXFLAGS="-Wa,-mrelax-relocations=no"
|
||||
|
||||
MUSL=musl-1.1.16
|
||||
MUSL=musl-1.1.17
|
||||
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
|
||||
cd $MUSL
|
||||
CC=gcc \
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
@ -23,7 +23,7 @@ SYSROOT=/usr/local/$TARGET/sysroot
|
||||
mkdir -p $SYSROOT
|
||||
pushd $SYSROOT
|
||||
|
||||
centos_base=http://mirror.centos.org/altarch/7.3.1611/os/ppc64le/Packages
|
||||
centos_base=http://vault.centos.org/altarch/7.3.1611/os/ppc64le/Packages/
|
||||
glibc_v=2.17-157.el7
|
||||
kernel_v=3.10.0-514.el7
|
||||
for package in glibc{,-devel,-headers}-$glibc_v kernel-headers-$kernel_v; do
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -24,19 +24,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY cross/build-rumprun.sh /tmp/
|
||||
COPY dist-various-1/build-rumprun.sh /tmp/
|
||||
RUN ./build-rumprun.sh
|
||||
|
||||
COPY cross/build-arm-musl.sh /tmp/
|
||||
COPY dist-various-1/build-arm-musl.sh /tmp/
|
||||
RUN ./build-arm-musl.sh
|
||||
|
||||
COPY cross/install-mips-musl.sh /tmp/
|
||||
COPY dist-various-1/install-mips-musl.sh /tmp/
|
||||
RUN ./install-mips-musl.sh
|
||||
|
||||
COPY cross/install-mipsel-musl.sh /tmp/
|
||||
COPY dist-various-1/install-mipsel-musl.sh /tmp/
|
||||
RUN ./install-mipsel-musl.sh
|
||||
|
||||
COPY cross/install-x86_64-redox.sh /tmp/
|
||||
COPY dist-various-1/install-x86_64-redox.sh /tmp/
|
||||
RUN ./install-x86_64-redox.sh
|
||||
|
||||
ENV TARGETS=asmjs-unknown-emscripten
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
set -ex
|
||||
|
||||
MUSL=1.1.16
|
||||
MUSL=1.1.17
|
||||
|
||||
hide_output() {
|
||||
set +x
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
55
src/ci/docker/dist-various-2/Dockerfile
Normal file
55
src/ci/docker/dist-various-2/Dockerfile
Normal file
@ -0,0 +1,55 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
RUN apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
gcc-multilib \
|
||||
libedit-dev \
|
||||
libgmp-dev \
|
||||
libisl-dev \
|
||||
libmpc-dev \
|
||||
libmpfr-dev \
|
||||
ninja-build \
|
||||
nodejs \
|
||||
python2.7-dev \
|
||||
software-properties-common \
|
||||
unzip
|
||||
|
||||
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-testing main'
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY dist-various-2/shared.sh dist-various-2/build-fuchsia-toolchain.sh /tmp/
|
||||
COPY dist-various-2/build-solaris-toolchain.sh /tmp/
|
||||
RUN /tmp/build-fuchsia-toolchain.sh
|
||||
RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386
|
||||
RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
|
||||
CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \
|
||||
CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \
|
||||
AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \
|
||||
CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \
|
||||
CXX_aarch64_unknown_fuchsia=aarch64-unknown-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++
|
||||
|
||||
ENV TARGETS=x86_64-unknown-fuchsia
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
|
||||
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
|
||||
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
|
||||
ENV TARGETS=$TARGETS,x86_64-sun-solaris
|
||||
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
107
src/ci/docker/dist-various-2/build-solaris-toolchain.sh
Executable file
107
src/ci/docker/dist-various-2/build-solaris-toolchain.sh
Executable file
@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
ARCH=$1
|
||||
LIB_ARCH=$2
|
||||
APT_ARCH=$3
|
||||
BINUTILS=2.28.1
|
||||
GCC=6.4.0
|
||||
|
||||
# First up, build binutils
|
||||
mkdir binutils
|
||||
cd binutils
|
||||
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-$BINUTILS/configure --target=$ARCH-sun-solaris2.10
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ../..
|
||||
rm -rf binutils
|
||||
|
||||
# Next, download and install the relevant solaris packages
|
||||
mkdir solaris
|
||||
cd solaris
|
||||
|
||||
dpkg --add-architecture $APT_ARCH
|
||||
apt-get update
|
||||
apt-get download $(apt-cache depends --recurse --no-replaces \
|
||||
libc-dev:$APT_ARCH \
|
||||
libm-dev:$APT_ARCH \
|
||||
libpthread-dev:$APT_ARCH \
|
||||
libresolv-dev:$APT_ARCH \
|
||||
librt-dev:$APT_ARCH \
|
||||
libsocket-dev:$APT_ARCH \
|
||||
system-crt:$APT_ARCH \
|
||||
system-header:$APT_ARCH \
|
||||
| grep "^\w")
|
||||
|
||||
for deb in *$APT_ARCH.deb; do
|
||||
dpkg -x $deb .
|
||||
done
|
||||
|
||||
# Remove Solaris 11 functions that are optionally used by libbacktrace.
|
||||
# This is for Solaris 10 compatibility.
|
||||
rm usr/include/link.h
|
||||
patch -p0 << 'EOF'
|
||||
--- usr/include/string.h
|
||||
+++ usr/include/string10.h
|
||||
@@ -93 +92,0 @@
|
||||
-extern size_t strnlen(const char *, size_t);
|
||||
EOF
|
||||
|
||||
mkdir /usr/local/$ARCH-sun-solaris2.10/usr
|
||||
mv usr/include /usr/local/$ARCH-sun-solaris2.10/usr/include
|
||||
mv usr/lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
|
||||
mv lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
|
||||
|
||||
ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/sys-include
|
||||
ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/include
|
||||
|
||||
cd ..
|
||||
rm -rf solaris
|
||||
|
||||
# Finally, download and build gcc to target solaris
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf -
|
||||
cd gcc-$GCC
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=$ARCH-sun-solaris2.10 \
|
||||
--with-gnu-as \
|
||||
--with-gnu-ld \
|
||||
--disable-multilib \
|
||||
--disable-nls \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libcilkrts \
|
||||
--disable-libada \
|
||||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-lto
|
||||
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ../..
|
||||
rm -rf gcc
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -15,7 +15,7 @@ set -ex
|
||||
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
|
||||
export CXXFLAGS="-Wa,-mrelax-relocations=no"
|
||||
|
||||
MUSL=musl-1.1.16
|
||||
MUSL=musl-1.1.17
|
||||
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
|
||||
cd $MUSL
|
||||
./configure --prefix=/musl-x86_64 --disable-shared
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
@ -52,7 +52,7 @@ curl $URL/2017-03-17-netbsd-comp.tgz | \
|
||||
cd usr/src
|
||||
|
||||
# The options, in order, do the following
|
||||
# * this is an unpriviledged build
|
||||
# * this is an unprivileged build
|
||||
# * output to a predictable location
|
||||
# * disable various uneeded stuff
|
||||
MKUNPRIVED=yes TOOLDIR=/x-tools/x86_64-unknown-netbsd \
|
||||
@ -64,12 +64,12 @@ cd ../..
|
||||
rm -rf usr
|
||||
|
||||
cat > /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc-sysroot <<'EOF'
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
exec /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc --sysroot=/x-tools/x86_64-unknown-netbsd/sysroot "$@"
|
||||
EOF
|
||||
|
||||
cat > /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++-sysroot <<'EOF'
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
exec /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++ --sysroot=/x-tools/x86_64-unknown-netbsd/sysroot "$@"
|
||||
EOF
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
set -e
|
||||
|
||||
export MSYS_NO_PATHCONV=1
|
||||
|
||||
script=`cd $(dirname $0) && pwd`/`basename $0`
|
||||
image=$1
|
||||
|
||||
@ -25,23 +27,32 @@ travis_fold start build_docker
|
||||
travis_time_start
|
||||
|
||||
if [ -f "$docker_dir/$image/Dockerfile" ]; then
|
||||
retry docker \
|
||||
build \
|
||||
--rm \
|
||||
-t rust-ci \
|
||||
-f "$docker_dir/$image/Dockerfile" \
|
||||
"$docker_dir"
|
||||
elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
|
||||
if [ -n "$TRAVIS_OS_NAME" ]; then
|
||||
echo Cannot run disabled images on travis!
|
||||
exit 1
|
||||
dockerfile="$docker_dir/$image/Dockerfile"
|
||||
if [ -x /usr/bin/cygpath ]; then
|
||||
context="`cygpath -w $docker_dir`"
|
||||
dockerfile="`cygpath -w $dockerfile`"
|
||||
else
|
||||
context="$docker_dir"
|
||||
fi
|
||||
retry docker \
|
||||
build \
|
||||
--rm \
|
||||
-t rust-ci \
|
||||
-f "$docker_dir/disabled/$image/Dockerfile" \
|
||||
"$docker_dir"
|
||||
-f "$dockerfile" \
|
||||
"$context"
|
||||
elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
|
||||
if [ -n "$TRAVIS_OS_NAME" ]; then
|
||||
echo Cannot run disabled images on travis!
|
||||
exit 1
|
||||
fi
|
||||
# retry messes with the pipe from tar to docker. Not needed on non-travis
|
||||
# Transform changes the context of disabled Dockerfiles to match the enabled ones
|
||||
tar --transform 's#^./disabled/#./#' -C $docker_dir -c . | docker \
|
||||
build \
|
||||
--rm \
|
||||
-t rust-ci \
|
||||
-f "$image/Dockerfile" \
|
||||
-
|
||||
else
|
||||
echo Invalid image: $image
|
||||
exit 1
|
||||
|
@ -10,40 +10,40 @@
|
||||
|
||||
set -ex
|
||||
|
||||
URL=https://dl.google.com/android/repository
|
||||
export ANDROID_HOME=/android/sdk
|
||||
PATH=$PATH:"${ANDROID_HOME}/tools/bin"
|
||||
|
||||
download_sdk() {
|
||||
mkdir -p /android/sdk
|
||||
cd /android/sdk
|
||||
curl -fO $URL/$1
|
||||
unzip -q $1
|
||||
rm -rf $1
|
||||
mkdir -p /android
|
||||
curl -fo sdk.zip "https://dl.google.com/android/repository/sdk-tools-linux-$1.zip"
|
||||
unzip -q sdk.zip -d "$ANDROID_HOME"
|
||||
rm -f sdk.zip
|
||||
}
|
||||
|
||||
download_sysimage() {
|
||||
# See https://developer.android.com/studio/tools/help/android.html
|
||||
abi=$1
|
||||
api=$2
|
||||
|
||||
filter="platform-tools,android-$api"
|
||||
filter="$filter,sys-img-$abi-android-$api"
|
||||
|
||||
# Keep printing yes to accept the licenses
|
||||
while true; do echo yes; sleep 10; done | \
|
||||
/android/sdk/tools/android update sdk -a --no-ui \
|
||||
--filter "$filter"
|
||||
# See https://developer.android.com/studio/command-line/sdkmanager.html for
|
||||
# usage of `sdkmanager`.
|
||||
#
|
||||
# The output from sdkmanager is so noisy that it will occupy all of the 4 MB
|
||||
# log extremely quickly. Thus we must silence all output.
|
||||
yes | sdkmanager --licenses > /dev/null
|
||||
sdkmanager platform-tools emulator \
|
||||
"platforms;android-$api" \
|
||||
"system-images;android-$api;default;$abi" > /dev/null
|
||||
}
|
||||
|
||||
create_avd() {
|
||||
# See https://developer.android.com/studio/tools/help/android.html
|
||||
abi=$1
|
||||
api=$2
|
||||
|
||||
echo no | \
|
||||
/android/sdk/tools/android create avd \
|
||||
--name $abi-$api \
|
||||
--target android-$api \
|
||||
--abi $abi
|
||||
# See https://developer.android.com/studio/command-line/avdmanager.html for
|
||||
# usage of `avdmanager`.
|
||||
echo no | avdmanager create avd \
|
||||
-n "$abi-$api" \
|
||||
-k "system-images;android-$api;default;$abi"
|
||||
}
|
||||
|
||||
download_and_create_avd() {
|
||||
@ -51,3 +51,15 @@ download_and_create_avd() {
|
||||
download_sysimage $2 $3
|
||||
create_avd $2 $3
|
||||
}
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# setup_android_sdk 4333796 armeabi-v7a 18
|
||||
#
|
||||
# 4333796 =>
|
||||
# SDK tool version.
|
||||
# Copy from https://developer.android.com/studio/index.html#command-tools
|
||||
# armeabi-v7a =>
|
||||
# System image ABI
|
||||
# 18 =>
|
||||
# Android API Level (18 = Android 4.3 = Jelly Bean MR2)
|
||||
|
36
src/ci/docker/wasm32-unknown/Dockerfile
Normal file
36
src/ci/docker/wasm32-unknown/Dockerfile
Normal file
@ -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 \
|
||||
python \
|
||||
git \
|
||||
cmake \
|
||||
sudo \
|
||||
gdb \
|
||||
xz-utils
|
||||
|
||||
RUN curl -sL https://nodejs.org/dist/v9.2.0/node-v9.2.0-linux-x64.tar.xz | \
|
||||
tar -xJ
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV TARGETS=wasm32-unknown-unknown
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--target=$TARGETS \
|
||||
--set build.nodejs=/node-v9.2.0-linux-x64/bin/node
|
||||
|
||||
ENV SCRIPT python2.7 /checkout/x.py test --target $TARGETS \
|
||||
src/test/ui \
|
||||
src/test/run-pass \
|
||||
src/test/compile-fail \
|
||||
src/test/parse-fail \
|
||||
src/test/mir-opt \
|
||||
src/test/codegen-units \
|
||||
src/libcore \
|
||||
src/libstd_unicode/ \
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user