diff --git a/scripts/build_steam.sh b/scripts/build_steam.sh new file mode 100755 index 00000000..5ff66849 --- /dev/null +++ b/scripts/build_steam.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$SCRIPT_DIR/.." +IMAGE="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest" + +docker run --rm \ + --platform linux/amd64 \ + -v "$PROJECT_ROOT":/app \ + -w /app \ + "$IMAGE" \ + bash -c ' +set -euo pipefail + +echo "==> Installing build dependencies..." +apt-get update -qq +apt-get install -y -qq \ + clang cmake meson ninja-build pkg-config nasm git curl unzip xz-utils \ + libgtk-3-dev liblzma-dev \ + libasound2-dev libass-dev libfreetype-dev libfontconfig-dev libfribidi-dev libharfbuzz-dev \ + libepoxy-dev libegl-dev libgl-dev libgnutls28-dev \ + libpipewire-0.3-dev libva-dev libvdpau-dev \ + libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxpresent-dev \ + libxkbcommon-dev libpulse-dev libdbus-1-dev libdrm-dev libgbm-dev \ + libwayland-dev wayland-protocols liblcms2-dev python3-pip \ + +pip3 install meson --upgrade + +echo "" +echo "==> Building libmpv..." +bash linux/packaging/build-libmpv.sh + +export PKG_CONFIG_PATH="$(pwd)/libmpv-prefix/lib/pkgconfig:$(pwd)/libmpv-prefix/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH:-}" + +echo "" +echo "==> Installing Flutter..." +git clone --depth 1 --branch stable https://github.com/flutter/flutter.git /opt/flutter +export PATH="/opt/flutter/bin:$PATH" +flutter --disable-analytics +flutter config --no-cli-animations +flutter precache --linux + +echo "" +echo "==> Building Plezy..." +flutter pub get +flutter build linux --release --dart-define=ENABLE_UPDATE_CHECK=true + +echo "" +echo "==> Assembling Steam bundle..." +BUNDLE=build/linux/x64/release/bundle + +# Copy libmpv + shaderc into bundle +BUNDLE_LIB="$BUNDLE/lib" +LIBMPV_DIR=$(dirname "$(find libmpv-prefix -name libmpv.so | head -1)") +cp -a "$LIBMPV_DIR"/libmpv.so* "$BUNDLE_LIB/" +cp -a libmpv-prefix/lib/libshaderc_shared.so* "$BUNDLE_LIB/" + +# For Steam, do NOT run bundle-libs.sh — the runtime provides system libs. +# Only verify the binary can resolve deps against the runtime. +echo "" +echo "==> Checking dependencies..." +MISSING=$(LD_LIBRARY_PATH="$BUNDLE_LIB" ldd "$BUNDLE/plezy" 2>&1 | grep "not found" || true) +if [[ -n "$MISSING" ]]; then + echo "WARNING: Unresolved dependencies (will need Steam runtime):" + echo "$MISSING" +fi + +echo "" +echo "==> Creating tarball..." +cd "$BUNDLE" +tar -czf /app/plezy-steam-linux-x64.tar.gz * + +echo "" +echo "==> Done! Output: plezy-steam-linux-x64.tar.gz" +' diff --git a/scripts/steam_deploy.sh b/scripts/steam_deploy.sh index 138885f2..0994c2bb 100755 --- a/scripts/steam_deploy.sh +++ b/scripts/steam_deploy.sh @@ -26,10 +26,14 @@ else fi mv "$WORK"/plezy-windows-x64-portable "$WORK/windows" -echo "Downloading Linux build..." -gh release download "$TAG" --repo "$REPO" -p "plezy-linux-x64.tar.gz" -D "$WORK" +echo "Extracting Linux Steam build..." +STEAM_TARBALL="$SCRIPT_DIR/../plezy-steam-linux-x64.tar.gz" +if [[ ! -f "$STEAM_TARBALL" ]]; then + echo "Error: $STEAM_TARBALL not found. Run build_steam.sh first." >&2 + exit 1 +fi mkdir -p "$WORK/linux" -tar xzf "$WORK/plezy-linux-x64.tar.gz" -C "$WORK/linux" +tar xzf "$STEAM_TARBALL" -C "$WORK/linux" # Generate VDF files cat > "$WORK/app_build.vdf" <