Skip to content

Commit 9f6b677

Browse files
author
Jorge Aparicio
committed
ci: test cross compiling core for the thumb targets
this commit adds a new path, src/libcore, to bootstrap that (cross) compiles only the core crate for the target, and a thumb image that will test cross compiling core for the 4 existing thumb targets. closes rust-lang#38828
1 parent 1a9b382 commit 9f6b677

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ matrix:
3939
- env: IMAGE=emscripten
4040
- env: IMAGE=i686-gnu
4141
- env: IMAGE=i686-gnu-nopt
42+
- env: IMAGE=thumb
4243
- env: IMAGE=x86_64-gnu
4344
- env: IMAGE=x86_64-gnu-full-bootstrap
4445
- env: IMAGE=x86_64-gnu-aux

src/bootstrap/compile.rs

+12
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ use channel::GitInfo;
2929
use util::{exe, libdir, is_dylib, copy};
3030
use {Build, Compiler, Mode};
3131

32+
pub fn core(build: &Build, target: &str, compiler: &Compiler) {
33+
println!("Building stage{} core artifacts ({} -> {})", compiler.stage,
34+
compiler.host, target);
35+
36+
let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build");
37+
38+
cargo.arg("--manifest-path")
39+
.arg(build.src.join("src/libcore/Cargo.toml"));
40+
41+
build.run(&mut cargo);
42+
}
43+
3244
/// Build the standard library.
3345
///
3446
/// This will build the standard library for a particular stage of the build

src/bootstrap/sanity.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ pub fn check(build: &mut Build) {
123123
// On emscripten we don't actually need the C compiler to just
124124
// build the target artifacts, only for testing. For the sake
125125
// of easier bot configuration, just skip detection.
126-
if target.contains("emscripten") {
126+
// Likewise with the thumbv*m-none-eabi* targets
127+
if target.contains("emscripten") || target.starts_with("thumbv") {
127128
continue;
128129
}
129130

src/bootstrap/step.rs

+6
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
264264
.dep(|s| s.name("libtest-link"));
265265

266266
for (krate, path, _default) in krates("std") {
267+
if krate.name == "core" {
268+
rules.build("build-crate-core", "src/libcore")
269+
.dep(move |s| s.name("rustc").host(&build.config.build).target(s.host))
270+
.run(move |s| compile::core(build, s.target, &s.compiler()));
271+
continue;
272+
}
267273
rules.build(&krate.build_step, path)
268274
.dep(|s| s.name("startup-objects"))
269275
.dep(move |s| s.name("rustc").host(&build.config.build).target(s.host))

src/ci/docker/thumb/Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python2.7 \
10+
git \
11+
cmake \
12+
sudo \
13+
gdb \
14+
xz-utils
15+
16+
RUN curl -o /usr/local/bin/sccache \
17+
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \
18+
chmod +x /usr/local/bin/sccache
19+
20+
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
21+
dpkg -i dumb-init_*.deb && \
22+
rm dumb-init_*.deb
23+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
24+
25+
ENV TARGETS=thumbv6m-none-eabi
26+
ENV TARGETS=$TARGETS,thumbv7m-none-eabi
27+
ENV TARGETS=$TARGETS,thumbv7em-none-eabi
28+
ENV TARGETS=$TARGETS,thumbv7em-none-eabihf
29+
30+
ENV RUST_CONFIGURE_ARGS \
31+
--target=$TARGETS
32+
ENV SCRIPT python2.7 ../x.py build --target $TARGETS src/libcore

0 commit comments

Comments
 (0)