From a6d88b023a941511ac824a8eee44540e8db04ac1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 13 Jan 2017 09:18:09 -0800 Subject: [PATCH] travis: Expand dist builder coverage This commit adds six new travis matrix entires for doing cross-compiled distribution builds of the compiler. The support added in #38731 allows us to quickly compile a complete suite of distribution artifacts for cross-compiled platforms, and currently each matrix entry (when fully cached) clocks in around an hour to finish. Note that a full test run typically takes about two hours right now. With further optimizations coming down the pike in #39026 this commit also starts doubling up cross-compiled distribution builders on each matrix entry. We initially planned to do one build per entry, but it's looking like we may be able to get by with more than one in each entry. Depending on how long these builds take we may even be able to up it to three, but we'll start with two first. This commit then completes the suite of cross-compiled compilers that we're going to compile, adding it for a whole litany of platforms detailed in the changes to the docker files here. The existing `cross` image is also trimmed down quite a bit to avoid duplicate work, and we'll eventually provision it for far more cross compilation as well. Note that the gcc toolchains installed to compile most of these compilers are inappropriate for actualy distribution. The glibc they pull in is much newer than we'd like, so before we turn nightlies off we'll need to tweak these docker files to custom build toolchains like the current `linux-cross` docker image does. --- .travis.yml | 10 +- src/ci/docker/arm-android/Dockerfile | 6 +- src/ci/docker/cross/Dockerfile | 37 +----- .../Dockerfile | 10 +- .../dist-armv7-aarch64-linux/Dockerfile | 34 +++++ .../Dockerfile | 15 ++- .../build-toolchain.sh | 30 +++-- src/ci/docker/dist-mips-linux/Dockerfile | 34 +++++ src/ci/docker/dist-mips64-linux/Dockerfile | 34 +++++ src/ci/docker/dist-powerpc-linux/Dockerfile | 35 ++++++ src/ci/docker/dist-powerpc64-linux/Dockerfile | 39 ++++++ .../docker/dist-s390x-linux-netbsd/Dockerfile | 43 +++++++ .../build-toolchain.sh | 116 ++++++++++++++++++ src/ci/docker/run.sh | 6 +- 14 files changed, 394 insertions(+), 55 deletions(-) rename src/ci/docker/{dist-arm-unknown-linux-gnueabi => dist-arm-linux}/Dockerfile (73%) create mode 100644 src/ci/docker/dist-armv7-aarch64-linux/Dockerfile rename src/ci/docker/{dist-x86_64-unknown-freebsd => dist-freebsd}/Dockerfile (65%) rename src/ci/docker/{dist-x86_64-unknown-freebsd => dist-freebsd}/build-toolchain.sh (84%) mode change 100644 => 100755 create mode 100644 src/ci/docker/dist-mips-linux/Dockerfile create mode 100644 src/ci/docker/dist-mips64-linux/Dockerfile create mode 100644 src/ci/docker/dist-powerpc-linux/Dockerfile create mode 100644 src/ci/docker/dist-powerpc64-linux/Dockerfile create mode 100644 src/ci/docker/dist-s390x-linux-netbsd/Dockerfile create mode 100644 src/ci/docker/dist-s390x-linux-netbsd/build-toolchain.sh diff --git a/.travis.yml b/.travis.yml index 505795d33e5ff..960e21ab4a053 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,14 @@ matrix: # Linux builders, all docker images - env: IMAGE=arm-android DEPLOY=1 - env: IMAGE=cross DEPLOY=1 - - env: IMAGE=dist-arm-unknown-linux-gnueabi DEPLOY=1 - - env: IMAGE=dist-x86_64-unknown-freebsd 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-mips-linux DEPLOY=1 + - env: IMAGE=dist-mips64-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=i686-gnu DEPLOY=1 - env: IMAGE=i686-gnu-nopt - env: IMAGE=x86_64-gnu DEPLOY=1 diff --git a/src/ci/docker/arm-android/Dockerfile b/src/ci/docker/arm-android/Dockerfile index e2ef8070b51af..d81666e84262f 100644 --- a/src/ci/docker/arm-android/Dockerfile +++ b/src/ci/docker/arm-android/Dockerfile @@ -53,4 +53,8 @@ ENV RUST_CONFIGURE_ARGS \ # to all the targets above eventually. ENV SCRIPT \ python2.7 ../x.py test --target arm-linux-androideabi && \ - python2.7 ../x.py dist --target arm-linux-androideabi + python2.7 ../x.py dist \ + --target arm-linux-androideabi \ + --target armv7-linux-androideabi \ + --target i686-linux-android \ + --target aarch64-linux-android diff --git a/src/ci/docker/cross/Dockerfile b/src/ci/docker/cross/Dockerfile index 6a6cc23698be2..7872397645136 100644 --- a/src/ci/docker/cross/Dockerfile +++ b/src/ci/docker/cross/Dockerfile @@ -10,17 +10,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ git \ cmake \ sudo \ - gcc-aarch64-linux-gnu libc6-dev-arm64-cross \ - gcc-arm-linux-gnueabi libc6-dev-armel-cross \ - gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \ - gcc-mips-linux-gnu libc6-dev-mips-cross \ - gcc-mipsel-linux-gnu libc6-dev-mipsel-cross \ - gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \ - gcc-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \ - gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \ - gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \ - gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \ - gcc-s390x-linux-gnu libc6-dev-s390x-cross \ xz-utils ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 @@ -32,19 +21,7 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini rm dumb-init_*.deb ENTRYPOINT ["/usr/bin/dumb-init", "--"] -ENV TARGETS=aarch64-unknown-linux-gnu -ENV TARGETS=$TARGETS,arm-unknown-linux-gnueabi -ENV TARGETS=$TARGETS,arm-unknown-linux-gnueabihf -ENV TARGETS=$TARGETS,armv7-unknown-linux-gnueabihf -ENV TARGETS=$TARGETS,asmjs-unknown-emscripten -ENV TARGETS=$TARGETS,mips-unknown-linux-gnu -ENV TARGETS=$TARGETS,mips64-unknown-linux-gnuabi64 -ENV TARGETS=$TARGETS,mips64el-unknown-linux-gnuabi64 -ENV TARGETS=$TARGETS,mipsel-unknown-linux-gnu -ENV TARGETS=$TARGETS,powerpc-unknown-linux-gnu -ENV TARGETS=$TARGETS,powerpc64-unknown-linux-gnu -ENV TARGETS=$TARGETS,powerpc64le-unknown-linux-gnu -ENV TARGETS=$TARGETS,s390x-unknown-linux-gnu +ENV TARGETS=asmjs-unknown-emscripten ENV TARGETS=$TARGETS,wasm32-unknown-emscripten #ENV TARGETS=$TARGETS,mips-unknown-linux-musl @@ -62,15 +39,3 @@ ENV RUST_CONFIGURE_ARGS \ ENV SCRIPT \ python2.7 ../x.py build && \ python2.7 ../x.py dist --target wasm32-unknown-emscripten - -ENV AR_s390x_unknown_linux_gnu=s390x-linux-gnu-ar \ - CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \ - AR_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-ar \ - CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \ - AR_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnuabi64-ar \ - CC_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnuabi64-gcc \ - AR_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-ar \ - CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc - -# FIXME(rust-lang/rust#36150): powerpc unfortunately aborts right now -ENV NO_LLVM_ASSERTIONS=1 diff --git a/src/ci/docker/dist-arm-unknown-linux-gnueabi/Dockerfile b/src/ci/docker/dist-arm-linux/Dockerfile similarity index 73% rename from src/ci/docker/dist-arm-unknown-linux-gnueabi/Dockerfile rename to src/ci/docker/dist-arm-linux/Dockerfile index 841464a42700d..1aafc669d1023 100644 --- a/src/ci/docker/dist-arm-unknown-linux-gnueabi/Dockerfile +++ b/src/ci/docker/dist-arm-linux/Dockerfile @@ -12,7 +12,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ sudo \ gdb \ xz-utils \ - g++-arm-linux-gnueabi + g++-arm-linux-gnueabi \ + g++-arm-linux-gnueabihf ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ @@ -23,8 +24,11 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini rm dumb-init_*.deb ENTRYPOINT ["/usr/bin/dumb-init", "--"] -ENV RUST_CONFIGURE_ARGS --host=arm-unknown-linux-gnueabi +ENV RUST_CONFIGURE_ARGS \ + --host=arm-unknown-linux-gnueabi,arm-unknown-linux-gnueabihf ENV SCRIPT \ python2.7 ../x.py dist \ --host arm-unknown-linux-gnueabi \ - --target arm-unknown-linux-gnueabi + --target arm-unknown-linux-gnueabi \ + --host arm-unknown-linux-gnueabihf \ + --target arm-unknown-linux-gnueabihf diff --git a/src/ci/docker/dist-armv7-aarch64-linux/Dockerfile b/src/ci/docker/dist-armv7-aarch64-linux/Dockerfile new file mode 100644 index 0000000000000..134e2b062ef0b --- /dev/null +++ b/src/ci/docker/dist-armv7-aarch64-linux/Dockerfile @@ -0,0 +1,34 @@ +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++-arm-linux-gnueabihf \ + g++-aarch64-linux-gnu + +ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 +RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ + tar xJf - -C /usr/local/bin --strip-components=1 + +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 RUST_CONFIGURE_ARGS \ + --host=armv7-unknown-linux-gnueabihf,aarch64-unknown-linux-gnu +ENV SCRIPT \ + python2.7 ../x.py dist \ + --host armv7-unknown-linux-gnueabihf \ + --target armv7-unknown-linux-gnueabihf \ + --host aarch64-unknown-linux-gnu \ + --target aarch64-unknown-linux-gnu diff --git a/src/ci/docker/dist-x86_64-unknown-freebsd/Dockerfile b/src/ci/docker/dist-freebsd/Dockerfile similarity index 65% rename from src/ci/docker/dist-x86_64-unknown-freebsd/Dockerfile rename to src/ci/docker/dist-freebsd/Dockerfile index 44cc57c2662d6..b49396c935c00 100644 --- a/src/ci/docker/dist-x86_64-unknown-freebsd/Dockerfile +++ b/src/ci/docker/dist-freebsd/Dockerfile @@ -15,7 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ wget COPY build-toolchain.sh /tmp/ -RUN sh /tmp/build-toolchain.sh +RUN /tmp/build-toolchain.sh x86_64 +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 && \ dpkg -i dumb-init_*.deb && \ @@ -29,10 +30,16 @@ RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | 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++ + 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 RUST_CONFIGURE_ARGS --host=x86_64-unknown-freebsd +ENV RUST_CONFIGURE_ARGS \ + --host=x86_64-unknown-freebsd,i686-unknown-freebsd ENV SCRIPT \ python2.7 ../x.py dist \ --host x86_64-unknown-freebsd \ - --target x86_64-unknown-freebsd + --target x86_64-unknown-freebsd \ + --host i686-unknown-freebsd \ + --target i686-unknown-freebsd diff --git a/src/ci/docker/dist-x86_64-unknown-freebsd/build-toolchain.sh b/src/ci/docker/dist-freebsd/build-toolchain.sh old mode 100644 new mode 100755 similarity index 84% rename from src/ci/docker/dist-x86_64-unknown-freebsd/build-toolchain.sh rename to src/ci/docker/dist-freebsd/build-toolchain.sh index 0fd6beaf4c1c0..5642e6fc937f9 --- a/src/ci/docker/dist-x86_64-unknown-freebsd/build-toolchain.sh +++ b/src/ci/docker/dist-freebsd/build-toolchain.sh @@ -11,10 +11,26 @@ set -ex -ARCH=x86_64 +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 @@ -22,10 +38,10 @@ cd binutils curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf - mkdir binutils-build cd binutils-build -../binutils-$BINUTILS/configure \ +hide_output ../binutils-$BINUTILS/configure \ --target=$ARCH-unknown-freebsd10 -make -j10 -make install +hide_output make -j10 +hide_output make install cd ../.. rm -rf binutils @@ -76,7 +92,7 @@ cd gcc-$GCC mkdir ../gcc-build cd ../gcc-build -../gcc-$GCC/configure \ +hide_output ../gcc-$GCC/configure \ --enable-languages=c,c++ \ --target=$ARCH-unknown-freebsd10 \ --disable-multilib \ @@ -90,7 +106,7 @@ cd ../gcc-build --disable-libsanitizer \ --disable-libquadmath-support \ --disable-lto -make -j10 -make install +hide_output make -j10 +hide_output make install cd ../.. rm -rf gcc diff --git a/src/ci/docker/dist-mips-linux/Dockerfile b/src/ci/docker/dist-mips-linux/Dockerfile new file mode 100644 index 0000000000000..a495cf57dc51c --- /dev/null +++ b/src/ci/docker/dist-mips-linux/Dockerfile @@ -0,0 +1,34 @@ +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++-mips-linux-gnu \ + g++-mipsel-linux-gnu + +ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 +RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ + tar xJf - -C /usr/local/bin --strip-components=1 + +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 RUST_CONFIGURE_ARGS \ + --host=mips-unknown-linux-gnu,mipsel-unknown-linux-gnu +ENV SCRIPT \ + python2.7 ../x.py dist \ + --host mips-unknown-linux-gnu \ + --target mips-unknown-linux-gnu \ + --host mipsel-unknown-linux-gnu \ + --target mipsel-unknown-linux-gnu diff --git a/src/ci/docker/dist-mips64-linux/Dockerfile b/src/ci/docker/dist-mips64-linux/Dockerfile new file mode 100644 index 0000000000000..bdb634f530392 --- /dev/null +++ b/src/ci/docker/dist-mips64-linux/Dockerfile @@ -0,0 +1,34 @@ +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++-mips64-linux-gnuabi64 \ + g++-mips64el-linux-gnuabi64 + +ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 +RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ + tar xJf - -C /usr/local/bin --strip-components=1 + +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 RUST_CONFIGURE_ARGS \ + --host=mips64-unknown-linux-gnuabi64,mips64el-unknown-linux-gnuabi64 +ENV SCRIPT \ + python2.7 ../x.py dist \ + --host mips64-unknown-linux-gnuabi64 \ + --target mips64-unknown-linux-gnuabi64 \ + --host mips64el-unknown-linux-gnuabi64 \ + --target mips64el-unknown-linux-gnuabi64 diff --git a/src/ci/docker/dist-powerpc-linux/Dockerfile b/src/ci/docker/dist-powerpc-linux/Dockerfile new file mode 100644 index 0000000000000..579824dfdb41a --- /dev/null +++ b/src/ci/docker/dist-powerpc-linux/Dockerfile @@ -0,0 +1,35 @@ +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++-powerpc-linux-gnu + +ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 +RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ + tar xJf - -C /usr/local/bin --strip-components=1 + +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 RUST_CONFIGURE_ARGS \ + --host=powerpc-unknown-linux-gnu +ENV SCRIPT \ + python2.7 ../x.py dist \ + --host powerpc-unknown-linux-gnu \ + --target powerpc-unknown-linux-gnu + +# FIXME(#36150) this will fail the bootstrap. Probably means something bad is +# happening! +ENV NO_LLVM_ASSERTIONS 1 diff --git a/src/ci/docker/dist-powerpc64-linux/Dockerfile b/src/ci/docker/dist-powerpc64-linux/Dockerfile new file mode 100644 index 0000000000000..33877d4b3e9f1 --- /dev/null +++ b/src/ci/docker/dist-powerpc64-linux/Dockerfile @@ -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 \ + gdb \ + xz-utils \ + g++-powerpc64-linux-gnu \ + g++-powerpc64le-linux-gnu + +ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 +RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ + tar xJf - -C /usr/local/bin --strip-components=1 + +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 \ + AR_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-ar \ + CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \ + CXX_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-g++ + +ENV RUST_CONFIGURE_ARGS \ + --host=powerpc64-unknown-linux-gnu,powerpc64le-unknown-linux-gnu +ENV SCRIPT \ + python2.7 ../x.py dist \ + --host powerpc64-unknown-linux-gnu \ + --target powerpc64-unknown-linux-gnu \ + --host powerpc64le-unknown-linux-gnu \ + --target powerpc64le-unknown-linux-gnu diff --git a/src/ci/docker/dist-s390x-linux-netbsd/Dockerfile b/src/ci/docker/dist-s390x-linux-netbsd/Dockerfile new file mode 100644 index 0000000000000..a59bc7012cacd --- /dev/null +++ b/src/ci/docker/dist-s390x-linux-netbsd/Dockerfile @@ -0,0 +1,43 @@ +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 \ + patch \ + g++-s390x-linux-gnu + +COPY build-toolchain.sh /tmp/ +RUN sh /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 && \ + dpkg -i dumb-init_*.deb && \ + rm dumb-init_*.deb +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + +ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 +RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ + tar xJf - -C /usr/local/bin --strip-components=1 + +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++ + +ENV RUST_CONFIGURE_ARGS \ + --host=x86_64-unknown-netbsd,s390x-unknown-linux-gnu +ENV SCRIPT \ + python2.7 ../x.py dist \ + --host x86_64-unknown-netbsd \ + --target x86_64-unknown-netbsd \ + --host s390x-unknown-linux-gnu \ + --target s390x-unknown-linux-gnu diff --git a/src/ci/docker/dist-s390x-linux-netbsd/build-toolchain.sh b/src/ci/docker/dist-s390x-linux-netbsd/build-toolchain.sh new file mode 100644 index 0000000000000..6b76636ee48c1 --- /dev/null +++ b/src/ci/docker/dist-s390x-linux-netbsd/build-toolchain.sh @@ -0,0 +1,116 @@ +#!/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 or the MIT license +# , 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 +curl https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/base.tgz | \ + tar xzf - -C netbsd ./usr/include ./usr/lib ./lib +curl https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/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 diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 8c2c8d2a9db5a..92cc30cd7df1d 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -25,8 +25,10 @@ docker \ -t rust-ci \ "`dirname "$script"`/$image" +objdir=$root_dir/obj + mkdir -p $HOME/.cargo -mkdir -p $root_dir/obj +mkdir -p $objdir args= if [ "$SCCACHE_BUCKET" != "" ]; then @@ -41,7 +43,7 @@ fi exec docker \ run \ --volume "$root_dir:/checkout:ro" \ - --volume "$root_dir/obj:/checkout/obj" \ + --volume "$objdir:/checkout/obj" \ --workdir /checkout/obj \ --env SRC=/checkout \ $args \