scripts: install the Linux prerequisites in one command (BUILD-LINUX-DEPS-INSTALLER) #1140

Open
github-bot wants to merge 2 commits from github-bot/gh-1140 into main AGit
Owner

@⁠PierreEbele on GitHub · 2026-11-24 19:10 UTC · original
PierreEbele:linux-deps-installer → main · +180 −1 · 2 files · 2 commits · open

Claimed in the coordination issue as: BUILD-LINUX-DEPS-INSTALLER (#14)

scripts/install_deps_linux.sh installs what docs/linux.md lists, in one command:

  • apt (Debian, Ubuntu and derivatives), dnf (Fedora) or pacman (Arch);
  • on apt, the newest llvm-21 or later the system's own sources have (llvm-22 on Debian 12 and 13, llvm-21 on Ubuntu 22.04 and 24.04, llvm-22 on 26.04), so no extra repository is needed;
  • optional packages (.NET SDK, ffmpeg, zenity, Tk) only where the distribution has them, with one warning line otherwise;
  • shows the commands and asks first; --dry-run only shows them, --yes doesn't ask, --minimal leaves the optional ones out;
  • afterwards it checks what the build needs: Python 3.12+, llvm-mc 21+ with AMDGPU, spirv-as/spirv-val, CMake 3.24+, Ninja, a C++ compiler, the Vulkan headers.

It touches nothing of the game and downloads only distribution packages. docs/linux.md gets one paragraph pointing at it, above the manual list (left as it was).

Tested (containers, as root):

  • debian:trixie, full install with --yes --minimal: every check ok (llvm-mc-22).
  • debian:bookworm, full install: everything installs; the check reports Python 3.11 as too old, as it should.
  • ubuntu:22.04, ubuntu:24.04, ubuntu:26.04, fedora:latest (45), archlinux:latest: --dry-run picks the expected packages.
  • A Debian 13 based desktop, --dry-run with sudo.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠PierreEbele** on GitHub · 2026-11-24 19:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140) `PierreEbele:linux-deps-installer` → `main` · +180 −1 · 2 files · 2 commits · open Claimed in the coordination issue as: BUILD-LINUX-DEPS-INSTALLER (#14) `scripts/install_deps_linux.sh` installs what `docs/linux.md` lists, in one command: - apt (Debian, Ubuntu and derivatives), dnf (Fedora) or pacman (Arch); - on apt, the newest `llvm-21` or later the system's own sources have (`llvm-22` on Debian 12 and 13, `llvm-21` on Ubuntu 22.04 and 24.04, `llvm-22` on 26.04), so no extra repository is needed; - optional packages (.NET SDK, ffmpeg, zenity, Tk) only where the distribution has them, with one warning line otherwise; - shows the commands and asks first; `--dry-run` only shows them, `--yes` doesn't ask, `--minimal` leaves the optional ones out; - afterwards it checks what the build needs: Python 3.12+, llvm-mc 21+ with AMDGPU, `spirv-as`/`spirv-val`, CMake 3.24+, Ninja, a C++ compiler, the Vulkan headers. It touches nothing of the game and downloads only distribution packages. `docs/linux.md` gets one paragraph pointing at it, above the manual list (left as it was). **Tested** (containers, as root): - `debian:trixie`, full install with `--yes --minimal`: every check ok (llvm-mc-22). - `debian:bookworm`, full install: everything installs; the check reports Python 3.11 as too old, as it should. - `ubuntu:22.04`, `ubuntu:24.04`, `ubuntu:26.04`, `fedora:latest` (45), `archlinux:latest`: `--dry-run` picks the expected packages. - A Debian 13 based desktop, `--dry-run` with sudo. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
scripts/install_deps_linux.sh installs what docs/linux.md lists with apt
(Debian, Ubuntu and derivatives), dnf or pacman. It takes the newest
llvm-21 or later the distribution packages, leaves out optional packages
it lacks, shows the commands and asks before running them (--dry-run,
--yes, --minimal), then checks Python 3.12+, llvm-mc with AMDGPU,
SPIRV-Tools, CMake 3.24+, Ninja, a C++ compiler and the Vulkan headers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With empty apt lists the installer ran apt-get update before its first
prompt, so answering no still changed the index. It now asks first
("Refresh the package lists now?"), puts apt-get update in the shown
plan otherwise, and one confirm() handles n, Enter and EOF as no.

Suggested by xel1uz in the review of #1140.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:39:58 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:25 UTC · original · approved these changes

Reviewed and verified. Adds scripts/install_deps_linux.sh supporting apt, dnf, and pacman with --dry-run, --minimal, and post-install tool verification for Python, LLVM/AMDGPU, SPIRV-Tools, and CMake. Clean-room compliant.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#pullrequestreview-6045877563) · **approved these changes** Reviewed and verified. Adds `scripts/install_deps_linux.sh` supporting apt, dnf, and pacman with `--dry-run`, `--minimal`, and post-install tool verification for Python, LLVM/AMDGPU, SPIRV-Tools, and CMake. Clean-room compliant.
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:13 UTC · original

Recommendation: [WAIT]

Reasoning: Adds scripts/install_deps_linux.sh, a one-command prerequisite installer for apt/dnf/pacman with --dry-run, --yes and --minimal that asks before installing. Useful, but it runs privileged package installs and has no tests and no independent run. Before merging, someone should post --dry-run output (and ideally a real run) from at least one distro per package manager to confirm the package names and LLVM selection logic. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main.

Impact level: 3/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#issuecomment-7143226569) **Recommendation:** [WAIT] **Reasoning:** Adds `scripts/install_deps_linux.sh`, a one-command prerequisite installer for apt/dnf/pacman with `--dry-run`, `--yes` and `--minimal` that asks before installing. Useful, but it runs privileged package installs and has no tests and no independent run. Before merging, someone should post `--dry-run` output (and ideally a real run) from at least one distro per package manager to confirm the package names and LLVM selection logic. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. **Impact level:** 3/10
Author
Owner

@⁠xel1uz on GitHub · 2026-11-24 20:39 UTC · original · reviewed

With empty apt lists, the installer runs apt-get update before the first prompt. I reproduced this on Ubuntu 26.04.1 (apt 3.2.1) using a temporary apt index and a local file: package source. Answering n on this revision still changed the index.

These four suggestions go together. They ask before refreshing an empty index, then show the resolved packages and ask before installing. With the fix, n, Enter, and EOF each produced zero apt-get calls and left the index contents and modification times unchanged. Answering yes then no refreshed once and skipped installation. I also checked --dry-run and --yes. The refresh used real apt; installs were simulated.

**@⁠xel1uz** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#pullrequestreview-6047030165) · **reviewed** With empty apt lists, the installer runs `apt-get update` before the first prompt. I reproduced this on Ubuntu 26.04.1 (apt 3.2.1) using a temporary apt index and a local `file:` package source. Answering `n` on this revision still changed the index. These four suggestions go together. They ask before refreshing an empty index, then show the resolved packages and ask before installing. With the fix, `n`, Enter, and EOF each produced zero `apt-get` calls and left the index contents and modification times unchanged. Answering yes then no refreshed once and skipped installation. I also checked `--dry-run` and `--yes`. The refresh used real apt; installs were simulated.
@ -0,0 +64,4 @@
case "$answer" in y|Y|yes|o|O|oui) return 0 ;; *) return 1 ;; esac
}
apt_has() { apt-cache show "$1" >/dev/null 2>&1; }
Author
Owner

