Skip to content

Commit 440fd3f

Browse files
committed
ci: drop distro LLVM packages, move Clang install up, set defaults
Also simplify the download and execution of `llvm.sh`
1 parent e2095bd commit 440fd3f

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

contrib/containers/ci/Dockerfile

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
77
# (zlib1g-dev is needed for the Qt host binary builds, but should not be used by target binaries)
88
ENV APT_ARGS="-y --no-install-recommends --no-upgrade"
99

10-
1110
# Install packages for i386; disabled on aarch64 and arm64 hosts
1211
RUN (dpkg --print-architecture | grep -Eq 'aarch64|arm64' || dpkg --add-architecture i386)
1312
RUN (dpkg --print-architecture | grep -Eq 'aarch64|arm64' || (apt-get update && apt-get install $APT_ARGS \
@@ -23,13 +22,11 @@ RUN apt-get update && apt-get install $APT_ARGS \
2322
bsdmainutils \
2423
curl \
2524
ccache \
26-
clang \
2725
cmake \
2826
g++ \
2927
gettext \
3028
git \
31-
libc++-dev \
32-
libc++abi-dev \
29+
gnupg \
3330
libtool \
3431
libxcb-icccm4 \
3532
libxcb-image0 \
@@ -42,12 +39,36 @@ RUN apt-get update && apt-get install $APT_ARGS \
4239
libxcb-xinerama0 \
4340
libxcb-xkb1 \
4441
libxkbcommon-x11-0 \
45-
wget \
42+
lsb-release \
43+
software-properties-common \
4644
unzip \
45+
wget \
4746
m4 \
4847
pkg-config \
4948
zlib1g-dev
5049

50+
# Install Clang+LLVM and set it as default
51+
# We don't need all packages but the default set doesn't include some
52+
# packages we want so we will need to install some of them manually.
53+
ARG LLVM_VERSION=16
54+
RUN set -ex; \
55+
echo "Installing LLVM and Clang ${LLVM_VERSION}..."; \
56+
curl -sL https://apt.llvm.org/llvm.sh | bash -s "${LLVM_VERSION}"; \
57+
echo "Installing additional packages..."; \
58+
apt-get update && apt-get install $APT_ARGS \
59+
"clang-format-${LLVM_VERSION}" \
60+
"clang-tidy-${LLVM_VERSION}" \
61+
"libc++-${LLVM_VERSION}-dev" \
62+
"libc++abi-${LLVM_VERSION}-dev" \
63+
"libclang-rt-${LLVM_VERSION}-dev"; \
64+
rm -rf /var/lib/apt/lists/*; \
65+
echo "Setting defaults..."; \
66+
lldbUpdAltArgs="update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${LLVM_VERSION} 100"; \
67+
for binName in clang clang++ clang-format clang-tidy clangd ld.lld lldb lldb-server; do \
68+
lldbUpdAltArgs="${lldbUpdAltArgs} --slave /usr/bin/${binName} ${binName} /usr/bin/${binName}-${LLVM_VERSION}"; \
69+
done; \
70+
sh -c "${lldbUpdAltArgs}";
71+
5172
# Python setup
5273
# PYTHON_VERSION should match the value in .python-version
5374
ARG PYTHON_VERSION=3.9.18
@@ -61,7 +82,6 @@ RUN apt-get update && apt-get install $APT_ARGS \
6182
libreadline-dev \
6283
libsqlite3-dev \
6384
libssl-dev \
64-
llvm \
6585
make \
6686
tk-dev \
6787
xz-utils
@@ -135,20 +155,6 @@ RUN \
135155
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; \
136156
exit 0
137157

138-
ARG LLVM_VERSION=16
139-
# Setup Clang+LLVM support
140-
RUN apt-get update && apt-get install $APT_ARGS \
141-
lsb-release \
142-
software-properties-common \
143-
gnupg \
144-
&& rm -rf /var/lib/apt/lists/*
145-
146-
RUN cd /tmp && \
147-
wget https://apt.llvm.org/llvm.sh && \
148-
chmod +x llvm.sh && \
149-
/tmp/llvm.sh ${LLVM_VERSION} && \
150-
rm -rf /tmp/llvm.sh
151-
152158
RUN \
153159
mkdir -p /src/dash && \
154160
mkdir -p /cache/ccache && \

0 commit comments

Comments
 (0)