VoidBuildSystem CI / 1 · Requirements (push) Successful in 8s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m35s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Failing after 26s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Failing after 28s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Skipped
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4B · Windows package (debug) (push) Skipped
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m31s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m20s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m25s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 7m4s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 7m9s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Successful in 1m18s
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Successful in 1m33s
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Successful in 1m34s
VoidBuildSystem CI / 5 · Release (push) Skipped
MinGW's -dumpversion prints e.g. '10-win32', which broke the numeric comparison; keep the leading major. Also try a nix-provided cross toolchain when nix is available, before falling back to the (often older) distribution package.
86 lines
2.5 KiB
Bash
86 lines
2.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Ensures a C++26-capable MinGW-w64 cross compiler (GCC >= 16).
|
|
#
|
|
# Tries, in order: the toolchain already on PATH, the project's Nix
|
|
# environment (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`), and the
|
|
# distribution package. Fails explicitly when none provides GCC 16.
|
|
set -euo pipefail
|
|
|
|
minimum=16
|
|
|
|
compiler_major() {
|
|
local compiler="${1:-x86_64-w64-mingw32-g++}"
|
|
command -v "${compiler}" >/dev/null 2>&1 || {
|
|
echo 0
|
|
return
|
|
}
|
|
# MinGW prints e.g. "10-win32": keep only the leading major number.
|
|
"${compiler}" -dumpversion 2>/dev/null | sed -nE 's/^([0-9]+).*/\1/p' | head -n1 ||
|
|
echo 0
|
|
}
|
|
|
|
compatible() {
|
|
[ "${1:-0}" -ge "${minimum}" ]
|
|
}
|
|
|
|
report() {
|
|
local major
|
|
major="$(compiler_major)"
|
|
if compatible "${major}"; then
|
|
echo "using MinGW-w64 $(x86_64-w64-mingw32-g++ --version | head -n1)"
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
if report; then
|
|
exit 0
|
|
fi
|
|
|
|
# The project environment provides the cross toolchain through its dev shell.
|
|
if command -v dev >/dev/null 2>&1; then
|
|
echo "trying the project dev environment for MinGW-w64 GCC ${minimum}+"
|
|
nix_path="$(dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc -c sh -c 'printf %s "$PATH"' \
|
|
2>/dev/null | tr -d '\r' | tail -n1 || true)"
|
|
if [ -n "${nix_path:-}" ]; then
|
|
export PATH="${nix_path}:${PATH}"
|
|
hash -r
|
|
fi
|
|
if report; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
# Nix, when the runner has it.
|
|
if command -v nix >/dev/null 2>&1; then
|
|
echo "trying nix for MinGW-w64 GCC ${minimum}+"
|
|
if nix shell --command true nixpkgs#pkgsCross.mingwW64.stdenv.cc >/dev/null 2>&1; then
|
|
nix_path="$(nix shell --command sh -c 'printf %s "$PATH"' \
|
|
nixpkgs#pkgsCross.mingwW64.stdenv.cc 2>/dev/null | tail -n1 || true)"
|
|
if [ -n "${nix_path:-}" ]; then
|
|
export PATH="${nix_path}:${PATH}"
|
|
hash -r
|
|
fi
|
|
fi
|
|
if report; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
# Distribution package (may be older than GCC 16).
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
sudo=""
|
|
if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi
|
|
${sudo} apt-get update || true
|
|
${sudo} apt-get install -y mingw-w64 || true
|
|
hash -r
|
|
if report; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
echo "MinGW-w64 GCC ${minimum} or newer is required to build VBS for Windows" >&2
|
|
echo "(C++26 reflection); found $(compiler_major). Install it on the runner image" >&2
|
|
echo "or provide it through the project's dev environment." >&2
|
|
exit 1
|