BlueGit

ict rusty-teams

Files

rusty-teams / packaging / kvt / ci-setup.sh

ci-setup.sh

ci-setup.sh 2.9 KiB Download Raw
1#!/usr/bin/env bash
2# KVT fork: tools for the BlueGit CI jobs in blue-ci-cd.yml, on an Ubuntu image.
3# ci-setup.sh linux Linux build (as .github/actions/setup-linux): headers, clang 21, mold (clang-21 zonder lldb/lld/clangd)
4# ci-setup.sh windows the above plus the cross-build bits: lld/llvm 21, wine, cargo-xwin
5# Rust comes from rustup (stable) into $CARGO_HOME, which the jobs cache.
6set -euo pipefail
7mode="${1:-linux}"
8export DEBIAN_FRONTEND=noninteractive
9# Keep Cargo and rustup in the workspace so ci-cache.sh can pack them.
10# BlueGit cache only copies files, not directories; the job stores a tarball.
11if [[ -n "${CI:-}" ]]; then
12 export CARGO_HOME="${CARGO_HOME:-$PWD/cargo-home}"
13 export RUSTUP_HOME="${RUSTUP_HOME:-$PWD/rustup-home}"
14 export PATH="$CARGO_HOME/bin:$PATH"
15 if [[ "$mode" == windows ]]; then
16 export XWIN_CACHE_DIR="${XWIN_CACHE_DIR:-$PWD/xwin-cache}"
17 fi
18fi
19apt-get update -qq
20apt-get install -y -qq --no-install-recommends \
21 ca-certificates curl git gnupg lsb-release wget \
22 build-essential binutils file python3 unzip xz-utils patch jq \
23 clang mold pkg-config libclang-dev \
24 libglib2.0-dev libfontconfig-dev libasound2-dev libva-dev \
25 libxkbcommon-dev libxkbcommon-x11-dev \
26 libx11-dev libxcb1-dev libxext-dev libxfixes-dev libxdamage-dev \
27 libxrandr-dev libxcomposite-dev libwayland-dev libpipewire-0.3-dev \
28 desktop-file-utils >/dev/null
29# webrtc-sys needs clang 21 (check_clang_version in vendor/webrtc-sys/build.rs).
30# Alleen het apt.llvm.org-repo toevoegen en clang-21 installeren: llvm.sh zelf zet er
31# ook lldb, lld en clangd bij (honderden MB extra uitpakken op de gedeelde runner).
32codename="$(lsb_release -cs)"
33curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key -o /etc/apt/trusted.gpg.d/apt.llvm.org.asc
34echo "deb https://apt.llvm.org/$codename/ llvm-toolchain-$codename-21 main" > /etc/apt/sources.list.d/llvm-21.list
35apt-get update -qq
36apt-get install -y -qq --no-install-recommends clang-21 >/dev/null
37if [[ "$mode" == windows ]]; then
38 # cargo-xwin (ureq/native-tls) needs OpenSSL headers to build on the Linux host.
39 apt-get install -y -qq --no-install-recommends lld-21 llvm-21 clang-tools-21 wine64 libssl-dev >/dev/null
40 # cargo-xwin calls the plain names.
41 for tool in clang-cl lld-link llvm-lib llvm-rc llvm-ar llvm-dlltool; do
42 for candidate in "/usr/lib/llvm-21/bin/$tool" "/usr/bin/$tool-21"; do
43 [[ -x "$candidate" ]] && ln -sf "$candidate" "/usr/local/bin/$tool" && break
44 done
45 done
46fi
47if ! command -v cargo >/dev/null; then
48 curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable >/dev/null
49fi
50# shellcheck disable=SC1091
51. "${CARGO_HOME:-$HOME/.cargo}/env"
52rustup toolchain install stable --profile minimal >/dev/null
53if [[ "$mode" == windows ]]; then
54 rustup target add x86_64-pc-windows-msvc >/dev/null
55 command -v cargo-xwin >/dev/null || cargo install cargo-xwin --locked >/dev/null
56fi
57rustc --version
58clang-21 --version | head -n 1