Added a build script

This commit is contained in:
Иван Кузьменко 2025-09-04 06:39:10 +03:00
parent 01a000b9fa
commit 441fcc76df
3 changed files with 27 additions and 2 deletions

23
build.ps1 Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env pwsh
. ".\common.ps1"
$game_name = $env:GAME_NAME ?? "game"
New-Item -ItemType Directory -Force -Path "./build/" | Out-Null
tar -cf "./build/$game_name.tar" -C $(Resolve-Path "./game/") *
$output = "./build/$game_name.exe"
[System.IO.File]::Copy("./lovedos/love.exe", $output, $true)
Add-Content $output -AsByteStream -Value $(Get-Content -Raw -AsByteStream $(Resolve-Path "./build/$game_name.tar"))
try {
$stream = $(Get-Item $output).Open([System.IO.FileMode]::Append)
$writer = [System.IO.BinaryWriter]::new($stream)
$tar = Get-Item "./build/$game_name.tar"
$writer.Write([Char[]] ('T', 'A', 'R', 0))
$writer.Write([Int32] ($tar.Length + 8))
} finally {
$writer.Dispose()
$stream.Dispose()
}