@⁠xel1uz on GitHub · 2026-11-24 20:39 UTC · original

confirm() {
    local answer
    [ "$assume_yes" -eq 1 ] && return 0
    read -r -p "$1 [y/N] " answer || return 1
    case "$answer" in y|Y|yes|o|O|oui) return 0 ;; *) return 1 ;; esac
}

apt_has() { apt-cache show "$1" >/dev/null 2>&1; }
**@⁠xel1uz** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#discussion_r4686236882) ```suggestion confirm() { local answer [ "$assume_yes" -eq 1 ] && return 0 read -r -p "$1 [y/N] " answer || return 1 case "$answer" in y|Y|yes|o|O|oui) return 0 ;; *) return 1 ;; esac } apt_has() { apt-cache show "$1" >/dev/null 2>&1; } ```
@ -0,0 +79,4 @@
"${SUDO[@]}" apt-get update
else
plan "${SU}apt-get update"
fi
Author
Owner

@⁠xel1uz on GitHub · 2026-11-24 20:39 UTC · original

        say "Package lists are needed to choose an LLVM version: ${SU}apt-get update"
        confirm "Refresh the package lists now?" || { say "Nothing installed."; exit 1; }
        say "+ ${SU}apt-get update"
        "${SUDO[@]}" apt-get update
    else
        plan "${SU}apt-get update"
    fi
