fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
4.0 KiB120 linesraw
1FROM centos:5
2
3WORKDIR /build
4
5# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
6# to http://vault.centos.org/
7RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
8RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
9RUN sed -i 's|#\(baseurl.*\)mirror.centos.org/centos/$releasever|\1vault.centos.org/5.11|' /etc/yum.repos.d/*.repo
10
11RUN yum upgrade -y && yum install -y \
12      curl \
13      bzip2 \
14      gcc \
15      gcc-c++ \
16      make \
17      glibc-devel \
18      perl \
19      zlib-devel \
20      file \
21      xz \
22      which \
23      pkgconfig \
24      wget \
25      autoconf \
26      gettext
27
28ENV PATH=/rustroot/bin:$PATH
29ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
30ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
31WORKDIR /tmp
32COPY dist-x86_64-linux/shared.sh /tmp/
33
34# We need a build of openssl which supports SNI to download artifacts from
35# static.rust-lang.org. This'll be used to link into libcurl below (and used
36# later as well), so build a copy of OpenSSL with dynamic libraries into our
37# generic root.
38COPY dist-x86_64-linux/build-openssl.sh /tmp/
39RUN ./build-openssl.sh
40
41# The `curl` binary on CentOS doesn't support SNI which is needed for fetching
42# some https urls we have, so install a new version of libcurl + curl which is
43# using the openssl we just built previously.
44#
45# Note that we also disable a bunch of optional features of curl that we don't
46# really need.
47COPY dist-x86_64-linux/build-curl.sh /tmp/
48RUN ./build-curl.sh
49
50# binutils < 2.22 has a bug where the 32-bit executables it generates
51# immediately segfault in Rust, so we need to install our own binutils.
52#
53# See https://github.com/rust-lang/rust/issues/20440 for more info
54COPY dist-x86_64-linux/build-binutils.sh /tmp/
55RUN ./build-binutils.sh
56
57# libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
58# only has 2.6.4, so build our own
59COPY dist-x86_64-linux/build-cmake.sh /tmp/
60RUN ./build-cmake.sh
61
62# Need a newer version of gcc than centos has to compile LLVM nowadays
63COPY dist-x86_64-linux/build-gcc.sh /tmp/
64RUN ./build-gcc.sh
65
66# CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
67COPY dist-x86_64-linux/build-python.sh /tmp/
68RUN ./build-python.sh
69
70# Now build LLVM+Clang 7, afterwards configuring further compilations to use the
71# clang/clang++ compilers.
72COPY dist-x86_64-linux/build-clang.sh dist-x86_64-linux/llvm-project-centos.patch /tmp/
73RUN ./build-clang.sh
74ENV CC=clang CXX=clang++
75
76# Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
77# cloning, so download and build it here.
78COPY dist-x86_64-linux/build-git.sh /tmp/
79RUN ./build-git.sh
80
81# for sanitizers, we need kernel headers files newer than the ones CentOS ships
82# with so we install newer ones here
83COPY dist-x86_64-linux/build-headers.sh /tmp/
84RUN ./build-headers.sh
85
86# OpenSSL requires a more recent version of perl
87# with so we install newer ones here
88COPY dist-x86_64-linux/build-perl.sh /tmp/
89RUN ./build-perl.sh
90
91COPY scripts/sccache.sh /scripts/
92RUN sh /scripts/sccache.sh
93
94ENV HOSTS=i686-unknown-linux-gnu
95
96ENV RUST_CONFIGURE_ARGS \
97      --enable-full-tools \
98      --enable-sanitizers \
99      --enable-profiler \
100      --set target.i686-unknown-linux-gnu.linker=clang \
101      --build=i686-unknown-linux-gnu \
102      --set rust.jemalloc
103ENV SCRIPT python2.7 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS
104ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang
105
106# This was added when we switched from gcc to clang. It's not clear why this is
107# needed unfortunately, but without this the stage1 bootstrap segfaults
108# somewhere inside of a build script. The build ends up just hanging instead of
109# actually killing the process that segfaulted, but if the process is run
110# manually in a debugger the segfault is immediately seen as well as the
111# misaligned stack access.
112#
113# Added in #50200 there's some more logs there
114ENV CFLAGS -mstackrealign
115
116# When we build cargo in this container, we don't want it to use the system
117# libcurl, instead it should compile its own.
118ENV LIBCURL_NO_PKG_CONFIG 1
119
120ENV DIST_REQUIRE_ALL_TOOLS 1