Files
OpenVR-AdvancedSettings-frame/build_scripts/steamframe/package-release.sh
T
matzmanandClaude Opus 5.5 d664f86945 Add layout diagnosis: font metrics in the log, --snapshot option
On the Steam Frame, the fixed 1200x800 QML layout overflows: about the
bottom quarter is cut off and the navigation icons overlap their text.
Forcing 96 DPI and switching the Quick Controls style didn't help, so the
cause has to be measured rather than guessed.

- SetWidget() logs the application font (family, pt, px), what 20 pt
  (MyText) is in px, the screen's DPI and the device pixel ratio.
- --snapshot <file> writes the rendered overlay (RenderBackend::readback)
  as PNG at most once per second while it is visible. A time interval,
  because OVRAS only renders when the scene changes. Written to a
  temporary file and renamed, so readers never see a partial file.
- run.sh passes arguments after the graphics API to the program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 00:06:09 +02:00

102 lines
4.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds OVRAS for the Steam Frame (aarch64) and packages it:
# dist/AdvancedSettings-<version>-linux-arm64/ (+ .tar.gz)
# The package uses SteamOS's own Qt (no Qt bundled). It contains the program
# folder as OVRAS expects it (binary, libopenvr_api.so, manifests, res/) plus
# install.sh, uninstall.sh, run.sh and README.txt. Adapted from the
# vrdashboard template.
#
# build_scripts/steamframe/package-release.sh [--no-build]
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root="$(cd "$here/../.." && pwd)"
build=1
for arg in "$@"; do
case "$arg" in
--no-build) build=0 ;;
*) echo "usage: $0 [--no-build]" >&2; exit 2 ;;
esac
done
# On the Frame itself build natively, elsewhere cross-compile.
if [[ "$(uname -m)" == aarch64 ]]; then mode=native; else mode=cross; fi
(( build )) && "$here/container-build.sh" "$mode"
exe=AdvancedSettings_app
bin="$root/build/steamframe-$mode/Release"
version="$(sed -n 's/^CMAKE_PROJECT_VERSION:[A-Z]*=//p' "$root/build/steamframe-$mode/CMakeCache.txt")"
[[ "$(file -b "$bin/$exe")" == *aarch64* ]] || { echo "$bin/$exe is not an aarch64 build" >&2; exit 1; }
package="AdvancedSettings-$version-linux-arm64"
out="$root/dist/$package"
rm -rf "$out" "$out.tar.gz"
mkdir -p "$out"
cp -a "$bin/." "$out/"
# The scripts start the program from the package folder: OVRAS writes its log
# (AdvancedSettings.log) to the working directory. Process names are cut to
# 15 characters, so running instances are found by command line.
cat > "$out/install.sh" <<EOF
#!/bin/sh
# Installs or updates OVR Advanced Settings: registers it with SteamVR (starts
# automatically with SteamVR from now on) and starts it now. SteamVR must be
# running. Works over SSH.
cd "\$(dirname "\$0")" || exit 1
# An update replaces the files of a running instance: stop it first.
pkill -f "/$exe( |\\\$)" 2>/dev/null && sleep 1
# OVRAS creates its QApplication before handling the manifest options, and
# Qt's default platform plugin (xcb) aborts without a display, e.g. over SSH.
# Registering draws nothing, so use the display-less "offscreen" plugin.
QT_QPA_PLATFORM=offscreen ./$exe --force-install-manifest || exit 1
# Start now. Over SSH there is no display; Qt needs one even for off-screen
# rendering, so use the Frame's (:0).
DISPLAY="\${DISPLAY:-:0}" nohup ./$exe >/dev/null 2>&1 &
echo "Installed and started."
EOF
cat > "$out/uninstall.sh" <<EOF
#!/bin/sh
# Unregisters OVR Advanced Settings from SteamVR and stops it. The folder can
# be deleted afterwards.
cd "\$(dirname "\$0")" || exit 1
pkill -f "/$exe( |\\\$)" 2>/dev/null
# No display needed for unregistering (see install.sh).
exec env QT_QPA_PLATFORM=offscreen ./$exe --force-remove-manifest
EOF
cat > "$out/run.sh" <<EOF
#!/bin/sh
# Restarts OVR Advanced Settings with the given graphics API, for testing.
# Further arguments go to the program:
# ./run.sh [opengl|vulkan] [options] (default: opengl)
# e.g. ./run.sh opengl --snapshot /tmp/ovras.png
cd "\$(dirname "\$0")" || exit 1
api="\${1:-opengl}"
[ \$# -gt 0 ] && shift
pkill -f "/$exe( |\\\$)" 2>/dev/null && sleep 1
DISPLAY="\${DISPLAY:-:0}" nohup ./$exe --graphics-api "\$api" "\$@" >/dev/null 2>&1 &
echo "Started with \$api; log: \$(pwd)/AdvancedSettings.log"
EOF
chmod +x "$out/install.sh" "$out/uninstall.sh" "$out/run.sh"
cat > "$out/README.txt" <<EOF
OVR Advanced Settings $version for the Steam Frame (SteamOS, aarch64)
Uses the system's Qt (SteamOS: Qt 6.8 or newer).
Install / update: ./install.sh (SteamVR must be running)
SteamVR remembers this folder's location: after moving it,
run ./install.sh again.
Uninstall: ./uninstall.sh
Test a graphics API: ./run.sh opengl | ./run.sh vulkan
Log: AdvancedSettings.log in the working directory (this folder
when started by the scripts)
License: GPL-3.0 (LICENSE); OpenVR: LICENSE-VALVE.
EOF
tar -C "$root/dist" -czf "$out.tar.gz" "$package"
echo "Release folder: $out"
echo "Archive: $out.tar.gz ($(du -h "$out.tar.gz" | cut -f1))"