**@⁠xel1uz** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#discussion_r4686236902) ```suggestion say "Package lists are needed to choose an LLVM version: ${SU}apt-get update" confirm "Refresh the package lists now?" || { say "Nothing installed."; exit 1; } say "+ ${SU}apt-get update" "${SUDO[@]}" apt-get update else plan "${SU}apt-get update" fi ```
Author
Owner

@⁠xel1uz on GitHub · 2026-11-24 20:39 UTC · original
On scripts/install_deps_linux.sh line 88 (outdated):

@@ -0,0 +1,165 @@
+#!/usr/bin/env bash
+# Installs the Linux prerequisites of docs/linux.md ("Build the port") with the distribution's package manager:
+# Python 3.12+, llvm-mc 21+ with the AMDGPU target, SPIRV-Tools, CMake, Ninja, a C++ compiler and the Vulkan
+# headers and loader, plus the optional ones (.NET SDK, ffmpeg, zenity, Tk) where the distribution packages them.
+#
+#   scripts/install_deps_linux.sh             show what it will do, ask, then install
+#   scripts/install_deps_linux.sh --dry-run   only show the commands
+#   scripts/install_deps_linux.sh --yes       don't ask
+#   scripts/install_deps_linux.sh --minimal   leave out .NET, ffmpeg, zenity and Tk
+#
+# Supported: apt (Debian, Ubuntu and derivatives such as Parrot or Kali), dnf (Fedora), pacman (Arch). On apt it takes
+# the newest llvm-21 or later the system's own sources have (in November 2026: llvm-22 on Debian 12 and 13, llvm-21 on
+# Ubuntu 22.04 and 24.04, llvm-22 on Ubuntu 26.04), so no extra repository is needed. When the install is done it
+# checks what the build needs, Python 3.12+ included (Debian 12 and Ubuntu 22.04 ship 3.11 and 3.10).
+#
+# Nothing of the game is downloaded or touched; packages come from the distribution only.
+set -euo pipefail
+
+LLVM_MIN=21
+LLVM_TRY=(23 22 21)
+
+dry_run=0
+assume_yes=0
+minimal=0
+for arg in "$@"; do
+    case "$arg" in
+        --dry-run) dry_run=1 ;;
+        --yes|-y) assume_yes=1 ;;
+        --minimal) minimal=1 ;;
+        -h|--help) sed -n '2,16p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
+        *) echo "Unknown option: $arg (see --help)" >&2; exit 2 ;;
+    esac
+done
+
+say() { printf '%s\n' "$*"; }
+warn() { printf 'warning: %s\n' "$*" >&2; }
+die() { printf 'error: %s\n' "$*" >&2; exit 1; }
+
+if [ "$(id -u)" -eq 0 ]; then
+    SUDO=()
+elif command -v sudo >/dev/null 2>&1; then
+    SUDO=(sudo)
+else
+    die "run this as root or install sudo"
+fi
+
+SU=${SUDO[*]:+${SUDO[*]} }
+
+# Commands are collected first, shown, and run only after the user agrees.
+PLAN=()
+plan() { PLAN+=("$*"); }
+
+[ -r /etc/os-release ] || die "/etc/os-release is missing; see docs/linux.md for the package list"
+# shellcheck disable=SC1091
+. /etc/os-release
+ID=${ID:-unknown}
+ID_LIKE=${ID_LIKE:-}
+is_like() { case " $ID $ID_LIKE " in *" $1 "*) return 0 ;; esac; return 1; }
+
+apt_has() { apt-cache show "$1" >/dev/null 2>&1; }
+
+setup_apt() {
+    local llvm="" v
+    # Package lists that were never fetched (a fresh container) would make every package look missing.
+    if ! apt_has git; then
+        if [ "$dry_run" -eq 1 ]; then
+            die "apt has no package lists yet; run '${SU}apt-get update' first"
+        fi
+        say "+ ${SU}apt-get update"
+        "${SUDO[@]}" apt-get update
+    fi
+    for v in "${LLVM_TRY[@]}"; do
+        if apt_has "llvm-$v"; then llvm=$v; break; fi
+    done
+    [ -n "$llvm" ] || die "no llvm-$LLVM_MIN or newer in your apt sources; add LLVM's own repository (https://apt.llvm.org) and run this again"
+    local pkgs=(git python3 "llvm-$llvm" spirv-tools cmake ninja-build g++ libvulkan-dev)
+    local optional=()
+    if [ "$minimal" -eq 0 ]; then
+        for p in ffmpeg zenity python3-tk; do
+            if apt_has "$p"; then optional+=("$p"); else warn "$p isn't packaged here; skipped (optional)"; fi
+        done
+        if apt_has dotnet-sdk-10.0; then optional+=(dotnet-sdk-10.0)
+        elif apt_has dotnet-sdk-8.0; then optional+=(dotnet-sdk-8.0)
+        else warn ".NET SDK isn't packaged here; the assets stage needs it: https://learn.microsoft.com/dotnet/core/install/linux"
+        fi
+    fi
+    plan "${SU}apt-get update"
+    plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}"
    plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}"
