#!/usr/bin/env bash
# Install system packages needed for llvm-mos build, MAME usage, and general dev.

set -euo pipefail
source "$(dirname "$0")/common.sh"

APT_PACKAGES=(
    # llvm-mos build toolchain
    build-essential
    cmake
    ninja-build
    clang
    lld
    python3
    python3-pip
    git
    zlib1g-dev
    libedit-dev
    libxml2-dev
    libncurses-dev
    # archive handling (calypsi ships zst; rom zips; llvm-mos-sdk tar.xz;
    # GNO/ME ships as ShrinkIt .shk archives extracted by nulib2)
    zstd
    xz-utils
    unzip
    tar
    nulib2
    # MAME Lua scripting & debug
    lua5.4
    liblua5.4-dev
    # runtime utilities used by install scripts
    curl
    ca-certificates
)

log "installing apt packages (sudo required)"
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends "${APT_PACKAGES[@]}"

log "system dependencies installed"
