[libc++][ci] Install Clang 11, Clang 12 and Clang ToT in the Docker image

The compiler support policy mentions that we support Clang 11 and 12, so
we should test those. We already test on Clang 12, but I'll add testers
for Clang 11 once the new Docker image is in use on all the builders.
This commit is contained in:
Louis Dionne 2021-07-08 12:19:53 -04:00
parent 4747e1b83b
commit 8ea2b951c6
1 changed files with 23 additions and 15 deletions

View File

@ -39,28 +39,36 @@ RUN apt-get update && apt-get install -y bash curl
RUN apt-get update && apt-get install -y ninja-build python3 python3-sphinx python3-distutils git gdb
RUN apt-get update && apt-get install -y libc6-dev-i386 # Required to cross-compile to 32 bits
# Install the most recently released LLVM
# Install Clang <latest>, <latest-1> and ToT, which are the ones we support.
ENV LLVM_LATEST_VERSION=12
RUN apt-get update && apt-get install -y lsb-release wget software-properties-common
RUN wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
RUN bash /tmp/llvm.sh
RUN LLVM_VERSION=$(find /usr/bin -regex '^.+/clang-[0-9.]+$') && LLVM_VERSION=${LLVM_VERSION#*clang-} && echo "LLVM_VERSION=$LLVM_VERSION" > /tmp/env.sh
RUN ln -s $(find /usr/bin -regex '^.+/clang\+\+-[0-9.]+$') /usr/bin/clang++ && [ -e $(readlink /usr/bin/clang++) ]
RUN ln -s $(find /usr/bin -regex '^.+/clang-[0-9.]+$') /usr/bin/clang && [ -e $(readlink /usr/bin/clang) ]
RUN bash /tmp/llvm.sh $(($LLVM_LATEST_VERSION - 1)) # previous release
RUN bash /tmp/llvm.sh $LLVM_LATEST_VERSION # latest release
RUN bash /tmp/llvm.sh $(($LLVM_LATEST_VERSION + 1)) # current ToT
# Install the not-yet-released LLVM
RUN . /tmp/env.sh && echo "LLVM_TOT_VERSION=$(($LLVM_VERSION + 1))" >> /tmp/env.sh
RUN . /tmp/env.sh && bash /tmp/llvm.sh ${LLVM_TOT_VERSION}
RUN . /tmp/env.sh && ln -s /usr/bin/clang++-${LLVM_TOT_VERSION} /usr/bin/clang++-tot && [ -e $(readlink /usr/bin/clang++-tot) ]
RUN . /tmp/env.sh && ln -s /usr/bin/clang-${LLVM_TOT_VERSION} /usr/bin/clang-tot && [ -e $(readlink /usr/bin/clang-tot) ]
# Make the latest Clang the "default" compiler on the system
RUN ln -fs /usr/bin/clang++-$LLVM_LATEST_VERSION /usr/bin/c++ && [ -e $(readlink /usr/bin/c++) ]
RUN ln -fs /usr/bin/clang-$LLVM_LATEST_VERSION /usr/bin/cc && [ -e $(readlink /usr/bin/cc) ]
# Temporarily keep the clang++ and clang++-tot symlinks around for backwards compatibility with builders
RUN ln -s /usr/bin/clang++-$LLVM_LATEST_VERSION /usr/bin/clang++ && [ -e $(readlink /usr/bin/clang++) ]
RUN ln -s /usr/bin/clang-$LLVM_LATEST_VERSION /usr/bin/clang && [ -e $(readlink /usr/bin/clang) ]
RUN ln -s /usr/bin/clang++-$(($LLVM_LATEST_VERSION + 1)) /usr/bin/clang++-tot && [ -e $(readlink /usr/bin/clang++-tot) ]
RUN ln -s /usr/bin/clang-$(($LLVM_LATEST_VERSION + 1)) /usr/bin/clang-tot && [ -e $(readlink /usr/bin/clang-tot) ]
# Install clang-format
RUN . /tmp/env.sh && apt-get install -y clang-format-$LLVM_VERSION
RUN ln -s $(find /usr/bin -regex '^.+/clang-format-[0-9.]+$') /usr/bin/clang-format && [ -e $(readlink /usr/bin/clang-format) ]
RUN ln -s $(find /usr/bin -regex '^.+/git-clang-format-[0-9.]+$') /usr/bin/git-clang-format && [ -e $(readlink /usr/bin/git-clang-format) ]
RUN apt-get install -y clang-format-$LLVM_LATEST_VERSION
RUN ln -s /usr/bin/clang-format-$LLVM_LATEST_VERSION /usr/bin/clang-format && [ -e $(readlink /usr/bin/clang-format) ]
RUN ln -s /usr/bin/git-clang-format-$LLVM_LATEST_VERSION /usr/bin/git-clang-format && [ -e $(readlink /usr/bin/git-clang-format) ]
# Install the most recent GCC version and the previous one (which are the two we support)
# Install the most recent GCC
ENV GCC_LATEST_VERSION=11
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update && apt install -y gcc-10 g++-10 gcc-11 g++-11
RUN apt-get update && apt install -y gcc-$GCC_LATEST_VERSION g++-$GCC_LATEST_VERSION
# Temporarily keep installing GCC 10 for backwards compatibility with build bots
RUN apt-get update && apt install -y gcc-10 g++-10
# Install a recent CMake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.sh -O /tmp/install-cmake.sh