**@⁠xel1uz** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#discussion_r4686236920) On `scripts/install_deps_linux.sh` line 88 (outdated): ```diff @@ -0,0 +1,165 @@ +#!/usr/bin/env bash +# Installs the Linux prerequisites of docs/linux.md ("Build the port") with the distribution's package manager: +# Python 3.12+, llvm-mc 21+ with the AMDGPU target, SPIRV-Tools, CMake, Ninja, a C++ compiler and the Vulkan +# headers and loader, plus the optional ones (.NET SDK, ffmpeg, zenity, Tk) where the distribution packages them. +# +# scripts/install_deps_linux.sh show what it will do, ask, then install +# scripts/install_deps_linux.sh --dry-run only show the commands +# scripts/install_deps_linux.sh --yes don't ask +# scripts/install_deps_linux.sh --minimal leave out .NET, ffmpeg, zenity and Tk +# +# Supported: apt (Debian, Ubuntu and derivatives such as Parrot or Kali), dnf (Fedora), pacman (Arch). On apt it takes +# the newest llvm-21 or later the system's own sources have (in November 2026: llvm-22 on Debian 12 and 13, llvm-21 on +# Ubuntu 22.04 and 24.04, llvm-22 on Ubuntu 26.04), so no extra repository is needed. When the install is done it +# checks what the build needs, Python 3.12+ included (Debian 12 and Ubuntu 22.04 ship 3.11 and 3.10). +# +# Nothing of the game is downloaded or touched; packages come from the distribution only. +set -euo pipefail + +LLVM_MIN=21 +LLVM_TRY=(23 22 21) + +dry_run=0 +assume_yes=0 +minimal=0 +for arg in "$@"; do + case "$arg" in + --dry-run) dry_run=1 ;; + --yes|-y) assume_yes=1 ;; + --minimal) minimal=1 ;; + -h|--help) sed -n '2,16p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + *) echo "Unknown option: $arg (see --help)" >&2; exit 2 ;; + esac +done + +say() { printf '%s\n' "$*"; } +warn() { printf 'warning: %s\n' "$*" >&2; } +die() { printf 'error: %s\n' "$*" >&2; exit 1; } + +if [ "$(id -u)" -eq 0 ]; then + SUDO=() +elif command -v sudo >/dev/null 2>&1; then + SUDO=(sudo) +else + die "run this as root or install sudo" +fi + +SU=${SUDO[*]:+${SUDO[*]} } + +# Commands are collected first, shown, and run only after the user agrees. +PLAN=() +plan() { PLAN+=("$*"); } + +[ -r /etc/os-release ] || die "/etc/os-release is missing; see docs/linux.md for the package list" +# shellcheck disable=SC1091 +. /etc/os-release +ID=${ID:-unknown} +ID_LIKE=${ID_LIKE:-} +is_like() { case " $ID $ID_LIKE " in *" $1 "*) return 0 ;; esac; return 1; } + +apt_has() { apt-cache show "$1" >/dev/null 2>&1; } + +setup_apt() { + local llvm="" v + # Package lists that were never fetched (a fresh container) would make every package look missing. + if ! apt_has git; then + if [ "$dry_run" -eq 1 ]; then + die "apt has no package lists yet; run '${SU}apt-get update' first" + fi + say "+ ${SU}apt-get update" + "${SUDO[@]}" apt-get update + fi + for v in "${LLVM_TRY[@]}"; do + if apt_has "llvm-$v"; then llvm=$v; break; fi + done + [ -n "$llvm" ] || die "no llvm-$LLVM_MIN or newer in your apt sources; add LLVM's own repository (https://apt.llvm.org) and run this again" + local pkgs=(git python3 "llvm-$llvm" spirv-tools cmake ninja-build g++ libvulkan-dev) + local optional=() + if [ "$minimal" -eq 0 ]; then + for p in ffmpeg zenity python3-tk; do + if apt_has "$p"; then optional+=("$p"); else warn "$p isn't packaged here; skipped (optional)"; fi + done + if apt_has dotnet-sdk-10.0; then optional+=(dotnet-sdk-10.0) + elif apt_has dotnet-sdk-8.0; then optional+=(dotnet-sdk-8.0) + else warn ".NET SDK isn't packaged here; the assets stage needs it: https://learn.microsoft.com/dotnet/core/install/linux" + fi + fi + plan "${SU}apt-get update" + plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}" ``` ```suggestion plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}" ```
Author
Owner

