Skip to content

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

Merged
aslan2142 merged 2 commits into
ProjectLeonida:mainfrom
PierreEbele:linux-deps-installer
Dec 1, 2026
Merged

aslan2142 merged 2 commits into
ProjectLeonida:mainfrom
PierreEbele:linux-deps-installer

Conversation

@PierreEbele

Copy link
Copy Markdown
Contributor

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

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Deedlyy

Deedlyy commented Nov 24, 2026

Copy link
Copy Markdown

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

@xel1uz xel1uz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
apt_has() { apt-cache show "$1" >/dev/null 2>&1; }
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; }

Comment on lines +69 to +71
say "+ ${SU}apt-get update"
"${SUDO[@]}" apt-get update
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
say "+ ${SU}apt-get update"
"${SUDO[@]}" apt-get update
fi
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

Comment thread scripts/install_deps_linux.sh Outdated
Comment on lines +87 to +88
plan "${SU}apt-get update"
plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
plan "${SU}apt-get update"
plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}"
plan "${SU}apt-get install -y ${pkgs[*]} ${optional[*]}"

Comment thread scripts/install_deps_linux.sh Outdated
Comment on lines +129 to +132
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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; }

PierreEbele added a commit to PierreEbele/leonida-1 that referenced this pull request Nov 24, 2026
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 ProjectLeonida#1140.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PierreEbele

Copy link
Copy Markdown
Contributor Author

@xel1uz thanks, you're right: the empty-index refresh ran before any prompt. Applied your four suggestions in 7eb78cf. 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 and others added 2 commits November 26, 2026 16:58
…DEPS-INSTALLER)

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 <noreply@anthropic.com>
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 ProjectLeonida#1140.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zmasi

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

#1140 | head b72251b (merged cleanly with main adfb382) | bash -n scripts/install_deps_linux.sh + bash scripts/install_deps_linux.sh --help + mocked apt/dnf/pacman --dry-run & --minimal probes + python -I tests/test_docs_cli_flags.py | red on main: scripts/install_deps_linux.sh absent on main and docs/linux.md had only the manual Ubuntu apt install block | green on PR+main: bash -n exited 0, --help exited 0, invalid option exited 2, missing /etc/os-release exited 1, mocked Ubuntu apt (llvm-22 + dotnet-sdk-8.0, --minimal, and empty-apt-lists refusal rc=1), Fedora dnf, and Arch pacman --dry-run plans all matched docs/linux.md, plus 4 ran, OK (test_docs_cli_flags.py), 17 ran, OK (test_docs_links.py), 5 ran, OK (test_docs_repo_paths.py), 2 ran, OK (test_docs_table_rows.py), and 3 ran, OK (test_text_write_line_endings.py) | Windows 11 (10.0.26200.9974), Python 3.12.10, Git for Windows Bash | AI-assisted: yes

Audited b72251bf2c (scripts/install_deps_linux.sh and docs/linux.md) merged cleanly onto main (adfb3821a2) on Windows 11. Confirmed set -euo pipefail shell syntax, flag parsing (--dry-run, --yes/-y, --minimal, --help), empty-apt-index refusal under --dry-run before prompting, LLVM_TRY=(23 22 21) selection, .NET 10.0/8.0 fallback across apt and dnf, pure LF line endings, tests/test_docs_encoding.py, and scripts/check_no_game_data.py.

@TheGeogeo

Copy link
Copy Markdown
Contributor

Checked b72251bf2 merged (no commit) with main 87a39df94: Python 3.12.4, Windows 11 10.0.26300, CPU only.

  • Not testable here: scripts/install_deps_linux.sh is a Linux shell script, and I did not run it. This is diff reading only.

AI-assisted (Claude Code).

@TheGeogeo

Copy link
Copy Markdown
Contributor

Read at b72251b against main bd643e4 (diff reading only). This answers the "no test" question.

  • A docs and installer-script change: no failing test fits the CTest or Python suites. The script installs system packages, so a red/green would mean running it with mocked package managers in a Linux shell, which is what the mocked --dry-run / --minimal run above does.
  • The script is new, so main has nothing to compare against.
  • Merges cleanly with current main.

AI-assisted (Claude Code).

@OreoFR

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Read-only check by OreoFR on macOS 27.2.1 (26B131), Apple M5, main 7c330c7, PR head b72251b — not executed (apt installer, not runnable on macOS)

Verdict: read-only OK (needs a run on a Linux box for a real red/green).

AI-assisted: Claude Code

@aslan2142 aslan2142 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed scripts/install_deps_linux.sh and docs/linux.md: clean-room compliant, supports apt/dnf/pacman with --dry-run, --yes, --minimal, prompts before both empty-index refresh (addressing @xel1uz's review) and package installation, and validates the installed toolchain afterward. Merges cleanly onto main.

Not merging immediately because the Nov 24 CI run is stale/red (windows, linux-gpu-tools, translator-tests, check cancelled). Ready to merge once CI is re-run green on current main (note: LLVM_TRY=(23 22 21) already prefers llvm-23 when available; you may optionally update the LLVM 21+ note for the shaders stage to align with #1923).

(AI-assisted review.)

@aslan2142
aslan2142 merged commit 20fb2cc into ProjectLeonida:main Dec 1, 2026
6 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants