79 lines
2.6 KiB
Docker
79 lines
2.6 KiB
Docker
# Build arguments
|
|
ARG BASE_BUILDER
|
|
|
|
# Base image
|
|
FROM $BASE_BUILDER
|
|
|
|
ARG CONAN_PROFILE_BRANCH
|
|
|
|
# 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 18
|
|
&& wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh \
|
|
&& chmod +x /tmp/llvm.sh \
|
|
&& /tmp/llvm.sh 18 all \
|
|
\
|
|
# Symlinks for clang 18 tools
|
|
&& ln -sf /usr/bin/clang-18 /usr/bin/clang \
|
|
&& ln -sf /usr/bin/clang++-18 /usr/bin/clang++ \
|
|
&& ln -sf /usr/bin/llvm-profdata-18 /usr/bin/llvm-profdata \
|
|
&& ln -sf /usr/bin/llvm-cov-18 /usr/bin/llvm-cov \
|
|
&& ln -sf /usr/bin/clang-format-18 /usr/bin/clang-format \
|
|
&& ln -sf /usr/bin/clang-tidy-18 /usr/bin/clang-tidy \
|
|
&& ln -sf /usr/bin/run-clang-tidy-18 /usr/bin/run-clang-tidy \
|
|
&& ln -sf /usr/bin/llvm-ar-18 /usr/bin/llvm-ar \
|
|
&& ln -sf /usr/bin/llvm-nm-18 /usr/bin/llvm-nm \
|
|
&& ln -sf /usr/bin/llvm-ranlib-18 /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 \
|
|
&& ./install-build-deps.sh \
|
|
&& 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 $CONAN_PROFILE_BRANCH" \
|
|
&& 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 |