diff --git a/.gitea/scripts/install-mingw.sh b/.gitea/scripts/install-mingw.sh index bc543aa..6859833 100644 --- a/.gitea/scripts/install-mingw.sh +++ b/.gitea/scripts/install-mingw.sh @@ -14,7 +14,9 @@ compiler_major() { echo 0 return } - "${compiler}" -dumpversion 2>/dev/null | cut -d. -f1 || echo 0 + # 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() { @@ -49,6 +51,22 @@ if command -v dev >/dev/null 2>&1; then 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=""