#!/usr/bin/env bash # KVT fork: tools for the BlueGit CI jobs in blue-ci-cd.yml, on an Ubuntu image. # ci-setup.sh linux Linux build (as .github/actions/setup-linux): headers, clang 21, mold # ci-setup.sh windows the above plus the cross-build bits: lld/llvm 21, wine, cargo-xwin # Rust comes from rustup (stable) into $CARGO_HOME, which the jobs cache. set -euo pipefail mode="${1:-linux}" export DEBIAN_FRONTEND=noninteractive apt-get update -qq apt-get install -y -qq --no-install-recommends \ ca-certificates curl git gnupg lsb-release wget software-properties-common \ build-essential binutils file python3 unzip xz-utils patch jq \ clang mold pkg-config libclang-dev \ libglib2.0-dev libfontconfig-dev libasound2-dev libva-dev \ libxkbcommon-dev libxkbcommon-x11-dev \ libx11-dev libxcb1-dev libxext-dev libxfixes-dev libxdamage-dev \ libxrandr-dev libxcomposite-dev libwayland-dev libpipewire-0.3-dev \ desktop-file-utils >/dev/null # webrtc-sys needs clang 21 (check_clang_version in vendor/webrtc-sys/build.rs). curl -fsSL https://apt.llvm.org/llvm.sh -o /tmp/llvm.sh bash /tmp/llvm.sh 21 >/dev/null apt-get install -y -qq --no-install-recommends clang-21 >/dev/null if [[ "$mode" == windows ]]; then # cargo-xwin (ureq/native-tls) needs OpenSSL headers to build on the Linux host. apt-get install -y -qq --no-install-recommends lld-21 llvm-21 clang-tools-21 wine64 libssl-dev >/dev/null # cargo-xwin calls the plain names. for tool in clang-cl lld-link llvm-lib llvm-rc llvm-ar llvm-dlltool; do for candidate in "/usr/lib/llvm-21/bin/$tool" "/usr/bin/$tool-21"; do [[ -x "$candidate" ]] && ln -sf "$candidate" "/usr/local/bin/$tool" && break done done fi if ! command -v cargo >/dev/null; then curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable >/dev/null fi # shellcheck disable=SC1091 . "${CARGO_HOME:-$HOME/.cargo}/env" rustup toolchain install stable --profile minimal >/dev/null if [[ "$mode" == windows ]]; then rustup target add x86_64-pc-windows-msvc >/dev/null command -v cargo-xwin >/dev/null || cargo install cargo-xwin --locked >/dev/null fi rustc --version clang-21 --version | head -n 1