BlueGit

ict rusty-teams

Files

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

ci-setup.sh

ci-setup.sh 2.2 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
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
9apt-get update -qq
10apt-get install -y -qq --no-install-recommends \
11 ca-certificates curl git gnupg lsb-release wget software-properties-common \
12 build-essential binutils file python3 unzip xz-utils patch jq \
13 clang mold pkg-config libclang-dev \
14 libglib2.0-dev libfontconfig-dev libasound2-dev libva-dev \
15 libxkbcommon-dev libxkbcommon-x11-dev \
16 libx11-dev libxcb1-dev libxext-dev libxfixes-dev libxdamage-dev \
17 libxrandr-dev libxcomposite-dev libwayland-dev libpipewire-0.3-dev \
18 desktop-file-utils >/dev/null
19# webrtc-sys needs clang 21 (check_clang_version in vendor/webrtc-sys/build.rs).
20curl -fsSL https://apt.llvm.org/llvm.sh -o /tmp/llvm.sh
21bash /tmp/llvm.sh 21 >/dev/null
22apt-get install -y -qq --no-install-recommends clang-21 >/dev/null
23if [[ "$mode" == windows ]]; then
24 # cargo-xwin (ureq/native-tls) needs OpenSSL headers to build on the Linux host.
25 apt-get install -y -qq --no-install-recommends lld-21 llvm-21 clang-tools-21 wine64 libssl-dev >/dev/null
26 # cargo-xwin calls the plain names.
27 for tool in clang-cl lld-link llvm-lib llvm-rc llvm-ar llvm-dlltool; do
28 for candidate in "/usr/lib/llvm-21/bin/$tool" "/usr/bin/$tool-21"; do
29 [[ -x "$candidate" ]] && ln -sf "$candidate" "/usr/local/bin/$tool" && break
30 done
31 done
32fi
33if ! command -v cargo >/dev/null; then
34 curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable >/dev/null
35fi
36# shellcheck disable=SC1091
37. "${CARGO_HOME:-$HOME/.cargo}/env"
38rustup toolchain install stable --profile minimal >/dev/null
39if [[ "$mode" == windows ]]; then
40 rustup target add x86_64-pc-windows-msvc >/dev/null
41 command -v cargo-xwin >/dev/null || cargo install cargo-xwin --locked >/dev/null
42fi
43rustc --version
44clang-21 --version | head -n 1