From fa27414defb435a767fef22d1267b51f3d8c9c1f Mon Sep 17 00:00:00 2001 From: Ethanw05 <46205865+Ethanw05@users.noreply.github.com> Date: Tue, 8 Sep 2026 20:10:34 -0600 Subject: [PATCH] Package Steam relay with Windows releases --- scripts/Build-Release.ps1 | 9 +++++++++ scripts/Build.ps1 | 6 +++++- scripts/Stage-SteamRelay.ps1 | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 scripts/Stage-SteamRelay.ps1 diff --git a/scripts/Build-Release.ps1 b/scripts/Build-Release.ps1 index d7c6b295..3238760a 100644 --- a/scripts/Build-Release.ps1 +++ b/scripts/Build-Release.ps1 @@ -18,6 +18,12 @@ try { # Link this invocation directly into private staging; never copy a generic cache EXE. & cargo rustc --release --locked --target x86_64-pc-windows-msvc --target-dir $TargetDirectory -p skate-game --bin skate3rust --no-default-features -- -C extra-filename= -o "$stage/skate3rust.exe" -C "link-arg=/PDB:$symbols/skate3rust.pdb" if ($LASTEXITCODE -ne 0) { throw 'Release compilation failed' } + & cargo build --release --locked --target x86_64-pc-windows-msvc --target-dir $TargetDirectory -p skate-steam-relay + if ($LASTEXITCODE -ne 0) { throw 'Steam relay compilation failed' } + & (Join-Path $PSScriptRoot 'Stage-SteamRelay.ps1') ` + -TargetDirectory $TargetDirectory ` + -BinDirectory $stage ` + -RelayExecutable (Join-Path $TargetDirectory 'x86_64-pc-windows-msvc/release/skate-steam-relay.exe') # rustc also emits a dep-info file beside -o; it contains local source paths. $depInfo = Join-Path $stage 'skate3rust.d' if (Test-Path -LiteralPath $depInfo) { Remove-Item -LiteralPath $depInfo } @@ -70,6 +76,9 @@ try { foreach ($name in @('skate3rust.exe', 'support/skate3setup.exe', 'support/skate3update.exe')) { $files[$name] = (Get-FileHash -LiteralPath (Join-Path $stage $name) -Algorithm SHA256).Hash.ToLower() } + foreach ($name in @('steam-relay/skate-steam-relay.exe', 'steam-relay/steam_api64.dll')) { + $files[$name] = (Get-FileHash -LiteralPath (Join-Path $stage $name) -Algorithm SHA256).Hash.ToLower() + } @{ schema = 1; repository = 'SK8-ENGINE/skate-3-rust-engine'; target = 'windows-x64' build = $build; tag = $tag; revision = (& git rev-parse HEAD).Trim(); files = $files diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 index f8bc82c4..9bcce4aa 100644 --- a/scripts/Build.ps1 +++ b/scripts/Build.ps1 @@ -4,7 +4,7 @@ $ErrorActionPreference = 'Stop' Push-Location $ProjectRoot try { if (-not $StageOnly) { - & cargo build -p skate-game --locked --target-dir $TargetDirectory + & cargo build -p skate-game -p skate-steam-relay --locked --target-dir $TargetDirectory if ($LASTEXITCODE -ne 0) { throw 'Build failed; see the compiler output above.' } } $debugDirectory = Join-Path $TargetDirectory 'debug' @@ -56,6 +56,10 @@ try { } } } + & (Join-Path $PSScriptRoot 'Stage-SteamRelay.ps1') -TargetDirectory $TargetDirectory -BinDirectory $binDirectory + foreach ($name in @('steam-relay/skate-steam-relay.exe', 'steam-relay/steam_api64.dll')) { + $staged += @{name = $name; sha256 = (Get-FileHash -LiteralPath (Join-Path $binDirectory $name) -Algorithm SHA256).Hash} + } $staged | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $binDirectory 'manifest.json') -Encoding UTF8 Write-Host "Ready: $binDirectory/skate3rust.exe" } finally { Pop-Location } diff --git a/scripts/Stage-SteamRelay.ps1 b/scripts/Stage-SteamRelay.ps1 new file mode 100644 index 00000000..46e399e1 --- /dev/null +++ b/scripts/Stage-SteamRelay.ps1 @@ -0,0 +1,20 @@ +param( + [string]$TargetDirectory = (Join-Path (Split-Path $PSScriptRoot -Parent) 'target'), + [string]$BinDirectory = (Join-Path (Split-Path $PSScriptRoot -Parent) 'bin'), + [string]$RelayExecutable = '' +) +$ErrorActionPreference = 'Stop' +$relayExecutable = if ($RelayExecutable) { $RelayExecutable } else { Join-Path $TargetDirectory 'debug/skate-steam-relay.exe' } +if (-not (Test-Path -LiteralPath $relayExecutable)) { throw 'Build skate-steam-relay before staging.' } +$relayMetadata = (& cargo metadata --format-version 1 --locked --filter-platform x86_64-pc-windows-msvc) -join "`n" +if ($LASTEXITCODE -ne 0) { throw 'Could not locate the locked Steam SDK redistributable.' } +$sdk = [regex]::Match($relayMetadata, '"name":"steamworks-sys","version":"0\.13\.0".*?"manifest_path":("(?:[^"\\]|\\.)*")') +if (-not $sdk.Success) { throw 'Expected steamworks-sys 0.13.0 in Cargo metadata.' } +$sdkManifest = ConvertFrom-Json -InputObject $sdk.Groups[1].Value +$steamDll = Join-Path (Split-Path -Parent $sdkManifest) 'lib/steam/redistributable_bin/win64/steam_api64.dll' +if (-not (Test-Path -LiteralPath $steamDll)) { throw "Missing Steam SDK DLL: $steamDll" } +$relayDirectory = Join-Path $BinDirectory 'steam-relay' +New-Item -ItemType Directory -Path $relayDirectory -Force | Out-Null +Copy-Item -LiteralPath $relayExecutable -Destination (Join-Path $relayDirectory 'skate-steam-relay.exe') -Force +Copy-Item -LiteralPath $steamDll -Destination (Join-Path $relayDirectory 'steam_api64.dll') -Force +Write-Host "Steam relay ready: $relayDirectory"