File: Dockerfile.clang

package info (click to toggle)
qcoro 0.12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,700 kB
  • sloc: cpp: 8,573; python: 32; xml: 26; makefile: 23; sh: 15
file content (68 lines) | stat: -rw-r--r-- 2,851 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# SPDX-FileCopyrightText: 2022 Daniel Vrátil <dvratil@kde.org>
# SPDX-License-Identifier: MIT
#
# Docker image for specific versions of clang and specific version of Qt.

FROM debian:bullseye
ARG compiler_version
ARG qt_version
ARG qt_modules
ARG qt_archives

SHELL ["/bin/bash", "-c"]

# Install build & runtime dependencies
RUN apt-get update \
    && apt-get upgrade --yes \
    && apt-get install --yes --no-install-recommends \
        cmake=3.18.4\* cmake-data=3.18.4\* \
        make \
        python3-pip python3-setuptools python3-wheel python3-dev \
        dbus dbus-x11 \
        libglib2.0-dev libxkbcommon-dev libfreetype6-dev libfontconfig1-dev \
        libssl-dev \
        libegl-dev libgl-dev libegl1=1.3.2\* libgl1=1.3.2\* libglx0=1.3.2\* libglvnd0=1.3.2\* \
        libvulkan-dev

# Install and set up clang
RUN \
    # Set up env \
    if [ "${compiler_version}" == "dev" ]; then \
        export CLANG_VERSION_SUFFIX=""; \
    else \
        export CLANG_VERSION_SUFFIX="-${compiler_version}"; \
    fi && \
    echo "export CC=\"/usr/bin/clang${CLANG_VERSION_SUFFIX}\"" >> /etc/profile.d/clang.sh && \
    echo "export CXX=\"/usr/bin/clang++${CLANG_VERSION_SUFFIX}\"" >> /etc/profile.d/clang.sh && \
    # Install tools needed to add the clang repository \
    apt-get install --yes --no-install-recommends ca-certificates wget gnupg && \
    # Add clang repository \
    echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye${CLANG_VERSION_SUFFIX} main" > /etc/apt/sources.list.d/llvm.list && \
    echo "deb-src http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye${CLANG_VERSION_SUFFIX} main" >> /etc/apt/sources.list.d/llvm.list && \
    wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
    # Install clang \
    apt-get update && \
    apt-get install --yes --install-recommends clang${CLANG_VERSION_SUFFIX} && \
    clang_major_version=$(clang${CLANG_VERSION_SUFFIX} --version | grep -Eo "[0-9]+.[0-9]+.[0-9]+" | cut -d'.' -f1) && \
    if [ ${clang_major_version} -gt 11 ]; then \
        apt-get install --yes --no-install-recommends libclang-rt-${clang_major_version}-dev; \
    fi

# Workaround a bug in CMake (?) which tries to look for OpenGL-related libraries
# in /usr/lib/x86_64-unknown-linux-gnu instead of /usr/lib/x86_64-linux-gnu
RUN ln -s x86_64-linux-gnu /usr/lib/x86_64-unknown-linux-gnu

# Install Qt
WORKDIR /root
RUN pip3 install 'aqtinstall==3.2.0'
COPY install-qt.sh ./install-qt.sh
RUN ./install-qt.sh "${qt_version}" "${qt_modules}" "${qt_archives}"

# Set Qt up environment
ENV QT_BASE_DIR "/opt/qt/${qt_version}/gcc_64"
ENV PATH "${QT_BASE_DIR}/bin:${PATH}"
ENV CMAKE_PREFIX_PATH "${QT_BASE_DIR}/lib/cmake"
ENV LD_LIBRARY_PATH "${QT_BASE_DIR}/lib:${LD_LIBRARY_PATH}"
ENV XDG_DATA_DIRS "${QT_BASE_DIR}/share:${XDG_DATA_DIRS}"

ENTRYPOINT [ "/bin/bash", "-l" ]