@⁠xel1uz on GitHub · 2026-11-24 20:39 UTC · original
On scripts/install_deps_linux.sh line 132 (outdated):

@@ -0,0 +1,165 @@
+#!/usr/bin/env bash
+# Installs the Linux prerequisites of docs/linux.md ("Build the port") with the distribution's package manager:
+# Python 3.12+, llvm-mc 21+ with the AMDGPU target, SPIRV-Tools, CMake, Ninja, a C++ compiler and the Vulkan
+# headers and loader, plus the optional ones (.NET SDK, ffmpeg, zenity, Tk) where the distribution packages them.
+#
+#   scripts/install_deps_linux.sh             show what it will do, ask, then install
+#   scripts/install_deps_linux.sh --dry-run   only show the commands
+#   scripts/install_deps_linux.sh --yes       don't ask
+#   scripts/install_deps_linux.sh --minimal   leave out .NET, ffmpeg, zenity and Tk
+#
+# Supported: apt (Debian, Ubuntu and derivatives such as Parrot or Kali), dnf (Fedora), pacman (Arch). On apt it takes
+# the newest llvm-21 or later the system's own sources have (in November 2026: llvm-22 on Debian 12 and 13, llvm-21 on
+# Ubuntu 22.04 and 24.04, llvm-22 on Ubuntu 26.04), so no extra repository is needed. When the install is done it
+# checks what the build needs, Python 3.12+ included (Debian 12 and Ubuntu 22.04 ship 3.11 and 3.10).
+#
+# Nothing of the game is downloaded or touched; packages come from the distribution only.
+set -euo pipefail
+
+LLVM_MIN=21
+LLVM_TRY=(23 22 21)
+
+dry_run=0
+assume_yes=0
+minimal=0
+for arg in "$@"; do
+    case "$arg" in
+        --dry-run) dry_run=1 ;;
+        --yes|-y) assume_yes=1 ;;
+        --minimal) minimal=1 ;;
+        -h|--help) sed -n '2,16p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
+        *) echo "Unknown option: $arg (see --help)" >&2; exit 2 ;;
+    esac
+done
+
+say() { printf '%s\n' "$*"; }
+warn() { printf 'warning: %s\n' "$*" >&2; }
+die() { printf 'error: %s\n' "$*" >&2; exit 1; }
+
+if [ "$(id -u)" -eq 0 ]; then
+    SUDO=()
+elif command -v sudo >/dev/null 2>&1; then
+    SUDO=(sudo)
+else
+    die "run this as root or install sudo"
+fi
+
+SU=${SUDO[*]:+${SUDO[*]} }
+
+# Commands are collected first, shown, and run only after the user agrees.
+PLAN=()
+plan() { PLAN+=("$*"); }
+
+[ -r /etc/os-release ] || die "/etc/os-release is missing; see docs/linux.md for the package list"
+# shellcheck disable=SC1091
+. /etc/os-release
+ID=${ID:-unknown}
+ID_LIKE=${ID_LIKE:-}
+is_like() { case " $ID $ID_LIKE " in *" $1 "*) return 0 ;; esac; return 1; }
+
+apt_has() { apt-cache show "$1" >/dev/null 2>&1; }
+
+setup_apt() {
+    local llvm="" v
+    # Package lists that were never fetched (a fresh container) would make every package look missing.
+    if ! apt_has git; then
+        if [ "$dry_run" -eq 1 ]; then
+            die "apt has no package lists yet; run '${SU}apt-get update' first"
+        fi
+        say "+ ${SU}apt-get update"
+        "${SUDO[@]}" apt-get update
+    fi
+    for v in "${LLVM_TRY[@]}"; do
+        if apt_has "llvm-$v"; then llvm=$v; break; fi
+    done
+    [ -n "$llvm" ] || die "no llvm-$LLVM_MIN or newer in your apt sources; add LLVM's own repository (https://apt.llvm.org) and run this again"
+    local pkgs=(git python3 "llvm-$llvm" spirv-tools cmake ninja-build g++ libvulkan-dev)
+    local optional=()
+    if [ "$minimal" -eq 0 ]; then
+        for p in ffmpeg zenity python3-tk; do
+            if apt_has "$p"; then optional+=("$p"); else warn "$p isn't packaged here; skipped (optional)"; fi
+        done
+        if apt_has dotnet-sdk-10.0; then optional+=(dotnet-sdk-10.0)
+        elif apt_has dotnet-sdk-8.0; then optional+=(dotnet-sdk-8.0)
+        else warn ".NET SDK isn't packaged here; the assets stage needs it: https://learn.microsoft.com/dotnet/core/install/linux"
+        fi
+    fi
+    plan "${SU}apt-get update"
+    plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}"
+}
+
+setup_dnf() {
+    local pkgs=(git python3 llvm spirv-tools cmake ninja-build gcc-c++ vulkan-headers vulkan-loader-devel)
+    local optional=()
+    if [ "$minimal" -eq 0 ]; then
+        for p in ffmpeg-free zenity python3-tkinter; do
+            if dnf -q info "$p" >/dev/null 2>&1; then optional+=("$p"); else warn "$p isn't available; skipped (optional)"; fi
+        done
+        if dnf -q info dotnet-sdk-10.0 >/dev/null 2>&1; then optional+=(dotnet-sdk-10.0)
+        elif dnf -q info dotnet-sdk-8.0 >/dev/null 2>&1; then optional+=(dotnet-sdk-8.0)
+        else warn ".NET SDK isn't available; the assets stage needs it"
+        fi
+    fi
+    plan "${SU}dnf install -y ${pkgs[*]} ${optional[*]}"
+}
+
+setup_pacman() {
+    local pkgs=(git python llvm spirv-tools cmake ninja gcc vulkan-headers vulkan-icd-loader)
+    [ "$minimal" -eq 0 ] && pkgs+=(dotnet-sdk ffmpeg zenity tk)
+    plan "${SU}pacman -S --needed --noconfirm ${pkgs[*]}"
+}
+
+if command -v apt-get >/dev/null 2>&1 && { is_like debian || is_like ubuntu; }; then
+    setup_apt
+elif command -v dnf >/dev/null 2>&1; then
+    setup_dnf
+elif command -v pacman >/dev/null 2>&1; then
+    setup_pacman
+else
+    die "no supported package manager (apt, dnf, pacman) on '$ID'; docs/linux.md lists what to install"
+fi
+
+say ""
+say "Detected: ${PRETTY_NAME:-$ID}"
+say "Commands:"
+for c in "${PLAN[@]}"; do say "  $c"; done
+say ""
+[ "$dry_run" -eq 1 ] && exit 0
+
+if [ "$assume_yes" -eq 0 ]; then
+    read -r -p "Run them? [y/N] " answer
+    case "$answer" in y|Y|yes|o|O|oui) ;; *) say "Nothing installed."; exit 1 ;; esac
+fi
confirm "Run them?" || { say "Nothing installed."; exit 1; }
**@⁠xel1uz** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#discussion_r4686236937) On `scripts/install_deps_linux.sh` line 132 (outdated): ```diff @@ -0,0 +1,165 @@ +#!/usr/bin/env bash +# Installs the Linux prerequisites of docs/linux.md ("Build the port") with the distribution's package manager: +# Python 3.12+, llvm-mc 21+ with the AMDGPU target, SPIRV-Tools, CMake, Ninja, a C++ compiler and the Vulkan +# headers and loader, plus the optional ones (.NET SDK, ffmpeg, zenity, Tk) where the distribution packages them. +# +# scripts/install_deps_linux.sh show what it will do, ask, then install +# scripts/install_deps_linux.sh --dry-run only show the commands +# scripts/install_deps_linux.sh --yes don't ask +# scripts/install_deps_linux.sh --minimal leave out .NET, ffmpeg, zenity and Tk +# +# Supported: apt (Debian, Ubuntu and derivatives such as Parrot or Kali), dnf (Fedora), pacman (Arch). On apt it takes +# the newest llvm-21 or later the system's own sources have (in November 2026: llvm-22 on Debian 12 and 13, llvm-21 on +# Ubuntu 22.04 and 24.04, llvm-22 on Ubuntu 26.04), so no extra repository is needed. When the install is done it +# checks what the build needs, Python 3.12+ included (Debian 12 and Ubuntu 22.04 ship 3.11 and 3.10). +# +# Nothing of the game is downloaded or touched; packages come from the distribution only. +set -euo pipefail + +LLVM_MIN=21 +LLVM_TRY=(23 22 21) + +dry_run=0 +assume_yes=0 +minimal=0 +for arg in "$@"; do + case "$arg" in + --dry-run) dry_run=1 ;; + --yes|-y) assume_yes=1 ;; + --minimal) minimal=1 ;; + -h|--help) sed -n '2,16p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + *) echo "Unknown option: $arg (see --help)" >&2; exit 2 ;; + esac +done + +say() { printf '%s\n' "$*"; } +warn() { printf 'warning: %s\n' "$*" >&2; } +die() { printf 'error: %s\n' "$*" >&2; exit 1; } + +if [ "$(id -u)" -eq 0 ]; then + SUDO=() +elif command -v sudo >/dev/null 2>&1; then + SUDO=(sudo) +else + die "run this as root or install sudo" +fi + +SU=${SUDO[*]:+${SUDO[*]} } + +# Commands are collected first, shown, and run only after the user agrees. +PLAN=() +plan() { PLAN+=("$*"); } + +[ -r /etc/os-release ] || die "/etc/os-release is missing; see docs/linux.md for the package list" +# shellcheck disable=SC1091 +. /etc/os-release +ID=${ID:-unknown} +ID_LIKE=${ID_LIKE:-} +is_like() { case " $ID $ID_LIKE " in *" $1 "*) return 0 ;; esac; return 1; } + +apt_has() { apt-cache show "$1" >/dev/null 2>&1; } + +setup_apt() { + local llvm="" v + # Package lists that were never fetched (a fresh container) would make every package look missing. + if ! apt_has git; then + if [ "$dry_run" -eq 1 ]; then + die "apt has no package lists yet; run '${SU}apt-get update' first" + fi + say "+ ${SU}apt-get update" + "${SUDO[@]}" apt-get update + fi + for v in "${LLVM_TRY[@]}"; do + if apt_has "llvm-$v"; then llvm=$v; break; fi + done + [ -n "$llvm" ] || die "no llvm-$LLVM_MIN or newer in your apt sources; add LLVM's own repository (https://apt.llvm.org) and run this again" + local pkgs=(git python3 "llvm-$llvm" spirv-tools cmake ninja-build g++ libvulkan-dev) + local optional=() + if [ "$minimal" -eq 0 ]; then + for p in ffmpeg zenity python3-tk; do + if apt_has "$p"; then optional+=("$p"); else warn "$p isn't packaged here; skipped (optional)"; fi + done + if apt_has dotnet-sdk-10.0; then optional+=(dotnet-sdk-10.0) + elif apt_has dotnet-sdk-8.0; then optional+=(dotnet-sdk-8.0) + else warn ".NET SDK isn't packaged here; the assets stage needs it: https://learn.microsoft.com/dotnet/core/install/linux" + fi + fi + plan "${SU}apt-get update" + plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}" +} + +setup_dnf() { + local pkgs=(git python3 llvm spirv-tools cmake ninja-build gcc-c++ vulkan-headers vulkan-loader-devel) + local optional=() + if [ "$minimal" -eq 0 ]; then + for p in ffmpeg-free zenity python3-tkinter; do + if dnf -q info "$p" >/dev/null 2>&1; then optional+=("$p"); else warn "$p isn't available; skipped (optional)"; fi + done + if dnf -q info dotnet-sdk-10.0 >/dev/null 2>&1; then optional+=(dotnet-sdk-10.0) + elif dnf -q info dotnet-sdk-8.0 >/dev/null 2>&1; then optional+=(dotnet-sdk-8.0) + else warn ".NET SDK isn't available; the assets stage needs it" + fi + fi + plan "${SU}dnf install -y ${pkgs[*]} ${optional[*]}" +} + +setup_pacman() { + local pkgs=(git python llvm spirv-tools cmake ninja gcc vulkan-headers vulkan-icd-loader) + [ "$minimal" -eq 0 ] && pkgs+=(dotnet-sdk ffmpeg zenity tk) + plan "${SU}pacman -S --needed --noconfirm ${pkgs[*]}" +} + +if command -v apt-get >/dev/null 2>&1 && { is_like debian || is_like ubuntu; }; then + setup_apt +elif command -v dnf >/dev/null 2>&1; then + setup_dnf +elif command -v pacman >/dev/null 2>&1; then + setup_pacman +else + die "no supported package manager (apt, dnf, pacman) on '$ID'; docs/linux.md lists what to install" +fi + +say "" +say "Detected: ${PRETTY_NAME:-$ID}" +say "Commands:" +for c in "${PLAN[@]}"; do say " $c"; done +say "" +[ "$dry_run" -eq 1 ] && exit 0 + +if [ "$assume_yes" -eq 0 ]; then + read -r -p "Run them? [y/N] " answer + case "$answer" in y|Y|yes|o|O|oui) ;; *) say "Nothing installed."; exit 1 ;; esac +fi ``` ```suggestion confirm "Run them?" || { say "Nothing installed."; exit 1; } ```
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-24 20:45 UTC · original

