]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
7b560aaaaa68826af7441aab521281294b78d867
[rust.git] / src / ci / docker / host-x86_64 / dist-x86_64-linux / Dockerfile
1 # We use Debian 6 (glibc 2.11, kernel 2.6.32) as a common base for other
2 # distros that still need Rust support: RHEL 6 (glibc 2.12, kernel 2.6.32) and
3 # SLES 11 SP4 (glibc 2.11, kernel 3.0).
4 FROM debian:6
5
6 WORKDIR /build
7
8 # Debian 6 is EOL and no longer available from the usual mirrors,
9 # so we'll need to switch to http://archive.debian.org/
10 RUN sed -i '/updates/d' /etc/apt/sources.list && \
11     sed -i 's/httpredir/archive/' /etc/apt/sources.list
12
13 RUN apt-get update && \
14     apt-get install --allow-unauthenticated -y --no-install-recommends \
15       automake \
16       bzip2 \
17       ca-certificates \
18       curl \
19       file \
20       g++ \
21       g++-multilib \
22       gcc \
23       gcc-multilib \
24       git \
25       lib32z1-dev \
26       libedit-dev \
27       libncurses-dev \
28       make \
29       patch \
30       perl \
31       pkg-config \
32       unzip \
33       wget \
34       xz-utils \
35       zlib1g-dev
36
37 # Install new Let's Encrypt root CA certificate and remove the expired one.
38 COPY host-x86_64/shared/ISRG_Root_X1.crt /usr/local/share/ca-certificates/ISRG_Root_X1.crt
39 RUN sed -i '/mozilla\/DST_Root_CA_X3\.crt/d' /etc/ca-certificates.conf
40 RUN /usr/sbin/update-ca-certificates
41
42 ENV PATH=/rustroot/bin:$PATH
43 ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/lib
44 ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
45 WORKDIR /tmp
46 RUN mkdir /home/user
47 COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
48
49 # We need a build of openssl which supports SNI to download artifacts from
50 # static.rust-lang.org. This'll be used to link into libcurl below (and used
51 # later as well), so build a copy of OpenSSL with dynamic libraries into our
52 # generic root.
53 COPY host-x86_64/dist-x86_64-linux/build-openssl.sh /tmp/
54 RUN ./build-openssl.sh
55
56 # The `curl` binary on Debian 6 doesn't support SNI which is needed for fetching
57 # some https urls we have, so install a new version of libcurl + curl which is
58 # using the openssl we just built previously.
59 #
60 # Note that we also disable a bunch of optional features of curl that we don't
61 # really need.
62 COPY host-x86_64/dist-x86_64-linux/build-curl.sh /tmp/
63 RUN ./build-curl.sh && apt-get remove -y curl
64
65 # binutils < 2.22 has a bug where the 32-bit executables it generates
66 # immediately segfault in Rust, so we need to install our own binutils.
67 #
68 # See https://github.com/rust-lang/rust/issues/20440 for more info
69 COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/
70 RUN ./build-binutils.sh
71
72 # Need at least GCC 5.1 to compile LLVM nowadays
73 COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/
74 RUN ./build-gcc.sh && apt-get remove -y gcc g++
75
76 COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/
77 # Build Python 3 needed for LLVM 12.
78 RUN ./build-python.sh 3.9.1
79
80 # LLVM needs cmake 3.13.4 or higher.
81 COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/
82 RUN ./build-cmake.sh
83
84 # Now build LLVM+Clang, afterwards configuring further compilations to use the
85 # clang/clang++ compilers.
86 COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
87 RUN ./build-clang.sh
88 ENV CC=clang CXX=clang++
89
90 ENV PERF_COMMIT 1e19fc4c6168d2f7596e512f42f358f245d8f09d
91 RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \
92     unzip perf.zip && \
93     mv rustc-perf-$PERF_COMMIT rustc-perf && \
94     rm perf.zip
95
96 COPY scripts/sccache.sh /scripts/
97 RUN sh /scripts/sccache.sh
98
99 ENV PGO_HOST=x86_64-unknown-linux-gnu
100
101 ENV HOSTS=x86_64-unknown-linux-gnu
102
103 ENV RUST_CONFIGURE_ARGS \
104       --enable-full-tools \
105       --enable-sanitizers \
106       --enable-profiler \
107       --enable-compiler-docs \
108       --set target.x86_64-unknown-linux-gnu.linker=clang \
109       --set target.x86_64-unknown-linux-gnu.ar=/rustroot/bin/llvm-ar \
110       --set target.x86_64-unknown-linux-gnu.ranlib=/rustroot/bin/llvm-ranlib \
111       --set llvm.thin-lto=true \
112       --set llvm.ninja=false \
113       --set rust.jemalloc
114 ENV SCRIPT ../src/ci/pgo.sh python3 ../x.py dist \
115     --host $HOSTS --target $HOSTS \
116     --include-default-paths \
117     src/tools/build-manifest
118 ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang
119
120 # This is the only builder which will create source tarballs
121 ENV DIST_SRC 1
122
123 # When we build cargo in this container, we don't want it to use the system
124 # libcurl, instead it should compile its own.
125 ENV LIBCURL_NO_PKG_CONFIG 1
126
127 ENV DIST_REQUIRE_ALL_TOOLS 1