]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/cross/Dockerfile
use shared scripts for init and sccache in cross image
[rust.git] / src / ci / docker / cross / Dockerfile
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   xz-utils \
14   zlib1g-dev \
15   g++-arm-linux-gnueabi \
16   g++-arm-linux-gnueabihf \
17   gcc-sparc64-linux-gnu \
18   libc6-dev-sparc64-cross \
19   bzip2 \
20   patch \
21   libssl-dev \
22   pkg-config
23
24 # dumb-init
25 COPY scripts/dumb-init.sh /scripts/
26 RUN sh /scripts/dumb-init.sh
27
28 WORKDIR /tmp
29
30 COPY cross/build-rumprun.sh /tmp/
31 RUN ./build-rumprun.sh
32
33 COPY cross/build-arm-musl.sh /tmp/
34 RUN ./build-arm-musl.sh
35
36 # originally from
37 # https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2
38 RUN mkdir /usr/local/mips-linux-musl
39 RUN curl -L https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2 | \
40       tar xjf - -C /usr/local/mips-linux-musl --strip-components=2
41 RUN for file in /usr/local/mips-linux-musl/bin/mips-openwrt-linux-*; do \
42       ln -s $file /usr/local/bin/`basename $file`; \
43     done
44
45 # Note that this originally came from:
46 # https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
47 RUN mkdir /usr/local/mipsel-linux-musl
48 RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
49       tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
50 RUN for file in /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-*; do \
51       ln -s $file /usr/local/bin/`basename $file`; \
52     done
53
54 ENV TARGETS=asmjs-unknown-emscripten
55 ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
56 ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
57 ENV TARGETS=$TARGETS,mips-unknown-linux-musl
58 ENV TARGETS=$TARGETS,mipsel-unknown-linux-musl
59 ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi
60 ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf
61 ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
62 ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu
63
64 ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
65     CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
66     CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc
67
68 # Suppress some warnings in the openwrt toolchains we downloaded
69 ENV STAGING_DIR=/tmp
70
71 ENV RUST_CONFIGURE_ARGS \
72       --enable-extended \
73       --target=$TARGETS \
74       --musl-root-arm=/usr/local/arm-linux-musleabi \
75       --musl-root-armhf=/usr/local/arm-linux-musleabihf \
76       --musl-root-armv7=/usr/local/armv7-linux-musleabihf
77 ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
78
79 # sccache
80 COPY scripts/sccache.sh /scripts/
81 RUN sh /scripts/sccache.sh
82
83 # init
84 ENTRYPOINT ["/usr/bin/dumb-init", "--"]