VoidBuildSystem CI / 1 · Requirements (push) Successful in 11s
VoidBuildSystem CI / 2b · Windows native (debug) (push) Failing after 14s
VoidBuildSystem CI / 2b · Windows native (relwithdebinfo) (push) Failing after 11s
VoidBuildSystem CI / 2 · Linux build (debug) (push) Successful in 4m27s
VoidBuildSystem CI / 2 · Linux build (asan) (push) Successful in 4m39s
VoidBuildSystem CI / 2 · Linux build (ubsan) (push) Successful in 4m21s
VoidBuildSystem CI / 2 · Linux build (relwithdebinfo) (push) Successful in 5m48s
VoidBuildSystem CI / 3 · Linux test (asan) (push) Successful in 1m56s
VoidBuildSystem CI / 3 · Linux test (ubsan) (push) Successful in 1m9s
VoidBuildSystem CI / 3b · Windows Wine test (debug) (push) Successful in 1m21s
VoidBuildSystem CI / 3b · Windows Wine test (relwithdebinfo) (push) Successful in 1m24s
VoidBuildSystem CI / 3 · Linux test (debug) (push) Failing after 6m0s
VoidBuildSystem CI / 3 · Linux test (relwithdebinfo) (push) Failing after 6m59s
VoidBuildSystem CI / 4 · Linux package (asan) (push) Skipped
VoidBuildSystem CI / 4 · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4 · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4 · Linux package (ubsan) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
Requirements now ensure Ninja >= 1.11 (distro package, then the pip wheel, then the official static binary) since the runner ships 1.10.1 and CMake needs 1.11+ for C++20 module scanning. The MSYS2 lane installs cmake/ninja/gcc through pacman when they are missing. The Windows-target sample uses C++20 so it also builds with the older MinGW-w64 GCC that distributions provide (the CI runner has GCC 10).
70 lines
2.1 KiB
Bash
70 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Ensure Ninja >= 1.11 (CMake needs it for C++20 module scanning).
|
|
#
|
|
# Tries, in order: the distribution package, the pip wheel, and the official
|
|
# static release binary (installed into /usr/local/bin so it shadows an older
|
|
# distro ninja).
|
|
set -euo pipefail
|
|
|
|
minimum=1.11
|
|
version_ok() {
|
|
local have="${1:-0}"
|
|
[ "$(printf '%s\n%s\n' "${minimum}" "${have}" | sort -V | head -n1)" = "${minimum}" ]
|
|
}
|
|
|
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
|
if version_ok "${have}"; then
|
|
echo "ninja ${have} already satisfies >= ${minimum}"
|
|
exit 0
|
|
fi
|
|
|
|
sudo=""
|
|
if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi
|
|
|
|
# 1. Distribution package.
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
${sudo} apt-get update || true
|
|
${sudo} apt-get install -y ninja-build || true
|
|
hash -r
|
|
fi
|
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
|
if version_ok "${have}"; then
|
|
echo "installed ninja ${have} from the distribution"
|
|
exit 0
|
|
fi
|
|
|
|
# 2. pip wheel (installs into /usr/local/bin, which shadows the distro binary).
|
|
if command -v python3 >/dev/null 2>&1; then
|
|
python3 -m pip install --quiet --break-system-packages ninja ||
|
|
python3 -m pip install --quiet ninja || true
|
|
hash -r
|
|
fi
|
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
|
if version_ok "${have}"; then
|
|
echo "installed ninja ${have} from pip"
|
|
exit 0
|
|
fi
|
|
|
|
# 3. Official static binary.
|
|
release=1.12.1
|
|
tmp="$(mktemp -d)"
|
|
url="https://github.com/ninja-build/ninja/releases/download/v${release}/ninja-linux.zip"
|
|
if command -v curl >/dev/null 2>&1; then
|
|
curl -fsSL "${url}" -o "${tmp}/ninja.zip"
|
|
elif command -v wget >/dev/null 2>&1; then
|
|
wget -qO "${tmp}/ninja.zip" "${url}"
|
|
else
|
|
echo "curl or wget is required to download ninja" >&2
|
|
exit 1
|
|
fi
|
|
python3 -c 'import sys, zipfile; zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])' \
|
|
"${tmp}/ninja.zip" "${tmp}"
|
|
${sudo} install -m 0755 "${tmp}/ninja" /usr/local/bin/ninja
|
|
hash -r
|
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
|
if ! version_ok "${have}"; then
|
|
echo "Ninja ${minimum}+ is required for C++20 module scanning (found ${have})" >&2
|
|
exit 1
|
|
fi
|
|
echo "installed ninja ${have} from the official release"
|