Add a build script
This commit is contained in:
parent
653bda0838
commit
3c99062536
1 changed files with 23 additions and 0 deletions
23
build.ps1
Normal file
23
build.ps1
Normal 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()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue