Merge remote-tracking branch 'upstream/master' into fast-swap
This commit is contained in:
commit
74751358e6
2269 changed files with 71376 additions and 59941 deletions
14
.gitmodules
vendored
14
.gitmodules
vendored
|
|
@ -13,17 +13,23 @@
|
|||
path = src/jemalloc
|
||||
url = https://github.com/rust-lang/jemalloc.git
|
||||
[submodule "src/rust-installer"]
|
||||
path = src/rust-installer
|
||||
path = src/tools/rust-installer
|
||||
url = https://github.com/rust-lang/rust-installer.git
|
||||
[submodule "src/liblibc"]
|
||||
path = src/liblibc
|
||||
url = https://github.com/rust-lang/libc.git
|
||||
[submodule "src/doc/nomicon"]
|
||||
path = src/doc/nomicon
|
||||
url = https://github.com/rust-lang-nursery/nomicon
|
||||
url = https://github.com/rust-lang-nursery/nomicon.git
|
||||
[submodule "src/tools/cargo"]
|
||||
path = cargo
|
||||
url = https://github.com/rust-lang/cargo
|
||||
path = src/tools/cargo
|
||||
url = https://github.com/rust-lang/cargo.git
|
||||
[submodule "reference"]
|
||||
path = src/doc/reference
|
||||
url = https://github.com/rust-lang-nursery/reference.git
|
||||
[submodule "book"]
|
||||
path = src/doc/book
|
||||
url = https://github.com/rust-lang/book.git
|
||||
[submodule "src/tools/rls"]
|
||||
path = src/tools/rls
|
||||
url = https://github.com/rust-lang-nursery/rls.git
|
||||
|
|
|
|||
1
.mailmap
1
.mailmap
|
|
@ -139,6 +139,7 @@ Margaret Meyerhofer <mmeyerho@andrew.cmu.edu> <mmeyerho@andrew>
|
|||
Mark Sinclair <mark.edward.x@gmail.com>
|
||||
Mark Sinclair <mark.edward.x@gmail.com> =Mark Sinclair <=125axel125@gmail.com>
|
||||
Markus Westerlind <marwes91@gmail.com> Markus <marwes91@gmail.com>
|
||||
Martin Hafskjold Thoresen <martinhath@gmail.com>
|
||||
Matej Lach <matej.lach@gmail.com> Matej Ľach <matej.lach@gmail.com>
|
||||
Matt Brubeck <mbrubeck@limpet.net> <mbrubeck@cs.hmc.edu>
|
||||
Matthew Auld <matthew.auld@intel.com>
|
||||
|
|
|
|||
111
.travis.yml
111
.travis.yml
|
|
@ -15,19 +15,27 @@ matrix:
|
|||
- env: IMAGE=arm-android
|
||||
- env: IMAGE=armhf-gnu
|
||||
- env: IMAGE=cross DEPLOY=1
|
||||
- env: IMAGE=dist-aarch64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-android DEPLOY=1
|
||||
- env: IMAGE=dist-arm-linux DEPLOY=1
|
||||
- env: IMAGE=dist-armv7-aarch64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-freebsd DEPLOY=1
|
||||
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
|
||||
- env: IMAGE=dist-armhf-linux DEPLOY=1
|
||||
- env: IMAGE=dist-armv7-linux DEPLOY=1
|
||||
- env: IMAGE=dist-fuchsia DEPLOY=1
|
||||
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
|
||||
- env: IMAGE=dist-i686-freebsd DEPLOY=1
|
||||
- env: IMAGE=dist-i686-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mips-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mips64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mips64el-linux DEPLOY=1
|
||||
- env: IMAGE=dist-mipsel-linux DEPLOY=1
|
||||
- env: IMAGE=dist-powerpc-linux DEPLOY=1
|
||||
- env: IMAGE=dist-powerpc64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-s390x-linux-netbsd DEPLOY=1
|
||||
- env: IMAGE=dist-x86-linux DEPLOY=1
|
||||
- env: IMAGE=dist-powerpc64le-linux DEPLOY=1
|
||||
- env: IMAGE=dist-s390x-linux DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-freebsd DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-musl DEPLOY=1
|
||||
- env: IMAGE=dist-x86_64-netbsd DEPLOY=1
|
||||
- env: IMAGE=emscripten
|
||||
- env: IMAGE=i686-gnu
|
||||
- env: IMAGE=i686-gnu-nopt
|
||||
|
|
@ -40,30 +48,43 @@ matrix:
|
|||
- env: IMAGE=x86_64-gnu-distcheck
|
||||
- env: IMAGE=x86_64-gnu-incremental
|
||||
|
||||
# OSX builders
|
||||
# OSX builders running tests, these run the full test suite.
|
||||
#
|
||||
# Note that the compiler is compiled to target 10.8 here because the Xcode
|
||||
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=check
|
||||
RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin
|
||||
RUST_CONFIGURE_ARGS="--build=x86_64-apple-darwin --enable-sanitizers"
|
||||
SRC=.
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
RUST_LOG=sccache
|
||||
MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
MACOSX_STD_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: &osx_install_sccache >
|
||||
travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/sccache
|
||||
travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/sccache &&
|
||||
travis_retry curl -o /usr/local/bin/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/stamp
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=check
|
||||
RUST_CONFIGURE_ARGS=--build=i686-apple-darwin
|
||||
SRC=.
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
RUST_LOG=sccache
|
||||
MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
MACOSX_STD_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: *osx_install_sccache
|
||||
|
||||
# OSX builders producing releases. These do not run the full test suite and
|
||||
# just produce a bunch of artifacts.
|
||||
#
|
||||
# Note that these are running in the `xcode7` image instead of the
|
||||
# `xcode8.2` image as above. That's because we want to build releases for
|
||||
# OSX 10.7 and `xcode7` is the latest Xcode able to compile LLVM for 10.7.
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-extended"
|
||||
|
|
@ -71,29 +92,33 @@ matrix:
|
|||
DEPLOY=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
RUST_LOG=sccache
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: >
|
||||
travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-apple-darwin &&
|
||||
chmod +x /usr/local/bin/sccache
|
||||
osx_image: xcode7
|
||||
install:
|
||||
- travis_retry brew update
|
||||
- travis_retry brew install xz
|
||||
- *osx_install_sccache
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended"
|
||||
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended --enable-sanitizers"
|
||||
SRC=.
|
||||
DEPLOY=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
RUST_LOG=sccache
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: *osx_install_sccache
|
||||
osx_image: xcode7
|
||||
install:
|
||||
- travis_retry brew update
|
||||
- travis_retry brew install xz
|
||||
- *osx_install_sccache
|
||||
|
||||
# "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.
|
||||
- env: IMAGE=dist-x86-linux DEPLOY_ALT=1
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
|
||||
- env: >
|
||||
RUST_CHECK_TARGET=dist
|
||||
RUST_CONFIGURE_ARGS="--enable-extended"
|
||||
|
|
@ -101,10 +126,13 @@ matrix:
|
|||
DEPLOY_ALT=1
|
||||
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
|
||||
SCCACHE_ERROR_LOG=/tmp/sccache.log
|
||||
RUST_LOG=sccache
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
install: *osx_install_sccache
|
||||
osx_image: xcode7
|
||||
install:
|
||||
- travis_retry brew update
|
||||
- travis_retry brew install xz
|
||||
- *osx_install_sccache
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
@ -113,6 +141,12 @@ env:
|
|||
# AWS_SECRET_ACCESS_KEY=...
|
||||
- secure: "Pixhh0hXDqGCdOyLtGFjli3J2AtDWIpyb2btIrLe956nCBDRutRoMm6rv5DI9sFZN07Mms7VzNNvhc9wCW1y63JAm414d2Co7Ob8kWMZlz9l9t7ACHuktUiis8yr+S4Quq1Vqd6pqi7pf2J++UxC8R/uLeqVrubzr6+X7AbmEFE="
|
||||
|
||||
# Note that this is overridden on OSX builders
|
||||
install: >
|
||||
travis_retry curl -o $HOME/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-unknown-linux-musl &&
|
||||
chmod +x $HOME/stamp &&
|
||||
export PATH=$PATH:$HOME
|
||||
|
||||
before_script:
|
||||
- >
|
||||
echo "#### Disk usage before running script:";
|
||||
|
|
@ -122,13 +156,14 @@ before_script:
|
|||
script:
|
||||
- >
|
||||
if [ "$ALLOW_PR" = "" ] && [ "$TRAVIS_BRANCH" != "auto" ]; then
|
||||
echo skipping, not a full build;
|
||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
travis_retry sh -c 'git submodule deinit -f . && git submodule update --init' &&
|
||||
src/ci/run.sh;
|
||||
echo skipping, not a full build
|
||||
else
|
||||
travis_retry sh -c 'git submodule deinit -f . && git submodule update --init' &&
|
||||
src/ci/docker/run.sh $IMAGE;
|
||||
stamp src/ci/init_repo.sh . "$HOME/rustsrc" &&
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
stamp src/ci/run.sh;
|
||||
else
|
||||
stamp src/ci/docker/run.sh $IMAGE;
|
||||
fi
|
||||
fi
|
||||
|
||||
after_success:
|
||||
|
|
@ -142,10 +177,25 @@ after_failure:
|
|||
echo "#### Build failed; Disk usage after running script:";
|
||||
df -h;
|
||||
du . | sort -nr | head -n100
|
||||
|
||||
# One of these is the linux sccache log, one is the OSX sccache log. Instead
|
||||
# of worrying about what system we are just cat both. One of these commands
|
||||
# will fail but that's ok, they'll both get executed.
|
||||
- cat obj/tmp/sccache.log
|
||||
- cat /tmp/sccache.log
|
||||
|
||||
# Random attempt at debugging currently. Just poking around in here to see if
|
||||
# anything shows up.
|
||||
- ls $HOME/Library/Logs/DiagnosticReports/
|
||||
|
||||
# attempt to debug anything killed by the oom killer on linux, just to see if
|
||||
# it happened
|
||||
- dmesg | grep -i kill
|
||||
|
||||
# Save tagged docker images we created and load them if they're available
|
||||
# Travis saves caches whether the build failed or not, nuke rustsrc if
|
||||
# the failure was while updating it (as it may be in a bad state)
|
||||
# https://github.com/travis-ci/travis-ci/issues/4472
|
||||
before_cache:
|
||||
- docker history -q rust-ci |
|
||||
grep -v missing |
|
||||
|
|
@ -153,6 +203,7 @@ before_cache:
|
|||
gzip > $HOME/docker/rust-ci.tar.gz
|
||||
before_install:
|
||||
- zcat $HOME/docker/rust-ci.tar.gz | docker load || true
|
||||
- mkdir -p $HOME/rustsrc
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ python x.py test src/test/rustdoc
|
|||
python x.py build src/libcore --stage 0
|
||||
```
|
||||
|
||||
You can explore the build system throught the various `--help` pages for each
|
||||
You can explore the build system through the various `--help` pages for each
|
||||
subcommand. For example to learn more about a command you can run:
|
||||
|
||||
```
|
||||
|
|
@ -311,9 +311,13 @@ To save @bors some work, and to get small changes through more quickly, when
|
|||
the other rollup-eligible patches too, and they'll get tested and merged at
|
||||
the same time.
|
||||
|
||||
To find documentation-related issues, sort by the [A-docs label][adocs].
|
||||
To find documentation-related issues, sort by the [T-doc label][tdoc].
|
||||
|
||||
[adocs]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-docs
|
||||
[tdoc]: https://github.com/rust-lang/rust/issues?q=is%3Aopen%20is%3Aissue%20label%3AT-doc
|
||||
|
||||
You can find documentation style guidelines in [RFC 1574][rfc1574].
|
||||
|
||||
[rfc1574]: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
|
||||
|
||||
In many cases, you don't need a full `./x.py doc`. You can use `rustdoc` directly
|
||||
to check small fixes. For example, `rustdoc src/doc/reference.md` will render
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -16,7 +16,7 @@ Read ["Installing Rust"] from [The Book].
|
|||
|
||||
1. Make sure you have installed the dependencies:
|
||||
|
||||
* `g++` 4.7 or later or `clang++` 3.x
|
||||
* `g++` 4.7 or later or `clang++` 3.x or later
|
||||
* `python` 2.7 (but not 3.x)
|
||||
* GNU `make` 3.81 or later
|
||||
* `cmake` 3.4.3 or later
|
||||
|
|
@ -161,8 +161,9 @@ If you’d like to build the documentation, it’s almost the same:
|
|||
$ ./x.py doc
|
||||
```
|
||||
|
||||
The generated documentation will appear in a top-level `doc` directory,
|
||||
created by the `make` rule.
|
||||
The generated documentation will appear under `doc` in the `build` directory for
|
||||
the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will be
|
||||
`build\x86_64-pc-windows-msvc\doc`.
|
||||
|
||||
## Notes
|
||||
|
||||
|
|
@ -197,8 +198,8 @@ The Rust community congregates in a few places:
|
|||
* [users.rust-lang.org] - General discussion and broader questions.
|
||||
* [/r/rust] - News and general discussion.
|
||||
|
||||
[Stack Overflow]: http://stackoverflow.com/questions/tagged/rust
|
||||
[/r/rust]: http://reddit.com/r/rust
|
||||
[Stack Overflow]: https://stackoverflow.com/questions/tagged/rust
|
||||
[/r/rust]: https://reddit.com/r/rust
|
||||
[users.rust-lang.org]: https://users.rust-lang.org/
|
||||
|
||||
## Contributing
|
||||
|
|
|
|||
1029
RELEASES.md
1029
RELEASES.md
File diff suppressed because it is too large
Load diff
87
appveyor.yml
87
appveyor.yml
|
|
@ -20,39 +20,28 @@ environment:
|
|||
|
||||
# 32/64-bit MinGW builds.
|
||||
#
|
||||
# The MinGW builds unfortunately have to both download a custom toolchain and
|
||||
# avoid the one installed by AppVeyor by default. Interestingly, though, for
|
||||
# different reasons!
|
||||
# We are using MinGW with posix threads since LLVM does not compile with
|
||||
# the win32 threads version due to missing support for C++'s std::thread.
|
||||
#
|
||||
# For 32-bit the installed gcc toolchain on AppVeyor uses the pthread
|
||||
# threading model. This is unfortunately not what we want, and if we compile
|
||||
# with it then there's lots of link errors in the standard library (undefined
|
||||
# references to pthread symbols).
|
||||
#
|
||||
# For 64-bit the installed gcc toolchain is currently 5.3.0 which
|
||||
# unfortunately segfaults on Windows with --enable-llvm-assertions (segfaults
|
||||
# in LLVM). See rust-lang/rust#28445 for more information, but to work around
|
||||
# this we go back in time to 4.9.2 specifically.
|
||||
# Instead of relying on the MinGW version installed on appveryor we download
|
||||
# and install one ourselves so we won't be surprised by changes to appveyor's
|
||||
# build image.
|
||||
#
|
||||
# Finally, note that the downloads below are all in the `rust-lang-ci` S3
|
||||
# bucket, but they cleraly didn't originate there! The downloads originally
|
||||
# came from the mingw-w64 SourceForge download site. Unfortunately
|
||||
# SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
|
||||
#
|
||||
# And as a final point of note, the 32-bit MinGW build using the makefiles do
|
||||
# *not* use debug assertions and llvm assertions. This is because they take
|
||||
# too long on appveyor and this is tested by rustbuild below.
|
||||
- MSYS_BITS: 32
|
||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
||||
SCRIPT: python x.py test
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
|
||||
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
|
||||
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
||||
MINGW_DIR: mingw32
|
||||
- MSYS_BITS: 64
|
||||
SCRIPT: python x.py test
|
||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
|
||||
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
|
||||
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
||||
MINGW_DIR: mingw64
|
||||
|
||||
# 32/64 bit MSVC and GNU deployment
|
||||
|
|
@ -70,15 +59,15 @@ environment:
|
|||
- MSYS_BITS: 32
|
||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended
|
||||
SCRIPT: python x.py dist
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
|
||||
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
|
||||
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
||||
MINGW_DIR: mingw32
|
||||
DEPLOY: 1
|
||||
- MSYS_BITS: 64
|
||||
SCRIPT: python x.py dist
|
||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
|
||||
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
|
||||
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
|
||||
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
||||
MINGW_DIR: mingw64
|
||||
DEPLOY: 1
|
||||
|
||||
|
|
@ -107,6 +96,26 @@ install:
|
|||
- if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
|
||||
- if defined MINGW_URL set PATH=%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%
|
||||
|
||||
# Here we do a pretty heinous thing which is to mangle the MinGW installation
|
||||
# we just had above. Currently, as of this writing, we're using MinGW-w64
|
||||
# builds of gcc, and that's currently at 6.3.0. We use 6.3.0 as it appears to
|
||||
# be the first version which contains a fix for #40546, builds randomly
|
||||
# failing during LLVM due to ar.exe/ranlib.exe failures.
|
||||
#
|
||||
# Unfortunately, though, 6.3.0 *also* is the first version of MinGW-w64 builds
|
||||
# to contain a regression in gdb (#40184). As a result if we were to use the
|
||||
# gdb provided (7.11.1) then we would fail all debuginfo tests.
|
||||
#
|
||||
# In order to fix spurious failures (pretty high priority) we use 6.3.0. To
|
||||
# avoid disabling gdb tests we download an *old* version of gdb, specifically
|
||||
# that found inside the 6.2.0 distribution. We then overwrite the 6.3.0 gdb
|
||||
# with the 6.2.0 gdb to get tests passing.
|
||||
#
|
||||
# Note that we don't literally overwrite the gdb.exe binary because it appears
|
||||
# to just use gdborig.exe, so that's the binary we deal with instead.
|
||||
- if defined MINGW_URL appveyor-retry appveyor DownloadFile %MINGW_URL%/2017-04-20-%MSYS_BITS%bit-gdborig.exe
|
||||
- if defined MINGW_URL mv 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_DIR%\bin\gdborig.exe
|
||||
|
||||
# Otherwise pull in the MinGW installed on appveyor
|
||||
- if NOT defined MINGW_URL set PATH=C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH%
|
||||
|
||||
|
|
@ -115,39 +124,41 @@ install:
|
|||
- set PATH=C:\Python27;%PATH%
|
||||
|
||||
# Download and install sccache
|
||||
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-pc-windows-msvc
|
||||
- mv 2017-02-25-sccache-x86_64-pc-windows-msvc sccache
|
||||
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-pc-windows-msvc
|
||||
- mv 2017-05-12-sccache-x86_64-pc-windows-msvc sccache.exe
|
||||
- set PATH=%PATH%;%CD%
|
||||
|
||||
# Download and install ninja
|
||||
#
|
||||
# Note that this is originally from the github releases patch of Ninja
|
||||
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-15-ninja-win.zip
|
||||
- 7z x 2017-03-15-ninja-win.zip
|
||||
- set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja
|
||||
# - set PATH=%PATH%;%CD% -- this already happens above for sccache
|
||||
|
||||
# Install InnoSetup to get `iscc` used to produce installers
|
||||
- appveyor-retry choco install -y InnoSetup
|
||||
- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
|
||||
|
||||
# Help debug some handle issues on AppVeyor
|
||||
- ps: Invoke-WebRequest -Uri https://download.sysinternals.com/files/Handle.zip -OutFile handle.zip
|
||||
- appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-15-Handle.zip
|
||||
- mkdir handle
|
||||
- ps: Expand-Archive handle.zip -dest handle
|
||||
- 7z x -ohandle 2017-05-15-Handle.zip
|
||||
- set PATH=%PATH%;%CD%\handle
|
||||
- handle.exe -accepteula -help
|
||||
|
||||
# Attempt to debug sccache failures
|
||||
- set RUST_LOG=sccache
|
||||
- set SCCACHE_ERROR_LOG=%CD%/sccache.log
|
||||
|
||||
test_script:
|
||||
- appveyor-retry sh -c 'git submodule deinit -f . && git submodule update --init'
|
||||
- if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
|
||||
- sh src/ci/init_repo.sh . /c/cache/rustsrc
|
||||
- set SRC=.
|
||||
- set NO_CCACHE=1
|
||||
- sh src/ci/run.sh
|
||||
|
||||
on_failure:
|
||||
- cat %CD%/sccache.log
|
||||
|
||||
cache:
|
||||
- "build/i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- "build/x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- "i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- "x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- cat %CD%\sccache.log || exit 0
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
|
@ -176,6 +187,7 @@ deploy:
|
|||
on:
|
||||
branch: auto
|
||||
DEPLOY: 1
|
||||
max_error_retry: 5
|
||||
|
||||
# This provider is the same as the one above except that it has a slightly
|
||||
# different upload directory and a slightly different trigger
|
||||
|
|
@ -192,6 +204,7 @@ deploy:
|
|||
on:
|
||||
branch: auto
|
||||
DEPLOY_ALT: 1
|
||||
max_error_retry: 5
|
||||
|
||||
# init:
|
||||
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
|
|
|||
1
cargo
1
cargo
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 5f3b9c4c6a7be1f177d6024cb83d150b6479148a
|
||||
7
configure
vendored
7
configure
vendored
|
|
@ -437,6 +437,7 @@ opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
|
|||
opt local-rebuild 0 "assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version"
|
||||
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
|
||||
opt llvm-link-shared 0 "prefer shared linking to LLVM (llvm-config --link-shared)"
|
||||
opt llvm-clean-rebuild 0 "delete LLVM build directory on rebuild"
|
||||
opt rpath 1 "build rpaths into rustc itself"
|
||||
opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
|
||||
# This is used by the automation to produce single-target nightlies
|
||||
|
|
@ -478,6 +479,7 @@ valopt i686-linux-android-ndk "" "i686-linux-android NDK standalone path"
|
|||
valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
|
||||
valopt armv7-linux-androideabi-ndk "" "armv7-linux-androideabi NDK standalone path"
|
||||
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
|
||||
valopt x86_64-linux-android-ndk "" "x86_64-linux-android NDK standalone path"
|
||||
valopt nacl-cross-path "" "NaCl SDK path (Pepper Canary is recommended). Must be absolute!"
|
||||
valopt musl-root "/usr/local" "MUSL root installation directory (deprecated)"
|
||||
valopt musl-root-x86_64 "" "x86_64-unknown-linux-musl install directory"
|
||||
|
|
@ -508,7 +510,6 @@ valopt default-ar "ar" "the default ar"
|
|||
opt_nosave manage-submodules 1 "let the build manage the git submodules"
|
||||
opt_nosave clang 0 "prefer clang to gcc for building the runtime"
|
||||
opt_nosave jemalloc 1 "build liballoc with jemalloc"
|
||||
opt elf-tls 1 "elf thread local storage on platforms where supported"
|
||||
opt full-bootstrap 0 "build three compilers instead of two"
|
||||
opt extended 0 "build an extended rust tool set"
|
||||
|
||||
|
|
@ -518,6 +519,7 @@ valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
|
|||
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
|
||||
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
|
||||
valopt_nosave docdir "${CFG_PREFIX}/share/doc/rust" "install documentation in PATH"
|
||||
valopt_nosave bindir "${CFG_PREFIX}/bin" "install binaries"
|
||||
|
||||
# On Windows this determines root of the subtree for target libraries.
|
||||
# Host runtime libs always go to 'bin'.
|
||||
|
|
@ -709,6 +711,7 @@ envopt LDFLAGS
|
|||
CFG_PREFIX=${CFG_PREFIX%/}
|
||||
CFG_MANDIR=${CFG_MANDIR%/}
|
||||
CFG_DOCDIR=${CFG_DOCDIR%/}
|
||||
CFG_BINDIR=${CFG_BINDIR%/}
|
||||
CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')"
|
||||
CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')"
|
||||
|
||||
|
|
@ -745,9 +748,11 @@ putvar CFG_AARCH64_LINUX_ANDROID_NDK
|
|||
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
|
||||
putvar CFG_ARMV7_LINUX_ANDROIDEABI_NDK
|
||||
putvar CFG_I686_LINUX_ANDROID_NDK
|
||||
putvar CFG_X86_64_LINUX_ANDROID_NDK
|
||||
putvar CFG_NACL_CROSS_PATH
|
||||
putvar CFG_MANDIR
|
||||
putvar CFG_DOCDIR
|
||||
putvar CFG_BINDIR
|
||||
putvar CFG_USING_LIBCPP
|
||||
|
||||
msg
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ Comma separated list of types of crates for the compiler to emit.
|
|||
\fB\-\-crate\-name\fR \fINAME\fR
|
||||
Specify the name of the crate being built.
|
||||
.TP
|
||||
\fB\-\-emit\fR [asm|llvm\-bc|llvm\-ir|obj|link|dep\-info][=\fIPATH\fR]
|
||||
\fB\-\-emit\fR [asm|llvm\-bc|llvm\-ir|obj|link|dep\-info|mir][=\fIPATH\fR]
|
||||
Configure the output that \fBrustc\fR will produce. Each emission may also have
|
||||
an optional explicit output \fIPATH\fR specified for that particular emission
|
||||
kind. This path takes precedence over the \fB-o\fR option.
|
||||
|
|
|
|||
1410
src/Cargo.lock
generated
1410
src/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -11,8 +11,11 @@ members = [
|
|||
"tools/rustbook",
|
||||
"tools/tidy",
|
||||
"tools/build-manifest",
|
||||
"tools/qemu-test-client",
|
||||
"tools/qemu-test-server",
|
||||
"tools/remote-test-client",
|
||||
"tools/remote-test-server",
|
||||
"tools/rust-installer",
|
||||
"tools/cargo",
|
||||
"tools/rls",
|
||||
]
|
||||
|
||||
# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
|
||||
|
|
@ -31,3 +34,6 @@ debug-assertions = false
|
|||
[profile.test]
|
||||
debug = false
|
||||
debug-assertions = false
|
||||
|
||||
[replace]
|
||||
"https://github.com/rust-lang/cargo#0.20.0" = { path = "tools/cargo" }
|
||||
|
|
|
|||
|
|
@ -23,13 +23,18 @@ name = "rustdoc"
|
|||
path = "bin/rustdoc.rs"
|
||||
test = false
|
||||
|
||||
[[bin]]
|
||||
name = "sccache-plus-cl"
|
||||
path = "bin/sccache-plus-cl.rs"
|
||||
test = false
|
||||
|
||||
[dependencies]
|
||||
build_helper = { path = "../build_helper" }
|
||||
cmake = "0.1.17"
|
||||
cmake = "0.1.23"
|
||||
filetime = "0.1"
|
||||
num_cpus = "0.2"
|
||||
num_cpus = "1.0"
|
||||
toml = "0.1"
|
||||
getopts = "0.2"
|
||||
rustc-serialize = "0.3"
|
||||
gcc = "0.3.38"
|
||||
gcc = "0.3.46"
|
||||
libc = "0.2"
|
||||
|
|
|
|||
|
|
@ -4,10 +4,6 @@ This is an in-progress README which is targeted at helping to explain how Rust
|
|||
is bootstrapped and in general some of the technical details of the build
|
||||
system.
|
||||
|
||||
> **Note**: This build system is currently under active development and is not
|
||||
> intended to be the primarily used one just yet. The makefiles are currently
|
||||
> the ones that are still "guaranteed to work" as much as possible at least.
|
||||
|
||||
## Using rustbuild
|
||||
|
||||
The rustbuild build system has a primary entry point, a top level `x.py` script:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,24 @@ use std::path::PathBuf;
|
|||
use std::process::{Command, ExitStatus};
|
||||
|
||||
fn main() {
|
||||
let args = env::args_os().skip(1).collect::<Vec<_>>();
|
||||
let mut args = env::args_os().skip(1).collect::<Vec<_>>();
|
||||
|
||||
// Append metadata suffix for internal crates. See the corresponding entry
|
||||
// in bootstrap/lib.rs for details.
|
||||
if let Ok(s) = env::var("RUSTC_METADATA_SUFFIX") {
|
||||
for i in 1..args.len() {
|
||||
// Dirty code for borrowing issues
|
||||
let mut new = None;
|
||||
if let Some(current_as_str) = args[i].to_str() {
|
||||
if (&*args[i - 1] == "-C" && current_as_str.starts_with("metadata")) ||
|
||||
current_as_str.starts_with("-Cmetadata") {
|
||||
new = Some(format!("{}-{}", current_as_str, s));
|
||||
}
|
||||
}
|
||||
if let Some(new) = new { args[i] = new.into(); }
|
||||
}
|
||||
}
|
||||
|
||||
// Detect whether or not we're a build script depending on whether --target
|
||||
// is passed (a bit janky...)
|
||||
let target = args.windows(2)
|
||||
|
|
@ -94,6 +111,13 @@ fn main() {
|
|||
cmd.arg("-Cprefer-dynamic");
|
||||
}
|
||||
|
||||
// Pass the `rustbuild` feature flag to crates which rustbuild is
|
||||
// building. See the comment in bootstrap/lib.rs where this env var is
|
||||
// set for more details.
|
||||
if env::var_os("RUSTBUILD_UNSTABLE").is_some() {
|
||||
cmd.arg("--cfg").arg("rustbuild");
|
||||
}
|
||||
|
||||
// Help the libc crate compile by assisting it in finding the MUSL
|
||||
// native libraries.
|
||||
if let Some(s) = env::var_os("MUSL_ROOT") {
|
||||
|
|
@ -182,11 +206,13 @@ fn main() {
|
|||
if env::var("RUSTC_RPATH") == Ok("true".to_string()) {
|
||||
let rpath = if target.contains("apple") {
|
||||
|
||||
// Note that we need to take one extra step on OSX to also pass
|
||||
// Note that we need to take one extra step on macOS to also pass
|
||||
// `-Wl,-instal_name,@rpath/...` to get things to work right. To
|
||||
// do that we pass a weird flag to the compiler to get it to do
|
||||
// so. Note that this is definitely a hack, and we should likely
|
||||
// flesh out rpath support more fully in the future.
|
||||
//
|
||||
// FIXME: remove condition after next stage0
|
||||
if stage != "0" {
|
||||
cmd.arg("-Z").arg("osx-rpath-install-name");
|
||||
}
|
||||
|
|
@ -211,6 +237,17 @@ fn main() {
|
|||
cmd.arg("-Z").arg("unstable-options");
|
||||
cmd.arg("-C").arg("target-feature=+crt-static");
|
||||
}
|
||||
|
||||
// Force all crates compiled by this compiler to (a) be unstable and (b)
|
||||
// allow the `rustc_private` feature to link to other unstable crates
|
||||
// also in the sysroot.
|
||||
//
|
||||
// FIXME: remove condition after next stage0
|
||||
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
|
||||
if stage != "0" {
|
||||
cmd.arg("-Z").arg("force-unstable-if-unmarked");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if verbose > 1 {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,14 @@ fn main() {
|
|||
.arg(sysroot)
|
||||
.env(bootstrap::util::dylib_path_var(),
|
||||
env::join_paths(&dylib_path).unwrap());
|
||||
|
||||
// Pass the `rustbuild` feature flag to crates which rustbuild is
|
||||
// building. See the comment in bootstrap/lib.rs where this env var is
|
||||
// set for more details.
|
||||
if env::var_os("RUSTBUILD_UNSTABLE").is_some() {
|
||||
cmd.arg("--cfg").arg("rustbuild");
|
||||
}
|
||||
|
||||
std::process::exit(match cmd.status() {
|
||||
Ok(s) => s.code().unwrap_or(1),
|
||||
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
|
||||
|
|
|
|||
43
src/bootstrap/bin/sccache-plus-cl.rs
Normal file
43
src/bootstrap/bin/sccache-plus-cl.rs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// 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.
|
||||
//
|
||||
// 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.
|
||||
|
||||
extern crate gcc;
|
||||
|
||||
use std::env;
|
||||
use std::process::{self, Command};
|
||||
|
||||
fn main() {
|
||||
let target = env::var("SCCACHE_TARGET").unwrap();
|
||||
// Locate the actual compiler that we're invoking
|
||||
env::remove_var("CC");
|
||||
env::remove_var("CXX");
|
||||
let mut cfg = gcc::Config::new();
|
||||
cfg.cargo_metadata(false)
|
||||
.out_dir("/")
|
||||
.target(&target)
|
||||
.host(&target)
|
||||
.opt_level(0)
|
||||
.debug(false);
|
||||
let compiler = cfg.get_compiler();
|
||||
|
||||
// Invoke sccache with said compiler
|
||||
let sccache_path = env::var_os("SCCACHE_PATH").unwrap();
|
||||
let mut cmd = Command::new(&sccache_path);
|
||||
cmd.arg(compiler.path());
|
||||
for &(ref k, ref v) in compiler.env() {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
for arg in env::args().skip(1) {
|
||||
cmd.arg(arg);
|
||||
}
|
||||
|
||||
let status = cmd.status().expect("failed to spawn");
|
||||
process::exit(status.code().unwrap_or(2))
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import contextlib
|
|||
import datetime
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
@ -39,7 +40,8 @@ def get(url, path, verbose=False):
|
|||
return
|
||||
else:
|
||||
if verbose:
|
||||
print("ignoring already-download file " + path + " due to failed verification")
|
||||
print("ignoring already-download file " +
|
||||
path + " due to failed verification")
|
||||
os.unlink(path)
|
||||
download(temp_path, url, True, verbose)
|
||||
if not verify(temp_path, sha_path, verbose):
|
||||
|
|
@ -99,8 +101,8 @@ def verify(path, sha_path, verbose):
|
|||
verified = found == expected
|
||||
if not verified:
|
||||
print("invalid checksum:\n"
|
||||
" found: {}\n"
|
||||
" expected: {}".format(found, expected))
|
||||
" found: {}\n"
|
||||
" expected: {}".format(found, expected))
|
||||
return verified
|
||||
|
||||
|
||||
|
|
@ -126,13 +128,13 @@ def unpack(tarball, dst, verbose=False, match=None):
|
|||
shutil.move(tp, fp)
|
||||
shutil.rmtree(os.path.join(dst, fname))
|
||||
|
||||
def run(args, verbose=False, exception=False):
|
||||
def run(args, verbose=False, exception=False, **kwargs):
|
||||
if verbose:
|
||||
print("running: " + ' '.join(args))
|
||||
sys.stdout.flush()
|
||||
# Use Popen here instead of call() as it apparently allows powershell on
|
||||
# Windows to not lock up waiting for input presumably.
|
||||
ret = subprocess.Popen(args)
|
||||
ret = subprocess.Popen(args, **kwargs)
|
||||
code = ret.wait()
|
||||
if code != 0:
|
||||
err = "failed to run: " + ' '.join(args)
|
||||
|
|
@ -140,6 +142,7 @@ def run(args, verbose=False, exception=False):
|
|||
raise RuntimeError(err)
|
||||
sys.exit(err)
|
||||
|
||||
|
||||
def stage0_data(rust_root):
|
||||
nightlies = os.path.join(rust_root, "src/stage0.txt")
|
||||
data = {}
|
||||
|
|
@ -152,65 +155,84 @@ def stage0_data(rust_root):
|
|||
data[a] = b
|
||||
return data
|
||||
|
||||
|
||||
def format_build_time(duration):
|
||||
return str(datetime.timedelta(seconds=int(duration)))
|
||||
|
||||
|
||||
class RustBuild(object):
|
||||
|
||||
def download_stage0(self):
|
||||
cache_dst = os.path.join(self.build_dir, "cache")
|
||||
rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date())
|
||||
cargo_cache = os.path.join(cache_dst, self.stage0_cargo_rev())
|
||||
rustc_cache = os.path.join(cache_dst, self.stage0_date())
|
||||
if not os.path.exists(rustc_cache):
|
||||
os.makedirs(rustc_cache)
|
||||
if not os.path.exists(cargo_cache):
|
||||
os.makedirs(cargo_cache)
|
||||
|
||||
rustc_channel = self.stage0_rustc_channel()
|
||||
cargo_channel = self.stage0_cargo_channel()
|
||||
|
||||
if self.rustc().startswith(self.bin_root()) and \
|
||||
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
|
||||
self.print_what_it_means_to_bootstrap()
|
||||
if os.path.exists(self.bin_root()):
|
||||
shutil.rmtree(self.bin_root())
|
||||
channel = self.stage0_rustc_channel()
|
||||
filename = "rust-std-{}-{}.tar.gz".format(channel, self.build)
|
||||
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
|
||||
filename = "rust-std-{}-{}.tar.gz".format(
|
||||
rustc_channel, self.build)
|
||||
url = self._download_url + "/dist/" + self.stage0_date()
|
||||
tarball = os.path.join(rustc_cache, filename)
|
||||
if not os.path.exists(tarball):
|
||||
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
|
||||
get("{}/{}".format(url, filename),
|
||||
tarball, verbose=self.verbose)
|
||||
unpack(tarball, self.bin_root(),
|
||||
match="rust-std-" + self.build,
|
||||
verbose=self.verbose)
|
||||
|
||||
filename = "rustc-{}-{}.tar.gz".format(channel, self.build)
|
||||
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
|
||||
filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
|
||||
url = self._download_url + "/dist/" + self.stage0_date()
|
||||
tarball = os.path.join(rustc_cache, filename)
|
||||
if not os.path.exists(tarball):
|
||||
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
|
||||
unpack(tarball, self.bin_root(), match="rustc", verbose=self.verbose)
|
||||
get("{}/{}".format(url, filename),
|
||||
tarball, verbose=self.verbose)
|
||||
unpack(tarball, self.bin_root(),
|
||||
match="rustc", verbose=self.verbose)
|
||||
self.fix_executable(self.bin_root() + "/bin/rustc")
|
||||
self.fix_executable(self.bin_root() + "/bin/rustdoc")
|
||||
with open(self.rustc_stamp(), 'w') as f:
|
||||
f.write(self.stage0_rustc_date())
|
||||
f.write(self.stage0_date())
|
||||
|
||||
if "pc-windows-gnu" in self.build:
|
||||
filename = "rust-mingw-{}-{}.tar.gz".format(
|
||||
rustc_channel, self.build)
|
||||
url = self._download_url + "/dist/" + self.stage0_date()
|
||||
tarball = os.path.join(rustc_cache, filename)
|
||||
if not os.path.exists(tarball):
|
||||
get("{}/{}".format(url, filename),
|
||||
tarball, verbose=self.verbose)
|
||||
unpack(tarball, self.bin_root(),
|
||||
match="rust-mingw", verbose=self.verbose)
|
||||
|
||||
if self.cargo().startswith(self.bin_root()) and \
|
||||
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
|
||||
self.print_what_it_means_to_bootstrap()
|
||||
filename = "cargo-nightly-{}.tar.gz".format(self.build)
|
||||
url = "https://s3.amazonaws.com/rust-lang-ci/cargo-builds/" + self.stage0_cargo_rev()
|
||||
tarball = os.path.join(cargo_cache, filename)
|
||||
filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
|
||||
url = self._download_url + "/dist/" + self.stage0_date()
|
||||
tarball = os.path.join(rustc_cache, filename)
|
||||
if not os.path.exists(tarball):
|
||||
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
|
||||
unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose)
|
||||
get("{}/{}".format(url, filename),
|
||||
tarball, verbose=self.verbose)
|
||||
unpack(tarball, self.bin_root(),
|
||||
match="cargo", verbose=self.verbose)
|
||||
self.fix_executable(self.bin_root() + "/bin/cargo")
|
||||
with open(self.cargo_stamp(), 'w') as f:
|
||||
f.write(self.stage0_cargo_rev())
|
||||
f.write(self.stage0_date())
|
||||
|
||||
def fix_executable(self, fname):
|
||||
# If we're on NixOS we need to change the path to the dynamic loader
|
||||
|
||||
default_encoding = sys.getdefaultencoding()
|
||||
try:
|
||||
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
|
||||
ostype = subprocess.check_output(
|
||||
['uname', '-s']).strip().decode(default_encoding)
|
||||
except (subprocess.CalledProcessError, WindowsError):
|
||||
return
|
||||
|
||||
|
|
@ -226,7 +248,8 @@ class RustBuild(object):
|
|||
print("info: you seem to be running NixOS. Attempting to patch " + fname)
|
||||
|
||||
try:
|
||||
interpreter = subprocess.check_output(["patchelf", "--print-interpreter", fname])
|
||||
interpreter = subprocess.check_output(
|
||||
["patchelf", "--print-interpreter", fname])
|
||||
interpreter = interpreter.strip().decode(default_encoding)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("warning: failed to call patchelf: %s" % e)
|
||||
|
|
@ -235,7 +258,8 @@ class RustBuild(object):
|
|||
loader = interpreter.split("/")[-1]
|
||||
|
||||
try:
|
||||
ldd_output = subprocess.check_output(['ldd', '/run/current-system/sw/bin/sh'])
|
||||
ldd_output = subprocess.check_output(
|
||||
['ldd', '/run/current-system/sw/bin/sh'])
|
||||
ldd_output = ldd_output.strip().decode(default_encoding)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("warning: unable to call ldd: %s" % e)
|
||||
|
|
@ -253,20 +277,21 @@ class RustBuild(object):
|
|||
correct_interpreter = loader_path + loader
|
||||
|
||||
try:
|
||||
subprocess.check_output(["patchelf", "--set-interpreter", correct_interpreter, fname])
|
||||
subprocess.check_output(
|
||||
["patchelf", "--set-interpreter", correct_interpreter, fname])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("warning: failed to call patchelf: %s" % e)
|
||||
return
|
||||
|
||||
def stage0_cargo_rev(self):
|
||||
return self._cargo_rev
|
||||
|
||||
def stage0_rustc_date(self):
|
||||
return self._rustc_date
|
||||
def stage0_date(self):
|
||||
return self._date
|
||||
|
||||
def stage0_rustc_channel(self):
|
||||
return self._rustc_channel
|
||||
|
||||
def stage0_cargo_channel(self):
|
||||
return self._cargo_channel
|
||||
|
||||
def rustc_stamp(self):
|
||||
return os.path.join(self.bin_root(), '.rustc-stamp')
|
||||
|
||||
|
|
@ -277,21 +302,23 @@ class RustBuild(object):
|
|||
if not os.path.exists(self.rustc_stamp()) or self.clean:
|
||||
return True
|
||||
with open(self.rustc_stamp(), 'r') as f:
|
||||
return self.stage0_rustc_date() != f.read()
|
||||
return self.stage0_date() != f.read()
|
||||
|
||||
def cargo_out_of_date(self):
|
||||
if not os.path.exists(self.cargo_stamp()) or self.clean:
|
||||
return True
|
||||
with open(self.cargo_stamp(), 'r') as f:
|
||||
return self.stage0_cargo_rev() != f.read()
|
||||
return self.stage0_date() != f.read()
|
||||
|
||||
def bin_root(self):
|
||||
return os.path.join(self.build_dir, self.build, "stage0")
|
||||
|
||||
def get_toml(self, key):
|
||||
for line in self.config_toml.splitlines():
|
||||
if line.startswith(key + ' ='):
|
||||
return self.get_string(line)
|
||||
match = re.match(r'^{}\s*=(.*)$'.format(key), line)
|
||||
if match is not None:
|
||||
value = match.group(1)
|
||||
return self.get_string(value) or value.strip()
|
||||
return None
|
||||
|
||||
def get_mk(self, key):
|
||||
|
|
@ -322,6 +349,8 @@ class RustBuild(object):
|
|||
|
||||
def get_string(self, line):
|
||||
start = line.find('"')
|
||||
if start == -1:
|
||||
return None
|
||||
end = start + 1 + line[start + 1:].find('"')
|
||||
return line[start + 1:end]
|
||||
|
||||
|
|
@ -359,28 +388,29 @@ class RustBuild(object):
|
|||
env["CARGO_TARGET_DIR"] = build_dir
|
||||
env["RUSTC"] = self.rustc()
|
||||
env["LD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
|
||||
(os.pathsep + env["LD_LIBRARY_PATH"]) \
|
||||
if "LD_LIBRARY_PATH" in env else ""
|
||||
(os.pathsep + env["LD_LIBRARY_PATH"]) \
|
||||
if "LD_LIBRARY_PATH" in env else ""
|
||||
env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
|
||||
(os.pathsep + env["DYLD_LIBRARY_PATH"]) \
|
||||
if "DYLD_LIBRARY_PATH" in env else ""
|
||||
(os.pathsep + env["DYLD_LIBRARY_PATH"]) \
|
||||
if "DYLD_LIBRARY_PATH" in env else ""
|
||||
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
|
||||
(os.pathsep + env["LIBRARY_PATH"]) \
|
||||
if "LIBRARY_PATH" in env else ""
|
||||
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
|
||||
os.pathsep + env["PATH"]
|
||||
os.pathsep + env["PATH"]
|
||||
if not os.path.isfile(self.cargo()):
|
||||
raise Exception("no cargo executable found at `%s`" % self.cargo())
|
||||
args = [self.cargo(), "build", "--manifest-path",
|
||||
os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")]
|
||||
if self.verbose:
|
||||
args.append("--verbose")
|
||||
if self.verbose > 1:
|
||||
args.append("--verbose")
|
||||
if self.use_locked_deps:
|
||||
args.append("--locked")
|
||||
if self.use_vendored_sources:
|
||||
args.append("--frozen")
|
||||
self.run(args, env)
|
||||
|
||||
def run(self, args, env):
|
||||
proc = subprocess.Popen(args, env=env)
|
||||
ret = proc.wait()
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
run(args, env=env, verbose=self.verbose)
|
||||
|
||||
def build_triple(self):
|
||||
default_encoding = sys.getdefaultencoding()
|
||||
|
|
@ -391,8 +421,10 @@ class RustBuild(object):
|
|||
if config:
|
||||
return config
|
||||
try:
|
||||
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
|
||||
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
|
||||
ostype = subprocess.check_output(
|
||||
['uname', '-s']).strip().decode(default_encoding)
|
||||
cputype = subprocess.check_output(
|
||||
['uname', '-m']).strip().decode(default_encoding)
|
||||
except (subprocess.CalledProcessError, OSError):
|
||||
if sys.platform == 'win32':
|
||||
return 'x86_64-pc-windows-msvc'
|
||||
|
|
@ -401,18 +433,15 @@ class RustBuild(object):
|
|||
raise Exception(err)
|
||||
sys.exit(err)
|
||||
|
||||
# Darwin's `uname -s` lies and always returns i386. We have to use
|
||||
# sysctl instead.
|
||||
if ostype == 'Darwin' and cputype == 'i686':
|
||||
args = ['sysctl', 'hw.optional.x86_64']
|
||||
sysctl = subprocess.check_output(args).decode(default_encoding)
|
||||
if ': 1' in sysctl:
|
||||
cputype = 'x86_64'
|
||||
|
||||
# The goal here is to come up with the same triple as LLVM would,
|
||||
# at least for the subset of platforms we're willing to target.
|
||||
if ostype == 'Linux':
|
||||
ostype = 'unknown-linux-gnu'
|
||||
os_from_sp = subprocess.check_output(
|
||||
['uname', '-o']).strip().decode(default_encoding)
|
||||
if os_from_sp == 'Android':
|
||||
ostype = 'linux-android'
|
||||
else:
|
||||
ostype = 'unknown-linux-gnu'
|
||||
elif ostype == 'FreeBSD':
|
||||
ostype = 'unknown-freebsd'
|
||||
elif ostype == 'DragonFly':
|
||||
|
|
@ -432,7 +461,7 @@ class RustBuild(object):
|
|||
# must be used instead.
|
||||
try:
|
||||
cputype = subprocess.check_output(['isainfo',
|
||||
'-k']).strip().decode(default_encoding)
|
||||
'-k']).strip().decode(default_encoding)
|
||||
except (subprocess.CalledProcessError, OSError):
|
||||
err = "isainfo not found"
|
||||
if self.verbose:
|
||||
|
|
@ -469,15 +498,21 @@ class RustBuild(object):
|
|||
cputype = 'i686'
|
||||
elif cputype in {'xscale', 'arm'}:
|
||||
cputype = 'arm'
|
||||
elif cputype in {'armv6l', 'armv7l', 'armv8l'}:
|
||||
if ostype == 'linux-android':
|
||||
ostype = 'linux-androideabi'
|
||||
elif cputype == 'armv6l':
|
||||
cputype = 'arm'
|
||||
ostype += 'eabihf'
|
||||
elif cputype == 'armv7l':
|
||||
if ostype == 'linux-android':
|
||||
ostype = 'linux-androideabi'
|
||||
else:
|
||||
ostype += 'eabihf'
|
||||
elif cputype in {'armv7l', 'armv8l'}:
|
||||
cputype = 'armv7'
|
||||
ostype += 'eabihf'
|
||||
elif cputype == 'aarch64':
|
||||
cputype = 'aarch64'
|
||||
elif cputype == 'arm64':
|
||||
if ostype == 'linux-android':
|
||||
ostype = 'linux-androideabi'
|
||||
else:
|
||||
ostype += 'eabihf'
|
||||
elif cputype in {'aarch64', 'arm64'}:
|
||||
cputype = 'aarch64'
|
||||
elif cputype == 'mips':
|
||||
if sys.byteorder == 'big':
|
||||
|
|
@ -517,6 +552,32 @@ class RustBuild(object):
|
|||
|
||||
return "{}-{}".format(cputype, ostype)
|
||||
|
||||
def update_submodules(self):
|
||||
if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or \
|
||||
self.get_toml('submodules') == "false" or \
|
||||
self.get_mk('CFG_DISABLE_MANAGE_SUBMODULES') == "1":
|
||||
return
|
||||
print('Updating submodules')
|
||||
default_encoding = sys.getdefaultencoding()
|
||||
run(["git", "submodule", "-q", "sync"], cwd=self.rust_root)
|
||||
submodules = [s.split(' ', 1)[1] for s in subprocess.check_output(
|
||||
["git", "config", "--file", os.path.join(self.rust_root, ".gitmodules"),
|
||||
"--get-regexp", "path"]
|
||||
).decode(default_encoding).splitlines()]
|
||||
submodules = [module for module in submodules
|
||||
if not ((module.endswith("llvm") and
|
||||
(self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or
|
||||
(module.endswith("jemalloc") and
|
||||
(self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT'))))
|
||||
]
|
||||
run(["git", "submodule", "update",
|
||||
"--init"] + submodules, cwd=self.rust_root, verbose=self.verbose)
|
||||
run(["git", "submodule", "-q", "foreach", "git",
|
||||
"reset", "-q", "--hard"], cwd=self.rust_root, verbose=self.verbose)
|
||||
run(["git", "submodule", "-q", "foreach", "git",
|
||||
"clean", "-qdfx"], cwd=self.rust_root, verbose=self.verbose)
|
||||
|
||||
|
||||
def bootstrap():
|
||||
parser = argparse.ArgumentParser(description='Build rust')
|
||||
parser.add_argument('--config')
|
||||
|
|
@ -545,6 +606,11 @@ def bootstrap():
|
|||
except:
|
||||
pass
|
||||
|
||||
if '\nverbose = 2' in rb.config_toml:
|
||||
rb.verbose = 2
|
||||
elif '\nverbose = 1' in rb.config_toml:
|
||||
rb.verbose = 1
|
||||
|
||||
rb.use_vendored_sources = '\nvendor = true' in rb.config_toml or \
|
||||
'CFG_ENABLE_VENDOR' in rb.config_mk
|
||||
|
||||
|
|
@ -563,7 +629,7 @@ def bootstrap():
|
|||
if rb.use_vendored_sources:
|
||||
if not os.path.exists('.cargo'):
|
||||
os.makedirs('.cargo')
|
||||
with open('.cargo/config','w') as f:
|
||||
with open('.cargo/config', 'w') as f:
|
||||
f.write("""
|
||||
[source.crates-io]
|
||||
replace-with = 'vendored-sources'
|
||||
|
|
@ -577,8 +643,15 @@ def bootstrap():
|
|||
shutil.rmtree('.cargo')
|
||||
|
||||
data = stage0_data(rb.rust_root)
|
||||
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
|
||||
rb._cargo_rev = data['cargo']
|
||||
rb._date = data['date']
|
||||
rb._rustc_channel = data['rustc']
|
||||
rb._cargo_channel = data['cargo']
|
||||
if 'dev' in data:
|
||||
rb._download_url = 'https://dev-static.rust-lang.org'
|
||||
else:
|
||||
rb._download_url = 'https://static.rust-lang.org'
|
||||
|
||||
rb.update_submodules()
|
||||
|
||||
# Fetch/build the bootstrap
|
||||
rb.build = rb.build_triple()
|
||||
|
|
@ -594,20 +667,27 @@ def bootstrap():
|
|||
env["BUILD"] = rb.build
|
||||
env["SRC"] = rb.rust_root
|
||||
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
|
||||
rb.run(args, env)
|
||||
run(args, env=env, verbose=rb.verbose)
|
||||
|
||||
|
||||
def main():
|
||||
start_time = time()
|
||||
help_triggered = (
|
||||
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
|
||||
try:
|
||||
bootstrap()
|
||||
print("Build completed successfully in %s" % format_build_time(time() - start_time))
|
||||
if not help_triggered:
|
||||
print("Build completed successfully in %s" %
|
||||
format_build_time(time() - start_time))
|
||||
except (SystemExit, KeyboardInterrupt) as e:
|
||||
if hasattr(e, 'code') and isinstance(e.code, int):
|
||||
exit_code = e.code
|
||||
else:
|
||||
exit_code = 1
|
||||
print(e)
|
||||
print("Build completed unsuccessfully in %s" % format_build_time(time() - start_time))
|
||||
if not help_triggered:
|
||||
print("Build completed unsuccessfully in %s" %
|
||||
format_build_time(time() - start_time))
|
||||
sys.exit(exit_code)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use build_helper::output;
|
|||
use Build;
|
||||
|
||||
// The version number
|
||||
pub const CFG_RELEASE_NUM: &'static str = "1.17.0";
|
||||
pub const CFG_RELEASE_NUM: &'static str = "1.19.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
|
||||
|
|
@ -42,9 +42,22 @@ struct Info {
|
|||
|
||||
impl GitInfo {
|
||||
pub fn new(dir: &Path) -> GitInfo {
|
||||
if !dir.join(".git").is_dir() {
|
||||
// See if this even begins to look like a git dir
|
||||
if !dir.join(".git").exists() {
|
||||
return GitInfo { inner: None }
|
||||
}
|
||||
|
||||
// Make sure git commands work
|
||||
let out = Command::new("git")
|
||||
.arg("rev-parse")
|
||||
.current_dir(dir)
|
||||
.output()
|
||||
.expect("failed to spawn git");
|
||||
if !out.status.success() {
|
||||
return GitInfo { inner: None }
|
||||
}
|
||||
|
||||
// Ok, let's scrape some info
|
||||
let ver_date = output(Command::new("git").current_dir(dir)
|
||||
.arg("log").arg("-1")
|
||||
.arg("--date=short")
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use {Build, Compiler, Mode};
|
|||
use dist;
|
||||
use util::{self, dylib_path, dylib_path_var, exe};
|
||||
|
||||
const ADB_TEST_DIR: &'static str = "/data/tmp";
|
||||
const ADB_TEST_DIR: &'static str = "/data/tmp/work";
|
||||
|
||||
/// The two modes of the test runner; tests or benchmarks.
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
@ -78,14 +78,6 @@ pub fn linkcheck(build: &Build, host: &str) {
|
|||
pub fn cargotest(build: &Build, stage: u32, host: &str) {
|
||||
let ref compiler = Compiler::new(stage, host);
|
||||
|
||||
// Configure PATH to find the right rustc. NB. we have to use PATH
|
||||
// and not RUSTC because the Cargo test suite has tests that will
|
||||
// fail if rustc is not spelled `rustc`.
|
||||
let path = build.sysroot(compiler).join("bin");
|
||||
let old_path = ::std::env::var("PATH").expect("");
|
||||
let sep = if cfg!(windows) { ";" } else {":" };
|
||||
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);
|
||||
|
||||
// Note that this is a short, cryptic, and not scoped directory name. This
|
||||
// is currently to minimize the length of path on Windows where we otherwise
|
||||
// quickly run into path name limit constraints.
|
||||
|
|
@ -95,9 +87,35 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
|
|||
let _time = util::timeit();
|
||||
let mut cmd = Command::new(build.tool(&Compiler::new(0, host), "cargotest"));
|
||||
build.prepare_tool_cmd(compiler, &mut cmd);
|
||||
build.run(cmd.env("PATH", newpath)
|
||||
.arg(&build.cargo)
|
||||
.arg(&out_dir));
|
||||
build.run(cmd.arg(&build.cargo)
|
||||
.arg(&out_dir)
|
||||
.env("RUSTC", build.compiler_path(compiler))
|
||||
.env("RUSTDOC", build.rustdoc(compiler)))
|
||||
}
|
||||
|
||||
/// Runs `cargo test` for `cargo` packaged with Rust.
|
||||
pub fn cargo(build: &Build, stage: u32, host: &str) {
|
||||
let ref compiler = Compiler::new(stage, host);
|
||||
|
||||
// Configure PATH to find the right rustc. NB. we have to use PATH
|
||||
// and not RUSTC because the Cargo test suite has tests that will
|
||||
// fail if rustc is not spelled `rustc`.
|
||||
let path = build.sysroot(compiler).join("bin");
|
||||
let old_path = ::std::env::var("PATH").expect("");
|
||||
let sep = if cfg!(windows) { ";" } else {":" };
|
||||
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);
|
||||
|
||||
let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml"));
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
// Don't run cross-compile tests, we may not have cross-compiled libstd libs
|
||||
// available.
|
||||
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
|
||||
|
||||
build.run(cargo.env("PATH", newpath));
|
||||
}
|
||||
|
||||
/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
|
||||
|
|
@ -176,7 +194,7 @@ pub fn compiletest(build: &Build,
|
|||
cmd.arg("--docck-python").arg(build.python());
|
||||
|
||||
if build.config.build.ends_with("apple-darwin") {
|
||||
// Force /usr/bin/python on OSX for LLDB tests because we're loading the
|
||||
// Force /usr/bin/python on macOS for LLDB tests because we're loading the
|
||||
// LLDB plugin's compiled module which only works with the system python
|
||||
// (namely not Homebrew-installed python)
|
||||
cmd.arg("--lldb-python").arg("/usr/bin/python");
|
||||
|
|
@ -225,10 +243,10 @@ pub fn compiletest(build: &Build,
|
|||
.arg("--llvm-cxxflags").arg("");
|
||||
}
|
||||
|
||||
if build.qemu_rootfs(target).is_some() {
|
||||
cmd.arg("--qemu-test-client")
|
||||
if build.remote_tested(target) {
|
||||
cmd.arg("--remote-test-client")
|
||||
.arg(build.tool(&Compiler::new(0, &build.config.build),
|
||||
"qemu-test-client"));
|
||||
"remote-test-client"));
|
||||
}
|
||||
|
||||
// Running a C compiler on MSVC requires a few env vars to be set, to be
|
||||
|
|
@ -285,6 +303,16 @@ pub fn docs(build: &Build, compiler: &Compiler) {
|
|||
continue
|
||||
}
|
||||
|
||||
// The nostarch directory in the book is for no starch, and so isn't guaranteed to build.
|
||||
// we don't care if it doesn't build, so skip it.
|
||||
use std::ffi::OsStr;
|
||||
let path: &OsStr = p.as_ref();
|
||||
if let Some(path) = path.to_str() {
|
||||
if path.contains("nostarch") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
println!("doc tests for: {}", p.display());
|
||||
markdown_test(build, compiler, &p);
|
||||
}
|
||||
|
|
@ -417,9 +445,7 @@ pub fn krate(build: &Build,
|
|||
dylib_path.insert(0, build.sysroot_libdir(&compiler, target));
|
||||
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
|
||||
if target.contains("android") ||
|
||||
target.contains("emscripten") ||
|
||||
build.qemu_rootfs(target).is_some() {
|
||||
if target.contains("emscripten") || build.remote_tested(target) {
|
||||
cargo.arg("--no-run");
|
||||
}
|
||||
|
||||
|
|
@ -431,75 +457,24 @@ pub fn krate(build: &Build,
|
|||
|
||||
let _time = util::timeit();
|
||||
|
||||
if target.contains("android") {
|
||||
build.run(&mut cargo);
|
||||
krate_android(build, &compiler, target, mode);
|
||||
} else if target.contains("emscripten") {
|
||||
if target.contains("emscripten") {
|
||||
build.run(&mut cargo);
|
||||
krate_emscripten(build, &compiler, target, mode);
|
||||
} else if build.qemu_rootfs(target).is_some() {
|
||||
} else if build.remote_tested(target) {
|
||||
build.run(&mut cargo);
|
||||
krate_qemu(build, &compiler, target, mode);
|
||||
krate_remote(build, &compiler, target, mode);
|
||||
} else {
|
||||
cargo.args(&build.flags.cmd.test_args());
|
||||
build.run(&mut cargo);
|
||||
}
|
||||
}
|
||||
|
||||
fn krate_android(build: &Build,
|
||||
compiler: &Compiler,
|
||||
target: &str,
|
||||
mode: Mode) {
|
||||
let mut tests = Vec::new();
|
||||
let out_dir = build.cargo_out(compiler, mode, target);
|
||||
find_tests(&out_dir, target, &mut tests);
|
||||
find_tests(&out_dir.join("deps"), target, &mut tests);
|
||||
|
||||
for test in tests {
|
||||
build.run(Command::new("adb").arg("push").arg(&test).arg(ADB_TEST_DIR));
|
||||
|
||||
let test_file_name = test.file_name().unwrap().to_string_lossy();
|
||||
let log = format!("{}/check-stage{}-T-{}-H-{}-{}.log",
|
||||
ADB_TEST_DIR,
|
||||
compiler.stage,
|
||||
target,
|
||||
compiler.host,
|
||||
test_file_name);
|
||||
let quiet = if build.config.quiet_tests { "--quiet" } else { "" };
|
||||
let program = format!("(cd {dir}; \
|
||||
LD_LIBRARY_PATH=./{target} ./{test} \
|
||||
--logfile {log} \
|
||||
{quiet} \
|
||||
{args})",
|
||||
dir = ADB_TEST_DIR,
|
||||
target = target,
|
||||
test = test_file_name,
|
||||
log = log,
|
||||
quiet = quiet,
|
||||
args = build.flags.cmd.test_args().join(" "));
|
||||
|
||||
let output = output(Command::new("adb").arg("shell").arg(&program));
|
||||
println!("{}", output);
|
||||
|
||||
t!(fs::create_dir_all(build.out.join("tmp")));
|
||||
build.run(Command::new("adb")
|
||||
.arg("pull")
|
||||
.arg(&log)
|
||||
.arg(build.out.join("tmp")));
|
||||
build.run(Command::new("adb").arg("shell").arg("rm").arg(&log));
|
||||
if !output.contains("result: ok") {
|
||||
panic!("some tests failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn krate_emscripten(build: &Build,
|
||||
compiler: &Compiler,
|
||||
target: &str,
|
||||
mode: Mode) {
|
||||
let mut tests = Vec::new();
|
||||
let out_dir = build.cargo_out(compiler, mode, target);
|
||||
find_tests(&out_dir, target, &mut tests);
|
||||
find_tests(&out_dir.join("deps"), target, &mut tests);
|
||||
|
||||
for test in tests {
|
||||
|
|
@ -515,17 +490,16 @@ fn krate_emscripten(build: &Build,
|
|||
}
|
||||
}
|
||||
|
||||
fn krate_qemu(build: &Build,
|
||||
compiler: &Compiler,
|
||||
target: &str,
|
||||
mode: Mode) {
|
||||
fn krate_remote(build: &Build,
|
||||
compiler: &Compiler,
|
||||
target: &str,
|
||||
mode: Mode) {
|
||||
let mut tests = Vec::new();
|
||||
let out_dir = build.cargo_out(compiler, mode, target);
|
||||
find_tests(&out_dir, target, &mut tests);
|
||||
find_tests(&out_dir.join("deps"), target, &mut tests);
|
||||
|
||||
let tool = build.tool(&Compiler::new(0, &build.config.build),
|
||||
"qemu-test-client");
|
||||
"remote-test-client");
|
||||
for test in tests {
|
||||
let mut cmd = Command::new(&tool);
|
||||
cmd.arg("run")
|
||||
|
|
@ -538,7 +512,6 @@ fn krate_qemu(build: &Build,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
fn find_tests(dir: &Path,
|
||||
target: &str,
|
||||
dst: &mut Vec<PathBuf>) {
|
||||
|
|
@ -556,60 +529,29 @@ fn find_tests(dir: &Path,
|
|||
}
|
||||
}
|
||||
|
||||
pub fn emulator_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
|
||||
if target.contains("android") {
|
||||
android_copy_libs(build, compiler, target)
|
||||
} else if let Some(s) = build.qemu_rootfs(target) {
|
||||
qemu_copy_libs(build, compiler, target, s)
|
||||
pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
|
||||
if !build.remote_tested(target) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
fn android_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
|
||||
println!("Android copy libs to emulator ({})", target);
|
||||
build.run(Command::new("adb").arg("wait-for-device"));
|
||||
build.run(Command::new("adb").arg("remount"));
|
||||
build.run(Command::new("adb").args(&["shell", "rm", "-r", ADB_TEST_DIR]));
|
||||
build.run(Command::new("adb").args(&["shell", "mkdir", ADB_TEST_DIR]));
|
||||
build.run(Command::new("adb")
|
||||
.arg("push")
|
||||
.arg(build.src.join("src/etc/adb_run_wrapper.sh"))
|
||||
.arg(ADB_TEST_DIR));
|
||||
|
||||
let target_dir = format!("{}/{}", ADB_TEST_DIR, target);
|
||||
build.run(Command::new("adb").args(&["shell", "mkdir", &target_dir[..]]));
|
||||
|
||||
for f in t!(build.sysroot_libdir(compiler, target).read_dir()) {
|
||||
let f = t!(f);
|
||||
let name = f.file_name().into_string().unwrap();
|
||||
if util::is_dylib(&name) {
|
||||
build.run(Command::new("adb")
|
||||
.arg("push")
|
||||
.arg(f.path())
|
||||
.arg(&target_dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn qemu_copy_libs(build: &Build,
|
||||
compiler: &Compiler,
|
||||
target: &str,
|
||||
rootfs: &Path) {
|
||||
println!("QEMU copy libs to emulator ({})", target);
|
||||
assert!(target.starts_with("arm"), "only works with arm for now");
|
||||
println!("REMOTE copy libs to emulator ({})", target);
|
||||
t!(fs::create_dir_all(build.out.join("tmp")));
|
||||
|
||||
// Copy our freshly compiled test server over to the rootfs
|
||||
let server = build.cargo_out(compiler, Mode::Tool, target)
|
||||
.join(exe("qemu-test-server", target));
|
||||
t!(fs::copy(&server, rootfs.join("testd")));
|
||||
.join(exe("remote-test-server", target));
|
||||
|
||||
// Spawn the emulator and wait for it to come online
|
||||
let tool = build.tool(&Compiler::new(0, &build.config.build),
|
||||
"qemu-test-client");
|
||||
build.run(Command::new(&tool)
|
||||
.arg("spawn-emulator")
|
||||
.arg(rootfs)
|
||||
.arg(build.out.join("tmp")));
|
||||
"remote-test-client");
|
||||
let mut cmd = Command::new(&tool);
|
||||
cmd.arg("spawn-emulator")
|
||||
.arg(target)
|
||||
.arg(&server)
|
||||
.arg(build.out.join("tmp"));
|
||||
if let Some(rootfs) = build.qemu_rootfs(target) {
|
||||
cmd.arg(rootfs);
|
||||
}
|
||||
build.run(&mut cmd);
|
||||
|
||||
// Push all our dylibs to the emulator
|
||||
for f in t!(build.sysroot_libdir(compiler, target).read_dir()) {
|
||||
|
|
@ -635,6 +577,7 @@ pub fn distcheck(build: &Build) {
|
|||
return
|
||||
}
|
||||
|
||||
println!("Distcheck");
|
||||
let dir = build.out.join("tmp").join("distcheck");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
|
|
@ -652,6 +595,26 @@ pub fn distcheck(build: &Build) {
|
|||
build.run(Command::new(build_helper::make(&build.config.build))
|
||||
.arg("check")
|
||||
.current_dir(&dir));
|
||||
|
||||
// Now make sure that rust-src has all of libstd's dependencies
|
||||
println!("Distcheck rust-src");
|
||||
let dir = build.out.join("tmp").join("distcheck-src");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
|
||||
let mut cmd = Command::new("tar");
|
||||
cmd.arg("-xzf")
|
||||
.arg(dist::rust_src_installer(build))
|
||||
.arg("--strip-components=1")
|
||||
.current_dir(&dir);
|
||||
build.run(&mut cmd);
|
||||
|
||||
let toml = dir.join("rust-src/lib/rustlib/src/rust/src/libstd/Cargo.toml");
|
||||
build.run(Command::new(&build.cargo)
|
||||
.arg("generate-lockfile")
|
||||
.arg("--manifest-path")
|
||||
.arg(&toml)
|
||||
.current_dir(&dir));
|
||||
}
|
||||
|
||||
/// Test the build system itself
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ use std::path::Path;
|
|||
use Build;
|
||||
|
||||
pub fn clean(build: &Build) {
|
||||
rm_rf(build, "tmp".as_ref());
|
||||
rm_rf(build, &build.out.join("tmp"));
|
||||
rm_rf(build, &build.out.join("dist"));
|
||||
rm_rf("tmp".as_ref());
|
||||
rm_rf(&build.out.join("tmp"));
|
||||
rm_rf(&build.out.join("dist"));
|
||||
|
||||
for host in build.config.host.iter() {
|
||||
let entries = match build.out.join(host).read_dir() {
|
||||
|
|
@ -38,32 +38,31 @@ pub fn clean(build: &Build) {
|
|||
continue
|
||||
}
|
||||
let path = t!(entry.path().canonicalize());
|
||||
rm_rf(build, &path);
|
||||
rm_rf(&path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn rm_rf(build: &Build, path: &Path) {
|
||||
if !path.exists() {
|
||||
return
|
||||
}
|
||||
if path.is_file() {
|
||||
return do_op(path, "remove file", |p| fs::remove_file(p));
|
||||
}
|
||||
fn rm_rf(path: &Path) {
|
||||
match path.symlink_metadata() {
|
||||
Err(e) => {
|
||||
if e.kind() == ErrorKind::NotFound {
|
||||
return;
|
||||
}
|
||||
panic!("failed to get metadata for file {}: {}", path.display(), e);
|
||||
},
|
||||
Ok(metadata) => {
|
||||
if metadata.file_type().is_file() || metadata.file_type().is_symlink() {
|
||||
do_op(path, "remove file", |p| fs::remove_file(p));
|
||||
return;
|
||||
}
|
||||
|
||||
for file in t!(fs::read_dir(path)) {
|
||||
let file = t!(file).path();
|
||||
|
||||
if file.is_dir() {
|
||||
rm_rf(build, &file);
|
||||
} else {
|
||||
// On windows we can't remove a readonly file, and git will
|
||||
// often clone files as readonly. As a result, we have some
|
||||
// special logic to remove readonly files on windows.
|
||||
do_op(&file, "remove file", |p| fs::remove_file(p));
|
||||
}
|
||||
}
|
||||
do_op(path, "remove dir", |p| fs::remove_dir(p));
|
||||
for file in t!(fs::read_dir(path)) {
|
||||
rm_rf(&t!(file).path());
|
||||
}
|
||||
do_op(path, "remove dir", |p| fs::remove_dir(p));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
fn do_op<F>(path: &Path, desc: &str, mut f: F)
|
||||
|
|
@ -71,9 +70,12 @@ fn do_op<F>(path: &Path, desc: &str, mut f: F)
|
|||
{
|
||||
match f(path) {
|
||||
Ok(()) => {}
|
||||
// On windows we can't remove a readonly file, and git will often clone files as readonly.
|
||||
// As a result, we have some special logic to remove readonly files on windows.
|
||||
// This is also the reason that we can't use things like fs::remove_dir_all().
|
||||
Err(ref e) if cfg!(windows) &&
|
||||
e.kind() == ErrorKind::PermissionDenied => {
|
||||
let mut p = t!(path.metadata()).permissions();
|
||||
let mut p = t!(path.symlink_metadata()).permissions();
|
||||
p.set_readonly(false);
|
||||
t!(fs::set_permissions(path, p));
|
||||
f(path).unwrap_or_else(|e| {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use std::collections::HashMap;
|
|||
use std::fs::{self, File};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::env;
|
||||
|
||||
use build_helper::{output, mtime, up_to_date};
|
||||
use filetime::FileTime;
|
||||
|
|
@ -44,6 +45,11 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
|
|||
build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
|
||||
let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build");
|
||||
let mut features = build.std_features();
|
||||
|
||||
if let Ok(target) = env::var("MACOSX_STD_DEPLOYMENT_TARGET") {
|
||||
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
|
||||
}
|
||||
|
||||
// When doing a local rebuild we tell cargo that we're stage1 rather than
|
||||
// stage0. This works fine if the local rust and being-built rust have the
|
||||
// same view of what the default allocator is, but fails otherwise. Since
|
||||
|
|
@ -109,6 +115,13 @@ pub fn std_link(build: &Build,
|
|||
if target.contains("musl") && !target.contains("mips") {
|
||||
copy_musl_third_party_objects(build, target, &libdir);
|
||||
}
|
||||
|
||||
if build.config.sanitizers && compiler.stage != 0 && target == "x86_64-apple-darwin" {
|
||||
// The sanitizers are only built in stage1 or above, so the dylibs will
|
||||
// be missing in stage0 and causes panic. See the `std()` function above
|
||||
// for reason why the sanitizers are not built in stage0.
|
||||
copy_apple_sanitizer_dylibs(&build.native_dir(target), "osx", &libdir);
|
||||
}
|
||||
}
|
||||
|
||||
/// Copies the crt(1,i,n).o startup objects
|
||||
|
|
@ -120,6 +133,18 @@ fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) {
|
|||
}
|
||||
}
|
||||
|
||||
fn copy_apple_sanitizer_dylibs(native_dir: &Path, platform: &str, into: &Path) {
|
||||
for &sanitizer in &["asan", "tsan"] {
|
||||
let filename = format!("libclang_rt.{}_{}_dynamic.dylib", sanitizer, platform);
|
||||
let mut src_path = native_dir.join(sanitizer);
|
||||
src_path.push("build");
|
||||
src_path.push("lib");
|
||||
src_path.push("darwin");
|
||||
src_path.push(&filename);
|
||||
copy(&src_path, &into.join(filename));
|
||||
}
|
||||
}
|
||||
|
||||
/// Build and prepare startup objects like rsbegin.o and rsend.o
|
||||
///
|
||||
/// These are primarily used on Windows right now for linking executables/dlls.
|
||||
|
|
@ -145,6 +170,7 @@ pub fn build_startup_objects(build: &Build, for_compiler: &Compiler, target: &st
|
|||
if !up_to_date(src_file, dst_file) {
|
||||
let mut cmd = Command::new(&compiler_path);
|
||||
build.run(cmd.env("RUSTC_BOOTSTRAP", "1")
|
||||
.arg("--cfg").arg(format!("stage{}", compiler.stage))
|
||||
.arg("--target").arg(target)
|
||||
.arg("--emit=obj")
|
||||
.arg("--out-dir").arg(dst_dir)
|
||||
|
|
@ -170,6 +196,9 @@ pub fn test(build: &Build, target: &str, compiler: &Compiler) {
|
|||
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
|
||||
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
|
||||
let mut cargo = build.cargo(compiler, Mode::Libtest, target, "build");
|
||||
if let Ok(target) = env::var("MACOSX_STD_DEPLOYMENT_TARGET") {
|
||||
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
|
||||
}
|
||||
cargo.arg("--manifest-path")
|
||||
.arg(build.src.join("src/libtest/Cargo.toml"));
|
||||
build.run(&mut cargo);
|
||||
|
|
@ -249,7 +278,7 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
|
|||
cargo.env("CFG_LLVM_ROOT", s);
|
||||
}
|
||||
// Building with a static libstdc++ is only supported on linux right now,
|
||||
// not for MSVC or OSX
|
||||
// not for MSVC or macOS
|
||||
if build.config.llvm_static_stdcpp &&
|
||||
!target.contains("windows") &&
|
||||
!target.contains("apple") {
|
||||
|
|
@ -266,6 +295,7 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
|
|||
cargo.env("CFG_DEFAULT_AR", s);
|
||||
}
|
||||
build.run(&mut cargo);
|
||||
update_mtime(build, &librustc_stamp(build, compiler, target));
|
||||
}
|
||||
|
||||
/// Same as `std_link`, only for librustc
|
||||
|
|
@ -296,6 +326,12 @@ fn libtest_stamp(build: &Build, compiler: &Compiler, target: &str) -> PathBuf {
|
|||
build.cargo_out(compiler, Mode::Libtest, target).join(".libtest.stamp")
|
||||
}
|
||||
|
||||
/// Cargo's output path for librustc in a given stage, compiled by a particular
|
||||
/// compiler for the specified target.
|
||||
fn librustc_stamp(build: &Build, compiler: &Compiler, target: &str) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Librustc, target).join(".librustc.stamp")
|
||||
}
|
||||
|
||||
fn compiler_file(compiler: &Path, file: &str) -> PathBuf {
|
||||
let out = output(Command::new(compiler)
|
||||
.arg(format!("-print-file-name={}", file)));
|
||||
|
|
@ -398,6 +434,23 @@ fn add_to_sysroot(out_dir: &Path, sysroot_dst: &Path) {
|
|||
}
|
||||
}
|
||||
|
||||
/// 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.
|
||||
pub fn maybe_clean_tools(build: &Build, stage: u32, target: &str, mode: Mode) {
|
||||
let compiler = Compiler::new(stage, &build.config.build);
|
||||
|
||||
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!(),
|
||||
};
|
||||
let out_dir = build.cargo_out(&compiler, Mode::Tool, target);
|
||||
build.clear_if_dirty(&out_dir, &stamp);
|
||||
}
|
||||
|
||||
/// Build a tool in `src/tools`
|
||||
///
|
||||
/// This will build the specified tool with the specified `host` compiler in
|
||||
|
|
@ -407,20 +460,8 @@ pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) {
|
|||
|
||||
let compiler = Compiler::new(stage, &build.config.build);
|
||||
|
||||
// FIXME: need to clear out previous tool and ideally deps, may require
|
||||
// isolating output directories or require a pseudo shim step to
|
||||
// clear out all the info.
|
||||
//
|
||||
// Maybe when libstd is compiled it should clear out the rustc of the
|
||||
// corresponding stage?
|
||||
// let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target);
|
||||
// build.clear_if_dirty(&out_dir, &libstd_stamp(build, stage, &host, target));
|
||||
|
||||
let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build");
|
||||
let mut dir = build.src.join(tool);
|
||||
if !dir.exists() {
|
||||
dir = build.src.join("src/tools").join(tool);
|
||||
}
|
||||
let dir = build.src.join("src/tools").join(tool);
|
||||
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
|
||||
|
||||
// We don't want to build tools dynamically as they'll be running across
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use std::process;
|
|||
use num_cpus;
|
||||
use rustc_serialize::Decodable;
|
||||
use toml::{Parser, Decoder, Value};
|
||||
use util::push_exe_path;
|
||||
use util::{exe, push_exe_path};
|
||||
|
||||
/// Global configuration for the entire build and/or bootstrap.
|
||||
///
|
||||
|
|
@ -60,6 +60,7 @@ pub struct Config {
|
|||
pub llvm_link_shared: bool,
|
||||
pub llvm_targets: Option<String>,
|
||||
pub llvm_link_jobs: Option<u32>,
|
||||
pub llvm_clean_rebuild: bool,
|
||||
|
||||
// rust codegen options
|
||||
pub rust_optimize: bool,
|
||||
|
|
@ -93,12 +94,15 @@ pub struct Config {
|
|||
pub backtrace: bool, // support for RUST_BACKTRACE
|
||||
|
||||
// misc
|
||||
pub low_priority: bool,
|
||||
pub channel: String,
|
||||
pub quiet_tests: bool,
|
||||
// Fallback musl-root for all targets
|
||||
pub musl_root: Option<PathBuf>,
|
||||
pub prefix: Option<PathBuf>,
|
||||
pub sysconfdir: Option<PathBuf>,
|
||||
pub docdir: Option<PathBuf>,
|
||||
pub bindir: Option<PathBuf>,
|
||||
pub libdir: Option<PathBuf>,
|
||||
pub libdir_relative: Option<PathBuf>,
|
||||
pub mandir: Option<PathBuf>,
|
||||
|
|
@ -145,6 +149,7 @@ struct Build {
|
|||
target: Vec<String>,
|
||||
cargo: Option<String>,
|
||||
rustc: Option<String>,
|
||||
low_priority: Option<bool>,
|
||||
compiler_docs: Option<bool>,
|
||||
docs: Option<bool>,
|
||||
submodules: Option<bool>,
|
||||
|
|
@ -164,9 +169,11 @@ struct Build {
|
|||
#[derive(RustcDecodable, Default, Clone)]
|
||||
struct Install {
|
||||
prefix: Option<String>,
|
||||
mandir: Option<String>,
|
||||
sysconfdir: Option<String>,
|
||||
docdir: Option<String>,
|
||||
bindir: Option<String>,
|
||||
libdir: Option<String>,
|
||||
mandir: Option<String>,
|
||||
}
|
||||
|
||||
/// TOML representation of how the LLVM build is configured.
|
||||
|
|
@ -181,6 +188,7 @@ struct Llvm {
|
|||
static_libstdcpp: Option<bool>,
|
||||
targets: Option<String>,
|
||||
link_jobs: Option<u32>,
|
||||
clean_rebuild: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(RustcDecodable, Default, Clone)]
|
||||
|
|
@ -262,7 +270,7 @@ impl Config {
|
|||
let table = match p.parse() {
|
||||
Some(table) => table,
|
||||
None => {
|
||||
println!("failed to parse TOML configuration:");
|
||||
println!("failed to parse TOML configuration '{}':", file.to_str().unwrap());
|
||||
for err in p.errors.iter() {
|
||||
let (loline, locol) = p.to_linecol(err.lo);
|
||||
let (hiline, hicol) = p.to_linecol(err.hi);
|
||||
|
|
@ -300,6 +308,7 @@ impl Config {
|
|||
config.nodejs = build.nodejs.map(PathBuf::from);
|
||||
config.gdb = build.gdb.map(PathBuf::from);
|
||||
config.python = build.python.map(PathBuf::from);
|
||||
set(&mut config.low_priority, build.low_priority);
|
||||
set(&mut config.compiler_docs, build.compiler_docs);
|
||||
set(&mut config.docs, build.docs);
|
||||
set(&mut config.submodules, build.submodules);
|
||||
|
|
@ -313,9 +322,11 @@ impl Config {
|
|||
|
||||
if let Some(ref install) = toml.install {
|
||||
config.prefix = install.prefix.clone().map(PathBuf::from);
|
||||
config.mandir = install.mandir.clone().map(PathBuf::from);
|
||||
config.sysconfdir = install.sysconfdir.clone().map(PathBuf::from);
|
||||
config.docdir = install.docdir.clone().map(PathBuf::from);
|
||||
config.bindir = install.bindir.clone().map(PathBuf::from);
|
||||
config.libdir = install.libdir.clone().map(PathBuf::from);
|
||||
config.mandir = install.mandir.clone().map(PathBuf::from);
|
||||
}
|
||||
|
||||
if let Some(ref llvm) = toml.llvm {
|
||||
|
|
@ -334,6 +345,7 @@ impl Config {
|
|||
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
|
||||
set(&mut config.llvm_version_check, llvm.version_check);
|
||||
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
||||
set(&mut config.llvm_clean_rebuild, llvm.clean_rebuild);
|
||||
config.llvm_targets = llvm.targets.clone();
|
||||
config.llvm_link_jobs = llvm.link_jobs;
|
||||
}
|
||||
|
|
@ -439,6 +451,7 @@ impl Config {
|
|||
("LLVM_VERSION_CHECK", self.llvm_version_check),
|
||||
("LLVM_STATIC_STDCPP", self.llvm_static_stdcpp),
|
||||
("LLVM_LINK_SHARED", self.llvm_link_shared),
|
||||
("LLVM_CLEAN_REBUILD", self.llvm_clean_rebuild),
|
||||
("OPTIMIZE", self.rust_optimize),
|
||||
("DEBUG_ASSERTIONS", self.rust_debug_assertions),
|
||||
("DEBUGINFO", self.rust_debuginfo),
|
||||
|
|
@ -519,9 +532,15 @@ impl Config {
|
|||
"CFG_PREFIX" => {
|
||||
self.prefix = Some(PathBuf::from(value));
|
||||
}
|
||||
"CFG_SYSCONFDIR" => {
|
||||
self.sysconfdir = Some(PathBuf::from(value));
|
||||
}
|
||||
"CFG_DOCDIR" => {
|
||||
self.docdir = Some(PathBuf::from(value));
|
||||
}
|
||||
"CFG_BINDIR" => {
|
||||
self.bindir = Some(PathBuf::from(value));
|
||||
}
|
||||
"CFG_LIBDIR" => {
|
||||
self.libdir = Some(PathBuf::from(value));
|
||||
}
|
||||
|
|
@ -566,6 +585,12 @@ impl Config {
|
|||
.or_insert(Target::default());
|
||||
target.ndk = Some(parse_configure_path(value));
|
||||
}
|
||||
"CFG_X86_64_LINUX_ANDROID_NDK" if value.len() > 0 => {
|
||||
let target = "x86_64-linux-android".to_string();
|
||||
let target = self.target_config.entry(target)
|
||||
.or_insert(Target::default());
|
||||
target.ndk = Some(parse_configure_path(value));
|
||||
}
|
||||
"CFG_LOCAL_RUST_ROOT" if value.len() > 0 => {
|
||||
let path = parse_configure_path(value);
|
||||
self.rustc = Some(push_exe_path(path.clone(), &["bin", "rustc"]));
|
||||
|
|
@ -576,10 +601,10 @@ impl Config {
|
|||
self.python = Some(path);
|
||||
}
|
||||
"CFG_ENABLE_CCACHE" if value == "1" => {
|
||||
self.ccache = Some("ccache".to_string());
|
||||
self.ccache = Some(exe("ccache", &self.build));
|
||||
}
|
||||
"CFG_ENABLE_SCCACHE" if value == "1" => {
|
||||
self.ccache = Some("sccache".to_string());
|
||||
self.ccache = Some(exe("sccache", &self.build));
|
||||
}
|
||||
"CFG_CONFIGURE_ARGS" if value.len() > 0 => {
|
||||
self.configure_args = value.split_whitespace()
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
# support. You'll need to write a target specification at least, and most
|
||||
# likely, teach rustc about the C ABI of the target. Get in touch with the
|
||||
# Rust team and file an issue if you need assistance in porting!
|
||||
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX"
|
||||
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon"
|
||||
|
||||
# Cap the number of parallel linker invocations when compiling LLVM.
|
||||
# This can be useful when building LLVM with debug info, which significantly
|
||||
|
|
@ -61,6 +61,11 @@
|
|||
# controlled by rustbuild's -j parameter.
|
||||
#link-jobs = 0
|
||||
|
||||
# Delete LLVM build directory on LLVM rebuild.
|
||||
# This option defaults to `false` for local development, but CI may want to
|
||||
# always perform clean full builds (possibly accelerated by (s)ccache).
|
||||
#clean-rebuild = false
|
||||
|
||||
# =============================================================================
|
||||
# General build configuration options
|
||||
# =============================================================================
|
||||
|
|
@ -83,11 +88,11 @@
|
|||
# for each target triple.
|
||||
#target = ["x86_64-unknown-linux-gnu"] # defaults to just the build triple
|
||||
|
||||
# Instead of downloading the src/nightlies.txt version of Cargo specified, use
|
||||
# Instead of downloading the src/stage0.txt version of Cargo specified, use
|
||||
# this Cargo binary instead to build all Rust code
|
||||
#cargo = "/path/to/bin/cargo"
|
||||
|
||||
# Instead of downloading the src/nightlies.txt version of the compiler
|
||||
# Instead of downloading the src/stage0.txt version of the compiler
|
||||
# specified, use this rustc binary instead as the stage0 snapshot compiler.
|
||||
#rustc = "/path/to/bin/rustc"
|
||||
|
||||
|
|
@ -147,6 +152,10 @@
|
|||
# known-good version of OpenSSL, compile it, and link it to Cargo.
|
||||
#openssl-static = false
|
||||
|
||||
# Run the build with low priority, by setting the process group's "nice" value
|
||||
# to +10 on Unix platforms, and by using a "low priority" job object on Windows.
|
||||
#low-priority = false
|
||||
|
||||
# =============================================================================
|
||||
# General install configuration options
|
||||
# =============================================================================
|
||||
|
|
@ -155,21 +164,31 @@
|
|||
# Instead of installing to /usr/local, install to this path instead.
|
||||
#prefix = "/usr/local"
|
||||
|
||||
# Where to install system configuration files
|
||||
# If this is a relative path, it will get installed in `prefix` above
|
||||
#sysconfdir = "/etc"
|
||||
|
||||
# Where to install documentation in `prefix` above
|
||||
#docdir = "share/doc/rust"
|
||||
|
||||
# Where to install binaries in `prefix` above
|
||||
#bindir = "bin"
|
||||
|
||||
# Where to install libraries in `prefix` above
|
||||
#libdir = "lib"
|
||||
|
||||
# Where to install man pages in `prefix` above
|
||||
#mandir = "share/man"
|
||||
|
||||
# Where to install documentation in `prefix` above
|
||||
#docdir = "share/doc/rust"
|
||||
|
||||
# =============================================================================
|
||||
# Options for compiling Rust code itself
|
||||
# =============================================================================
|
||||
[rust]
|
||||
|
||||
# Whether or not to optimize the compiler and standard library
|
||||
# Note: the slowness of the non optimized compiler compiling itself usually
|
||||
# outweighs the time gains in not doing optimizations, therefore a
|
||||
# full bootstrap takes much more time with optimize set to false.
|
||||
#optimize = true
|
||||
|
||||
# Number of codegen units to use for each compiler invocation. A value of 0
|
||||
|
|
|
|||
|
|
@ -26,19 +26,19 @@ use std::process::{Command, Stdio};
|
|||
|
||||
use build_helper::output;
|
||||
|
||||
#[cfg(not(target_os = "solaris"))]
|
||||
const SH_CMD: &'static str = "sh";
|
||||
// On Solaris, sh is the historical bourne shell, not a POSIX shell, or bash.
|
||||
#[cfg(target_os = "solaris")]
|
||||
const SH_CMD: &'static str = "bash";
|
||||
|
||||
use {Build, Compiler, Mode};
|
||||
use channel;
|
||||
use util::{cp_r, libdir, is_dylib, cp_filtered, copy, exe};
|
||||
|
||||
fn pkgname(build: &Build, component: &str) -> String {
|
||||
assert!(component.starts_with("rust")); // does not work with cargo
|
||||
format!("{}-{}", component, build.rust_package_vers())
|
||||
if component == "cargo" {
|
||||
format!("{}-{}", component, build.cargo_package_vers())
|
||||
} else if component == "rls" {
|
||||
format!("{}-{}", component, build.package_vers(&build.release_num("rls")))
|
||||
} else {
|
||||
assert!(component.starts_with("rust"));
|
||||
format!("{}-{}", component, build.rust_package_vers())
|
||||
}
|
||||
}
|
||||
|
||||
fn distdir(build: &Build) -> PathBuf {
|
||||
|
|
@ -49,6 +49,10 @@ pub fn tmpdir(build: &Build) -> PathBuf {
|
|||
build.out.join("tmp/dist")
|
||||
}
|
||||
|
||||
fn rust_installer(build: &Build) -> Command {
|
||||
build.tool_cmd(&Compiler::new(0, &build.config.build), "rust-installer")
|
||||
}
|
||||
|
||||
/// Builds the `rust-docs` installer component.
|
||||
///
|
||||
/// Slurps up documentation from the `stage`'s `host`.
|
||||
|
|
@ -68,14 +72,14 @@ pub fn docs(build: &Build, stage: u32, host: &str) {
|
|||
let src = build.out.join(host).join("doc");
|
||||
cp_r(&src, &dst);
|
||||
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust-Documentation")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=Rust-documentation-is-installed.")
|
||||
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg("--image-dir").arg(&image)
|
||||
.arg("--work-dir").arg(&tmpdir(build))
|
||||
.arg("--output-dir").arg(&distdir(build))
|
||||
.arg(format!("--package-name={}-{}", name, host))
|
||||
.arg("--component-name=rust-docs")
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo")
|
||||
|
|
@ -92,6 +96,140 @@ pub fn docs(build: &Build, stage: u32, host: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
fn find_files(files: &[&str], path: &[PathBuf]) -> Vec<PathBuf> {
|
||||
let mut found = Vec::new();
|
||||
|
||||
for file in files {
|
||||
let file_path =
|
||||
path.iter()
|
||||
.map(|dir| dir.join(file))
|
||||
.find(|p| p.exists());
|
||||
|
||||
if let Some(file_path) = file_path {
|
||||
found.push(file_path);
|
||||
} else {
|
||||
panic!("Could not find '{}' in {:?}", file, path);
|
||||
}
|
||||
}
|
||||
|
||||
found
|
||||
}
|
||||
|
||||
fn make_win_dist(rust_root: &Path, plat_root: &Path, target_triple: &str, build: &Build) {
|
||||
//Ask gcc where it keeps its stuff
|
||||
let mut cmd = Command::new(build.cc(target_triple));
|
||||
cmd.arg("-print-search-dirs");
|
||||
build.run_quiet(&mut cmd);
|
||||
let gcc_out =
|
||||
String::from_utf8(
|
||||
cmd
|
||||
.output()
|
||||
.expect("failed to execute gcc")
|
||||
.stdout).expect("gcc.exe output was not utf8");
|
||||
|
||||
let mut bin_path: Vec<_> =
|
||||
env::split_paths(&env::var_os("PATH").unwrap_or_default())
|
||||
.collect();
|
||||
let mut lib_path = Vec::new();
|
||||
|
||||
for line in gcc_out.lines() {
|
||||
let idx = line.find(':').unwrap();
|
||||
let key = &line[..idx];
|
||||
let trim_chars: &[_] = &[' ', '='];
|
||||
let value =
|
||||
line[(idx + 1)..]
|
||||
.trim_left_matches(trim_chars)
|
||||
.split(';')
|
||||
.map(|s| PathBuf::from(s));
|
||||
|
||||
if key == "programs" {
|
||||
bin_path.extend(value);
|
||||
} else if key == "libraries" {
|
||||
lib_path.extend(value);
|
||||
}
|
||||
}
|
||||
|
||||
let target_tools = vec!["gcc.exe", "ld.exe", "ar.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");
|
||||
} else {
|
||||
rustc_dlls.push("libgcc_s_seh-1.dll");
|
||||
}
|
||||
|
||||
let target_libs = vec![ //MinGW libs
|
||||
"libgcc.a",
|
||||
"libgcc_eh.a",
|
||||
"libgcc_s.a",
|
||||
"libm.a",
|
||||
"libmingw32.a",
|
||||
"libmingwex.a",
|
||||
"libstdc++.a",
|
||||
"libiconv.a",
|
||||
"libmoldname.a",
|
||||
"libpthread.a",
|
||||
//Windows import libs
|
||||
"libadvapi32.a",
|
||||
"libbcrypt.a",
|
||||
"libcomctl32.a",
|
||||
"libcomdlg32.a",
|
||||
"libcrypt32.a",
|
||||
"libgdi32.a",
|
||||
"libimagehlp.a",
|
||||
"libiphlpapi.a",
|
||||
"libkernel32.a",
|
||||
"libmsvcrt.a",
|
||||
"libodbc32.a",
|
||||
"libole32.a",
|
||||
"liboleaut32.a",
|
||||
"libopengl32.a",
|
||||
"libpsapi.a",
|
||||
"librpcrt4.a",
|
||||
"libsetupapi.a",
|
||||
"libshell32.a",
|
||||
"libuser32.a",
|
||||
"libuserenv.a",
|
||||
"libuuid.a",
|
||||
"libwinhttp.a",
|
||||
"libwinmm.a",
|
||||
"libwinspool.a",
|
||||
"libws2_32.a",
|
||||
"libwsock32.a",
|
||||
];
|
||||
|
||||
//Find mingw artifacts we want to bundle
|
||||
let target_tools = find_files(&target_tools, &bin_path);
|
||||
let rustc_dlls = find_files(&rustc_dlls, &bin_path);
|
||||
let target_libs = find_files(&target_libs, &lib_path);
|
||||
|
||||
fn copy_to_folder(src: &Path, dest_folder: &Path) {
|
||||
let file_name = src.file_name().unwrap().to_os_string();
|
||||
let dest = dest_folder.join(file_name);
|
||||
copy(src, &dest);
|
||||
}
|
||||
|
||||
//Copy runtime dlls next to rustc.exe
|
||||
let dist_bin_dir = rust_root.join("bin/");
|
||||
fs::create_dir_all(&dist_bin_dir).expect("creating dist_bin_dir failed");
|
||||
for src in rustc_dlls {
|
||||
copy_to_folder(&src, &dist_bin_dir);
|
||||
}
|
||||
|
||||
//Copy platform tools to platform-specific bin directory
|
||||
let target_bin_dir = plat_root.join("lib").join("rustlib").join(target_triple).join("bin");
|
||||
fs::create_dir_all(&target_bin_dir).expect("creating target_bin_dir failed");
|
||||
for src in target_tools {
|
||||
copy_to_folder(&src, &target_bin_dir);
|
||||
}
|
||||
|
||||
//Copy platform libs to platform-specific lib directory
|
||||
let target_lib_dir = plat_root.join("lib").join("rustlib").join(target_triple).join("lib");
|
||||
fs::create_dir_all(&target_lib_dir).expect("creating target_lib_dir failed");
|
||||
for src in target_libs {
|
||||
copy_to_folder(&src, &target_lib_dir);
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the `rust-mingw` installer component.
|
||||
///
|
||||
/// This contains all the bits and pieces to run the MinGW Windows targets
|
||||
|
|
@ -105,27 +243,20 @@ pub fn mingw(build: &Build, host: &str) {
|
|||
let _ = fs::remove_dir_all(&image);
|
||||
t!(fs::create_dir_all(&image));
|
||||
|
||||
// The first argument to the script is a "temporary directory" which is just
|
||||
// The first argument is a "temporary directory" which is just
|
||||
// thrown away (this contains the runtime DLLs included in the rustc package
|
||||
// above) and the second argument is where to place all the MinGW components
|
||||
// (which is what we want).
|
||||
//
|
||||
// FIXME: this script should be rewritten into Rust
|
||||
let mut cmd = Command::new(build.python());
|
||||
cmd.arg(build.src.join("src/etc/make-win-dist.py"))
|
||||
.arg(tmpdir(build))
|
||||
.arg(&image)
|
||||
.arg(host);
|
||||
build.run(&mut cmd);
|
||||
make_win_dist(&tmpdir(build), &image, host, &build);
|
||||
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust-MinGW")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=Rust-MinGW-is-installed.")
|
||||
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg("--image-dir").arg(&image)
|
||||
.arg("--work-dir").arg(&tmpdir(build))
|
||||
.arg("--output-dir").arg(&distdir(build))
|
||||
.arg(format!("--package-name={}-{}", name, host))
|
||||
.arg("--component-name=rust-mingw")
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
|
|
@ -168,15 +299,8 @@ pub fn rustc(build: &Build, stage: u32, host: &str) {
|
|||
// anything requiring us to distribute a license, but it's likely the
|
||||
// install will *also* include the rust-mingw package, which also needs
|
||||
// licenses, so to be safe we just include it here in all MinGW packages.
|
||||
//
|
||||
// FIXME: this script should be rewritten into Rust
|
||||
if host.contains("pc-windows-gnu") {
|
||||
let mut cmd = Command::new(build.python());
|
||||
cmd.arg(build.src.join("src/etc/make-win-dist.py"))
|
||||
.arg(&image)
|
||||
.arg(tmpdir(build))
|
||||
.arg(host);
|
||||
build.run(&mut cmd);
|
||||
make_win_dist(&image, &tmpdir(build), host, build);
|
||||
|
||||
let dst = image.join("share/doc");
|
||||
t!(fs::create_dir_all(&dst));
|
||||
|
|
@ -184,15 +308,15 @@ pub fn rustc(build: &Build, stage: u32, host: &str) {
|
|||
}
|
||||
|
||||
// Finally, wrap everything up in a nice tarball!
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=Rust-is-ready-to-roll.")
|
||||
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg(format!("--non-installed-overlay={}", sanitize_sh(&overlay)))
|
||||
.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, host))
|
||||
.arg("--component-name=rustc")
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
|
|
@ -248,7 +372,12 @@ pub fn debugger_scripts(build: &Build,
|
|||
install(&build.src.join("src/etc/").join(file), &dst, 0o644);
|
||||
};
|
||||
if host.contains("windows-msvc") {
|
||||
// no debugger scripts
|
||||
// windbg debugger scripts
|
||||
install(&build.src.join("src/etc/rust-windbg.cmd"), &sysroot.join("bin"),
|
||||
0o755);
|
||||
|
||||
cp_debugger_script("natvis/libcore.natvis");
|
||||
cp_debugger_script("natvis/libcollections.natvis");
|
||||
} else {
|
||||
cp_debugger_script("debugger_pretty_printers_common.py");
|
||||
|
||||
|
|
@ -289,14 +418,14 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
|
|||
let src = build.sysroot(compiler).join("lib/rustlib");
|
||||
cp_r(&src.join(target), &dst);
|
||||
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=std-is-standing-at-the-ready.")
|
||||
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg("--image-dir").arg(&image)
|
||||
.arg("--work-dir").arg(&tmpdir(build))
|
||||
.arg("--output-dir").arg(&distdir(build))
|
||||
.arg(format!("--package-name={}-{}", name, target))
|
||||
.arg(format!("--component-name=rust-std-{}", target))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
|
|
@ -304,26 +433,26 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
|
|||
t!(fs::remove_dir_all(&image));
|
||||
}
|
||||
|
||||
/// The path to the complete rustc-src tarball
|
||||
pub fn rust_src_location(build: &Build) -> PathBuf {
|
||||
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
|
||||
distdir(build).join(&format!("{}.tar.gz", plain_name))
|
||||
}
|
||||
|
||||
/// The path to the rust-src component installer
|
||||
pub fn rust_src_installer(build: &Build) -> PathBuf {
|
||||
let name = pkgname(build, "rust-src");
|
||||
distdir(build).join(&format!("{}.tar.gz", name))
|
||||
}
|
||||
|
||||
/// Creates a tarball of save-analysis metadata, if available.
|
||||
pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
|
||||
assert!(build.config.extended);
|
||||
println!("Dist analysis");
|
||||
|
||||
if build.config.channel != "nightly" {
|
||||
println!("\tskipping - not on nightly channel");
|
||||
return;
|
||||
}
|
||||
if compiler.host != build.config.build {
|
||||
println!("\tskipping - not a build host");
|
||||
return
|
||||
}
|
||||
if compiler.stage != 2 {
|
||||
println!("\tskipping - not stage2");
|
||||
return
|
||||
println!("\tskipping, not a build host");
|
||||
return;
|
||||
}
|
||||
|
||||
// Package save-analysis from stage1 if not doing a full bootstrap, as the
|
||||
|
|
@ -345,14 +474,14 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
|
|||
println!("image_src: {:?}, dst: {:?}", image_src, dst);
|
||||
cp_r(&image_src, &dst);
|
||||
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=save-analysis-saved.")
|
||||
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg("--image-dir").arg(&image)
|
||||
.arg("--work-dir").arg(&tmpdir(build))
|
||||
.arg("--output-dir").arg(&distdir(build))
|
||||
.arg(format!("--package-name={}-{}", name, target))
|
||||
.arg(format!("--component-name=rust-analysis-{}", target))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
|
|
@ -370,13 +499,11 @@ pub fn rust_src(build: &Build) {
|
|||
|
||||
println!("Dist src");
|
||||
|
||||
let name = pkgname(build, "rust-src");
|
||||
let image = tmpdir(build).join(format!("{}-image", name));
|
||||
let _ = fs::remove_dir_all(&image);
|
||||
|
||||
let dst = image.join("lib/rustlib/src");
|
||||
let dst_src = dst.join("rust");
|
||||
t!(fs::create_dir_all(&dst_src));
|
||||
// Make sure that the root folder of tarball has the correct name
|
||||
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
|
||||
let plain_dst_src = tmpdir(build).join(&plain_name);
|
||||
let _ = fs::remove_dir_all(&plain_dst_src);
|
||||
t!(fs::create_dir_all(&plain_dst_src));
|
||||
|
||||
// This is the set of root paths which will become part of the source package
|
||||
let src_files = [
|
||||
|
|
@ -392,7 +519,6 @@ pub fn rust_src(build: &Build) {
|
|||
let src_dirs = [
|
||||
"man",
|
||||
"src",
|
||||
"cargo",
|
||||
];
|
||||
|
||||
let filter_fn = move |path: &Path| {
|
||||
|
|
@ -424,69 +550,112 @@ pub fn rust_src(build: &Build) {
|
|||
|
||||
// Copy the directories using our filter
|
||||
for item in &src_dirs {
|
||||
let dst = &dst_src.join(item);
|
||||
let dst = &plain_dst_src.join(item);
|
||||
t!(fs::create_dir(dst));
|
||||
cp_filtered(&build.src.join(item), dst, &filter_fn);
|
||||
}
|
||||
// Copy the files normally
|
||||
for item in &src_files {
|
||||
copy(&build.src.join(item), &dst_src.join(item));
|
||||
copy(&build.src.join(item), &plain_dst_src.join(item));
|
||||
}
|
||||
|
||||
// Get cargo-vendor installed, if it isn't already.
|
||||
let mut has_cargo_vendor = false;
|
||||
let mut cmd = Command::new(&build.cargo);
|
||||
for line in output(cmd.arg("install").arg("--list")).lines() {
|
||||
has_cargo_vendor |= line.starts_with("cargo-vendor ");
|
||||
}
|
||||
if !has_cargo_vendor {
|
||||
// If we're building from git sources, we need to vendor a complete distribution.
|
||||
if build.src_is_git {
|
||||
// Get cargo-vendor installed, if it isn't already.
|
||||
let mut has_cargo_vendor = false;
|
||||
let mut cmd = Command::new(&build.cargo);
|
||||
cmd.arg("install")
|
||||
.arg("--force")
|
||||
.arg("--debug")
|
||||
.arg("--vers").arg(CARGO_VENDOR_VERSION)
|
||||
.arg("cargo-vendor")
|
||||
.env("RUSTC", &build.rustc);
|
||||
for line in output(cmd.arg("install").arg("--list")).lines() {
|
||||
has_cargo_vendor |= line.starts_with("cargo-vendor ");
|
||||
}
|
||||
if !has_cargo_vendor {
|
||||
let mut cmd = Command::new(&build.cargo);
|
||||
cmd.arg("install")
|
||||
.arg("--force")
|
||||
.arg("--debug")
|
||||
.arg("--vers").arg(CARGO_VENDOR_VERSION)
|
||||
.arg("cargo-vendor")
|
||||
.env("RUSTC", &build.rustc);
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
|
||||
// Vendor all Cargo dependencies
|
||||
let mut cmd = Command::new(&build.cargo);
|
||||
cmd.arg("vendor")
|
||||
.current_dir(&plain_dst_src.join("src"));
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
|
||||
// Vendor all Cargo dependencies
|
||||
let mut cmd = Command::new(&build.cargo);
|
||||
cmd.arg("vendor")
|
||||
.current_dir(&dst_src.join("src"));
|
||||
build.run(&mut cmd);
|
||||
|
||||
// Create source tarball in rust-installer format
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=Awesome-Source.")
|
||||
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg(format!("--package-name={}", name))
|
||||
.arg("--component-name=rust-src")
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
build.run(&mut cmd);
|
||||
|
||||
// Rename directory, so that root folder of tarball has the correct name
|
||||
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
|
||||
let plain_dst_src = tmpdir(build).join(&plain_name);
|
||||
let _ = fs::remove_dir_all(&plain_dst_src);
|
||||
t!(fs::create_dir_all(&plain_dst_src));
|
||||
cp_r(&dst_src, &plain_dst_src);
|
||||
|
||||
// Create the version file
|
||||
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
|
||||
|
||||
// Create plain source tarball
|
||||
let mut cmd = Command::new("tar");
|
||||
cmd.arg("-czf").arg(sanitize_sh(&rust_src_location(build)))
|
||||
.arg(&plain_name)
|
||||
let mut tarball = rust_src_location(build);
|
||||
tarball.set_extension(""); // strip .gz
|
||||
tarball.set_extension(""); // strip .tar
|
||||
if let Some(dir) = tarball.parent() {
|
||||
t!(fs::create_dir_all(dir));
|
||||
}
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("tarball")
|
||||
.arg("--input").arg(&plain_name)
|
||||
.arg("--output").arg(&tarball)
|
||||
.arg("--work-dir=.")
|
||||
.current_dir(tmpdir(build));
|
||||
build.run(&mut cmd);
|
||||
|
||||
|
||||
let name = pkgname(build, "rust-src");
|
||||
let image = tmpdir(build).join(format!("{}-image", name));
|
||||
let _ = fs::remove_dir_all(&image);
|
||||
|
||||
let dst = image.join("lib/rustlib/src");
|
||||
let dst_src = dst.join("rust");
|
||||
t!(fs::create_dir_all(&dst_src));
|
||||
|
||||
// This is the reduced set of paths which will become the rust-src component
|
||||
// (essentially libstd and all of its path dependencies)
|
||||
let std_src_dirs = [
|
||||
"src/build_helper",
|
||||
"src/liballoc",
|
||||
"src/liballoc_jemalloc",
|
||||
"src/liballoc_system",
|
||||
"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",
|
||||
"src/librustc_tsan",
|
||||
"src/libstd",
|
||||
"src/libstd_unicode",
|
||||
"src/libunwind",
|
||||
"src/rustc/libc_shim",
|
||||
];
|
||||
|
||||
for item in &std_src_dirs {
|
||||
let dst = &dst_src.join(item);
|
||||
t!(fs::create_dir_all(dst));
|
||||
cp_r(&plain_dst_src.join(item), dst);
|
||||
}
|
||||
|
||||
// Create source tarball in rust-installer format
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=Awesome-Source.")
|
||||
.arg("--image-dir").arg(&image)
|
||||
.arg("--work-dir").arg(&tmpdir(build))
|
||||
.arg("--output-dir").arg(&distdir(build))
|
||||
.arg(format!("--package-name={}", name))
|
||||
.arg("--component-name=rust-src")
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
build.run(&mut cmd);
|
||||
|
||||
t!(fs::remove_dir_all(&image));
|
||||
t!(fs::remove_dir_all(&plain_dst_src));
|
||||
}
|
||||
|
|
@ -534,10 +703,10 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
|
|||
println!("Dist cargo stage{} ({})", stage, target);
|
||||
let compiler = Compiler::new(stage, &build.config.build);
|
||||
|
||||
let src = build.src.join("cargo");
|
||||
let src = build.src.join("src/tools/cargo");
|
||||
let etc = src.join("src/etc");
|
||||
let release_num = build.cargo_release_num();
|
||||
let name = format!("cargo-{}", build.package_vers(&release_num));
|
||||
let release_num = build.release_num("cargo");
|
||||
let name = pkgname(build, "cargo");
|
||||
let version = build.cargo_info.version(build, &release_num);
|
||||
|
||||
let tmp = tmpdir(build);
|
||||
|
|
@ -547,7 +716,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
|
|||
|
||||
// Prepare the image directory
|
||||
t!(fs::create_dir_all(image.join("share/zsh/site-functions")));
|
||||
t!(fs::create_dir_all(image.join("etc/bash_completions.d")));
|
||||
t!(fs::create_dir_all(image.join("etc/bash_completion.d")));
|
||||
let cargo = build.cargo_out(&compiler, Mode::Tool, target)
|
||||
.join(exe("cargo", target));
|
||||
install(&cargo, &image.join("bin"), 0o755);
|
||||
|
|
@ -557,7 +726,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
|
|||
}
|
||||
install(&etc.join("_cargo"), &image.join("share/zsh/site-functions"), 0o644);
|
||||
copy(&etc.join("cargo.bashcomp.sh"),
|
||||
&image.join("etc/bash_completions.d/cargo"));
|
||||
&image.join("etc/bash_completion.d/cargo"));
|
||||
let doc = image.join("share/doc/cargo");
|
||||
install(&src.join("README.md"), &doc, 0o644);
|
||||
install(&src.join("LICENSE-MIT"), &doc, 0o644);
|
||||
|
|
@ -575,33 +744,87 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
|
|||
t!(t!(File::create(overlay.join("version"))).write_all(version.as_bytes()));
|
||||
|
||||
// Generate the installer tarball
|
||||
let mut cmd = Command::new("sh");
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=Rust-is-ready-to-roll.")
|
||||
.arg(format!("--image-dir={}", sanitize_sh(&image)))
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build))))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg(format!("--non-installed-overlay={}", sanitize_sh(&overlay)))
|
||||
.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("--component-name=cargo")
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
|
||||
pub fn rls(build: &Build, stage: u32, target: &str) {
|
||||
assert!(build.config.extended);
|
||||
println!("Dist RLS stage{} ({})", stage, target);
|
||||
let compiler = Compiler::new(stage, &build.config.build);
|
||||
|
||||
let src = build.src.join("src/tools/rls");
|
||||
let release_num = build.release_num("rls");
|
||||
let name = pkgname(build, "rls");
|
||||
let version = build.rls_info.version(build, &release_num);
|
||||
|
||||
let tmp = tmpdir(build);
|
||||
let image = tmp.join("rls-image");
|
||||
drop(fs::remove_dir_all(&image));
|
||||
t!(fs::create_dir_all(&image));
|
||||
|
||||
// Prepare the image directory
|
||||
let rls = build.cargo_out(&compiler, Mode::Tool, target)
|
||||
.join(exe("rls", target));
|
||||
install(&rls, &image.join("bin"), 0o755);
|
||||
let doc = image.join("share/doc/rls");
|
||||
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("rls-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(build);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=RLS-ready-to-serve.")
|
||||
.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("--component-name=rls")
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
|
||||
/// Creates a combined installer for the specified target in the provided stage.
|
||||
pub fn extended(build: &Build, stage: u32, target: &str) {
|
||||
println!("Dist extended stage{} ({})", stage, target);
|
||||
|
||||
let dist = distdir(build);
|
||||
let cargo_vers = build.cargo_release_num();
|
||||
let rustc_installer = dist.join(format!("{}-{}.tar.gz",
|
||||
pkgname(build, "rustc"),
|
||||
target));
|
||||
let cargo_installer = dist.join(format!("cargo-{}-{}.tar.gz",
|
||||
build.package_vers(&cargo_vers),
|
||||
let cargo_installer = dist.join(format!("{}-{}.tar.gz",
|
||||
pkgname(build, "cargo"),
|
||||
target));
|
||||
let rls_installer = dist.join(format!("{}-{}.tar.gz",
|
||||
pkgname(build, "rls"),
|
||||
target));
|
||||
let analysis_installer = dist.join(format!("{}-{}.tar.gz",
|
||||
pkgname(build, "rust-analysis"),
|
||||
target));
|
||||
let docs_installer = dist.join(format!("{}-{}.tar.gz",
|
||||
pkgname(build, "rust-docs"),
|
||||
target));
|
||||
|
|
@ -629,27 +852,28 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
|
|||
// 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 input_tarballs = format!("{},{},{},{}",
|
||||
sanitize_sh(&rustc_installer),
|
||||
sanitize_sh(&cargo_installer),
|
||||
sanitize_sh(&docs_installer),
|
||||
sanitize_sh(&std_installer));
|
||||
let mut tarballs = vec![rustc_installer, cargo_installer, rls_installer,
|
||||
analysis_installer, docs_installer, std_installer];
|
||||
if target.contains("pc-windows-gnu") {
|
||||
input_tarballs.push_str(",");
|
||||
input_tarballs.push_str(&sanitize_sh(&mingw_installer));
|
||||
tarballs.push(mingw_installer);
|
||||
}
|
||||
let mut input_tarballs = tarballs[0].as_os_str().to_owned();
|
||||
for tarball in &tarballs[1..] {
|
||||
input_tarballs.push(",");
|
||||
input_tarballs.push(tarball);
|
||||
}
|
||||
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/combine-installers.sh")))
|
||||
let mut cmd = rust_installer(build);
|
||||
cmd.arg("combine")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=Rust-is-ready-to-roll.")
|
||||
.arg(format!("--work-dir={}", sanitize_sh(&work)))
|
||||
.arg(format!("--output-dir={}", sanitize_sh(&distdir(build))))
|
||||
.arg("--work-dir").arg(&work)
|
||||
.arg("--output-dir").arg(&distdir(build))
|
||||
.arg(format!("--package-name={}-{}", pkgname(build, "rust"), target))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo")
|
||||
.arg(format!("--input-tarballs={}", input_tarballs))
|
||||
.arg(format!("--non-installed-overlay={}", sanitize_sh(&overlay)));
|
||||
.arg("--input-tarballs").arg(input_tarballs)
|
||||
.arg("--non-installed-overlay").arg(&overlay);
|
||||
build.run(&mut cmd);
|
||||
|
||||
let mut license = String::new();
|
||||
|
|
@ -678,7 +902,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
|
|||
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)),
|
||||
&pkg.join("rustc"));
|
||||
cp_r(&work.join(&format!("cargo-nightly-{}", target)),
|
||||
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"));
|
||||
|
|
@ -730,7 +954,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
|
|||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target))
|
||||
.join("rustc"),
|
||||
&exe.join("rustc"));
|
||||
cp_r(&work.join(&format!("cargo-nightly-{}", target))
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target))
|
||||
.join("cargo"),
|
||||
&exe.join("cargo"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target))
|
||||
|
|
@ -944,7 +1168,8 @@ pub fn hash_and_sign(build: &Build) {
|
|||
cmd.arg(distdir(build));
|
||||
cmd.arg(today.trim());
|
||||
cmd.arg(build.rust_package_vers());
|
||||
cmd.arg(build.package_vers(&build.cargo_release_num()));
|
||||
cmd.arg(build.package_vers(&build.release_num("cargo")));
|
||||
cmd.arg(build.package_vers(&build.release_num("rls")));
|
||||
cmd.arg(addr);
|
||||
|
||||
t!(fs::create_dir_all(distdir(build)));
|
||||
|
|
|
|||
|
|
@ -53,6 +53,82 @@ pub fn rustbook(build: &Build, target: &str, name: &str) {
|
|||
.arg(out));
|
||||
}
|
||||
|
||||
/// Build the book and associated stuff.
|
||||
///
|
||||
/// We need to build:
|
||||
///
|
||||
/// * Book (first edition)
|
||||
/// * Book (second edition)
|
||||
/// * Index page
|
||||
/// * Redirect pages
|
||||
pub fn book(build: &Build, target: &str, name: &str) {
|
||||
// build book first edition
|
||||
rustbook(build, target, &format!("{}/first-edition", name));
|
||||
|
||||
// build book second edition
|
||||
rustbook(build, target, &format!("{}/second-edition", name));
|
||||
|
||||
// build the index page
|
||||
let index = format!("{}/index.md", name);
|
||||
println!("Documenting book index ({})", target);
|
||||
invoke_rustdoc(build, target, &index);
|
||||
|
||||
// build the redirect pages
|
||||
println!("Documenting book redirect pages ({})", target);
|
||||
for file in t!(fs::read_dir(build.src.join("src/doc/book/redirects"))) {
|
||||
let file = t!(file);
|
||||
let path = file.path();
|
||||
let path = path.to_str().unwrap();
|
||||
|
||||
invoke_rustdoc(build, target, path);
|
||||
}
|
||||
}
|
||||
|
||||
fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
|
||||
let out = build.doc_out(target);
|
||||
|
||||
let compiler = Compiler::new(0, &build.config.build);
|
||||
|
||||
let path = build.src.join("src/doc").join(markdown);
|
||||
|
||||
let rustdoc = build.rustdoc(&compiler);
|
||||
|
||||
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 = Command::new(&rustdoc);
|
||||
|
||||
build.add_rustc_lib_path(&compiler, &mut cmd);
|
||||
|
||||
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)
|
||||
.arg("--markdown-playground-url")
|
||||
.arg("https://play.rust-lang.org/")
|
||||
.arg("-o").arg(&out)
|
||||
.arg(&path)
|
||||
.arg("--markdown-css")
|
||||
.arg("rust.css");
|
||||
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
|
||||
/// Generates all standalone documentation as compiled by the rustdoc in `stage`
|
||||
/// for the `target` into `out`.
|
||||
///
|
||||
|
|
@ -168,9 +244,7 @@ pub fn std(build: &Build, stage: u32, target: &str) {
|
|||
// We don't want to build docs for internal std dependencies unless
|
||||
// in compiler-docs mode. When not in that mode, we whitelist the crates
|
||||
// for which docs must be built.
|
||||
if build.config.compiler_docs {
|
||||
cargo.arg("-p").arg("std");
|
||||
} else {
|
||||
if !build.config.compiler_docs {
|
||||
cargo.arg("--no-deps");
|
||||
for krate in &["alloc", "collections", "core", "std", "std_unicode"] {
|
||||
cargo.arg("-p").arg(krate);
|
||||
|
|
@ -244,9 +318,15 @@ pub fn rustc(build: &Build, stage: u32, target: &str) {
|
|||
.arg(build.src.join("src/rustc/Cargo.toml"))
|
||||
.arg("--features").arg(build.rustc_features());
|
||||
|
||||
// Like with libstd above if compiler docs aren't enabled then we're not
|
||||
// documenting internal dependencies, so we have a whitelist.
|
||||
if !build.config.compiler_docs {
|
||||
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");
|
||||
} else {
|
||||
// Like with libstd above if compiler docs aren't enabled then we're not
|
||||
// documenting internal dependencies, so we have a whitelist.
|
||||
cargo.arg("--no-deps");
|
||||
for krate in &["proc_macro"] {
|
||||
cargo.arg("-p").arg(krate);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use std::fs;
|
|||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
|
||||
use getopts::{Matches, Options};
|
||||
use getopts::Options;
|
||||
|
||||
use Build;
|
||||
use config::Config;
|
||||
|
|
@ -75,7 +75,22 @@ pub enum Subcommand {
|
|||
|
||||
impl Flags {
|
||||
pub fn parse(args: &[String]) -> Flags {
|
||||
let mut extra_help = String::new();
|
||||
let mut subcommand_help = format!("\
|
||||
Usage: x.py <subcommand> [options] [<paths>...]
|
||||
|
||||
Subcommands:
|
||||
build Compile either the compiler or libraries
|
||||
test Build and run some test suites
|
||||
bench Build and run some benchmarks
|
||||
doc Build documentation
|
||||
clean Clean out build directories
|
||||
dist Build and/or install distribution artifacts
|
||||
|
||||
To learn more about a subcommand, run `./x.py <subcommand> -h`");
|
||||
|
||||
let mut opts = Options::new();
|
||||
// Options common to all subcommands
|
||||
opts.optflagmulti("v", "verbose", "use verbose output (-vv for very verbose)");
|
||||
opts.optflag("i", "incremental", "use incremental compilation");
|
||||
opts.optopt("", "config", "TOML configuration file for build", "FILE");
|
||||
|
|
@ -89,21 +104,83 @@ impl Flags {
|
|||
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
|
||||
opts.optflag("h", "help", "print this help message");
|
||||
|
||||
let usage = |n, opts: &Options| -> ! {
|
||||
let command = args.get(0).map(|s| &**s);
|
||||
let brief = format!("Usage: x.py {} [options] [<args>...]",
|
||||
command.unwrap_or("<command>"));
|
||||
// fn usage()
|
||||
let usage = |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
|
||||
println!("{}", opts.usage(subcommand_help));
|
||||
if !extra_help.is_empty() {
|
||||
println!("{}", extra_help);
|
||||
}
|
||||
process::exit(exit_code);
|
||||
};
|
||||
|
||||
println!("{}", opts.usage(&brief));
|
||||
match command {
|
||||
Some("build") => {
|
||||
println!("\
|
||||
// We can't use getopt to parse the options until we have completed specifying which
|
||||
// options are valid, but under the current implementation, some options are conditional on
|
||||
// the subcommand. Therefore we must manually identify the subcommand first, so that we can
|
||||
// complete the definition of the options. Then we can use the getopt::Matches object from
|
||||
// there on out.
|
||||
let mut possible_subcommands = args.iter().collect::<Vec<_>>();
|
||||
possible_subcommands.retain(|&s|
|
||||
(s == "build")
|
||||
|| (s == "test")
|
||||
|| (s == "bench")
|
||||
|| (s == "doc")
|
||||
|| (s == "clean")
|
||||
|| (s == "dist"));
|
||||
let subcommand = match possible_subcommands.first() {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
// No subcommand -- show the general usage and subcommand help
|
||||
println!("{}\n", subcommand_help);
|
||||
process::exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
// Some subcommands get extra options
|
||||
match subcommand.as_str() {
|
||||
"test" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
||||
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
||||
"dist" => { opts.optflag("", "install", "run installer as well"); },
|
||||
_ => { },
|
||||
};
|
||||
|
||||
// Done specifying what options are possible, so do the getopts parsing
|
||||
let matches = opts.parse(&args[..]).unwrap_or_else(|e| {
|
||||
// Invalid argument/option format
|
||||
println!("\n{}\n", e);
|
||||
usage(1, &opts, &subcommand_help, &extra_help);
|
||||
});
|
||||
// Extra sanity check to make sure we didn't hit this crazy corner case:
|
||||
//
|
||||
// ./x.py --frobulate clean build
|
||||
// ^-- option ^ ^- actual subcommand
|
||||
// \_ arg to option could be mistaken as subcommand
|
||||
let mut pass_sanity_check = true;
|
||||
match matches.free.get(0) {
|
||||
Some(check_subcommand) => {
|
||||
if &check_subcommand != subcommand {
|
||||
pass_sanity_check = false;
|
||||
}
|
||||
},
|
||||
None => {
|
||||
pass_sanity_check = false;
|
||||
}
|
||||
}
|
||||
if !pass_sanity_check {
|
||||
println!("{}\n", subcommand_help);
|
||||
println!("Sorry, I couldn't figure out which subcommand you were trying to specify.\n\
|
||||
You may need to move some options to after the subcommand.\n");
|
||||
process::exit(1);
|
||||
}
|
||||
// Extra help text for some commands
|
||||
match subcommand.as_str() {
|
||||
"build" => {
|
||||
subcommand_help.push_str("\n
|
||||
Arguments:
|
||||
This subcommand accepts a number of positional arguments of directories to
|
||||
the crates and/or artifacts to compile. For example:
|
||||
This subcommand accepts a number of paths to directories to the crates
|
||||
and/or artifacts to compile. For example:
|
||||
|
||||
./x.py build src/libcore
|
||||
./x.py build src/libproc_macro
|
||||
./x.py build src/libcore src/libproc_macro
|
||||
./x.py build src/libstd --stage 1
|
||||
|
||||
If no arguments are passed then the complete artifacts for that stage are
|
||||
|
|
@ -114,15 +191,13 @@ Arguments:
|
|||
|
||||
For a quick build with a usable compile, you can pass:
|
||||
|
||||
./x.py build --stage 1 src/libtest
|
||||
");
|
||||
}
|
||||
|
||||
Some("test") => {
|
||||
println!("\
|
||||
./x.py build --stage 1 src/libtest");
|
||||
}
|
||||
"test" => {
|
||||
subcommand_help.push_str("\n
|
||||
Arguments:
|
||||
This subcommand accepts a number of positional arguments of directories to
|
||||
tests that should be compiled and run. For example:
|
||||
This subcommand accepts a number of paths to directories to tests that
|
||||
should be compiled and run. For example:
|
||||
|
||||
./x.py test src/test/run-pass
|
||||
./x.py test src/libstd --test-args hash_map
|
||||
|
|
@ -132,139 +207,90 @@ Arguments:
|
|||
compiled and tested.
|
||||
|
||||
./x.py test
|
||||
./x.py test --stage 1
|
||||
");
|
||||
}
|
||||
|
||||
Some("doc") => {
|
||||
println!("\
|
||||
./x.py test --stage 1");
|
||||
}
|
||||
"doc" => {
|
||||
subcommand_help.push_str("\n
|
||||
Arguments:
|
||||
This subcommand accepts a number of positional arguments of directories of
|
||||
documentation to build. For example:
|
||||
This subcommand accepts a number of paths to directories of documentation
|
||||
to build. For example:
|
||||
|
||||
./x.py doc src/doc/book
|
||||
./x.py doc src/doc/nomicon
|
||||
./x.py doc src/libstd
|
||||
./x.py doc src/doc/book src/libstd
|
||||
|
||||
If no arguments are passed then everything is documented:
|
||||
|
||||
./x.py doc
|
||||
./x.py doc --stage 1
|
||||
");
|
||||
}
|
||||
|
||||
_ => {}
|
||||
./x.py doc --stage 1");
|
||||
}
|
||||
|
||||
if let Some(command) = command {
|
||||
if command == "build" ||
|
||||
command == "dist" ||
|
||||
command == "doc" ||
|
||||
command == "test" ||
|
||||
command == "bench" ||
|
||||
command == "clean" {
|
||||
println!("Available invocations:");
|
||||
if args.iter().any(|a| a == "-v") {
|
||||
let flags = Flags::parse(&["build".to_string()]);
|
||||
let mut config = Config::default();
|
||||
config.build = flags.build.clone();
|
||||
let mut build = Build::new(flags, config);
|
||||
metadata::build(&mut build);
|
||||
step::build_rules(&build).print_help(command);
|
||||
} else {
|
||||
println!(" ... elided, run `./x.py {} -h -v` to see",
|
||||
command);
|
||||
}
|
||||
|
||||
println!("");
|
||||
}
|
||||
}
|
||||
|
||||
println!("\
|
||||
Subcommands:
|
||||
build Compile either the compiler or libraries
|
||||
test Build and run some test suites
|
||||
bench Build and run some benchmarks
|
||||
doc Build documentation
|
||||
clean Clean out build directories
|
||||
dist Build and/or install distribution artifacts
|
||||
|
||||
To learn more about a subcommand, run `./x.py <command> -h`
|
||||
");
|
||||
|
||||
process::exit(n);
|
||||
_ => { }
|
||||
};
|
||||
if args.len() == 0 {
|
||||
println!("a command must be passed");
|
||||
usage(1, &opts);
|
||||
}
|
||||
let parse = |opts: &Options| {
|
||||
let m = opts.parse(&args[1..]).unwrap_or_else(|e| {
|
||||
println!("failed to parse options: {}", e);
|
||||
usage(1, opts);
|
||||
});
|
||||
if m.opt_present("h") {
|
||||
usage(0, opts);
|
||||
}
|
||||
return m
|
||||
};
|
||||
|
||||
// Get any optional paths which occur after the subcommand
|
||||
let cwd = t!(env::current_dir());
|
||||
let remaining_as_path = |m: &Matches| {
|
||||
m.free.iter().map(|p| cwd.join(p)).collect::<Vec<_>>()
|
||||
};
|
||||
let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
|
||||
|
||||
let m: Matches;
|
||||
let cmd = match &args[0][..] {
|
||||
"build" => {
|
||||
m = parse(&opts);
|
||||
Subcommand::Build { paths: remaining_as_path(&m) }
|
||||
|
||||
// All subcommands can have an optional "Available paths" section
|
||||
if matches.opt_present("verbose") {
|
||||
let flags = Flags::parse(&["build".to_string()]);
|
||||
let mut config = Config::default();
|
||||
config.build = flags.build.clone();
|
||||
let mut build = Build::new(flags, config);
|
||||
metadata::build(&mut build);
|
||||
let maybe_rules_help = step::build_rules(&build).get_help(subcommand);
|
||||
if maybe_rules_help.is_some() {
|
||||
extra_help.push_str(maybe_rules_help.unwrap().as_str());
|
||||
}
|
||||
"doc" => {
|
||||
m = parse(&opts);
|
||||
Subcommand::Doc { paths: remaining_as_path(&m) }
|
||||
} else {
|
||||
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?
|
||||
if matches.opt_present("help") {
|
||||
usage(0, &opts, &subcommand_help, &extra_help);
|
||||
}
|
||||
|
||||
let cmd = match subcommand.as_str() {
|
||||
"build" => {
|
||||
Subcommand::Build { paths: paths }
|
||||
}
|
||||
"test" => {
|
||||
opts.optmulti("", "test-args", "extra arguments", "ARGS");
|
||||
m = parse(&opts);
|
||||
Subcommand::Test {
|
||||
paths: remaining_as_path(&m),
|
||||
test_args: m.opt_strs("test-args"),
|
||||
paths: paths,
|
||||
test_args: matches.opt_strs("test-args"),
|
||||
}
|
||||
}
|
||||
"bench" => {
|
||||
opts.optmulti("", "test-args", "extra arguments", "ARGS");
|
||||
m = parse(&opts);
|
||||
Subcommand::Bench {
|
||||
paths: remaining_as_path(&m),
|
||||
test_args: m.opt_strs("test-args"),
|
||||
paths: paths,
|
||||
test_args: matches.opt_strs("test-args"),
|
||||
}
|
||||
}
|
||||
"doc" => {
|
||||
Subcommand::Doc { paths: paths }
|
||||
}
|
||||
"clean" => {
|
||||
m = parse(&opts);
|
||||
if m.free.len() > 0 {
|
||||
println!("clean takes no arguments");
|
||||
usage(1, &opts);
|
||||
if paths.len() > 0 {
|
||||
println!("\nclean takes no arguments\n");
|
||||
usage(1, &opts, &subcommand_help, &extra_help);
|
||||
}
|
||||
Subcommand::Clean
|
||||
}
|
||||
"dist" => {
|
||||
opts.optflag("", "install", "run installer as well");
|
||||
m = parse(&opts);
|
||||
Subcommand::Dist {
|
||||
paths: remaining_as_path(&m),
|
||||
install: m.opt_present("install"),
|
||||
paths: paths,
|
||||
install: matches.opt_present("install"),
|
||||
}
|
||||
}
|
||||
"--help" => usage(0, &opts),
|
||||
cmd => {
|
||||
println!("unknown command: {}", cmd);
|
||||
usage(1, &opts);
|
||||
_ => {
|
||||
usage(1, &opts, &subcommand_help, &extra_help);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
let cfg_file = m.opt_str("config").map(PathBuf::from).or_else(|| {
|
||||
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
|
||||
if fs::metadata("config.toml").is_ok() {
|
||||
Some(PathBuf::from("config.toml"))
|
||||
} else {
|
||||
|
|
@ -272,31 +298,29 @@ To learn more about a subcommand, run `./x.py <command> -h`
|
|||
}
|
||||
});
|
||||
|
||||
let mut stage = m.opt_str("stage").map(|j| j.parse().unwrap());
|
||||
let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
|
||||
|
||||
let incremental = m.opt_present("i");
|
||||
|
||||
if incremental {
|
||||
if matches.opt_present("incremental") {
|
||||
if stage.is_none() {
|
||||
stage = Some(1);
|
||||
}
|
||||
}
|
||||
|
||||
Flags {
|
||||
verbose: m.opt_count("v"),
|
||||
verbose: matches.opt_count("verbose"),
|
||||
stage: stage,
|
||||
on_fail: m.opt_str("on-fail"),
|
||||
keep_stage: m.opt_str("keep-stage").map(|j| j.parse().unwrap()),
|
||||
build: m.opt_str("build").unwrap_or_else(|| {
|
||||
on_fail: matches.opt_str("on-fail"),
|
||||
keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
|
||||
build: matches.opt_str("build").unwrap_or_else(|| {
|
||||
env::var("BUILD").unwrap()
|
||||
}),
|
||||
host: split(m.opt_strs("host")),
|
||||
target: split(m.opt_strs("target")),
|
||||
host: split(matches.opt_strs("host")),
|
||||
target: split(matches.opt_strs("target")),
|
||||
config: cfg_file,
|
||||
src: m.opt_str("src").map(PathBuf::from),
|
||||
jobs: m.opt_str("jobs").map(|j| j.parse().unwrap()),
|
||||
src: matches.opt_str("src").map(PathBuf::from),
|
||||
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
|
||||
cmd: cmd,
|
||||
incremental: incremental,
|
||||
incremental: matches.opt_present("incremental"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,55 +21,110 @@ use std::process::Command;
|
|||
use Build;
|
||||
use dist::{sanitize_sh, tmpdir};
|
||||
|
||||
/// Installs everything.
|
||||
pub fn install(build: &Build, stage: u32, host: &str) {
|
||||
let prefix_default = PathBuf::from("/usr/local");
|
||||
let docdir_default = PathBuf::from("share/doc/rust");
|
||||
let mandir_default = PathBuf::from("share/man");
|
||||
let libdir_default = PathBuf::from("lib");
|
||||
let prefix = build.config.prefix.as_ref().unwrap_or(&prefix_default);
|
||||
let docdir = build.config.docdir.as_ref().unwrap_or(&docdir_default);
|
||||
let libdir = build.config.libdir.as_ref().unwrap_or(&libdir_default);
|
||||
let mandir = build.config.mandir.as_ref().unwrap_or(&mandir_default);
|
||||
|
||||
let docdir = prefix.join(docdir);
|
||||
let libdir = prefix.join(libdir);
|
||||
let mandir = prefix.join(mandir);
|
||||
|
||||
let destdir = env::var_os("DESTDIR").map(PathBuf::from);
|
||||
|
||||
let prefix = add_destdir(&prefix, &destdir);
|
||||
let docdir = add_destdir(&docdir, &destdir);
|
||||
let libdir = add_destdir(&libdir, &destdir);
|
||||
let mandir = add_destdir(&mandir, &destdir);
|
||||
|
||||
let empty_dir = build.out.join("tmp/empty_dir");
|
||||
t!(fs::create_dir_all(&empty_dir));
|
||||
if build.config.docs {
|
||||
install_sh(&build, "docs", "rust-docs", stage, host, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
}
|
||||
install_sh(&build, "std", "rust-std", stage, host, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
install_sh(&build, "rustc", "rustc", stage, host, &prefix,
|
||||
&docdir, &libdir, &mandir, &empty_dir);
|
||||
t!(fs::remove_dir_all(&empty_dir));
|
||||
pub struct Installer<'a> {
|
||||
build: &'a Build,
|
||||
prefix: PathBuf,
|
||||
sysconfdir: PathBuf,
|
||||
docdir: PathBuf,
|
||||
bindir: PathBuf,
|
||||
libdir: PathBuf,
|
||||
mandir: PathBuf,
|
||||
}
|
||||
|
||||
fn install_sh(build: &Build, package: &str, name: &str, stage: u32, host: &str,
|
||||
prefix: &Path, docdir: &Path, libdir: &Path, mandir: &Path, empty_dir: &Path) {
|
||||
println!("Install {} stage{} ({})", package, stage, host);
|
||||
let package_name = format!("{}-{}-{}", name, build.rust_package_vers(), host);
|
||||
impl<'a> Installer<'a> {
|
||||
pub fn new(build: &'a Build) -> Installer<'a> {
|
||||
let prefix_default = PathBuf::from("/usr/local");
|
||||
let sysconfdir_default = PathBuf::from("/etc");
|
||||
let docdir_default = PathBuf::from("share/doc/rust");
|
||||
let bindir_default = PathBuf::from("bin");
|
||||
let libdir_default = PathBuf::from("lib");
|
||||
let mandir_default = PathBuf::from("share/man");
|
||||
let prefix = build.config.prefix.as_ref().unwrap_or(&prefix_default);
|
||||
let sysconfdir = build.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
|
||||
let docdir = build.config.docdir.as_ref().unwrap_or(&docdir_default);
|
||||
let bindir = build.config.bindir.as_ref().unwrap_or(&bindir_default);
|
||||
let libdir = build.config.libdir.as_ref().unwrap_or(&libdir_default);
|
||||
let mandir = build.config.mandir.as_ref().unwrap_or(&mandir_default);
|
||||
|
||||
let mut cmd = Command::new("sh");
|
||||
cmd.current_dir(empty_dir)
|
||||
.arg(sanitize_sh(&tmpdir(build).join(&package_name).join("install.sh")))
|
||||
.arg(format!("--prefix={}", sanitize_sh(prefix)))
|
||||
.arg(format!("--docdir={}", sanitize_sh(docdir)))
|
||||
.arg(format!("--libdir={}", sanitize_sh(libdir)))
|
||||
.arg(format!("--mandir={}", sanitize_sh(mandir)))
|
||||
.arg("--disable-ldconfig");
|
||||
build.run(&mut cmd);
|
||||
let sysconfdir = prefix.join(sysconfdir);
|
||||
let docdir = prefix.join(docdir);
|
||||
let bindir = prefix.join(bindir);
|
||||
let libdir = prefix.join(libdir);
|
||||
let mandir = prefix.join(mandir);
|
||||
|
||||
let destdir = env::var_os("DESTDIR").map(PathBuf::from);
|
||||
|
||||
let prefix = add_destdir(&prefix, &destdir);
|
||||
let sysconfdir = add_destdir(&sysconfdir, &destdir);
|
||||
let docdir = add_destdir(&docdir, &destdir);
|
||||
let bindir = add_destdir(&bindir, &destdir);
|
||||
let libdir = add_destdir(&libdir, &destdir);
|
||||
let mandir = add_destdir(&mandir, &destdir);
|
||||
|
||||
Installer {
|
||||
build,
|
||||
prefix,
|
||||
sysconfdir,
|
||||
docdir,
|
||||
bindir,
|
||||
libdir,
|
||||
mandir,
|
||||
}
|
||||
}
|
||||
|
||||
/// Installs everything.
|
||||
pub fn install(&self, stage: u32, host: &str) {
|
||||
let empty_dir = self.build.out.join("tmp/empty_dir");
|
||||
t!(fs::create_dir_all(&empty_dir));
|
||||
|
||||
if self.build.config.docs {
|
||||
self.install_sh("docs", "rust-docs", &self.build.rust_package_vers(),
|
||||
stage, Some(host), &empty_dir);
|
||||
}
|
||||
|
||||
for target in self.build.config.target.iter() {
|
||||
self.install_sh("std", "rust-std", &self.build.rust_package_vers(),
|
||||
stage, Some(target), &empty_dir);
|
||||
}
|
||||
|
||||
if self.build.config.extended {
|
||||
self.install_sh("cargo", "cargo", &self.build.cargo_package_vers(),
|
||||
stage, Some(host), &empty_dir);
|
||||
self.install_sh("rls", "rls", &self.build.rls_package_vers(),
|
||||
stage, Some(host), &empty_dir);
|
||||
self.install_sh("analysis", "rust-analysis", &self.build.rust_package_vers(),
|
||||
stage, Some(host), &empty_dir);
|
||||
self.install_sh("src", "rust-src", &self.build.rust_package_vers(),
|
||||
stage, None, &empty_dir);
|
||||
}
|
||||
|
||||
self.install_sh("rustc", "rustc", &self.build.rust_package_vers(),
|
||||
stage, Some(host), &empty_dir);
|
||||
|
||||
t!(fs::remove_dir_all(&empty_dir));
|
||||
}
|
||||
|
||||
fn install_sh(&self, package: &str, name: &str, version: &str,
|
||||
stage: u32, host: Option<&str>, empty_dir: &Path) {
|
||||
println!("Install {} stage{} ({:?})", package, stage, host);
|
||||
let package_name = if let Some(host) = host {
|
||||
format!("{}-{}-{}", name, version, host)
|
||||
} else {
|
||||
format!("{}-{}", name, version)
|
||||
};
|
||||
|
||||
let mut cmd = Command::new("sh");
|
||||
cmd.current_dir(empty_dir)
|
||||
.arg(sanitize_sh(&tmpdir(self.build).join(&package_name).join("install.sh")))
|
||||
.arg(format!("--prefix={}", sanitize_sh(&self.prefix)))
|
||||
.arg(format!("--sysconfdir={}", sanitize_sh(&self.sysconfdir)))
|
||||
.arg(format!("--docdir={}", sanitize_sh(&self.docdir)))
|
||||
.arg(format!("--bindir={}", sanitize_sh(&self.bindir)))
|
||||
.arg(format!("--libdir={}", sanitize_sh(&self.libdir)))
|
||||
.arg(format!("--mandir={}", sanitize_sh(&self.mandir)))
|
||||
.arg("--disable-ldconfig");
|
||||
self.build.run(&mut cmd);
|
||||
}
|
||||
}
|
||||
|
||||
fn add_destdir(path: &Path, destdir: &Option<PathBuf>) -> PathBuf {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
use std::env;
|
||||
use std::io;
|
||||
use std::mem;
|
||||
use Build;
|
||||
|
||||
type HANDLE = *mut u8;
|
||||
type BOOL = i32;
|
||||
|
|
@ -60,8 +61,10 @@ const DUPLICATE_SAME_ACCESS: DWORD = 0x2;
|
|||
const PROCESS_DUP_HANDLE: DWORD = 0x40;
|
||||
const JobObjectExtendedLimitInformation: JOBOBJECTINFOCLASS = 9;
|
||||
const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: DWORD = 0x2000;
|
||||
const JOB_OBJECT_LIMIT_PRIORITY_CLASS: DWORD = 0x00000020;
|
||||
const SEM_FAILCRITICALERRORS: UINT = 0x0001;
|
||||
const SEM_NOGPFAULTERRORBOX: UINT = 0x0002;
|
||||
const BELOW_NORMAL_PRIORITY_CLASS: DWORD = 0x00004000;
|
||||
|
||||
extern "system" {
|
||||
fn CreateJobObjectW(lpJobAttributes: *mut u8, lpName: *const u8) -> HANDLE;
|
||||
|
|
@ -118,7 +121,7 @@ struct JOBOBJECT_BASIC_LIMIT_INFORMATION {
|
|||
SchedulingClass: DWORD,
|
||||
}
|
||||
|
||||
pub unsafe fn setup() {
|
||||
pub unsafe fn setup(build: &mut Build) {
|
||||
// Tell Windows to not show any UI on errors (such as not finding a required dll
|
||||
// during startup or terminating abnormally). This is important for running tests,
|
||||
// since some of them use abnormal termination by design.
|
||||
|
|
@ -136,6 +139,10 @@ pub unsafe fn setup() {
|
|||
// children will reside in the job by default.
|
||||
let mut info = mem::zeroed::<JOBOBJECT_EXTENDED_LIMIT_INFORMATION>();
|
||||
info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||
if build.config.low_priority {
|
||||
info.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_PRIORITY_CLASS;
|
||||
info.BasicLimitInformation.PriorityClass = BELOW_NORMAL_PRIORITY_CLASS;
|
||||
}
|
||||
let r = SetInformationJobObject(job,
|
||||
JobObjectExtendedLimitInformation,
|
||||
&mut info as *mut _ as LPVOID,
|
||||
|
|
|
|||
|
|
@ -76,13 +76,16 @@ extern crate num_cpus;
|
|||
extern crate rustc_serialize;
|
||||
extern crate toml;
|
||||
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
|
||||
use std::cmp;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::fs::{self, File};
|
||||
use std::io::Read;
|
||||
use std::path::{Component, PathBuf, Path};
|
||||
use std::path::{PathBuf, Path};
|
||||
use std::process::Command;
|
||||
|
||||
use build_helper::{run_silent, run_suppressed, output, mtime};
|
||||
|
|
@ -108,9 +111,21 @@ pub mod util;
|
|||
#[cfg(windows)]
|
||||
mod job;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[cfg(unix)]
|
||||
mod job {
|
||||
pub unsafe fn setup() {}
|
||||
use libc;
|
||||
|
||||
pub unsafe fn setup(build: &mut ::Build) {
|
||||
if build.config.low_priority {
|
||||
libc::setpriority(libc::PRIO_PGRP as _, 0, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
mod job {
|
||||
pub unsafe fn setup(_build: &mut ::Build) {
|
||||
}
|
||||
}
|
||||
|
||||
pub use config::Config;
|
||||
|
|
@ -151,6 +166,7 @@ pub struct Build {
|
|||
out: PathBuf,
|
||||
rust_info: channel::GitInfo,
|
||||
cargo_info: channel::GitInfo,
|
||||
rls_info: channel::GitInfo,
|
||||
local_rebuild: bool,
|
||||
|
||||
// Probed tools at runtime
|
||||
|
|
@ -162,6 +178,7 @@ pub struct Build {
|
|||
cxx: HashMap<String, gcc::Tool>,
|
||||
crates: HashMap<String, Crate>,
|
||||
is_sudo: bool,
|
||||
src_is_git: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -180,7 +197,7 @@ struct Crate {
|
|||
///
|
||||
/// These entries currently correspond to the various output directories of the
|
||||
/// build system, with each mod generating output in a different directory.
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Mode {
|
||||
/// This cargo is going to build the standard library, placing output in the
|
||||
/// "stageN-std" directory.
|
||||
|
|
@ -194,7 +211,7 @@ pub enum Mode {
|
|||
/// output in the "stageN-rustc" directory.
|
||||
Librustc,
|
||||
|
||||
/// This cargo is going to some build tool, placing output in the
|
||||
/// This cargo is going to build some tool, placing output in the
|
||||
/// "stageN-tools" directory.
|
||||
Tool,
|
||||
}
|
||||
|
|
@ -233,6 +250,8 @@ impl Build {
|
|||
};
|
||||
let rust_info = channel::GitInfo::new(&src);
|
||||
let cargo_info = channel::GitInfo::new(&src.join("src/tools/cargo"));
|
||||
let rls_info = channel::GitInfo::new(&src.join("src/tools/rls"));
|
||||
let src_is_git = src.join(".git").exists();
|
||||
|
||||
Build {
|
||||
flags: flags,
|
||||
|
|
@ -244,6 +263,7 @@ impl Build {
|
|||
|
||||
rust_info: rust_info,
|
||||
cargo_info: cargo_info,
|
||||
rls_info: rls_info,
|
||||
local_rebuild: local_rebuild,
|
||||
cc: HashMap::new(),
|
||||
cxx: HashMap::new(),
|
||||
|
|
@ -251,13 +271,14 @@ impl Build {
|
|||
lldb_version: None,
|
||||
lldb_python_dir: None,
|
||||
is_sudo: is_sudo,
|
||||
src_is_git: src_is_git,
|
||||
}
|
||||
}
|
||||
|
||||
/// Executes the entire build, as configured by the flags and configuration.
|
||||
pub fn build(&mut self) {
|
||||
unsafe {
|
||||
job::setup();
|
||||
job::setup(self);
|
||||
}
|
||||
|
||||
if let Subcommand::Clean = self.flags.cmd {
|
||||
|
|
@ -279,132 +300,12 @@ impl Build {
|
|||
self.verbose(&format!("auto-detected local-rebuild {}", local_release));
|
||||
self.local_rebuild = true;
|
||||
}
|
||||
self.verbose("updating submodules");
|
||||
self.update_submodules();
|
||||
self.verbose("learning about cargo");
|
||||
metadata::build(self);
|
||||
|
||||
step::run(self);
|
||||
}
|
||||
|
||||
/// Updates all git submodules that we have.
|
||||
///
|
||||
/// This will detect if any submodules are out of date an run the necessary
|
||||
/// commands to sync them all with upstream.
|
||||
fn update_submodules(&self) {
|
||||
struct Submodule<'a> {
|
||||
path: &'a Path,
|
||||
state: State,
|
||||
}
|
||||
|
||||
enum State {
|
||||
// The submodule may have staged/unstaged changes
|
||||
MaybeDirty,
|
||||
// Or could be initialized but never updated
|
||||
NotInitialized,
|
||||
// The submodule, itself, has extra commits but those changes haven't been commited to
|
||||
// the (outer) git repository
|
||||
OutOfSync,
|
||||
}
|
||||
|
||||
if !self.config.submodules {
|
||||
return
|
||||
}
|
||||
if fs::metadata(self.src.join(".git")).is_err() {
|
||||
return
|
||||
}
|
||||
let git = || {
|
||||
let mut cmd = Command::new("git");
|
||||
cmd.current_dir(&self.src);
|
||||
return cmd
|
||||
};
|
||||
let git_submodule = || {
|
||||
let mut cmd = Command::new("git");
|
||||
cmd.current_dir(&self.src).arg("submodule");
|
||||
return cmd
|
||||
};
|
||||
|
||||
// FIXME: this takes a seriously long time to execute on Windows and a
|
||||
// nontrivial amount of time on Unix, we should have a better way
|
||||
// of detecting whether we need to run all the submodule commands
|
||||
// below.
|
||||
let out = output(git_submodule().arg("status"));
|
||||
let mut submodules = vec![];
|
||||
for line in out.lines() {
|
||||
// NOTE `git submodule status` output looks like this:
|
||||
//
|
||||
// -5066b7dcab7e700844b0e2ba71b8af9dc627a59b src/liblibc
|
||||
// +b37ef24aa82d2be3a3cc0fe89bf82292f4ca181c src/compiler-rt (remotes/origin/..)
|
||||
// e058ca661692a8d01f8cf9d35939dfe3105ce968 src/jemalloc (3.6.0-533-ge058ca6)
|
||||
//
|
||||
// The first character can be '-', '+' or ' ' and denotes the `State` of the submodule
|
||||
// Right next to this character is the SHA-1 of the submodule HEAD
|
||||
// And after that comes the path to the submodule
|
||||
let path = Path::new(line[1..].split(' ').skip(1).next().unwrap());
|
||||
let state = if line.starts_with('-') {
|
||||
State::NotInitialized
|
||||
} else if line.starts_with('+') {
|
||||
State::OutOfSync
|
||||
} else if line.starts_with(' ') {
|
||||
State::MaybeDirty
|
||||
} else {
|
||||
panic!("unexpected git submodule state: {:?}", line.chars().next());
|
||||
};
|
||||
|
||||
submodules.push(Submodule { path: path, state: state })
|
||||
}
|
||||
|
||||
self.run(git_submodule().arg("sync"));
|
||||
|
||||
for submodule in submodules {
|
||||
// If using llvm-root then don't touch the llvm submodule.
|
||||
if submodule.path.components().any(|c| c == Component::Normal("llvm".as_ref())) &&
|
||||
self.config.target_config.get(&self.config.build)
|
||||
.and_then(|c| c.llvm_config.as_ref()).is_some()
|
||||
{
|
||||
continue
|
||||
}
|
||||
|
||||
if submodule.path.components().any(|c| c == Component::Normal("jemalloc".as_ref())) &&
|
||||
!self.config.use_jemalloc
|
||||
{
|
||||
continue
|
||||
}
|
||||
|
||||
// `submodule.path` is the relative path to a submodule (from the repository root)
|
||||
// `submodule_path` is the path to a submodule from the cwd
|
||||
|
||||
// use `submodule.path` when e.g. executing a submodule specific command from the
|
||||
// repository root
|
||||
// use `submodule_path` when e.g. executing a normal git command for the submodule
|
||||
// (set via `current_dir`)
|
||||
let submodule_path = self.src.join(submodule.path);
|
||||
|
||||
match submodule.state {
|
||||
State::MaybeDirty => {
|
||||
// drop staged changes
|
||||
self.run(git().current_dir(&submodule_path)
|
||||
.args(&["reset", "--hard"]));
|
||||
// drops unstaged changes
|
||||
self.run(git().current_dir(&submodule_path)
|
||||
.args(&["clean", "-fdx"]));
|
||||
},
|
||||
State::NotInitialized => {
|
||||
self.run(git_submodule().arg("init").arg(submodule.path));
|
||||
self.run(git_submodule().arg("update").arg(submodule.path));
|
||||
},
|
||||
State::OutOfSync => {
|
||||
// drops submodule commits that weren't reported to the (outer) git repository
|
||||
self.run(git_submodule().arg("update").arg(submodule.path));
|
||||
self.run(git().current_dir(&submodule_path)
|
||||
.args(&["reset", "--hard"]));
|
||||
self.run(git().current_dir(&submodule_path)
|
||||
.args(&["clean", "-fdx"]));
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Clear out `dir` if `input` is newer.
|
||||
///
|
||||
/// After this executes, it will also ensure that `dir` exists.
|
||||
|
|
@ -461,8 +362,6 @@ impl Build {
|
|||
.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
|
||||
.env("RUSTC_REAL", self.compiler_path(compiler))
|
||||
.env("RUSTC_STAGE", stage.to_string())
|
||||
.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
|
||||
.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string())
|
||||
.env("RUSTC_CODEGEN_UNITS",
|
||||
self.config.rust_codegen_units.to_string())
|
||||
.env("RUSTC_DEBUG_ASSERTIONS",
|
||||
|
|
@ -474,6 +373,32 @@ impl Build {
|
|||
.env("RUSTDOC_REAL", self.rustdoc(compiler))
|
||||
.env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));
|
||||
|
||||
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");
|
||||
|
||||
// Currently the compiler depends on crates from crates.io, and
|
||||
// then other crates can depend on the compiler (e.g. proc-macro
|
||||
// crates). Let's say, for example that rustc itself depends on the
|
||||
// bitflags crate. If an external crate then depends on the
|
||||
// bitflags crate as well, we need to make sure they don't
|
||||
// conflict, even if they pick the same verison of bitflags. We'll
|
||||
// want to make sure that e.g. a plugin and rustc each get their
|
||||
// own copy of bitflags.
|
||||
|
||||
// Cargo ensures that this works in general through the -C metadata
|
||||
// flag. This flag will frob the symbols in the binary to make sure
|
||||
// they're different, even though the source code is the exact
|
||||
// same. To solve this problem for the compiler we extend Cargo's
|
||||
// already-passed -C metadata flag with our own. Our rustc.rs
|
||||
// wrapper around the actual rustc will detect -C metadata being
|
||||
// passed and frob it with this extra string we're passing in.
|
||||
cargo.env("RUSTC_METADATA_SUFFIX", "rustc");
|
||||
}
|
||||
|
||||
// Enable usage of unstable features
|
||||
cargo.env("RUSTC_BOOTSTRAP", "1");
|
||||
self.add_rust_test_threads(&mut cargo);
|
||||
|
|
@ -491,7 +416,7 @@ impl Build {
|
|||
// For other crates, however, we know that we've already got a standard
|
||||
// library up and running, so we can use the normal compiler to compile
|
||||
// build scripts in that situation.
|
||||
if let Mode::Libstd = mode {
|
||||
if mode == Mode::Libstd {
|
||||
cargo.env("RUSTC_SNAPSHOT", &self.rustc)
|
||||
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
|
||||
} else {
|
||||
|
|
@ -499,8 +424,31 @@ impl Build {
|
|||
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
|
||||
}
|
||||
|
||||
// There are two invariants we must maintain:
|
||||
// * stable crates cannot depend on unstable crates (general Rust rule),
|
||||
// * crates that end up in the sysroot must be unstable (rustbuild rule).
|
||||
//
|
||||
// In order to do enforce the latter, we pass the env var
|
||||
// `RUSTBUILD_UNSTABLE` down the line for any crates which will end up
|
||||
// in the sysroot. We read this in bootstrap/bin/rustc.rs and if it is
|
||||
// set, then we pass the `rustbuild` feature to rustc when building the
|
||||
// the crate.
|
||||
//
|
||||
// In turn, crates that can be used here should recognise the `rustbuild`
|
||||
// feature and opt-in to `rustc_private`.
|
||||
//
|
||||
// We can't always pass `rustbuild` because crates which are outside of
|
||||
// the compiler, libs, and tests are stable and we don't want to make
|
||||
// their deps unstable (since this would break the first invariant
|
||||
// above).
|
||||
//
|
||||
// FIXME: remove this after next stage0
|
||||
if mode != Mode::Tool && stage == 0 {
|
||||
cargo.env("RUSTBUILD_UNSTABLE", "1");
|
||||
}
|
||||
|
||||
// Ignore incremental modes except for stage0, since we're
|
||||
// not guaranteeing correctness acros builds if the compiler
|
||||
// not guaranteeing correctness across builds if the compiler
|
||||
// is changing under your feet.`
|
||||
if self.flags.incremental && compiler.stage == 0 {
|
||||
let incr_dir = self.incremental_dir(compiler);
|
||||
|
|
@ -524,11 +472,24 @@ impl Build {
|
|||
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
|
||||
}
|
||||
|
||||
if self.config.channel == "nightly" && compiler.is_final_stage(self) {
|
||||
if self.config.extended && compiler.is_final_stage(self) {
|
||||
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
|
||||
}
|
||||
|
||||
// Environment variables *required* needed throughout the build
|
||||
// When being built Cargo will at some point call `nmake.exe` on Windows
|
||||
// MSVC. Unfortunately `nmake` will read these two environment variables
|
||||
// below and try to intepret them. We're likely being run, however, from
|
||||
// MSYS `make` which uses the same variables.
|
||||
//
|
||||
// As a result, to prevent confusion and errors, we remove these
|
||||
// variables from our environment to prevent passing MSYS make flags to
|
||||
// nmake, causing it to blow up.
|
||||
if cfg!(target_env = "msvc") {
|
||||
cargo.env_remove("MAKE");
|
||||
cargo.env_remove("MAKEFLAGS");
|
||||
}
|
||||
|
||||
// Environment variables *required* throughout the build
|
||||
//
|
||||
// FIXME: should update code to not require this env var
|
||||
cargo.env("CFG_COMPILER_HOST_TRIPLE", target);
|
||||
|
|
@ -686,7 +647,7 @@ impl Build {
|
|||
}
|
||||
|
||||
/// Returns the root output directory for all Cargo output in a given stage,
|
||||
/// running a particular comipler, wehther or not we're building the
|
||||
/// running a particular compiler, wehther or not we're building the
|
||||
/// standard library, and targeting the specified architecture.
|
||||
fn cargo_out(&self,
|
||||
compiler: &Compiler,
|
||||
|
|
@ -846,13 +807,20 @@ impl Build {
|
|||
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// If we're compiling on OSX then we add a few unconditional flags
|
||||
// If we're compiling on macOS then we add a few unconditional flags
|
||||
// indicating that we want libc++ (more filled out than libstdc++) and
|
||||
// we want to compile for 10.7. This way we can ensure that
|
||||
// LLVM/jemalloc/etc are all properly compiled.
|
||||
if target.contains("apple-darwin") {
|
||||
base.push("-stdlib=libc++".into());
|
||||
}
|
||||
|
||||
// Work around an apparently bad MinGW / GCC optimization,
|
||||
// See: http://lists.llvm.org/pipermail/cfe-dev/2016-December/051980.html
|
||||
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78936
|
||||
if target == "i686-pc-windows-gnu" {
|
||||
base.push("-fno-omit-frame-pointer".into());
|
||||
}
|
||||
return base
|
||||
}
|
||||
|
||||
|
|
@ -896,6 +864,12 @@ impl Build {
|
|||
.map(|p| &**p)
|
||||
}
|
||||
|
||||
/// Returns whether the target will be tested using the `remote-test-client`
|
||||
/// and `remote-test-server` binaries.
|
||||
fn remote_tested(&self, target: &str) -> bool {
|
||||
self.qemu_rootfs(target).is_some() || target.contains("android")
|
||||
}
|
||||
|
||||
/// Returns the root of the "rootfs" image that this target will be using,
|
||||
/// if one was configured.
|
||||
///
|
||||
|
|
@ -994,6 +968,16 @@ impl Build {
|
|||
self.package_vers(channel::CFG_RELEASE_NUM)
|
||||
}
|
||||
|
||||
/// Returns the value of `package_vers` above for Cargo
|
||||
fn cargo_package_vers(&self) -> String {
|
||||
self.package_vers(&self.release_num("cargo"))
|
||||
}
|
||||
|
||||
/// Returns the value of `package_vers` above for rls
|
||||
fn rls_package_vers(&self) -> String {
|
||||
self.package_vers(&self.release_num("rls"))
|
||||
}
|
||||
|
||||
/// Returns the `version` string associated with this compiler for Rust
|
||||
/// itself.
|
||||
///
|
||||
|
|
@ -1003,10 +987,11 @@ impl Build {
|
|||
self.rust_info.version(self, channel::CFG_RELEASE_NUM)
|
||||
}
|
||||
|
||||
/// Returns the `a.b.c` version that Cargo is at.
|
||||
fn cargo_release_num(&self) -> String {
|
||||
/// Returns the `a.b.c` version that the given package is at.
|
||||
fn release_num(&self, package: &str) -> String {
|
||||
let mut toml = String::new();
|
||||
t!(t!(File::open(self.src.join("cargo/Cargo.toml"))).read_to_string(&mut toml));
|
||||
let toml_file_name = self.src.join(&format!("src/tools/{}/Cargo.toml", package));
|
||||
t!(t!(File::open(toml_file_name)).read_to_string(&mut toml));
|
||||
for line in toml.lines() {
|
||||
let prefix = "version = \"";
|
||||
let suffix = "\"";
|
||||
|
|
@ -1015,7 +1000,7 @@ impl Build {
|
|||
}
|
||||
}
|
||||
|
||||
panic!("failed to find version in cargo's Cargo.toml")
|
||||
panic!("failed to find version in {}'s Cargo.toml", package)
|
||||
}
|
||||
|
||||
/// Returns whether unstable features should be enabled for the compiler
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ fn build_krate(build: &mut Build, krate: &str) {
|
|||
// the dependency graph and what `-p` arguments there are.
|
||||
let mut cargo = Command::new(&build.cargo);
|
||||
cargo.arg("metadata")
|
||||
.arg("--format-version").arg("1")
|
||||
.arg("--manifest-path").arg(build.src.join(krate).join("Cargo.toml"));
|
||||
let output = output(&mut cargo);
|
||||
let output: Output = json::decode(&output).unwrap();
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ check:
|
|||
check-aux:
|
||||
$(Q)$(BOOTSTRAP) test \
|
||||
src/tools/cargotest \
|
||||
cargo \
|
||||
src/test/pretty \
|
||||
src/test/run-pass/pretty \
|
||||
src/test/run-fail/pretty \
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
//! LLVM and compiler-rt are essentially just wired up to everything else to
|
||||
//! ensure that they're always in place if needed.
|
||||
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{Read, Write};
|
||||
use std::path::Path;
|
||||
|
|
@ -41,9 +43,9 @@ pub fn llvm(build: &Build, target: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
let clean_trigger = build.src.join("src/rustllvm/llvm-auto-clean-trigger");
|
||||
let mut clean_trigger_contents = String::new();
|
||||
t!(t!(File::open(&clean_trigger)).read_to_string(&mut clean_trigger_contents));
|
||||
let rebuild_trigger = build.src.join("src/rustllvm/llvm-rebuild-trigger");
|
||||
let mut rebuild_trigger_contents = String::new();
|
||||
t!(t!(File::open(&rebuild_trigger)).read_to_string(&mut rebuild_trigger_contents));
|
||||
|
||||
let out_dir = build.llvm_out(target);
|
||||
let done_stamp = out_dir.join("llvm-finished-building");
|
||||
|
|
@ -51,18 +53,15 @@ pub fn llvm(build: &Build, target: &str) {
|
|||
let mut done_contents = String::new();
|
||||
t!(t!(File::open(&done_stamp)).read_to_string(&mut done_contents));
|
||||
|
||||
// LLVM was already built previously.
|
||||
// We don't track changes in LLVM sources, so we need to choose between reusing
|
||||
// what was built previously, or cleaning the directory and doing a fresh build.
|
||||
// The choice depends on contents of the clean-trigger file.
|
||||
// If the contents are the same as during the previous build, then no action is required.
|
||||
// If the contents differ from the previous build, then cleaning is triggered.
|
||||
if done_contents == clean_trigger_contents {
|
||||
// If LLVM was already built previously and contents of the rebuild-trigger file
|
||||
// didn't change from the previous build, then no action is required.
|
||||
if done_contents == rebuild_trigger_contents {
|
||||
return
|
||||
} else {
|
||||
t!(fs::remove_dir_all(&out_dir));
|
||||
}
|
||||
}
|
||||
if build.config.llvm_clean_rebuild {
|
||||
drop(fs::remove_dir_all(&out_dir));
|
||||
}
|
||||
|
||||
println!("Building LLVM for {}", target);
|
||||
let _time = util::timeit();
|
||||
|
|
@ -83,7 +82,7 @@ pub fn llvm(build: &Build, target: &str) {
|
|||
// NOTE: remember to also update `config.toml.example` when changing the defaults!
|
||||
let llvm_targets = match build.config.llvm_targets {
|
||||
Some(ref s) => s,
|
||||
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX",
|
||||
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon",
|
||||
};
|
||||
|
||||
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
|
||||
|
|
@ -109,6 +108,7 @@ pub fn llvm(build: &Build, target: &str) {
|
|||
cfg.define("LLVM_USE_CRT_DEBUG", "MT");
|
||||
cfg.define("LLVM_USE_CRT_RELEASE", "MT");
|
||||
cfg.define("LLVM_USE_CRT_RELWITHDEBINFO", "MT");
|
||||
cfg.static_crt(true);
|
||||
}
|
||||
|
||||
if target.starts_with("i686") {
|
||||
|
|
@ -131,21 +131,59 @@ pub fn llvm(build: &Build, target: &str) {
|
|||
.define("LLVM_TABLEGEN", &host);
|
||||
}
|
||||
|
||||
// MSVC handles compiler business itself
|
||||
if !target.contains("msvc") {
|
||||
if let Some(ref ccache) = build.config.ccache {
|
||||
cfg.define("CMAKE_C_COMPILER", ccache)
|
||||
.define("CMAKE_C_COMPILER_ARG1", build.cc(target))
|
||||
.define("CMAKE_CXX_COMPILER", ccache)
|
||||
.define("CMAKE_CXX_COMPILER_ARG1", build.cxx(target));
|
||||
let sanitize_cc = |cc: &Path| {
|
||||
if target.contains("msvc") {
|
||||
OsString::from(cc.to_str().unwrap().replace("\\", "/"))
|
||||
} else {
|
||||
cfg.define("CMAKE_C_COMPILER", build.cc(target))
|
||||
.define("CMAKE_CXX_COMPILER", build.cxx(target));
|
||||
cc.as_os_str().to_owned()
|
||||
}
|
||||
cfg.build_arg("-j").build_arg(build.jobs().to_string());
|
||||
};
|
||||
|
||||
let configure_compilers = |cfg: &mut cmake::Config| {
|
||||
// MSVC with CMake uses msbuild by default which doesn't respect these
|
||||
// vars that we'd otherwise configure. In that case we just skip this
|
||||
// entirely.
|
||||
if target.contains("msvc") && !build.config.ninja {
|
||||
return
|
||||
}
|
||||
|
||||
let cc = build.cc(target);
|
||||
let cxx = build.cxx(target);
|
||||
|
||||
// Handle msvc + ninja + ccache specially (this is what the bots use)
|
||||
if target.contains("msvc") &&
|
||||
build.config.ninja &&
|
||||
build.config.ccache.is_some() {
|
||||
let mut cc = env::current_exe().expect("failed to get cwd");
|
||||
cc.set_file_name("sccache-plus-cl.exe");
|
||||
|
||||
cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc))
|
||||
.define("CMAKE_CXX_COMPILER", sanitize_cc(&cc));
|
||||
cfg.env("SCCACHE_PATH",
|
||||
build.config.ccache.as_ref().unwrap())
|
||||
.env("SCCACHE_TARGET", target);
|
||||
|
||||
// If ccache is configured we inform the build a little differently hwo
|
||||
// to invoke ccache while also invoking our compilers.
|
||||
} else if let Some(ref ccache) = build.config.ccache {
|
||||
cfg.define("CMAKE_C_COMPILER", ccache)
|
||||
.define("CMAKE_C_COMPILER_ARG1", sanitize_cc(cc))
|
||||
.define("CMAKE_CXX_COMPILER", ccache)
|
||||
.define("CMAKE_CXX_COMPILER_ARG1", sanitize_cc(cxx));
|
||||
} else {
|
||||
cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc))
|
||||
.define("CMAKE_CXX_COMPILER", sanitize_cc(cxx));
|
||||
}
|
||||
|
||||
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(" "));
|
||||
};
|
||||
|
||||
configure_compilers(&mut cfg);
|
||||
|
||||
if env::var_os("SCCACHE_ERROR_LOG").is_some() {
|
||||
cfg.env("RUST_LOG", "sccache=info");
|
||||
}
|
||||
|
||||
// FIXME: we don't actually need to build all LLVM tools and all LLVM
|
||||
|
|
@ -154,7 +192,7 @@ pub fn llvm(build: &Build, target: &str) {
|
|||
// tools and libs on all platforms.
|
||||
cfg.build();
|
||||
|
||||
t!(t!(File::create(&done_stamp)).write_all(clean_trigger_contents.as_bytes()));
|
||||
t!(t!(File::create(&done_stamp)).write_all(rebuild_trigger_contents.as_bytes()));
|
||||
}
|
||||
|
||||
fn check_llvm_version(build: &Build, llvm_config: &Path) {
|
||||
|
|
@ -225,9 +263,24 @@ pub fn openssl(build: &Build, target: &str) {
|
|||
let tarball = out.join(&name);
|
||||
if !tarball.exists() {
|
||||
let tmp = tarball.with_extension("tmp");
|
||||
build.run(Command::new("curl")
|
||||
.arg("-o").arg(&tmp)
|
||||
.arg(format!("https://www.openssl.org/source/{}", name)));
|
||||
// originally from https://www.openssl.org/source/...
|
||||
let url = format!("https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/{}",
|
||||
name);
|
||||
let mut ok = false;
|
||||
for _ in 0..3 {
|
||||
let status = Command::new("curl")
|
||||
.arg("-o").arg(&tmp)
|
||||
.arg(&url)
|
||||
.status()
|
||||
.expect("failed to spawn curl");
|
||||
if status.success() {
|
||||
ok = true;
|
||||
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");
|
||||
|
|
@ -257,11 +310,15 @@ pub fn openssl(build: &Build, target: &str) {
|
|||
configure.arg("no-ssl3");
|
||||
|
||||
let os = match target {
|
||||
"aarch64-linux-android" => "linux-aarch64",
|
||||
"aarch64-unknown-linux-gnu" => "linux-aarch64",
|
||||
"arm-linux-androideabi" => "android",
|
||||
"arm-unknown-linux-gnueabi" => "linux-armv4",
|
||||
"arm-unknown-linux-gnueabihf" => "linux-armv4",
|
||||
"armv7-linux-androideabi" => "android-armv7",
|
||||
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
|
||||
"i686-apple-darwin" => "darwin-i386-cc",
|
||||
"i686-linux-android" => "android-x86",
|
||||
"i686-unknown-freebsd" => "BSD-x86-elf",
|
||||
"i686-unknown-linux-gnu" => "linux-elf",
|
||||
"i686-unknown-linux-musl" => "linux-elf",
|
||||
|
|
@ -274,6 +331,7 @@ pub fn openssl(build: &Build, target: &str) {
|
|||
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
|
||||
"s390x-unknown-linux-gnu" => "linux64-s390x",
|
||||
"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-linux-gnu" => "linux-x86_64",
|
||||
"x86_64-unknown-linux-musl" => "linux-x86_64",
|
||||
|
|
@ -285,11 +343,23 @@ pub fn openssl(build: &Build, target: &str) {
|
|||
for flag in build.cflags(target) {
|
||||
configure.arg(flag);
|
||||
}
|
||||
// There is no specific os target for android aarch64 or x86_64,
|
||||
// so we need to pass some extra cflags
|
||||
if target == "aarch64-linux-android" || target == "x86_64-linux-android" {
|
||||
configure.arg("-mandroid");
|
||||
configure.arg("-fomit-frame-pointer");
|
||||
}
|
||||
// Make PIE binaries
|
||||
// Non-PIE linker support was removed in Lollipop
|
||||
// https://source.android.com/security/enhancements/enhancements50
|
||||
if target == "i686-linux-android" {
|
||||
configure.arg("no-asm");
|
||||
}
|
||||
configure.current_dir(&obj);
|
||||
println!("Configuring openssl for {}", target);
|
||||
build.run_quiet(&mut configure);
|
||||
println!("Building openssl for {}", target);
|
||||
build.run_quiet(Command::new("make").current_dir(&obj));
|
||||
build.run_quiet(Command::new("make").arg("-j1").current_dir(&obj));
|
||||
println!("Installing openssl for {}", target);
|
||||
build.run_quiet(Command::new("make").arg("install").current_dir(&obj));
|
||||
|
||||
|
|
|
|||
|
|
@ -65,26 +65,25 @@ pub fn check(build: &mut Build) {
|
|||
|
||||
// If we've got a git directory we're gona need git to update
|
||||
// submodules and learn about various other aspects.
|
||||
if fs::metadata(build.src.join(".git")).is_ok() {
|
||||
if build.src_is_git {
|
||||
need_cmd("git".as_ref());
|
||||
}
|
||||
|
||||
// We need cmake, but only if we're actually building LLVM
|
||||
for host in build.config.host.iter() {
|
||||
if let Some(config) = build.config.target_config.get(host) {
|
||||
if config.llvm_config.is_some() {
|
||||
continue
|
||||
}
|
||||
}
|
||||
// We need cmake, but only if we're actually building LLVM or sanitizers.
|
||||
let building_llvm = build.config.host.iter()
|
||||
.filter_map(|host| build.config.target_config.get(host))
|
||||
.any(|config| config.llvm_config.is_none());
|
||||
if building_llvm || build.config.sanitizers {
|
||||
need_cmd("cmake".as_ref());
|
||||
if build.config.ninja {
|
||||
// Some Linux distros rename `ninja` to `ninja-build`.
|
||||
// CMake can work with either binary name.
|
||||
if have_cmd("ninja-build".as_ref()).is_none() {
|
||||
need_cmd("ninja".as_ref());
|
||||
}
|
||||
}
|
||||
|
||||
// Ninja is currently only used for LLVM itself.
|
||||
if building_llvm && build.config.ninja {
|
||||
// Some Linux distros rename `ninja` to `ninja-build`.
|
||||
// CMake can work with either binary name.
|
||||
if have_cmd("ninja-build".as_ref()).is_none() {
|
||||
need_cmd("ninja".as_ref());
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if build.config.python.is_none() {
|
||||
|
|
@ -151,10 +150,10 @@ pub fn check(build: &mut Build) {
|
|||
}
|
||||
|
||||
for target in build.config.target.iter() {
|
||||
// Can't compile for iOS unless we're on OSX
|
||||
// Can't compile for iOS unless we're on macOS
|
||||
if target.contains("apple-ios") &&
|
||||
!build.config.build.contains("apple-darwin") {
|
||||
panic!("the iOS target is only supported on OSX");
|
||||
panic!("the iOS target is only supported on macOS");
|
||||
}
|
||||
|
||||
// Make sure musl-root is valid if specified
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
//! along with the actual implementation elsewhere. You can find more comments
|
||||
//! about how to define rules themselves below.
|
||||
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::collections::{BTreeMap, HashSet, HashMap};
|
||||
use std::mem;
|
||||
|
||||
use check::{self, TestKind};
|
||||
|
|
@ -137,7 +137,9 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
while let Some(krate) = list.pop() {
|
||||
let default = krate == name;
|
||||
let krate = &build.crates[krate];
|
||||
let path = krate.path.strip_prefix(&build.src).unwrap();
|
||||
let path = krate.path.strip_prefix(&build.src)
|
||||
// This handles out of tree paths
|
||||
.unwrap_or(&krate.path);
|
||||
ret.push((krate, path.to_str().unwrap(), default));
|
||||
for dep in krate.deps.iter() {
|
||||
if visited.insert(dep) && dep != "build_helper" {
|
||||
|
|
@ -305,7 +307,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
|
||||
.dep(|s| s.name("test-helpers"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.default(mode != "pretty") // pretty tests don't run everywhere
|
||||
.run(move |s| {
|
||||
check::compiletest(build, &s.compiler(), s.target, mode, dir)
|
||||
|
|
@ -344,7 +346,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
|
||||
.dep(|s| s.name("test-helpers"))
|
||||
.dep(|s| s.name("debugger-scripts"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.run(move |s| check::compiletest(build, &s.compiler(), s.target,
|
||||
"debuginfo-gdb", "debuginfo"));
|
||||
let mut rule = rules.test("check-debuginfo", "src/test/debuginfo");
|
||||
|
|
@ -398,14 +400,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
for (krate, path, _default) in krates("std") {
|
||||
rules.test(&krate.test_step, path)
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
Mode::Libstd, TestKind::Test,
|
||||
Some(&krate.name)));
|
||||
}
|
||||
rules.test("check-std-all", "path/to/nowhere")
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.default(true)
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
Mode::Libstd, TestKind::Test, None));
|
||||
|
|
@ -414,14 +416,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
for (krate, path, _default) in krates("std") {
|
||||
rules.bench(&krate.bench_step, path)
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
Mode::Libstd, TestKind::Bench,
|
||||
Some(&krate.name)));
|
||||
}
|
||||
rules.bench("bench-std-all", "path/to/nowhere")
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.default(true)
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
Mode::Libstd, TestKind::Bench, None));
|
||||
|
|
@ -429,21 +431,21 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
for (krate, path, _default) in krates("test") {
|
||||
rules.test(&krate.test_step, path)
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
Mode::Libtest, TestKind::Test,
|
||||
Some(&krate.name)));
|
||||
}
|
||||
rules.test("check-test-all", "path/to/nowhere")
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.default(true)
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
Mode::Libtest, TestKind::Test, None));
|
||||
for (krate, path, _default) in krates("rustc-main") {
|
||||
rules.test(&krate.test_step, path)
|
||||
.dep(|s| s.name("librustc"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.host(true)
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
Mode::Librustc, TestKind::Test,
|
||||
|
|
@ -451,7 +453,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
}
|
||||
rules.test("check-rustc-all", "path/to/nowhere")
|
||||
.dep(|s| s.name("librustc"))
|
||||
.dep(|s| s.name("emulator-copy-libs"))
|
||||
.dep(|s| s.name("remote-copy-libs"))
|
||||
.default(true)
|
||||
.host(true)
|
||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||
|
|
@ -468,6 +470,10 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.dep(|s| s.name("librustc"))
|
||||
.host(true)
|
||||
.run(move |s| check::cargotest(build, s.stage, s.target));
|
||||
rules.test("check-cargo", "cargo")
|
||||
.dep(|s| s.name("tool-cargo"))
|
||||
.host(true)
|
||||
.run(move |s| check::cargo(build, s.stage, s.target));
|
||||
rules.test("check-tidy", "src/tools/tidy")
|
||||
.dep(|s| s.name("tool-tidy").stage(0))
|
||||
.default(true)
|
||||
|
|
@ -494,33 +500,33 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
rules.build("openssl", "path/to/nowhere")
|
||||
.run(move |s| native::openssl(build, s.target));
|
||||
|
||||
// Some test suites are run inside emulators, and most of our test binaries
|
||||
// are linked dynamically which means we need to ship the standard library
|
||||
// and such to the emulator ahead of time. This step represents this and is
|
||||
// a dependency of all test suites.
|
||||
// Some test suites are run inside emulators or on remote devices, and most
|
||||
// of our test binaries are linked dynamically which means we need to ship
|
||||
// the standard library and such to the emulator ahead of time. This step
|
||||
// represents this and is a dependency of all test suites.
|
||||
//
|
||||
// Most of the time this step is a noop (the `check::emulator_copy_libs`
|
||||
// only does work if necessary). For some steps such as shipping data to
|
||||
// QEMU we have to build our own tools so we've got conditional dependencies
|
||||
// on those programs as well. Note that the QEMU client is built for the
|
||||
// build target (us) and the server is built for the target.
|
||||
rules.test("emulator-copy-libs", "path/to/nowhere")
|
||||
// on those programs as well. Note that the remote test client is built for
|
||||
// the build target (us) and the server is built for the target.
|
||||
rules.test("remote-copy-libs", "path/to/nowhere")
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(move |s| {
|
||||
if build.qemu_rootfs(s.target).is_some() {
|
||||
s.name("tool-qemu-test-client").target(s.host).stage(0)
|
||||
if build.remote_tested(s.target) {
|
||||
s.name("tool-remote-test-client").target(s.host).stage(0)
|
||||
} else {
|
||||
Step::noop()
|
||||
}
|
||||
})
|
||||
.dep(move |s| {
|
||||
if build.qemu_rootfs(s.target).is_some() {
|
||||
s.name("tool-qemu-test-server")
|
||||
if build.remote_tested(s.target) {
|
||||
s.name("tool-remote-test-server")
|
||||
} else {
|
||||
Step::noop()
|
||||
}
|
||||
})
|
||||
.run(move |s| check::emulator_copy_libs(build, &s.compiler(), s.target));
|
||||
.run(move |s| check::remote_copy_libs(build, &s.compiler(), s.target));
|
||||
|
||||
rules.test("check-bootstrap", "src/bootstrap")
|
||||
.default(true)
|
||||
|
|
@ -533,34 +539,50 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
//
|
||||
// Tools used during the build system but not shipped
|
||||
rules.build("tool-rustbook", "src/tools/rustbook")
|
||||
.dep(|s| s.name("librustc"))
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("librustc-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "rustbook"));
|
||||
rules.build("tool-error-index", "src/tools/error_index_generator")
|
||||
.dep(|s| s.name("librustc"))
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("librustc-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "error_index_generator"));
|
||||
rules.build("tool-tidy", "src/tools/tidy")
|
||||
.dep(|s| s.name("libstd"))
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "tidy"));
|
||||
rules.build("tool-linkchecker", "src/tools/linkchecker")
|
||||
.dep(|s| s.name("libstd"))
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "linkchecker"));
|
||||
rules.build("tool-cargotest", "src/tools/cargotest")
|
||||
.dep(|s| s.name("libstd"))
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "cargotest"));
|
||||
rules.build("tool-compiletest", "src/tools/compiletest")
|
||||
.dep(|s| s.name("libtest"))
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libtest-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "compiletest"));
|
||||
rules.build("tool-build-manifest", "src/tools/build-manifest")
|
||||
.dep(|s| s.name("libstd"))
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "build-manifest"));
|
||||
rules.build("tool-qemu-test-server", "src/tools/qemu-test-server")
|
||||
.dep(|s| s.name("libstd"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "qemu-test-server"));
|
||||
rules.build("tool-qemu-test-client", "src/tools/qemu-test-client")
|
||||
.dep(|s| s.name("libstd"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "qemu-test-client"));
|
||||
rules.build("tool-cargo", "cargo")
|
||||
.dep(|s| s.name("libstd"))
|
||||
rules.build("tool-remote-test-server", "src/tools/remote-test-server")
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "remote-test-server"));
|
||||
rules.build("tool-remote-test-client", "src/tools/remote-test-client")
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "remote-test-client"));
|
||||
rules.build("tool-rust-installer", "src/tools/rust-installer")
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "rust-installer"));
|
||||
rules.build("tool-cargo", "src/tools/cargo")
|
||||
.host(true)
|
||||
.default(build.config.extended)
|
||||
.dep(|s| s.name("maybe-clean-tools"))
|
||||
.dep(|s| s.name("libstd-tool"))
|
||||
.dep(|s| s.stage(0).host(s.target).name("openssl"))
|
||||
.dep(move |s| {
|
||||
// Cargo depends on procedural macros, which requires a full host
|
||||
|
|
@ -570,6 +592,37 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.host(&build.config.build)
|
||||
})
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "cargo"));
|
||||
rules.build("tool-rls", "src/tools/rls")
|
||||
.host(true)
|
||||
.default(build.config.extended)
|
||||
.dep(|s| s.name("librustc-tool"))
|
||||
.dep(|s| s.stage(0).host(s.target).name("openssl"))
|
||||
.dep(move |s| {
|
||||
// rls, like cargo, uses procedural macros
|
||||
s.name("librustc-link")
|
||||
.target(&build.config.build)
|
||||
.host(&build.config.build)
|
||||
})
|
||||
.run(move |s| compile::tool(build, s.stage, s.target, "rls"));
|
||||
|
||||
// "pseudo rule" which represents completely cleaning out the tools dir in
|
||||
// one stage. This needs to happen whenever a dependency changes (e.g.
|
||||
// libstd, libtest, librustc) and all of the tool compilations above will
|
||||
// be sequenced after this rule.
|
||||
rules.build("maybe-clean-tools", "path/to/nowhere")
|
||||
.after("librustc-tool")
|
||||
.after("libtest-tool")
|
||||
.after("libstd-tool");
|
||||
|
||||
rules.build("librustc-tool", "path/to/nowhere")
|
||||
.dep(|s| s.name("librustc"))
|
||||
.run(move |s| compile::maybe_clean_tools(build, s.stage, s.target, Mode::Librustc));
|
||||
rules.build("libtest-tool", "path/to/nowhere")
|
||||
.dep(|s| s.name("libtest"))
|
||||
.run(move |s| compile::maybe_clean_tools(build, s.stage, s.target, Mode::Libtest));
|
||||
rules.build("libstd-tool", "path/to/nowhere")
|
||||
.dep(|s| s.name("libstd"))
|
||||
.run(move |s| compile::maybe_clean_tools(build, s.stage, s.target, Mode::Libstd));
|
||||
|
||||
// ========================================================================
|
||||
// Documentation targets
|
||||
|
|
@ -581,7 +634,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.stage(0)
|
||||
})
|
||||
.default(build.config.docs)
|
||||
.run(move |s| doc::rustbook(build, s.target, "book"));
|
||||
.run(move |s| doc::book(build, s.target, "book"));
|
||||
rules.doc("doc-nomicon", "src/doc/nomicon")
|
||||
.dep(move |s| {
|
||||
s.name("tool-rustbook")
|
||||
|
|
@ -633,12 +686,16 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
for (krate, path, default) in krates("test") {
|
||||
rules.doc(&krate.doc_step, path)
|
||||
.dep(|s| s.name("libtest-link"))
|
||||
// Needed so rustdoc generates relative links to std.
|
||||
.dep(|s| s.name("doc-crate-std"))
|
||||
.default(default && build.config.compiler_docs)
|
||||
.run(move |s| doc::test(build, s.stage, s.target));
|
||||
}
|
||||
for (krate, path, default) in krates("rustc-main") {
|
||||
rules.doc(&krate.doc_step, path)
|
||||
.dep(|s| s.name("librustc-link"))
|
||||
// Needed so rustdoc generates relative links to std.
|
||||
.dep(|s| s.name("doc-crate-std"))
|
||||
.host(true)
|
||||
.default(default && build.config.docs)
|
||||
.run(move |s| doc::rustc(build, s.stage, s.target));
|
||||
|
|
@ -651,6 +708,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.host(true)
|
||||
.only_host_build(true)
|
||||
.default(true)
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| dist::rustc(build, s.stage, s.target));
|
||||
rules.dist("dist-std", "src/libstd")
|
||||
.dep(move |s| {
|
||||
|
|
@ -665,10 +723,12 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
})
|
||||
.default(true)
|
||||
.only_host_build(true)
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| dist::std(build, &s.compiler(), s.target));
|
||||
rules.dist("dist-mingw", "path/to/nowhere")
|
||||
.default(true)
|
||||
.only_host_build(true)
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| {
|
||||
if s.target.contains("pc-windows-gnu") {
|
||||
dist::mingw(build, s.target)
|
||||
|
|
@ -679,24 +739,34 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.host(true)
|
||||
.only_build(true)
|
||||
.only_host_build(true)
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |_| dist::rust_src(build));
|
||||
rules.dist("dist-docs", "src/doc")
|
||||
.default(true)
|
||||
.only_host_build(true)
|
||||
.dep(|s| s.name("default:doc"))
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| dist::docs(build, s.stage, s.target));
|
||||
rules.dist("dist-analysis", "analysis")
|
||||
.default(build.config.extended)
|
||||
.dep(|s| s.name("dist-std"))
|
||||
.default(true)
|
||||
.only_host_build(true)
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| dist::analysis(build, &s.compiler(), s.target));
|
||||
rules.dist("dist-rls", "rls")
|
||||
.host(true)
|
||||
.only_host_build(true)
|
||||
.dep(|s| s.name("tool-rls"))
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| dist::rls(build, s.stage, s.target));
|
||||
rules.dist("install", "path/to/nowhere")
|
||||
.dep(|s| s.name("default:dist"))
|
||||
.run(move |s| install::install(build, s.stage, s.target));
|
||||
.run(move |s| install::Installer::new(build).install(s.stage, s.target));
|
||||
rules.dist("dist-cargo", "cargo")
|
||||
.host(true)
|
||||
.only_host_build(true)
|
||||
.dep(|s| s.name("tool-cargo"))
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| dist::cargo(build, s.stage, s.target));
|
||||
rules.dist("dist-extended", "extended")
|
||||
.default(build.config.extended)
|
||||
|
|
@ -707,6 +777,9 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
.dep(|d| d.name("dist-mingw"))
|
||||
.dep(|d| d.name("dist-docs"))
|
||||
.dep(|d| d.name("dist-cargo"))
|
||||
.dep(|d| d.name("dist-rls"))
|
||||
.dep(|d| d.name("dist-analysis"))
|
||||
.dep(move |s| tool_rust_installer(build, s))
|
||||
.run(move |s| dist::extended(build, s.stage, s.target));
|
||||
|
||||
rules.dist("dist-sign", "hash-and-sign")
|
||||
|
|
@ -718,6 +791,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
|
||||
rules.verify();
|
||||
return rules;
|
||||
|
||||
/// Helper to depend on a stage0 build-only rust-installer tool.
|
||||
fn tool_rust_installer<'a>(build: &'a Build, step: &Step<'a>) -> Step<'a> {
|
||||
step.name("tool-rust-installer")
|
||||
.host(&build.config.build)
|
||||
.target(&build.config.build)
|
||||
.stage(0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
|
||||
|
|
@ -807,6 +888,11 @@ struct Rule<'a> {
|
|||
/// Whether this rule is only for the build triple, not anything in hosts or
|
||||
/// targets.
|
||||
only_build: bool,
|
||||
|
||||
/// A list of "order only" dependencies. This rules does not actually
|
||||
/// depend on these rules, but if they show up in the dependency graph then
|
||||
/// this rule must be executed after all these rules.
|
||||
after: Vec<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
|
@ -830,6 +916,7 @@ impl<'a> Rule<'a> {
|
|||
host: false,
|
||||
only_host_build: false,
|
||||
only_build: false,
|
||||
after: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -849,6 +936,11 @@ impl<'a, 'b> RuleBuilder<'a, 'b> {
|
|||
self
|
||||
}
|
||||
|
||||
fn after(&mut self, step: &'a str) -> &mut Self {
|
||||
self.rule.after.push(step);
|
||||
self
|
||||
}
|
||||
|
||||
fn run<F>(&mut self, f: F) -> &mut Self
|
||||
where F: Fn(&Step<'a>) + 'a,
|
||||
{
|
||||
|
|
@ -974,26 +1066,25 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
|
|||
}
|
||||
}
|
||||
|
||||
pub fn print_help(&self, command: &str) {
|
||||
pub fn get_help(&self, command: &str) -> Option<String> {
|
||||
let kind = match command {
|
||||
"build" => Kind::Build,
|
||||
"doc" => Kind::Doc,
|
||||
"test" => Kind::Test,
|
||||
"bench" => Kind::Bench,
|
||||
"dist" => Kind::Dist,
|
||||
_ => return,
|
||||
_ => return None,
|
||||
};
|
||||
let rules = self.rules.values().filter(|r| r.kind == kind);
|
||||
let rules = rules.filter(|r| !r.path.contains("nowhere"));
|
||||
let mut rules = rules.collect::<Vec<_>>();
|
||||
rules.sort_by_key(|r| r.path);
|
||||
|
||||
println!("Available paths:\n");
|
||||
let mut help_string = String::from("Available paths:\n");
|
||||
for rule in rules {
|
||||
print!(" ./x.py {} {}", command, rule.path);
|
||||
|
||||
println!("");
|
||||
help_string.push_str(format!(" ./x.py {} {}\n", command, rule.path).as_str());
|
||||
}
|
||||
Some(help_string)
|
||||
}
|
||||
|
||||
/// Construct the top-level build steps that we're going to be executing,
|
||||
|
|
@ -1133,31 +1224,52 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
|
|||
/// From the top level targets `steps` generate a topological ordering of
|
||||
/// all steps needed to run those steps.
|
||||
fn expand(&self, steps: &[Step<'a>]) -> Vec<Step<'a>> {
|
||||
// First up build a graph of steps and their dependencies. The `nodes`
|
||||
// map is a map from step to a unique number. The `edges` map is a
|
||||
// map from these unique numbers to a list of other numbers,
|
||||
// representing dependencies.
|
||||
let mut nodes = HashMap::new();
|
||||
nodes.insert(Step::noop(), 0);
|
||||
let mut edges = HashMap::new();
|
||||
edges.insert(0, HashSet::new());
|
||||
for step in steps {
|
||||
self.build_graph(step.clone(), &mut nodes, &mut edges);
|
||||
}
|
||||
|
||||
// Now that we've built up the actual dependency graph, draw more
|
||||
// dependency edges to satisfy the `after` dependencies field for each
|
||||
// rule.
|
||||
self.satisfy_after_deps(&nodes, &mut edges);
|
||||
|
||||
// And finally, perform a topological sort to return a list of steps to
|
||||
// execute.
|
||||
let mut order = Vec::new();
|
||||
let mut added = HashSet::new();
|
||||
added.insert(Step::noop());
|
||||
for step in steps.iter().cloned() {
|
||||
self.fill(step, &mut order, &mut added);
|
||||
let mut visited = HashSet::new();
|
||||
visited.insert(0);
|
||||
let idx_to_node = nodes.iter().map(|p| (*p.1, p.0)).collect::<HashMap<_, _>>();
|
||||
for idx in 0..nodes.len() {
|
||||
self.topo_sort(idx, &idx_to_node, &edges, &mut visited, &mut order);
|
||||
}
|
||||
return order
|
||||
}
|
||||
|
||||
/// Performs topological sort of dependencies rooted at the `step`
|
||||
/// specified, pushing all results onto the `order` vector provided.
|
||||
/// Builds the dependency graph rooted at `step`.
|
||||
///
|
||||
/// In other words, when this method returns, the `order` vector will
|
||||
/// contain a list of steps which if executed in order will eventually
|
||||
/// complete the `step` specified as well.
|
||||
///
|
||||
/// The `added` set specified here is the set of steps that are already
|
||||
/// present in `order` (and hence don't need to be added again).
|
||||
fn fill(&self,
|
||||
step: Step<'a>,
|
||||
order: &mut Vec<Step<'a>>,
|
||||
added: &mut HashSet<Step<'a>>) {
|
||||
if !added.insert(step.clone()) {
|
||||
return
|
||||
/// The `nodes` and `edges` maps are filled out according to the rule
|
||||
/// described by `step.name`.
|
||||
fn build_graph(&self,
|
||||
step: Step<'a>,
|
||||
nodes: &mut HashMap<Step<'a>, usize>,
|
||||
edges: &mut HashMap<usize, HashSet<usize>>) -> usize {
|
||||
use std::collections::hash_map::Entry;
|
||||
|
||||
let idx = nodes.len();
|
||||
match nodes.entry(step.clone()) {
|
||||
Entry::Vacant(e) => { e.insert(idx); }
|
||||
Entry::Occupied(e) => return *e.get(),
|
||||
}
|
||||
|
||||
let mut deps = Vec::new();
|
||||
for dep in self.rules[step.name].deps.iter() {
|
||||
let dep = dep(&step);
|
||||
if dep.name.starts_with("default:") {
|
||||
|
|
@ -1169,13 +1281,61 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
|
|||
let host = self.build.config.host.iter().any(|h| h == dep.target);
|
||||
let rules = self.rules.values().filter(|r| r.default);
|
||||
for rule in rules.filter(|r| r.kind == kind && (!r.host || host)) {
|
||||
self.fill(dep.name(rule.name), order, added);
|
||||
deps.push(self.build_graph(dep.name(rule.name), nodes, edges));
|
||||
}
|
||||
} else {
|
||||
self.fill(dep, order, added);
|
||||
deps.push(self.build_graph(dep, nodes, edges));
|
||||
}
|
||||
}
|
||||
order.push(step);
|
||||
|
||||
edges.entry(idx).or_insert(HashSet::new()).extend(deps);
|
||||
return idx
|
||||
}
|
||||
|
||||
/// Given a dependency graph with a finished list of `nodes`, fill out more
|
||||
/// dependency `edges`.
|
||||
///
|
||||
/// This is the step which satisfies all `after` listed dependencies in
|
||||
/// `Rule` above.
|
||||
fn satisfy_after_deps(&self,
|
||||
nodes: &HashMap<Step<'a>, usize>,
|
||||
edges: &mut HashMap<usize, HashSet<usize>>) {
|
||||
// Reverse map from the name of a step to the node indices that it
|
||||
// appears at.
|
||||
let mut name_to_idx = HashMap::new();
|
||||
for (step, &idx) in nodes {
|
||||
name_to_idx.entry(step.name).or_insert(Vec::new()).push(idx);
|
||||
}
|
||||
|
||||
for (step, idx) in nodes {
|
||||
if *step == Step::noop() {
|
||||
continue
|
||||
}
|
||||
for after in self.rules[step.name].after.iter() {
|
||||
// This is the critical piece of an `after` dependency. If the
|
||||
// dependency isn't actually in our graph then no edge is drawn,
|
||||
// only if it's already present do we draw the edges.
|
||||
if let Some(idxs) = name_to_idx.get(after) {
|
||||
edges.get_mut(idx).unwrap()
|
||||
.extend(idxs.iter().cloned());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn topo_sort(&self,
|
||||
cur: usize,
|
||||
nodes: &HashMap<usize, &Step<'a>>,
|
||||
edges: &HashMap<usize, HashSet<usize>>,
|
||||
visited: &mut HashSet<usize>,
|
||||
order: &mut Vec<Step<'a>>) {
|
||||
if !visited.insert(cur) {
|
||||
return
|
||||
}
|
||||
for dep in edges[&cur].iter() {
|
||||
self.topo_sort(*dep, nodes, edges, visited, order);
|
||||
}
|
||||
order.push(nodes[&cur].clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1213,20 +1373,20 @@ mod tests {
|
|||
name: "std".to_string(),
|
||||
deps: Vec::new(),
|
||||
path: cwd.join("src/std"),
|
||||
doc_step: "doc-std".to_string(),
|
||||
doc_step: "doc-crate-std".to_string(),
|
||||
build_step: "build-crate-std".to_string(),
|
||||
test_step: "test-std".to_string(),
|
||||
bench_step: "bench-std".to_string(),
|
||||
test_step: "test-crate-std".to_string(),
|
||||
bench_step: "bench-crate-std".to_string(),
|
||||
version: String::new(),
|
||||
});
|
||||
build.crates.insert("test".to_string(), ::Crate {
|
||||
name: "test".to_string(),
|
||||
deps: Vec::new(),
|
||||
path: cwd.join("src/test"),
|
||||
doc_step: "doc-test".to_string(),
|
||||
doc_step: "doc-crate-test".to_string(),
|
||||
build_step: "build-crate-test".to_string(),
|
||||
test_step: "test-test".to_string(),
|
||||
bench_step: "bench-test".to_string(),
|
||||
test_step: "test-crate-test".to_string(),
|
||||
bench_step: "bench-crate-test".to_string(),
|
||||
version: String::new(),
|
||||
});
|
||||
build.crates.insert("rustc-main".to_string(), ::Crate {
|
||||
|
|
@ -1234,10 +1394,10 @@ mod tests {
|
|||
deps: Vec::new(),
|
||||
version: String::new(),
|
||||
path: cwd.join("src/rustc-main"),
|
||||
doc_step: "doc-rustc-main".to_string(),
|
||||
doc_step: "doc-crate-rustc-main".to_string(),
|
||||
build_step: "build-crate-rustc-main".to_string(),
|
||||
test_step: "test-rustc-main".to_string(),
|
||||
bench_step: "bench-rustc-main".to_string(),
|
||||
test_step: "test-crate-rustc-main".to_string(),
|
||||
bench_step: "bench-crate-rustc-main".to_string(),
|
||||
});
|
||||
return build
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,8 @@ pub fn dylib_path_var() -> &'static str {
|
|||
"PATH"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"DYLD_LIBRARY_PATH"
|
||||
} else if cfg!(target_os = "haiku") {
|
||||
"LIBRARY_PATH"
|
||||
} else {
|
||||
"LD_LIBRARY_PATH"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,7 +198,11 @@ pub fn native_lib_boilerplate(src_name: &str,
|
|||
let out_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or(env::var_os("OUT_DIR").unwrap());
|
||||
let out_dir = PathBuf::from(out_dir).join(out_name);
|
||||
t!(create_dir_racy(&out_dir));
|
||||
println!("cargo:rustc-link-lib=static={}", link_name);
|
||||
if link_name.contains('=') {
|
||||
println!("cargo:rustc-link-lib={}", link_name);
|
||||
} else {
|
||||
println!("cargo:rustc-link-lib=static={}", link_name);
|
||||
}
|
||||
println!("cargo:rustc-link-search=native={}", out_dir.join(search_subdir).display());
|
||||
|
||||
let timestamp = out_dir.join("rustbuild.timestamp");
|
||||
|
|
@ -209,6 +213,21 @@ pub fn native_lib_boilerplate(src_name: &str,
|
|||
}
|
||||
}
|
||||
|
||||
pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) -> Result<NativeLibBoilerplate, ()> {
|
||||
let (link_name, search_path) = match &*env::var("TARGET").unwrap() {
|
||||
"x86_64-unknown-linux-gnu" => (
|
||||
format!("clang_rt.{}-x86_64", sanitizer_name),
|
||||
"build/lib/linux",
|
||||
),
|
||||
"x86_64-apple-darwin" => (
|
||||
format!("dylib=clang_rt.{}_osx_dynamic", sanitizer_name),
|
||||
"build/lib/darwin",
|
||||
),
|
||||
_ => return Err(()),
|
||||
};
|
||||
native_lib_boilerplate("compiler-rt", sanitizer_name, &link_name, search_path)
|
||||
}
|
||||
|
||||
fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
|
||||
t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
|
||||
let meta = t!(e.metadata());
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ for example:
|
|||
|
||||
Images will output artifacts in an `obj` dir at the root of a repository.
|
||||
|
||||
## Filesystem layout
|
||||
|
||||
- Each directory, excluding `scripts` and `disabled`, corresponds to a docker image
|
||||
- `scripts` contains files shared by docker images
|
||||
- `disabled` contains images that are not build travis
|
||||
|
||||
## Cross toolchains
|
||||
|
||||
A number of these images take quite a long time to compile as they're building
|
||||
|
|
@ -152,18 +158,13 @@ For targets: `powerpc-unknown-linux-gnu`
|
|||
- Path and misc options > Patches origin = Bundled, then local
|
||||
- Path and misc options > Local patch directory = /tmp/patches
|
||||
- Target options > Target Architecture = powerpc
|
||||
- Target options > Emit assembly for CPU = power4 -- (+)
|
||||
- Target options > Tune for CPU = power6 -- (+)
|
||||
- Target options > Emit assembly for CPU = powerpc -- pure 32-bit PowerPC
|
||||
- Operating System > Target OS = linux
|
||||
- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
|
||||
- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
|
||||
- C compiler > gcc version = 4.9.3
|
||||
- C compiler > Core gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
|
||||
- C compiler > gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
|
||||
- C compiler > C++ = ENABLE -- to cross compile LLVM
|
||||
|
||||
(+) These CPU options match the configuration of the toolchains in RHEL6.
|
||||
|
||||
## `powerpc64-linux-gnu.config`
|
||||
|
||||
For targets: `powerpc64-unknown-linux-gnu`
|
||||
|
|
|
|||
|
|
@ -1,46 +1,60 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libssl-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
python2.7 \
|
||||
sudo \
|
||||
unzip \
|
||||
xz-utils
|
||||
|
||||
# dumb-init
|
||||
COPY scripts/dumb-init.sh /scripts/
|
||||
RUN sh /scripts/dumb-init.sh
|
||||
|
||||
# ndk
|
||||
COPY scripts/android-ndk.sh /scripts/
|
||||
RUN . /scripts/android-ndk.sh && \
|
||||
download_and_make_toolchain android-ndk-r13b-linux-x86_64.zip arm 9
|
||||
|
||||
# sdk
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python2.7 \
|
||||
git \
|
||||
cmake \
|
||||
unzip \
|
||||
expect \
|
||||
openjdk-9-jre \
|
||||
sudo \
|
||||
libgl1-mesa-glx \
|
||||
libpulse0 \
|
||||
libstdc++6:i386 \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
openjdk-9-jre-headless \
|
||||
tzdata
|
||||
|
||||
WORKDIR /android/
|
||||
ENV PATH=$PATH:/android/ndk-arm-9/bin:/android/sdk/tools:/android/sdk/platform-tools
|
||||
COPY scripts/android-sdk.sh /scripts/
|
||||
RUN . /scripts/android-sdk.sh && \
|
||||
download_and_create_avd tools_r25.2.5-linux.zip armeabi-v7a 18
|
||||
|
||||
COPY install-ndk.sh install-sdk.sh accept-licenses.sh /android/
|
||||
RUN sh /android/install-ndk.sh
|
||||
RUN sh /android/install-sdk.sh
|
||||
# env
|
||||
ENV PATH=$PATH:/android/sdk/tools
|
||||
ENV PATH=$PATH:/android/sdk/platform-tools
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
|
||||
COPY start-emulator.sh /android/
|
||||
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/android/start-emulator.sh"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-24-sccache-x86_64-unknown-linux-gnu && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
ENV TARGETS=arm-linux-androideabi
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--target=arm-linux-androideabi \
|
||||
--arm-linux-androideabi-ndk=/android/ndk-arm-9
|
||||
--target=$TARGETS \
|
||||
--arm-linux-androideabi-ndk=/android/ndk/arm-9
|
||||
|
||||
ENV SCRIPT python2.7 ../x.py test --target arm-linux-androideabi
|
||||
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
|
||||
|
||||
# sccache
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# init
|
||||
COPY scripts/android-start-emulator.sh /scripts/
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/scripts/android-start-emulator.sh"]
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/expect -f
|
||||
# ignore-license
|
||||
|
||||
set timeout 1800
|
||||
set cmd [lindex $argv 0]
|
||||
set licenses [lindex $argv 1]
|
||||
|
||||
spawn {*}$cmd
|
||||
expect {
|
||||
"Do you accept the license '*'*" {
|
||||
exp_send "y\r"
|
||||
exp_continue
|
||||
}
|
||||
eof
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/sh
|
||||
# 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
|
||||
|
||||
cpgdb() {
|
||||
cp android-ndk-r11c/prebuilt/linux-x86_64/bin/gdb /android/$1/bin/$2-gdb
|
||||
cp android-ndk-r11c/prebuilt/linux-x86_64/bin/gdb-orig /android/$1/bin/gdb-orig
|
||||
cp -r android-ndk-r11c/prebuilt/linux-x86_64/share /android/$1/share
|
||||
}
|
||||
|
||||
# Prep the Android NDK
|
||||
#
|
||||
# See https://github.com/servo/servo/wiki/Building-for-Android
|
||||
curl -O https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip
|
||||
unzip -q android-ndk-r11c-linux-x86_64.zip
|
||||
bash android-ndk-r11c/build/tools/make-standalone-toolchain.sh \
|
||||
--platform=android-9 \
|
||||
--toolchain=arm-linux-androideabi-4.9 \
|
||||
--install-dir=/android/ndk-arm-9 \
|
||||
--ndk-dir=/android/android-ndk-r11c \
|
||||
--arch=arm
|
||||
cpgdb ndk-arm-9 arm-linux-androideabi
|
||||
|
||||
rm -rf ./android-ndk-r11c-linux-x86_64.zip ./android-ndk-r11c
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/sh
|
||||
# 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
|
||||
|
||||
# Prep the SDK and emulator
|
||||
#
|
||||
# Note that the update process requires that we accept a bunch of licenses, and
|
||||
# we can't just pipe `yes` into it for some reason, so we take the same strategy
|
||||
# located in https://github.com/appunite/docker by just wrapping it in a script
|
||||
# which apparently magically accepts the licenses.
|
||||
|
||||
mkdir sdk
|
||||
curl https://dl.google.com/android/android-sdk_r24.4-linux.tgz | \
|
||||
tar xzf - -C sdk --strip-components=1
|
||||
|
||||
filter="platform-tools,android-18"
|
||||
filter="$filter,sys-img-armeabi-v7a-android-18"
|
||||
|
||||
./accept-licenses.sh "android - update sdk -a --no-ui --filter $filter"
|
||||
|
||||
echo "no" | android create avd \
|
||||
--name arm-18 \
|
||||
--target android-18 \
|
||||
--abi armeabi-v7a
|
||||
|
|
@ -31,7 +31,7 @@ WORKDIR /build
|
|||
# The `vexpress_config` config file was a previously generated config file for
|
||||
# the kernel. This file was generated by running `make vexpress_defconfig`
|
||||
# followed by `make menuconfig` and then enabling the IPv6 protocol page.
|
||||
COPY vexpress_config /build/.config
|
||||
COPY armhf-gnu/vexpress_config /build/.config
|
||||
RUN curl https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.42.tar.xz | \
|
||||
tar xJf - && \
|
||||
cd /build/linux-4.4.42 && \
|
||||
|
|
@ -63,18 +63,18 @@ RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-bas
|
|||
|
||||
# Copy over our init script, which starts up our test server and also a few
|
||||
# other misc tasks.
|
||||
COPY rcS rootfs/etc/init.d/rcS
|
||||
COPY armhf-gnu/rcS rootfs/etc/init.d/rcS
|
||||
RUN chmod +x rootfs/etc/init.d/rcS
|
||||
|
||||
# Helper to quickly fill the entropy pool in the kernel.
|
||||
COPY addentropy.c /tmp/
|
||||
COPY armhf-gnu/addentropy.c /tmp/
|
||||
RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
|
||||
|
||||
# TODO: What is this?!
|
||||
RUN curl -O http://ftp.nl.debian.org/debian/dists/jessie/main/installer-armhf/current/images/device-tree/vexpress-v2p-ca15-tc1.dtb
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
@ -32,10 +32,10 @@ ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
|||
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY build-rumprun.sh /tmp/
|
||||
COPY cross/build-rumprun.sh /tmp/
|
||||
RUN ./build-rumprun.sh
|
||||
|
||||
COPY build-arm-musl.sh /tmp/
|
||||
COPY cross/build-arm-musl.sh /tmp/
|
||||
RUN ./build-arm-musl.sh
|
||||
|
||||
# originally from
|
||||
|
|
@ -74,6 +74,7 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
|
|||
ENV STAGING_DIR=/tmp
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--enable-extended \
|
||||
--target=$TARGETS \
|
||||
--musl-root-arm=/usr/local/arm-linux-musleabi \
|
||||
--musl-root-armhf=/usr/local/arm-linux-musleabihf \
|
||||
|
|
|
|||
50
src/ci/docker/disabled/dist-aarch64-android/Dockerfile
Normal file
50
src/ci/docker/disabled/dist-aarch64-android/Dockerfile
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libssl-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
python2.7 \
|
||||
sudo \
|
||||
unzip \
|
||||
xz-utils
|
||||
|
||||
# dumb-init
|
||||
COPY scripts/dumb-init.sh /scripts/
|
||||
RUN sh /scripts/dumb-init.sh
|
||||
|
||||
# ndk
|
||||
COPY scripts/android-ndk.sh /scripts/
|
||||
RUN . /scripts/android-ndk.sh && \
|
||||
download_and_make_toolchain android-ndk-r13b-linux-x86_64.zip arm64 21
|
||||
|
||||
# env
|
||||
ENV PATH=$PATH:/android/ndk/arm64-21/bin
|
||||
|
||||
ENV DEP_Z_ROOT=/android/ndk/arm64-21/sysroot/usr/
|
||||
|
||||
ENV HOSTS=aarch64-linux-android
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
||||
--target=$HOSTS \
|
||||
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
|
||||
--disable-rpath \
|
||||
--enable-extended \
|
||||
--enable-cargo-openssl-static
|
||||
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS
|
||||
|
||||
# sccache
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# init
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
68
src/ci/docker/disabled/dist-armv7-android/Dockerfile
Normal file
68
src/ci/docker/disabled/dist-armv7-android/Dockerfile
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libssl-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
python2.7 \
|
||||
sudo \
|
||||
unzip \
|
||||
xz-utils
|
||||
|
||||
# dumb-init
|
||||
COPY scripts/dumb-init.sh /scripts/
|
||||
RUN sh /scripts/dumb-init.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 arm 21 && \
|
||||
remove_ndk
|
||||
|
||||
RUN chmod 777 /android/ndk && \
|
||||
ln -s /android/ndk/arm-21 /android/ndk/arm
|
||||
|
||||
# env
|
||||
ENV PATH=$PATH:/android/ndk/arm-9/bin
|
||||
|
||||
ENV DEP_Z_ROOT=/android/ndk/arm-9/sysroot/usr/
|
||||
|
||||
ENV HOSTS=armv7-linux-androideabi
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
||||
--target=$HOSTS \
|
||||
--armv7-linux-androideabi-ndk=/android/ndk/arm \
|
||||
--disable-rpath \
|
||||
--enable-extended \
|
||||
--enable-cargo-openssl-static
|
||||
|
||||
# We support api level 9, 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
|
||||
# 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
|
||||
# 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 && \
|
||||
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
|
||||
|
||||
# sccache
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# init
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
68
src/ci/docker/disabled/dist-i686-android/Dockerfile
Normal file
68
src/ci/docker/disabled/dist-i686-android/Dockerfile
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libssl-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
python2.7 \
|
||||
sudo \
|
||||
unzip \
|
||||
xz-utils
|
||||
|
||||
# dumb-init
|
||||
COPY scripts/dumb-init.sh /scripts/
|
||||
RUN sh /scripts/dumb-init.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 x86 9 && \
|
||||
make_standalone_toolchain x86 21 && \
|
||||
remove_ndk
|
||||
|
||||
RUN chmod 777 /android/ndk && \
|
||||
ln -s /android/ndk/x86-21 /android/ndk/x86
|
||||
|
||||
# env
|
||||
ENV PATH=$PATH:/android/ndk/x86-9/bin
|
||||
|
||||
ENV DEP_Z_ROOT=/android/ndk/x86-9/sysroot/usr/
|
||||
|
||||
ENV HOSTS=i686-linux-android
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
||||
--target=$HOSTS \
|
||||
--i686-linux-android-ndk=/android/ndk/x86 \
|
||||
--disable-rpath \
|
||||
--enable-extended \
|
||||
--enable-cargo-openssl-static
|
||||
|
||||
# We support api level 9, 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
|
||||
# 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
|
||||
# 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 && \
|
||||
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
|
||||
|
||||
# sccache
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# init
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
50
src/ci/docker/disabled/dist-x86_64-android/Dockerfile
Normal file
50
src/ci/docker/disabled/dist-x86_64-android/Dockerfile
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libssl-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
python2.7 \
|
||||
sudo \
|
||||
unzip \
|
||||
xz-utils
|
||||
|
||||
# dumb-init
|
||||
COPY scripts/dumb-init.sh /scripts/
|
||||
RUN sh /scripts/dumb-init.sh
|
||||
|
||||
# ndk
|
||||
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
|
||||
|
||||
# env
|
||||
ENV PATH=$PATH:/android/ndk/x86_64-21/bin
|
||||
|
||||
ENV DEP_Z_ROOT=/android/ndk/x86_64-21/sysroot/usr/
|
||||
|
||||
ENV HOSTS=x86_64-linux-android
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
||||
--target=$HOSTS \
|
||||
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \
|
||||
--disable-rpath \
|
||||
--enable-extended \
|
||||
--enable-cargo-openssl-static
|
||||
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS
|
||||
|
||||
# sccache
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# init
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
|
@ -27,10 +27,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
|
|
@ -60,24 +56,22 @@ RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
|||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY armv7-linux-gnueabihf.config /tmp/
|
||||
COPY armv7-linux-gnueabihf.config aarch64-linux-gnu.config build-toolchains.sh /tmp/
|
||||
COPY dist-aarch64-linux/aarch64-linux-gnu.config dist-aarch64-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/aarch64-unknown-linux-gnueabi/bin
|
||||
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \
|
||||
AR_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-ar \
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-g++ \
|
||||
CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
|
||||
AR_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-ar \
|
||||
CXX_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-g++
|
||||
CXX_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=armv7-unknown-linux-gnueabihf
|
||||
ENV HOSTS=$HOSTS,aarch64-unknown-linux-gnu
|
||||
ENV HOSTS=aarch64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
37
src/ci/docker/dist-aarch64-linux/build-toolchains.sh
Executable file
37
src/ci/docker/dist-aarch64-linux/build-toolchains.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/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.
|
||||
#
|
||||
# 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
|
||||
|
||||
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
|
||||
rm /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../aarch64-linux-gnu.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
|
@ -1,50 +1,56 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
g++ \
|
||||
make \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python2.7 \
|
||||
git \
|
||||
cmake \
|
||||
unzip \
|
||||
expect \
|
||||
openjdk-9-jre \
|
||||
sudo \
|
||||
libstdc++6:i386 \
|
||||
xz-utils \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
git \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
make \
|
||||
pkg-config \
|
||||
python2.7 \
|
||||
sudo \
|
||||
unzip \
|
||||
xz-utils
|
||||
|
||||
WORKDIR /android/
|
||||
ENV PATH=$PATH:/android/ndk-arm-9/bin:/android/sdk/tools:/android/sdk/platform-tools
|
||||
# dumb-init
|
||||
COPY scripts/dumb-init.sh /scripts/
|
||||
RUN sh /scripts/dumb-init.sh
|
||||
|
||||
COPY install-ndk.sh /android/
|
||||
RUN sh /android/install-ndk.sh
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
# 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 && \
|
||||
make_standalone_toolchain arm64 21 && \
|
||||
make_standalone_toolchain x86_64 21 && \
|
||||
remove_ndk
|
||||
|
||||
# env
|
||||
ENV TARGETS=arm-linux-androideabi
|
||||
ENV TARGETS=$TARGETS,armv7-linux-androideabi
|
||||
ENV TARGETS=$TARGETS,i686-linux-android
|
||||
ENV TARGETS=$TARGETS,aarch64-linux-android
|
||||
ENV TARGETS=$TARGETS,armv7-linux-androideabi
|
||||
ENV TARGETS=$TARGETS,x86_64-linux-android
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--target=$TARGETS \
|
||||
--arm-linux-androideabi-ndk=/android/ndk-arm-9 \
|
||||
--armv7-linux-androideabi-ndk=/android/ndk-arm-9 \
|
||||
--i686-linux-android-ndk=/android/ndk-x86-9 \
|
||||
--aarch64-linux-android-ndk=/android/ndk-aarch64
|
||||
--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 \
|
||||
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
|
||||
--x86_64-linux-android-ndk=/android/ndk/x86_64-21
|
||||
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
||||
|
||||
# cache
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# init
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
#!/bin/sh
|
||||
# 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
|
||||
|
||||
# Prep the Android NDK
|
||||
#
|
||||
# See https://github.com/servo/servo/wiki/Building-for-Android
|
||||
curl -O https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip
|
||||
unzip -q android-ndk-r11c-linux-x86_64.zip
|
||||
bash android-ndk-r11c/build/tools/make-standalone-toolchain.sh \
|
||||
--platform=android-9 \
|
||||
--toolchain=arm-linux-androideabi-4.9 \
|
||||
--install-dir=/android/ndk-arm-9 \
|
||||
--ndk-dir=/android/android-ndk-r11c \
|
||||
--arch=arm
|
||||
bash android-ndk-r11c/build/tools/make-standalone-toolchain.sh \
|
||||
--platform=android-21 \
|
||||
--toolchain=aarch64-linux-android-4.9 \
|
||||
--install-dir=/android/ndk-aarch64 \
|
||||
--ndk-dir=/android/android-ndk-r11c \
|
||||
--arch=arm64
|
||||
bash android-ndk-r11c/build/tools/make-standalone-toolchain.sh \
|
||||
--platform=android-9 \
|
||||
--toolchain=x86-4.9 \
|
||||
--install-dir=/android/ndk-x86-9 \
|
||||
--ndk-dir=/android/android-ndk-r11c \
|
||||
--arch=x86
|
||||
|
||||
rm -rf ./android-ndk-r11c-linux-x86_64.zip ./android-ndk-r11c
|
||||
|
|
@ -27,10 +27,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
|
|
@ -60,23 +56,22 @@ RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
|||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY arm-linux-gnueabihf.config arm-linux-gnueabi.config build-toolchains.sh /tmp/
|
||||
COPY dist-arm-linux/arm-linux-gnueabi.config dist-arm-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabi/bin
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \
|
||||
AR_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-ar \
|
||||
CXX_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-g++ \
|
||||
CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
|
||||
AR_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-ar \
|
||||
CXX_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-g++
|
||||
CXX_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabi
|
||||
ENV HOSTS=$HOSTS,arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
|
|||
|
|
@ -35,11 +35,3 @@ ct-ng oldconfig
|
|||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../arm-linux-gnueabihf.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
|
|
|||
77
src/ci/docker/dist-armhf-linux/Dockerfile
Normal file
77
src/ci/docker/dist-armhf-linux/Dockerfile
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
gdb \
|
||||
git \
|
||||
gperf \
|
||||
help2man \
|
||||
libncurses-dev \
|
||||
libtool-bin \
|
||||
make \
|
||||
patch \
|
||||
python2.7 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
|
||||
cd make-3.81 && \
|
||||
./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf make-3.81
|
||||
|
||||
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
|
||||
tar xjf - && \
|
||||
cd crosstool-ng && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf crosstool-ng
|
||||
|
||||
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
|
||||
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-armhf-linux/arm-linux-gnueabihf.config dist-armhf-linux/build-toolchains.sh /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
|
||||
AR_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-ar \
|
||||
CXX_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=arm-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
37
src/ci/docker/dist-armhf-linux/build-toolchains.sh
Executable file
37
src/ci/docker/dist-armhf-linux/build-toolchains.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/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.
|
||||
#
|
||||
# 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
|
||||
|
||||
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
|
||||
rm /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../arm-linux-gnueabihf.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
77
src/ci/docker/dist-armv7-linux/Dockerfile
Normal file
77
src/ci/docker/dist-armv7-linux/Dockerfile
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
gdb \
|
||||
git \
|
||||
gperf \
|
||||
help2man \
|
||||
libncurses-dev \
|
||||
libtool-bin \
|
||||
make \
|
||||
patch \
|
||||
python2.7 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
|
||||
cd make-3.81 && \
|
||||
./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf make-3.81
|
||||
|
||||
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
|
||||
tar xjf - && \
|
||||
cd crosstool-ng && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf crosstool-ng
|
||||
|
||||
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
|
||||
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY dist-armv7-linux/build-toolchains.sh dist-armv7-linux/armv7-linux-gnueabihf.config /tmp/
|
||||
RUN ./build-toolchains.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
|
||||
|
||||
ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
|
||||
AR_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-ar \
|
||||
CXX_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-g++
|
||||
|
||||
ENV HOSTS=armv7-unknown-linux-gnueabihf
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
@ -35,11 +35,3 @@ ct-ng oldconfig
|
|||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cp ../aarch64-linux-gnu.config .config
|
||||
ct-ng oldconfig
|
||||
hide_output ct-ng build
|
||||
cd ..
|
||||
rm -rf build
|
||||
|
|
@ -14,13 +14,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
xz-utils \
|
||||
swig \
|
||||
libedit-dev \
|
||||
libncurses5-dev
|
||||
libncurses5-dev \
|
||||
patch
|
||||
|
||||
RUN curl -L https://cmake.org/files/v3.8/cmake-3.8.0-rc1-Linux-x86_64.tar.gz | \
|
||||
tar xzf - -C /usr/local --strip-components=1
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY shared.sh build-toolchain.sh /tmp/
|
||||
COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh dist-fuchsia/compiler-rt-dso-handle.patch /tmp/
|
||||
RUN /tmp/build-toolchain.sh
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
@ -29,7 +30,7 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
|
|
@ -43,5 +44,5 @@ ENV \
|
|||
ENV TARGETS=x86_64-unknown-fuchsia
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
||||
|
|
|
|||
|
|
@ -9,26 +9,31 @@
|
|||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
# ignore-tidy-linelength
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
# Download sources
|
||||
SRCS=(
|
||||
"https://fuchsia.googlesource.com/magenta magenta ac69119"
|
||||
"https://fuchsia.googlesource.com/third_party/llvm llvm 5463083"
|
||||
"https://fuchsia.googlesource.com/third_party/clang llvm/tools/clang 4ff7b4b"
|
||||
"https://fuchsia.googlesource.com/third_party/lld llvm/tools/lld fd465a3"
|
||||
"https://fuchsia.googlesource.com/third_party/lldb llvm/tools/lldb 6bb11f8"
|
||||
"https://fuchsia.googlesource.com/third_party/compiler-rt llvm/runtimes/compiler-rt 52d4ecc"
|
||||
"https://fuchsia.googlesource.com/third_party/libcxx llvm/runtimes/libcxx e891cc8"
|
||||
"https://fuchsia.googlesource.com/third_party/libcxxabi llvm/runtimes/libcxxabi f0f0257"
|
||||
"https://fuchsia.googlesource.com/third_party/libunwind llvm/runtimes/libunwind 50bddc1"
|
||||
"https://fuchsia.googlesource.com/magenta magenta d17073dc8de344ead3b65e8cc6a12280dec38c84"
|
||||
"https://llvm.googlesource.com/llvm llvm 3f58a16d8eec385e2b3ebdfbb84ff9d3bf27e025"
|
||||
"https://llvm.googlesource.com/clang llvm/tools/clang 727ea63e6e82677f6e10e05e08bc7d6bdbae3111"
|
||||
"https://llvm.googlesource.com/lld llvm/tools/lld a31286c1366e5e89b8872803fded13805a1a084b"
|
||||
"https://llvm.googlesource.com/lldb llvm/tools/lldb 0b2384abec4cb99ad66687712e07dee4dd9d187e"
|
||||
"https://llvm.googlesource.com/compiler-rt llvm/runtimes/compiler-rt 9093a35c599fe41278606a20b51095ea8bd5a081"
|
||||
"https://llvm.googlesource.com/libcxx llvm/runtimes/libcxx 607e0c71ec4f7fd377ad3f6c47b08dbe89f66eaa"
|
||||
"https://llvm.googlesource.com/libcxxabi llvm/runtimes/libcxxabi 0a3a1a8a5ca5ef69e0f6b7d5b9d13e63e6fd2c19"
|
||||
"https://llvm.googlesource.com/libunwind llvm/runtimes/libunwind e128003563d99d9ee62247c4cee40f07d21c03e3"
|
||||
)
|
||||
|
||||
fetch() {
|
||||
mkdir -p $2
|
||||
pushd $2 > /dev/null
|
||||
curl -sL $1/+archive/$3.tar.gz | tar xzf -
|
||||
git init
|
||||
git remote add origin $1
|
||||
git fetch --depth=1 origin $3
|
||||
git reset --hard FETCH_HEAD
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +41,11 @@ for i in "${SRCS[@]}"; do
|
|||
fetch $i
|
||||
done
|
||||
|
||||
# Remove this once https://reviews.llvm.org/D28791 is resolved
|
||||
cd llvm/runtimes/compiler-rt
|
||||
patch -Np1 < /tmp/compiler-rt-dso-handle.patch
|
||||
cd ../../..
|
||||
|
||||
# Build toolchain
|
||||
cd llvm
|
||||
mkdir build
|
||||
|
|
|
|||
41
src/ci/docker/dist-fuchsia/compiler-rt-dso-handle.patch
Normal file
41
src/ci/docker/dist-fuchsia/compiler-rt-dso-handle.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
|
||||
index fc4384af2..b442264c0 100644
|
||||
--- a/lib/builtins/CMakeLists.txt
|
||||
+++ b/lib/builtins/CMakeLists.txt
|
||||
@@ -194,6 +194,12 @@ if(APPLE)
|
||||
atomic_thread_fence.c)
|
||||
endif()
|
||||
|
||||
+if(FUCHSIA)
|
||||
+ set(GENERIC_SOURCES
|
||||
+ ${GENERIC_SOURCES}
|
||||
+ dso_handle.c)
|
||||
+endif()
|
||||
+
|
||||
if(NOT WIN32 OR MINGW)
|
||||
set(GENERIC_SOURCES
|
||||
${GENERIC_SOURCES}
|
||||
diff --git a/lib/builtins/dso_handle.c b/lib/builtins/dso_handle.c
|
||||
new file mode 100644
|
||||
index 000000000..7766cd0aa
|
||||
--- /dev/null
|
||||
+++ b/lib/builtins/dso_handle.c
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* ===-- dso_handle.c - Provide __dso_handle -------------------------------===
|
||||
+ *
|
||||
+ * The LLVM Compiler Infrastructure
|
||||
+ *
|
||||
+ * This file is dual licensed under the MIT and the University of Illinois Open
|
||||
+ * Source Licenses. See LICENSE.TXT for details.
|
||||
+ *
|
||||
+ * ===----------------------------------------------------------------------===
|
||||
+ */
|
||||
+
|
||||
+/* __dso_handle symbol is mandated by C++ ABI with a value which is an address
|
||||
+ * in one of the object's segments, and as such this symbol has to be included
|
||||
+ * statically and cannot be a part of a shared library. Traditionally, it has
|
||||
+ * been defined in crtbegin.o but there's no principled reason for it to be
|
||||
+ * there. We defined this symbol in the builtin library which is built as a
|
||||
+ * static library and always included in the final link.
|
||||
+ */
|
||||
+__attribute__((visibility("hidden"))) void *const __dso_handle;
|
||||
|
|
@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
pkg-config
|
||||
|
||||
WORKDIR /build/
|
||||
COPY musl-libunwind-patch.patch build-musl.sh /build/
|
||||
COPY dist-i586-gnu-i686-musl/musl-libunwind-patch.patch dist-i586-gnu-i686-musl/build-musl.sh /build/
|
||||
RUN sh /build/build-musl.sh && rm -rf /build
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
@ -26,12 +26,13 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--target=i686-unknown-linux-musl,i586-unknown-linux-gnu \
|
||||
--musl-root-i686=/musl-i686
|
||||
--musl-root-i686=/musl-i686 \
|
||||
--enable-extended
|
||||
|
||||
# Newer binutils broke things on some vms/distros (i.e., linking against
|
||||
# unknown relocs disabled by the following flag), so we need to go out of our
|
||||
|
|
|
|||
|
|
@ -15,11 +15,14 @@ set -ex
|
|||
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
|
||||
export CXXFLAGS="-Wa,-mrelax-relocations=no"
|
||||
|
||||
MUSL=musl-1.1.14
|
||||
MUSL=musl-1.1.16
|
||||
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
|
||||
cd $MUSL
|
||||
CFLAGS="$CFLAGS -m32" ./configure --prefix=/musl-i686 --disable-shared --target=i686
|
||||
make -j10
|
||||
CC=gcc \
|
||||
CFLAGS="$CFLAGS -m32" \
|
||||
./configure --prefix=/musl-i686 --disable-shared \
|
||||
--target=i686
|
||||
make AR=ar RANLIB=ranlib -j10
|
||||
make install
|
||||
cd ..
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
COPY build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh x86_64
|
||||
COPY dist-i686-freebsd/build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh i686
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
@ -26,19 +25,15 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-ar \
|
||||
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-gcc \
|
||||
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-g++ \
|
||||
AR_i686_unknown_freebsd=i686-unknown-freebsd10-ar \
|
||||
CC_i686_unknown_freebsd=i686-unknown-freebsd10-gcc \
|
||||
CXX_i686_unknown_freebsd=i686-unknown-freebsd10-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-freebsd
|
||||
ENV HOSTS=$HOSTS,i686-unknown-freebsd
|
||||
ENV HOSTS=i686-unknown-freebsd
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
@ -2,10 +2,17 @@ FROM centos:5
|
|||
|
||||
WORKDIR /build
|
||||
|
||||
# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
|
||||
# to http://vault.centos.org/
|
||||
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
|
||||
RUN sed -i 's|#\(baseurl.*\)mirror.centos.org/centos/$releasever|\1vault.centos.org/5.11|' /etc/yum.repos.d/*.repo
|
||||
|
||||
RUN yum upgrade -y && yum install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
glibc-devel \
|
||||
perl \
|
||||
|
|
@ -22,13 +29,13 @@ ENV PATH=/rustroot/bin:$PATH
|
|||
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
|
||||
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
|
||||
WORKDIR /tmp
|
||||
COPY shared.sh build-binutils.sh /tmp/
|
||||
COPY dist-i686-linux/shared.sh dist-i686-linux/build-binutils.sh /tmp/
|
||||
|
||||
# We need a build of openssl which supports SNI to download artifacts from
|
||||
# static.rust-lang.org. This'll be used to link into libcurl below (and used
|
||||
# later as well), so build a copy of OpenSSL with dynamic libraries into our
|
||||
# generic root.
|
||||
COPY build-openssl.sh /tmp/
|
||||
COPY dist-i686-linux/build-openssl.sh /tmp/
|
||||
RUN ./build-openssl.sh
|
||||
|
||||
# The `curl` binary on CentOS doesn't support SNI which is needed for fetching
|
||||
|
|
@ -37,7 +44,7 @@ RUN ./build-openssl.sh
|
|||
#
|
||||
# Note that we also disable a bunch of optional features of curl that we don't
|
||||
# really need.
|
||||
COPY build-curl.sh /tmp/
|
||||
COPY dist-i686-linux/build-curl.sh /tmp/
|
||||
RUN ./build-curl.sh
|
||||
|
||||
# binutils < 2.22 has a bug where the 32-bit executables it generates
|
||||
|
|
@ -47,26 +54,26 @@ RUN ./build-curl.sh
|
|||
RUN ./build-binutils.sh
|
||||
|
||||
# Need a newer version of gcc than centos has to compile LLVM nowadays
|
||||
COPY build-gcc.sh /tmp/
|
||||
COPY dist-i686-linux/build-gcc.sh /tmp/
|
||||
RUN ./build-gcc.sh
|
||||
|
||||
# CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
|
||||
COPY build-python.sh /tmp/
|
||||
COPY dist-i686-linux/build-python.sh /tmp/
|
||||
RUN ./build-python.sh
|
||||
|
||||
# Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
|
||||
# cloning, so download and build it here.
|
||||
COPY build-git.sh /tmp/
|
||||
COPY dist-i686-linux/build-git.sh /tmp/
|
||||
RUN ./build-git.sh
|
||||
|
||||
# libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
|
||||
# only has 2.6.4, so build our own
|
||||
COPY build-cmake.sh /tmp/
|
||||
COPY dist-i686-linux/build-cmake.sh /tmp/
|
||||
RUN ./build-cmake.sh
|
||||
|
||||
# for sanitizers, we need kernel headers files newer than the ones CentOS ships
|
||||
# with so we install newer ones here
|
||||
COPY build-headers.sh /tmp/
|
||||
COPY dist-i686-linux/build-headers.sh /tmp/
|
||||
RUN ./build-headers.sh
|
||||
|
||||
RUN curl -Lo /rustroot/dumb-init \
|
||||
|
|
@ -75,15 +82,20 @@ RUN curl -Lo /rustroot/dumb-init \
|
|||
ENTRYPOINT ["/rustroot/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV HOSTS=i686-unknown-linux-gnu
|
||||
ENV HOSTS=$HOSTS,x86_64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
||||
--enable-extended \
|
||||
--enable-sanitizers
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
||||
# This is the only builder which will create source tarballs
|
||||
ENV DIST_SRC 1
|
||||
|
||||
# When we build cargo in this container, we don't want it to use the system
|
||||
# libcurl, instead it should compile its own.
|
||||
ENV LIBCURL_NO_PKG_CONFIG 1
|
||||
|
|
@ -13,12 +13,14 @@ set -ex
|
|||
|
||||
source shared.sh
|
||||
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-4.7.4/gcc-4.7.4.tar.bz2 | tar xjf -
|
||||
cd gcc-4.7.4
|
||||
GCC=4.8.5
|
||||
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
|
||||
cd gcc-$GCC
|
||||
./contrib/download_prerequisites
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-4.7.4/configure \
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--prefix=/rustroot \
|
||||
--enable-languages=c,c++
|
||||
hide_output make -j10
|
||||
|
|
@ -27,5 +29,5 @@ ln -nsf gcc /rustroot/bin/cc
|
|||
|
||||
cd ..
|
||||
rm -rf gcc-build
|
||||
rm -rf gcc-4.7.4
|
||||
yum erase -y gcc binutils
|
||||
rm -rf gcc-$GCC
|
||||
yum erase -y gcc gcc-c++ binutils
|
||||
|
|
@ -12,9 +12,10 @@
|
|||
set -ex
|
||||
source shared.sh
|
||||
|
||||
VERSION=1.0.2j
|
||||
VERSION=1.0.2k
|
||||
URL=https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/openssl-$VERSION.tar.gz
|
||||
|
||||
curl https://www.openssl.org/source/openssl-$VERSION.tar.gz | tar xzf -
|
||||
curl $URL | tar xzf -
|
||||
|
||||
cd openssl-$VERSION
|
||||
hide_output ./config --prefix=/rustroot shared -fPIC
|
||||
|
|
@ -13,12 +13,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
gdb \
|
||||
xz-utils \
|
||||
g++-mips-linux-gnu \
|
||||
g++-mipsel-linux-gnu \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
@ -27,7 +26,6 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mips-unknown-linux-gnu
|
||||
ENV HOSTS=$HOSTS,mipsel-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
gdb \
|
||||
xz-utils \
|
||||
g++-mips64-linux-gnuabi64 \
|
||||
g++-mips64el-linux-gnuabi64 \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
|
|
@ -27,7 +26,6 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
|
|||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mips64-unknown-linux-gnuabi64
|
||||
ENV HOSTS=$HOSTS,mips64el-unknown-linux-gnuabi64
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
|
|||
31
src/ci/docker/dist-mips64el-linux/Dockerfile
Normal file
31
src/ci/docker/dist-mips64el-linux/Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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 \
|
||||
gdb \
|
||||
xz-utils \
|
||||
g++-mips64el-linux-gnuabi64 \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mips64el-unknown-linux-gnuabi64
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
31
src/ci/docker/dist-mipsel-linux/Dockerfile
Normal file
31
src/ci/docker/dist-mipsel-linux/Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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 \
|
||||
gdb \
|
||||
xz-utils \
|
||||
g++-mipsel-linux-gnu \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
ENV HOSTS=mipsel-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
@ -27,10 +27,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
|
|
@ -60,12 +56,16 @@ RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
|||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY patches/ /tmp/patches/
|
||||
COPY powerpc-linux-gnu.config build-powerpc-toolchain.sh /tmp/
|
||||
COPY dist-powerpc-linux/patches/ /tmp/patches/
|
||||
COPY dist-powerpc-linux/powerpc-linux-gnu.config dist-powerpc-linux/build-powerpc-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ CT_ARCH_SUPPORTS_WITH_FLOAT=y
|
|||
CT_ARCH_DEFAULT_BE=y
|
||||
CT_ARCH_DEFAULT_32=y
|
||||
CT_ARCH_ABI=""
|
||||
CT_ARCH_CPU="power4"
|
||||
CT_ARCH_TUNE="power6"
|
||||
CT_ARCH_CPU="powerpc"
|
||||
CT_ARCH_TUNE=""
|
||||
CT_ARCH_BE=y
|
||||
# CT_ARCH_LE is not set
|
||||
CT_ARCH_32=y
|
||||
|
|
@ -391,8 +391,8 @@ CT_CC_GCC_HAS_LIBSANITIZER=y
|
|||
CT_CC_GCC_VERSION="4.9.3"
|
||||
# CT_CC_LANG_FORTRAN is not set
|
||||
CT_CC_GCC_ENABLE_CXX_FLAGS=""
|
||||
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--with-cpu-32=power4 --with-cpu=default32"
|
||||
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-cpu-32=power4 --with-cpu=default32"
|
||||
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=""
|
||||
CT_CC_GCC_EXTRA_CONFIG_ARRAY=""
|
||||
CT_CC_GCC_EXTRA_ENV_ARRAY=""
|
||||
CT_CC_GCC_STATIC_LIBSTDCXX=y
|
||||
# CT_CC_GCC_SYSTEM_ZLIB is not set
|
||||
|
|
|
|||
|
|
@ -25,11 +25,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
|
|
@ -60,28 +56,24 @@ RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
|||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY patches/ /tmp/patches/
|
||||
COPY powerpc64-linux-gnu.config build-powerpc64-toolchain.sh /tmp/
|
||||
COPY dist-powerpc64-linux/patches/ /tmp/patches/
|
||||
COPY dist-powerpc64-linux/shared.sh dist-powerpc64-linux/powerpc64-linux-gnu.config dist-powerpc64-linux/build-powerpc64-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc64-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get install -y --no-install-recommends rpm2cpio cpio
|
||||
COPY build-powerpc64le-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc64le-toolchain.sh
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
AR_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-ar \
|
||||
CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc \
|
||||
CXX_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-g++ \
|
||||
AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
|
||||
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
|
||||
CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++
|
||||
CXX_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc64-unknown-linux-gnu
|
||||
ENV HOSTS=$HOSTS,powerpc64le-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
|
|||
|
|
@ -11,22 +11,7 @@
|
|||
|
||||
set -ex
|
||||
|
||||
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
|
||||
rm /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
set -x
|
||||
}
|
||||
source shared.sh
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
|
|
|||
25
src/ci/docker/dist-powerpc64-linux/shared.sh
Normal file
25
src/ci/docker/dist-powerpc64-linux/shared.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
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
|
||||
}
|
||||
77
src/ci/docker/dist-powerpc64le-linux/Dockerfile
Normal file
77
src/ci/docker/dist-powerpc64le-linux/Dockerfile
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
automake \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
flex \
|
||||
g++ \
|
||||
gawk \
|
||||
gdb \
|
||||
git \
|
||||
gperf \
|
||||
help2man \
|
||||
libncurses-dev \
|
||||
libtool-bin \
|
||||
make \
|
||||
patch \
|
||||
python2.7 \
|
||||
sudo \
|
||||
texinfo \
|
||||
wget \
|
||||
xz-utils \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
|
||||
# toolchains we build below chokes on that, so go back to make 3
|
||||
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
|
||||
cd make-3.81 && \
|
||||
./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf make-3.81
|
||||
|
||||
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
|
||||
tar xjf - && \
|
||||
cd crosstool-ng && \
|
||||
./configure --prefix=/usr/local && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf crosstool-ng
|
||||
|
||||
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
|
||||
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
||||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get install -y --no-install-recommends rpm2cpio cpio
|
||||
COPY dist-powerpc64le-linux/shared.sh dist-powerpc64le-linux/build-powerpc64le-toolchain.sh /tmp/
|
||||
RUN ./build-powerpc64le-toolchain.sh
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
|
||||
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
|
||||
CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=powerpc64le-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
set -ex
|
||||
|
||||
source shared.sh
|
||||
|
||||
BINUTILS=2.25.1
|
||||
GCC=5.3.0
|
||||
TARGET=powerpc64le-linux-gnu
|
||||
|
|
@ -40,9 +42,9 @@ pushd binutils-$TARGET
|
|||
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
|
||||
make -j10
|
||||
make install
|
||||
hide_output ../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
popd
|
||||
rm -rf binutils-$TARGET
|
||||
|
||||
|
|
@ -51,11 +53,11 @@ mkdir gcc-$TARGET
|
|||
pushd gcc-$TARGET
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
|
||||
cd gcc-$GCC
|
||||
./contrib/download_prerequisites
|
||||
hide_output ./contrib/download_prerequisites
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
../gcc-$GCC/configure \
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=$TARGET \
|
||||
--with-cpu=power8 \
|
||||
|
|
@ -72,8 +74,8 @@ cd ../gcc-build
|
|||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-lto
|
||||
make -j10
|
||||
make install
|
||||
hide_output hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
popd
|
||||
rm -rf gcc-$TARGET
|
||||
25
src/ci/docker/dist-powerpc64le-linux/shared.sh
Normal file
25
src/ci/docker/dist-powerpc64le-linux/shared.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
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
|
||||
}
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
#!/bin/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.
|
||||
|
||||
# ignore-tidy-linelength
|
||||
|
||||
set -ex
|
||||
|
||||
BINUTILS=2.25.1
|
||||
GCC=5.3.0
|
||||
|
||||
# First up, build binutils
|
||||
mkdir binutils
|
||||
cd binutils
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
../binutils-$BINUTILS/configure \
|
||||
--target=x86_64-unknown-netbsd
|
||||
make -j10
|
||||
make install
|
||||
cd ../..
|
||||
rm -rf binutils
|
||||
|
||||
# Next, download the NetBSD libc and relevant header files
|
||||
mkdir netbsd
|
||||
# originally from:
|
||||
# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/base.tgz
|
||||
curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-base.tgz | \
|
||||
tar xzf - -C netbsd ./usr/include ./usr/lib ./lib
|
||||
# originally from:
|
||||
# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/comp.tgz
|
||||
curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-comp.tgz | \
|
||||
tar xzf - -C netbsd ./usr/include ./usr/lib
|
||||
|
||||
dst=/usr/local/x86_64-unknown-netbsd
|
||||
cp -r netbsd/usr/include $dst
|
||||
cp netbsd/usr/lib/crt0.o $dst/lib
|
||||
cp netbsd/usr/lib/crti.o $dst/lib
|
||||
cp netbsd/usr/lib/crtn.o $dst/lib
|
||||
cp netbsd/usr/lib/crtbeginS.o $dst/lib
|
||||
cp netbsd/usr/lib/crtendS.o $dst/lib
|
||||
cp netbsd/usr/lib/crtbegin.o $dst/lib
|
||||
cp netbsd/usr/lib/crtend.o $dst/lib
|
||||
cp netbsd/usr/lib/gcrt0.o $dst/lib
|
||||
cp netbsd/usr/lib/libc.a $dst/lib
|
||||
cp netbsd/usr/lib/libc_p.a $dst/lib
|
||||
cp netbsd/usr/lib/libc_pic.a $dst/lib
|
||||
cp netbsd/lib/libc.so.12.193.1 $dst/lib
|
||||
cp netbsd/lib/libutil.so.7.21 $dst/lib
|
||||
cp netbsd/usr/lib/libm.a $dst/lib
|
||||
cp netbsd/usr/lib/libm_p.a $dst/lib
|
||||
cp netbsd/usr/lib/libm_pic.a $dst/lib
|
||||
cp netbsd/lib/libm.so.0.11 $dst/lib
|
||||
cp netbsd/usr/lib/librt.so.1.1 $dst/lib
|
||||
cp netbsd/usr/lib/libpthread.a $dst/lib
|
||||
cp netbsd/usr/lib/libpthread_p.a $dst/lib
|
||||
cp netbsd/usr/lib/libpthread_pic.a $dst/lib
|
||||
cp netbsd/usr/lib/libpthread.so.1.2 $dst/lib
|
||||
|
||||
ln -s libc.so.12.193.1 $dst/lib/libc.so
|
||||
ln -s libc.so.12.193.1 $dst/lib/libc.so.12
|
||||
ln -s libm.so.0.11 $dst/lib/libm.so
|
||||
ln -s libm.so.0.11 $dst/lib/libm.so.0
|
||||
ln -s libutil.so.7.21 $dst/lib/libutil.so
|
||||
ln -s libutil.so.7.21 $dst/lib/libutil.so.7
|
||||
ln -s libpthread.so.1.2 $dst/lib/libpthread.so
|
||||
ln -s libpthread.so.1.2 $dst/lib/libpthread.so.1
|
||||
ln -s librt.so.1.1 $dst/lib/librt.so
|
||||
|
||||
rm -rf netbsd
|
||||
|
||||
# Finally, download and build gcc to target NetBSD
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
|
||||
cd gcc-$GCC
|
||||
./contrib/download_prerequisites
|
||||
|
||||
# Originally from
|
||||
# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__base.h
|
||||
PATCHES="https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch1.patch"
|
||||
|
||||
# Originally from
|
||||
# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__configure__char.cc
|
||||
PATCHES="$PATCHES https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch2.patch"
|
||||
|
||||
for patch in $PATCHES; do
|
||||
curl $patch | patch -Np0
|
||||
done
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=x86_64-unknown-netbsd \
|
||||
--disable-libcilkrts \
|
||||
--disable-multilib \
|
||||
--disable-nls \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libcilkrt \
|
||||
--disable-libada \
|
||||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-lto
|
||||
make -j10
|
||||
make install
|
||||
|
||||
cd ../..
|
||||
rm -rf gcc
|
||||
|
|
@ -27,10 +27,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
|
|
@ -60,27 +56,24 @@ RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
|
|||
USER rustbuild
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY patches/ /tmp/patches/
|
||||
COPY s390x-linux-gnu.config build-s390x-toolchain.sh /tmp/
|
||||
COPY dist-s390x-linux/patches/ /tmp/patches/
|
||||
COPY dist-s390x-linux/s390x-linux-gnu.config dist-s390x-linux/build-s390x-toolchain.sh /tmp/
|
||||
RUN ./build-s390x-toolchain.sh
|
||||
|
||||
USER root
|
||||
|
||||
COPY build-netbsd-toolchain.sh /tmp/
|
||||
RUN ./build-netbsd-toolchain.sh
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_netbsd=x86_64-unknown-netbsd-ar \
|
||||
CC_x86_64_unknown_netbsd=x86_64-unknown-netbsd-gcc \
|
||||
CXX_x86_64_unknown_netbsd=x86_64-unknown-netbsd-g++ \
|
||||
CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc \
|
||||
AR_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-ar \
|
||||
CXX_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-netbsd
|
||||
ENV HOSTS=$HOSTS,s390x-unknown-linux-gnu
|
||||
ENV HOSTS=s390x-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
39
src/ci/docker/dist-x86_64-freebsd/Dockerfile
Normal file
39
src/ci/docker/dist-x86_64-freebsd/Dockerfile
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
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 \
|
||||
pkg-config
|
||||
|
||||
COPY dist-x86_64-freebsd/build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh x86_64
|
||||
|
||||
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
|
||||
dpkg -i dumb-init_*.deb && \
|
||||
rm dumb-init_*.deb
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-ar \
|
||||
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-gcc \
|
||||
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-g++
|
||||
|
||||
ENV HOSTS=x86_64-unknown-freebsd
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
112
src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh
Executable file
112
src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
#!/bin/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=$1
|
||||
BINUTILS=2.25.1
|
||||
GCC=5.3.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-freebsd10
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
cd ../..
|
||||
rm -rf binutils
|
||||
|
||||
# Next, download the FreeBSD libc and relevant header files
|
||||
|
||||
mkdir freebsd
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.2-RELEASE/base.txz
|
||||
;;
|
||||
i686)
|
||||
URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/10.2-RELEASE/base.txz
|
||||
;;
|
||||
esac
|
||||
curl $URL | tar xJf - -C freebsd ./usr/include ./usr/lib ./lib
|
||||
|
||||
dst=/usr/local/$ARCH-unknown-freebsd10
|
||||
|
||||
cp -r freebsd/usr/include $dst/
|
||||
cp freebsd/usr/lib/crt1.o $dst/lib
|
||||
cp freebsd/usr/lib/Scrt1.o $dst/lib
|
||||
cp freebsd/usr/lib/crti.o $dst/lib
|
||||
cp freebsd/usr/lib/crtn.o $dst/lib
|
||||
cp freebsd/usr/lib/libc.a $dst/lib
|
||||
cp freebsd/usr/lib/libutil.a $dst/lib
|
||||
cp freebsd/usr/lib/libutil_p.a $dst/lib
|
||||
cp freebsd/usr/lib/libm.a $dst/lib
|
||||
cp freebsd/usr/lib/librt.so.1 $dst/lib
|
||||
cp freebsd/usr/lib/libexecinfo.so.1 $dst/lib
|
||||
cp freebsd/lib/libc.so.7 $dst/lib
|
||||
cp freebsd/lib/libm.so.5 $dst/lib
|
||||
cp freebsd/lib/libutil.so.9 $dst/lib
|
||||
cp freebsd/lib/libthr.so.3 $dst/lib/libpthread.so
|
||||
|
||||
ln -s libc.so.7 $dst/lib/libc.so
|
||||
ln -s libm.so.5 $dst/lib/libm.so
|
||||
ln -s librt.so.1 $dst/lib/librt.so
|
||||
ln -s libutil.so.9 $dst/lib/libutil.so
|
||||
ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so
|
||||
rm -rf freebsd
|
||||
|
||||
# Finally, download and build gcc to target FreeBSD
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
|
||||
cd gcc-$GCC
|
||||
./contrib/download_prerequisites
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=$ARCH-unknown-freebsd10 \
|
||||
--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
|
||||
101
src/ci/docker/dist-x86_64-linux/Dockerfile
Normal file
101
src/ci/docker/dist-x86_64-linux/Dockerfile
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
FROM centos:5
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
|
||||
# to http://vault.centos.org/
|
||||
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
|
||||
RUN sed -i 's|#\(baseurl.*\)mirror.centos.org/centos/$releasever|\1vault.centos.org/5.11|' /etc/yum.repos.d/*.repo
|
||||
|
||||
RUN yum upgrade -y && yum install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
glibc-devel \
|
||||
perl \
|
||||
zlib-devel \
|
||||
file \
|
||||
xz \
|
||||
which \
|
||||
pkgconfig \
|
||||
wget \
|
||||
autoconf \
|
||||
gettext
|
||||
|
||||
ENV PATH=/rustroot/bin:$PATH
|
||||
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
|
||||
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
|
||||
WORKDIR /tmp
|
||||
COPY dist-x86_64-linux/shared.sh dist-x86_64-linux/build-binutils.sh /tmp/
|
||||
|
||||
# We need a build of openssl which supports SNI to download artifacts from
|
||||
# static.rust-lang.org. This'll be used to link into libcurl below (and used
|
||||
# later as well), so build a copy of OpenSSL with dynamic libraries into our
|
||||
# generic root.
|
||||
COPY dist-x86_64-linux/build-openssl.sh /tmp/
|
||||
RUN ./build-openssl.sh
|
||||
|
||||
# The `curl` binary on CentOS doesn't support SNI which is needed for fetching
|
||||
# some https urls we have, so install a new version of libcurl + curl which is
|
||||
# using the openssl we just built previously.
|
||||
#
|
||||
# Note that we also disable a bunch of optional features of curl that we don't
|
||||
# really need.
|
||||
COPY dist-x86_64-linux/build-curl.sh /tmp/
|
||||
RUN ./build-curl.sh
|
||||
|
||||
# binutils < 2.22 has a bug where the 32-bit executables it generates
|
||||
# immediately segfault in Rust, so we need to install our own binutils.
|
||||
#
|
||||
# See https://github.com/rust-lang/rust/issues/20440 for more info
|
||||
RUN ./build-binutils.sh
|
||||
|
||||
# Need a newer version of gcc than centos has to compile LLVM nowadays
|
||||
COPY dist-x86_64-linux/build-gcc.sh /tmp/
|
||||
RUN ./build-gcc.sh
|
||||
|
||||
# CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
|
||||
COPY dist-x86_64-linux/build-python.sh /tmp/
|
||||
RUN ./build-python.sh
|
||||
|
||||
# Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
|
||||
# cloning, so download and build it here.
|
||||
COPY dist-x86_64-linux/build-git.sh /tmp/
|
||||
RUN ./build-git.sh
|
||||
|
||||
# libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
|
||||
# only has 2.6.4, so build our own
|
||||
COPY dist-x86_64-linux/build-cmake.sh /tmp/
|
||||
RUN ./build-cmake.sh
|
||||
|
||||
# for sanitizers, we need kernel headers files newer than the ones CentOS ships
|
||||
# with so we install newer ones here
|
||||
COPY dist-x86_64-linux/build-headers.sh /tmp/
|
||||
RUN ./build-headers.sh
|
||||
|
||||
RUN curl -Lo /rustroot/dumb-init \
|
||||
https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \
|
||||
chmod +x /rustroot/dumb-init
|
||||
ENTRYPOINT ["/rustroot/dumb-init", "--"]
|
||||
|
||||
RUN curl -o /usr/local/bin/sccache \
|
||||
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
|
||||
chmod +x /usr/local/bin/sccache
|
||||
|
||||
ENV HOSTS=x86_64-unknown-linux-gnu
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--host=$HOSTS \
|
||||
--enable-extended \
|
||||
--enable-sanitizers
|
||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
||||
# This is the only builder which will create source tarballs
|
||||
ENV DIST_SRC 1
|
||||
|
||||
# When we build cargo in this container, we don't want it to use the system
|
||||
# libcurl, instead it should compile its own.
|
||||
ENV LIBCURL_NO_PKG_CONFIG 1
|
||||
26
src/ci/docker/dist-x86_64-linux/build-binutils.sh
Executable file
26
src/ci/docker/dist-x86_64-linux/build-binutils.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/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.
|
||||
#
|
||||
# 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
|
||||
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.bz2 | tar xfj -
|
||||
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-2.25.1/configure --prefix=/rustroot
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ..
|
||||
rm -rf binutils-build
|
||||
rm -rf binutils-2.25.1
|
||||
25
src/ci/docker/dist-x86_64-linux/build-cmake.sh
Executable file
25
src/ci/docker/dist-x86_64-linux/build-cmake.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/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.
|
||||
#
|
||||
# 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
|
||||
|
||||
curl https://cmake.org/files/v3.6/cmake-3.6.3.tar.gz | tar xzf -
|
||||
|
||||
mkdir cmake-build
|
||||
cd cmake-build
|
||||
hide_output ../cmake-3.6.3/configure --prefix=/rustroot
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ..
|
||||
rm -rf cmake-build
|
||||
rm -rf cmake-3.6.3
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue