Reviewed-on: #5 Co-authored-by: Romain BOULLARD <romain.boullard@protonmail.com> Co-committed-by: Romain BOULLARD <romain.boullard@protonmail.com>
76 lines
2.5 KiB
Docker
76 lines
2.5 KiB
Docker
# Build arguments
|
|
ARG BASE_BUILDER
|
|
|
|
# Base image
|
|
FROM $BASE_BUILDER
|
|
|
|
# Environment variables for ccache and pipx
|
|
ENV CCACHE_DIR=/ccache \
|
|
CCACHE_COMPRESS=1 \
|
|
CCACHE_MAXSIZE=10G \
|
|
CCACHE_COMPILERCHECK=content \
|
|
PATH=/root/.local/bin:$PATH
|
|
|
|
# Install system dependencies, clang, and pipx
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
cppcheck \
|
|
ccache \
|
|
cmake \
|
|
ninja-build \
|
|
git \
|
|
pkg-config \
|
|
wget \
|
|
lsb-release \
|
|
software-properties-common \
|
|
pipx \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
\
|
|
# Install LLVM 21
|
|
&& wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh \
|
|
&& chmod +x /tmp/llvm.sh \
|
|
&& /tmp/llvm.sh 21 all \
|
|
\
|
|
# Symlinks for clang 21 tools
|
|
&& ln -sf /usr/bin/clang-21 /usr/bin/clang \
|
|
&& ln -sf /usr/bin/clang++-21 /usr/bin/clang++ \
|
|
&& ln -sf /usr/bin/llvm-profdata-21 /usr/bin/llvm-profdata \
|
|
&& ln -sf /usr/bin/llvm-cov-21 /usr/bin/llvm-cov \
|
|
&& ln -sf /usr/bin/clang-format-21 /usr/bin/clang-format \
|
|
&& ln -sf /usr/bin/clang-tidy-21 /usr/bin/clang-tidy \
|
|
&& ln -sf /usr/bin/run-clang-tidy-21 /usr/bin/run-clang-tidy \
|
|
&& ln -sf /usr/bin/llvm-ar-21 /usr/bin/llvm-ar \
|
|
&& ln -sf /usr/bin/llvm-nm-21 /usr/bin/llvm-nm \
|
|
&& ln -sf /usr/bin/llvm-ranlib-21 /usr/bin/llvm-ranlib \
|
|
\
|
|
# Reset ccache stats
|
|
&& ccache --zero-stats
|
|
|
|
RUN VERSION=1.2.0; \
|
|
curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux-x86_64-v$VERSION.tar.xz" \
|
|
| sudo tar -C /opt -xJ && \
|
|
sudo ln -s "/opt/infer-linux64-v$VERSION/bin/infer" /usr/local/bin/infer
|
|
|
|
# Install pipx and Conan
|
|
RUN pipx ensurepath \
|
|
&& pipx install conan
|
|
|
|
# Build and install mold
|
|
RUN git clone --branch v2.40.4 https://github.com/rui314/mold.git /tmp/mold \
|
|
&& cd /tmp/mold \
|
|
&& cmake . -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_CXX_COMPILER=clang++ \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
-B build \
|
|
&& cmake --build build -j$(nproc) \
|
|
&& cmake --install build \
|
|
&& rm -rf /tmp/mold
|
|
|
|
# Configure Conan with custom profiles and remote
|
|
RUN conan config install https://git.romainboullard.com/BigfootDev/ConanProfiles.git --args="--branch main" \
|
|
&& conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages \
|
|
&& conan remote disable conancenter
|
|
|
|
# Show ccache stats (optional, for debugging)
|
|
RUN ccache --show-stats |