# Build environment for Amped 3 Revamped on Linux (x86_64 and aarch64): what
# setup.sh needs, for read-only systems such as SteamOS and Armada where the
# tools can't be installed. linux/container-build.sh builds and runs it with
# podman (or docker); nothing from it ends up installed on the system.
#
# Ubuntu 24.04 (glibc 2.39) keeps the result compatible with SteamOS 3.6+ and
# current Fedora-based systems; the C++ runtime is linked statically.
FROM docker.io/library/ubuntu:24.04

ARG LLVM_VERSION=20
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates curl gnupg git python3 cmake ninja-build pkg-config make \
        g++-14 libstdc++-14-dev \
        libx11-dev libx11-xcb-dev libxcb1-dev libxext-dev libxrandr-dev libxi-dev \
        libxcursor-dev libxinerama-dev libxss-dev libxfixes-dev libxtst-dev \
        libwayland-dev wayland-protocols libxkbcommon-dev libdecor-0-dev \
        libegl-dev libgl-dev libgles-dev libvulkan-dev \
        libasound2-dev libpulse-dev libpipewire-0.3-dev libjack-jackd2-dev \
        libudev-dev libdbus-1-dev libibus-1.0-dev libusb-1.0-0-dev \
        zlib1g-dev unzip file \
    && rm -rf /var/lib/apt/lists/*

# Clang 20 from the LLVM project's packages (Ubuntu's own is 18).
RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm.gpg \
    && echo "deb [signed-by=/usr/share/keyrings/llvm.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-${LLVM_VERSION} main" \
        > /etc/apt/sources.list.d/llvm.list \
    && apt-get update && apt-get install -y --no-install-recommends \
        clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION} \
    && rm -rf /var/lib/apt/lists/*

# Git refuses repositories owned by another user (the mounted project).
RUN git config --system --add safe.directory '*'
