#!/usr/bin/env bash # Builds OVRAS for the Steam Frame (aarch64) and packages it: # dist/AdvancedSettings--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" </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" </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" </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" <