# Build environment for the deckhud AppImage. Debian 13 sets the glibc floor
# (2.41), which covers SteamOS and current Plasma 6 distributions.
FROM docker.io/library/debian:trixie

RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential cmake ninja-build git ca-certificates curl file patchelf \
        qmake6 qt6-base-dev qt6-base-private-dev qt6-declarative-dev \
        qt6-wayland qt6-wayland-dev qt6-wayland-private-dev qt6-websockets-dev \
        qml6-module-qtquick qml6-module-qtquick-shapes qml6-module-qtquick-window \
        qml6-module-qtwebsockets qml6-module-qtqml-workerscript \
        libwayland-dev wayland-protocols libxkbcommon-dev \
    && rm -rf /var/lib/apt/lists/*

# LayerShellQt isn't packaged in Debian 13. v6.4.5 is the newest release that
# builds against Qt 6.8; it wants ECM >= 6.14 (Debian has 6.13).
RUN git clone --depth 1 --branch v6.14.0 https://invent.kde.org/frameworks/extra-cmake-modules.git /src/ecm \
    && cmake -S /src/ecm -B /src/ecm/build -G Ninja -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr \
    && cmake --build /src/ecm/build && cmake --install /src/ecm/build \
    && git clone --depth 1 --branch v6.4.5 https://invent.kde.org/plasma/layer-shell-qt.git /src/lsq \
    && cmake -S /src/lsq -B /src/lsq/build -G Ninja -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr \
        -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
    && cmake --build /src/lsq/build && cmake --install /src/lsq/build \
    && rm -rf /src

RUN curl -fsSLo /usr/local/bin/linuxdeploy \
        https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
    && curl -fsSLo /usr/local/bin/linuxdeploy-plugin-qt \
        https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \
    && chmod +x /usr/local/bin/linuxdeploy /usr/local/bin/linuxdeploy-plugin-qt

# No FUSE in containers: let the tool AppImages extract themselves.
ENV APPIMAGE_EXTRACT_AND_RUN=1