@⁠xel1uz thanks, you're right: the empty-index refresh ran before any prompt. Applied your four suggestions in 7eb78cf9. Checked in a debian:trixie container with empty apt lists: n and EOF exit 1 with no apt-get call and the lists directory still empty (0 files); y then n refreshes once and installs nothing; --dry-run with lists present shows apt-get update in the plan.

@⁠Deedlyy the --dry-run outputs per package manager are in the description (Ubuntu 22.04/24.04/26.04, Fedora 45, Arch), plus full installs on Debian 12 and 13 with the post-install check.

AI-assisted.

**@⁠PierreEbele** on GitHub · 2026-11-24 20:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1140#issuecomment-7144009206) @⁠xel1uz thanks, you're right: the empty-index refresh ran before any prompt. Applied your four suggestions in 7eb78cf9. Checked in a `debian:trixie` container with empty apt lists: `n` and EOF exit 1 with no `apt-get` call and the lists directory still empty (0 files); `y` then `n` refreshes once and installs nothing; `--dry-run` with lists present shows `apt-get update` in the plan. @⁠Deedlyy the `--dry-run` outputs per package manager are in the description (Ubuntu 22.04/24.04/26.04, Fedora 45, Arch), plus full installs on Debian 12 and 13 with the post-install check. AI-assisted.
github-bot force-pushed github-bot/gh-1140 from 7eb78cf9ec to b72251bf2c 2026-11-26 16:01:31 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1140/head:github-bot/gh-1140'
git switch 'github-bot/gh-1140'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1140'
git switch 'github-bot/gh-1140'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1140'
git switch 'github-bot/gh-1140'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1140'
git switch 'main'
git merge --squash 'github-bot/gh-1140'
git switch 'main'
git merge --ff-only 'github-bot/gh-1140'
git switch 'main'
git merge 'github-bot/gh-1140'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.