From 97a8032cd541ea850e21079368892ce72e727e19 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Wed, 7 Oct 2026 11:26:44 -0400 Subject: [PATCH] Build steam for aarch64 on Valve's native arm64 client Arch ships steam for x86_64 only, so on AArch64 `omarchy-pkg-add steam` found nothing. This aarch64 build installs the same Valve launcher files (desktop entry, icons, steam-devices udev rules) but replaces the x86 bootstrap with Valve's native arm64 client, which then updates itself from the stable steam_client_linuxarm64 channel. The bootstrap is just the client binary, which links only glibc, taken from the manifest's bins_linuxarm64_linuxarm64 zip and pinned to the sha2 the manifest publishes. /usr/bin/steam unpacks it on first launch, keeps the ~/.steam links the client requires, and restarts the client when it exits with 42 after updating. Valve's bin_steam.sh cannot do this: it only knows the ubuntu12_32 bootstrap. Beyond Arch's dependencies the client needs gtk2 and libibus for its UI, and lsof, which it runs to find its own IPC ports. --- pkgbuilds/steam/.omarchy/package.json | 3 + pkgbuilds/steam/PKGBUILD | 129 ++++++++++++++++++++++++++ pkgbuilds/steam/steam.sh | 42 +++++++++ 3 files changed, 174 insertions(+) create mode 100644 pkgbuilds/steam/.omarchy/package.json create mode 100644 pkgbuilds/steam/PKGBUILD create mode 100644 pkgbuilds/steam/steam.sh diff --git a/pkgbuilds/steam/.omarchy/package.json b/pkgbuilds/steam/.omarchy/package.json new file mode 100644 index 0000000..2a9719d --- /dev/null +++ b/pkgbuilds/steam/.omarchy/package.json @@ -0,0 +1,3 @@ +{ + "source": "local" +} diff --git a/pkgbuilds/steam/PKGBUILD b/pkgbuilds/steam/PKGBUILD new file mode 100644 index 0000000..8abce39 --- /dev/null +++ b/pkgbuilds/steam/PKGBUILD @@ -0,0 +1,129 @@ +# Maintainer: Ryan Hughes +# Contributor: Levente Polyak +# Contributor: Giancarlo Razzolini +# Contributor: Christian Heusel +# +# Arch builds steam for x86_64 only; this is the aarch64 build. It installs +# the same Valve launcher files (desktop entry, icons, udev rules) but swaps +# the x86 bootstrap for Valve's native arm64 client, which then updates itself +# from Valve's linuxarm64 client channel. _client is the client build the +# bootstrap was taken from; it only matters for the first launch, so it moves +# with the launcher rather than with every client release. + +pkgbase=steam +pkgname=(steam steam-devices) +pkgver=1.0.0.87 +pkgrel=1 +_client=1788652215 +_client_zip=bins_linuxarm64_linuxarm64.zip.dc817d33f8308815bf4fde6a3cb61fd4529728c8 +pkgdesc="Valve's digital software delivery system" +url='https://steampowered.com/' +arch=('aarch64') +license=('LicenseRef-steam-subscriber-agreement') +# the beta directory is a superset of stable and also contains the stable releases +source=( + "https://repo.steampowered.com/$pkgbase/archive/beta/${pkgbase}_$pkgver.tar.gz" + "$pkgbase-client-$_client.zip::https://client-update.steamstatic.com/$_client_zip" + steam.sh +) +noextract=("$pkgbase-client-$_client.zip") +# The client checksum is the sha2 Valve's steam_client_linuxarm64 manifest +# publishes for that zip. +sha256sums=('649375d2f9377f8009aaf3e2ff09978041eb9114897d9c5a3886f1d82e27ba1f' + 'c2d7c0ecb8de7e209504cd657b785127cd1ac3d905668c296e87c360b2b54163' + '6f8d705e7d615b2debf8449898c51ad687136cd8f6605ef3c7573b4aa768e342') + +build() { + # The arm64 counterpart of Valve's bootstraplinux_ubuntu12_32.tar.xz. The + # client binary links only glibc and downloads the rest of Steam itself. + mkdir -p bootstrap + bsdtar -xf "$pkgbase-client-$_client.zip" -C bootstrap steamrtarm64/steam + chmod 755 bootstrap/steamrtarm64 bootstrap/steamrtarm64/steam + tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=0 --group=0 --numeric-owner \ + -cJf bootstraplinux_linuxarm64.tar.xz -C bootstrap steamrtarm64 +} + +package_steam() { + # Libraries the arm64 client links against from the host, plus lsof, which + # the client runs to find its own IPC ports. + depends=( + alsa-lib + at-spi2-core + bash + cairo + coreutils + dbus + fontconfig + freetype2 + gdk-pixbuf2 + glib2 + glibc + gtk2 + hicolor-icon-theme + libcups + libdrm + libgcc + libglvnd + libibus + libnm + libpipewire + libpulse + libsm + libstdc++ + libva + libvdpau + libx11 + libxcomposite + libxdamage + libxext + libxfixes + libxi + libxinerama + libxkbcommon + libxrandr + libxrender + libxtst + lsof + mesa + nss + openal + pango + sdl2-compat + systemd-libs + tar + ttf-font + vulkan-driver + vulkan-icd-loader + xdg-user-dirs + xz + ) + optdepends=( + 'ntsync-autoload: for NTSync support' + 'polkit: to setup SteamVR without root access' + 'xdg-desktop-portal-impl: file & folder picker' + 'xorg-fonts-misc: for non-latin locales' + ) + depends+=(steam-devices) + + cd "$pkgbase-launcher" + make DESTDIR="$pkgdir" install-docs install-icons install-desktop install-appdata + + install -Dm755 "$srcdir/steam.sh" "$pkgdir/usr/bin/steam" + install -Dm644 "$srcdir/bootstraplinux_linuxarm64.tar.xz" -t "$pkgdir/usr/lib/steam" + + install -d "$pkgdir/usr/share/licenses/$pkgname" + ln -s "../../doc/$pkgname/steam_subscriber_agreement.txt" "$pkgdir/usr/share/licenses/$pkgname/" + install -Dm644 debian/changelog -t "$pkgdir/usr/share/doc/$pkgname" +} + +package_steam-devices() { + pkgdesc="List of devices Steam and SteamVR will want read/write permissions on" + license=(MIT) + depends=(udev) + + cd "$srcdir/$pkgbase-launcher/subprojects/steam-devices" + + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + install -Dm644 60-steam-input.rules "$pkgdir/usr/lib/udev/rules.d/60-steam-input.rules" + install -Dm644 60-steam-vr.rules "$pkgdir/usr/lib/udev/rules.d/60-steam-vr.rules" +} diff --git a/pkgbuilds/steam/steam.sh b/pkgbuilds/steam/steam.sh new file mode 100644 index 0000000..4115572 --- /dev/null +++ b/pkgbuilds/steam/steam.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Launches Valve's native arm64 Steam client. +# +# Valve's own launcher (bin_steam.sh) only knows the x86 bootstrap, so this +# does its job for linuxarm64: unpack the client on first run, keep the +# ~/.steam links the client refuses to start without, and start the client +# again whenever it exits asking to be restarted after updating itself. + +set -euo pipefail + +bootstrap=/usr/lib/steam/bootstraplinux_linuxarm64.tar.xz +# The exit status Steam uses to ask to be started again. +restart_status=42 + +if [[ $(id -u) == 0 ]]; then + echo "steam: cannot run as root" >&2 + exit 1 +fi + +# Like Valve's launcher, follow ~/.steam/steam when it points at a working +# install, so a library that was moved keeps working. +steamroot=$(readlink -e "$HOME/.steam/steam" || true) +if [[ -z $steamroot || ! -x $steamroot/steamrtarm64/steam ]]; then + steamroot=${XDG_DATA_HOME:-$HOME/.local/share}/Steam + if [[ ! -x $steamroot/steamrtarm64/steam ]]; then + (umask 077 && mkdir -p "$steamroot" && tar -xJf "$bootstrap" -C "$steamroot") + fi +fi + +mkdir -p "$HOME/.steam" +ln -sfn "$steamroot" "$HOME/.steam/steam" +ln -sfn "$steamroot" "$HOME/.steam/root" +# The arm64 counterpart of the sdk32/sdk64 links steam.sh makes for games +# that load the Steam API from ~/.steam. +ln -sfn "$steamroot/linuxarm64" "$HOME/.steam/sdkarm64" + +cd "$steamroot" +while :; do + status=0 + "$steamroot/steamrtarm64/steam" "$@" || status=$? + ((status == restart_status)) || exit "$status" +done