137 lines
6.8 KiB
INI
137 lines
6.8 KiB
INI
FROM ubuntu:24.04
|
|
|
|
ARG QT_VERSION=6.10.1
|
|
ARG QT_INSTALL_DIR=/opt/qt
|
|
ARG ZLIB_VERSION=1.3.1
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV QT_VERSION=${QT_VERSION}
|
|
ENV QT_INSTALL_DIR=${QT_INSTALL_DIR}
|
|
|
|
# ── Build tools & native deps ──────────────────────────────────────────────────
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
python3 python3-pip \
|
|
cmake ninja-build pkg-config git \
|
|
build-essential libgl1-mesa-dev \
|
|
gcc g++ mingw-w64 \
|
|
libuchardet-dev \
|
|
libquazip1-qt6-dev libminizip-dev \
|
|
libdjvulibre-dev libwpd-dev \
|
|
libxcb-cursor0 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── aqtinstall ─────────────────────────────────────────────────────────────────
|
|
RUN pip3 install --quiet --break-system-packages aqtinstall
|
|
|
|
# ── Qt 6 for Linux (native build + host tools for cross-compile) ───────────────
|
|
RUN aqt install-qt linux desktop ${QT_VERSION} linux_gcc_64 \
|
|
--outputdir ${QT_INSTALL_DIR}
|
|
|
|
# ── Qt 6 for Windows (MinGW cross-compile target) ─────────────────────────────
|
|
RUN aqt install-qt windows desktop ${QT_VERSION} win64_mingw \
|
|
--outputdir ${QT_INSTALL_DIR}
|
|
|
|
# ── libiconv for MinGW (static, cross-compiled) ───────────────────────────────
|
|
COPY scripts/mingw-w64-toolchain.cmake /opt/mingw-w64-toolchain.cmake
|
|
|
|
RUN apt-get update -qq && apt-get install -y --no-install-recommends wget && rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN wget -q https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz -O /tmp/libiconv.tar.gz && \
|
|
tar -xf /tmp/libiconv.tar.gz -C /tmp && \
|
|
cd /tmp/libiconv-1.17 && \
|
|
./configure --host=x86_64-w64-mingw32 --prefix=/opt/mingw-sysroot \
|
|
--enable-static --disable-shared --disable-nls && \
|
|
make -j$(nproc) && make install && \
|
|
rm -rf /tmp/libiconv-1.17 /tmp/libiconv.tar.gz
|
|
|
|
# ── uchardet for MinGW (static, cross-compiled) ───────────────────────────────
|
|
RUN git clone --depth 1 https://gitlab.freedesktop.org/uchardet/uchardet.git /tmp/uchardet && \
|
|
cmake -B /tmp/uchardet-build /tmp/uchardet -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=/opt/mingw-w64-toolchain.cmake \
|
|
-DCMAKE_INSTALL_PREFIX=/opt/mingw-sysroot \
|
|
-DBUILD_SHARED_LIBS=OFF && \
|
|
cmake --build /tmp/uchardet-build && \
|
|
cmake --install /tmp/uchardet-build && \
|
|
rm -rf /tmp/uchardet /tmp/uchardet-build
|
|
|
|
# ── zlib + minizip for MinGW (static, cross-compiled) ─────────────────────────
|
|
RUN wget -q https://github.com/madler/zlib/archive/refs/tags/v${ZLIB_VERSION}.tar.gz -O /tmp/zlib.tar.gz && \
|
|
tar -xf /tmp/zlib.tar.gz -C /tmp && \
|
|
\
|
|
# Build zlib static lib using the MinGW-specific Makefile
|
|
cd /tmp/zlib-${ZLIB_VERSION} && \
|
|
make -f win32/Makefile.gcc \
|
|
PREFIX=x86_64-w64-mingw32- \
|
|
BINARY_PATH=/opt/mingw-sysroot/bin \
|
|
INCLUDE_PATH=/opt/mingw-sysroot/include \
|
|
LIBRARY_PATH=/opt/mingw-sysroot/lib \
|
|
SHARED_MODE=0 install && \
|
|
\
|
|
# Build minizip static lib from contrib/minizip
|
|
cd /tmp/zlib-${ZLIB_VERSION}/contrib/minizip && \
|
|
x86_64-w64-mingw32-gcc -c \
|
|
-I/opt/mingw-sysroot/include \
|
|
-DNOUNCRYPT -DNOCRYPT \
|
|
ioapi.c unzip.c zip.c && \
|
|
x86_64-w64-mingw32-ar rcs libminizip.a ioapi.o unzip.o zip.o && \
|
|
cp libminizip.a /opt/mingw-sysroot/lib/ && \
|
|
mkdir -p /opt/mingw-sysroot/include/minizip && \
|
|
cp ioapi.h unzip.h zip.h /opt/mingw-sysroot/include/minizip/ && \
|
|
\
|
|
# Write pkg-config file
|
|
mkdir -p /opt/mingw-sysroot/lib/pkgconfig && \
|
|
printf 'prefix=/opt/mingw-sysroot\nlibdir=${prefix}/lib\nincludedir=${prefix}/include/minizip\n\nName: minizip\nDescription: Minizip zip/unzip library\nVersion: %s\nLibs: -L${libdir} -lminizip -lz\nCflags: -I${includedir}\n' "${ZLIB_VERSION}" \
|
|
> /opt/mingw-sysroot/lib/pkgconfig/minizip.pc && \
|
|
\
|
|
rm -rf /tmp/zlib-${ZLIB_VERSION} /tmp/zlib.tar.gz
|
|
|
|
ENV QT_LINUX_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/gcc_64
|
|
ENV QT_WINDOWS_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/mingw_64
|
|
ENV MINGW_SYSROOT=/opt/mingw-sysroot
|
|
|
|
# ── linuxdeploy + Qt plugin (for AppImage packaging) ────────────────────────
|
|
RUN wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
|
|
-O /usr/local/bin/linuxdeploy && \
|
|
chmod +x /usr/local/bin/linuxdeploy && \
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \
|
|
-O /usr/local/bin/linuxdeploy-plugin-qt && \
|
|
chmod +x /usr/local/bin/linuxdeploy-plugin-qt
|
|
|
|
# ── FUSE not available in Docker — extract AppImage tools ────────────────────
|
|
RUN cd /tmp && \
|
|
/usr/local/bin/linuxdeploy --appimage-extract && \
|
|
mv squashfs-root /opt/linuxdeploy && \
|
|
ln -sf /opt/linuxdeploy/AppRun /usr/local/bin/linuxdeploy && \
|
|
/usr/local/bin/linuxdeploy-plugin-qt --appimage-extract && \
|
|
mv squashfs-root /opt/linuxdeploy-plugin-qt && \
|
|
ln -sf /opt/linuxdeploy-plugin-qt/AppRun /usr/local/bin/linuxdeploy-plugin-qt
|
|
|
|
# ── appimagetool (for final AppImage creation) ──────────────────────────────
|
|
RUN wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage \
|
|
-O /tmp/appimagetool && \
|
|
chmod +x /tmp/appimagetool && \
|
|
cd /tmp && /tmp/appimagetool --appimage-extract && \
|
|
mv squashfs-root /opt/appimagetool && \
|
|
ln -sf /opt/appimagetool/AppRun /usr/local/bin/appimagetool && \
|
|
rm /tmp/appimagetool
|
|
|
|
# ── file utility (needed by linuxdeploy for ELF detection) ──────────────────
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends file patchelf zip curl jq && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── gitlab-runner (shell executor) ───────────────────────────────────────────
|
|
RUN wget -q https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64 \
|
|
-O /usr/local/bin/gitlab-runner && \
|
|
chmod +x /usr/local/bin/gitlab-runner && \
|
|
mkdir -p /etc/gitlab-runner /builds && \
|
|
chmod 777 /builds
|
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD []
|