From 51d437d3393b0a14d89455389357ca28fd039d59 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 07:40:05 +0300 Subject: [PATCH] ci: rely on the Void CI images for the toolchain The windows-gcc image already ships MinGW-w64 GCC 16 (UCRT), Wine and CMake/Ninja, and the vulkan image ships GCC 16, CMake 4 and the Void dependencies. Drop the MinGW download, the apt package installs and the Wine install; the Windows lane now uses the repository's PATH-based MinGW toolchain file and stages the runtime DLLs from the MinGW sysroot. --- .gitea/cmake/mingw-w64-toolchain.cmake | 17 ++++++++ .gitea/scripts/install-mingw.sh | 57 -------------------------- .gitea/workflows/ci.yml | 46 +++------------------ 3 files changed, 22 insertions(+), 98 deletions(-) create mode 100644 .gitea/cmake/mingw-w64-toolchain.cmake delete mode 100644 .gitea/scripts/install-mingw.sh diff --git a/.gitea/cmake/mingw-w64-toolchain.cmake b/.gitea/cmake/mingw-w64-toolchain.cmake new file mode 100644 index 0000000..09e1f7b --- /dev/null +++ b/.gitea/cmake/mingw-w64-toolchain.cmake @@ -0,0 +1,17 @@ +# Cross-compiles VoidBuildSystem for 64-bit Windows (UCRT) with the MinGW-w64 +# toolchain on PATH (the Void CI `windows-gcc` image provides GCC 16). +# The Wine CI lane runs the executables on Linux. +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +set(CMAKE_AR x86_64-w64-mingw32-ar) +set(CMAKE_RANLIB x86_64-w64-mingw32-ranlib) + +# Look for target libraries and headers in the MinGW sysroot, but run host +# programs (cmake, ninja, python, ...) from the normal PATH. +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/.gitea/scripts/install-mingw.sh b/.gitea/scripts/install-mingw.sh deleted file mode 100644 index 852379d..0000000 --- a/.gitea/scripts/install-mingw.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env bash -# Installs the MinGW-w64 GCC 16 cross toolchain (UCRT) used to build VBS for -# Windows from Linux: https://github.com/AmanoTeam/mingw-gcc-cross (gcc-16). -# -# Usage: install-mingw.sh [PREFIX] (default /opt/mingw-gcc-cross) -set -euo pipefail - -release=gcc-16 -host=x86_64-unknown-linux-gnu -url="https://github.com/AmanoTeam/mingw-gcc-cross/releases/download/${release}/${host}.tar.xz" -prefix="${1:-/opt/mingw-gcc-cross}" -compiler="${prefix}/bin/x86_64-w64-mingw32-ucrt-g++" - -# cc1plus links against the GMP/MPFR/MPC/isl/zstd copies shipped in the -# toolchain, so the host loader needs the prefix on its search path. -export LD_LIBRARY_PATH="${prefix}/lib:${prefix}/lib64:${LD_LIBRARY_PATH:-}" -if [ -n "${GITHUB_ENV:-}" ]; then - echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "${GITHUB_ENV}" -fi - -self_check() { - local probe - probe="$(mktemp -d)" - printf 'int main() { return 0; }\n' > "${probe}/probe.cpp" - if ! "${compiler}" -c "${probe}/probe.cpp" -o "${probe}/probe.o"; then - echo "the MinGW-w64 toolchain at '${prefix}' cannot compile:" >&2 - "${compiler}" -v -c "${probe}/probe.cpp" -o "${probe}/probe.o" 2>&1 | tail -n 20 >&2 || - true - ls -la "${prefix}/libexec/gcc/x86_64-w64-mingw32/"*/cc1plus >&2 || true - df -h "${prefix}" >&2 || true - rm -rf "${probe}" - exit 1 - fi - rm -rf "${probe}" - echo "MinGW-w64 toolchain OK: $("${compiler}" --version | head -n1)" -} - -if [ -x "${compiler}" ]; then - echo "using the existing MinGW-w64 toolchain at ${prefix}" - self_check - exit 0 -fi - -sudo="" -if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi -tmp="$(mktemp -d)" -trap 'rm -rf "${tmp}"' EXIT -if command -v curl >/dev/null 2>&1; then - curl -fsSL "${url}" -o "${tmp}/toolchain.tar.xz" -else - wget -qO "${tmp}/toolchain.tar.xz" "${url}" -fi -${sudo} rm -rf "${prefix}" -${sudo} mkdir -p "${prefix}" -${sudo} tar -xJf "${tmp}/toolchain.tar.xz" -C "${prefix}" --strip-components=1 -echo "toolchain file: ${prefix}/usr/local/share/mingw/cmake/x86_64-w64-mingw32-ucrt.cmake" -self_check diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4301a6b..219f91c 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -64,29 +64,6 @@ jobs: fi bash .gitea/scripts/install-ninja.sh git --version - - name: Install the development requirements - run: | - # The optional backends (OpenSSL, SQLite3) are opportunistic: a runner that - # provides the GCC 16 toolchain already satisfies the mandatory requirements. - if ! command -v apt-get >/dev/null 2>&1; then - echo "apt-get is not available; using the toolchain provided by the runner" - exit 0 - fi - sudo="" - if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi - missing="" - for package in libssl-dev libsqlite3-dev pkg-config; do - if command -v dpkg >/dev/null 2>&1 && dpkg -s "${package}" >/dev/null 2>&1; then - continue - fi - missing="${missing} ${package}" - done - if [ -n "${missing}" ]; then - ${sudo} apt-get update - ${sudo} apt-get install -y ${missing} - else - echo "all development packages are already installed" - fi # --------------------------------------------------------------------------- # 2A / 3A - Linux native @@ -257,21 +234,19 @@ jobs: build_type: RelWithDebInfo steps: - uses: actions/checkout@v4 - - name: Install the MinGW-w64 GCC 16 cross toolchain - run: bash .gitea/scripts/install-mingw.sh /opt/mingw-gcc-cross - name: Configure run: | cmake -S . -B "build/wine-${{ matrix.variant }}" -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=/opt/mingw-gcc-cross/usr/local/share/mingw/cmake/x86_64-w64-mingw32-ucrt.cmake \ + -DCMAKE_TOOLCHAIN_FILE="$PWD/.gitea/cmake/mingw-w64-toolchain.cmake" \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Build run: cmake --build "build/wine-${{ matrix.variant }}" --parallel 4 - name: Stage the MinGW runtime DLLs run: | - for lib in libstdc++.dll libgcc_s_seh.dll libwinpthread.dll; do - if [ -f "/opt/mingw-gcc-cross/x86_64-w64-mingw32-ucrt/lib/${lib}" ]; then - cp "/opt/mingw-gcc-cross/x86_64-w64-mingw32-ucrt/lib/${lib}" \ + for lib in libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll; do + if [ -f "/usr/x86_64-w64-mingw32/bin/${lib}" ]; then + cp "/usr/x86_64-w64-mingw32/bin/${lib}" \ "build/wine-${{ matrix.variant }}/bin/" fi done @@ -311,19 +286,8 @@ jobs: with: name: vbs-wine-build-${{ matrix.variant }} path: build/wine-${{ matrix.variant }} - - name: Install Wine + - name: Check Wine run: | - sudo="" - if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi - if ! command -v wine >/dev/null 2>&1; then - if command -v apt-get >/dev/null 2>&1; then - ${sudo} apt-get update - ${sudo} apt-get install -y wine64 || ${sudo} apt-get install -y wine - fi - fi - if ! command -v wine >/dev/null 2>&1 && command -v wine64 >/dev/null 2>&1; then - ${sudo} ln -sf "$(command -v wine64)" /usr/local/bin/wine - fi if ! command -v wine >/dev/null 2>&1; then echo "wine is required to run the Windows test executables" >&2 exit 1