27 lines
1.3 KiB
PowerShell
27 lines
1.3 KiB
PowerShell
param([string]$Toolchain = $env:BOING_TOOLCHAIN)
|
|
$ErrorActionPreference = 'Stop'
|
|
if (!$Toolchain) { throw 'Specificare -Toolchain con la cartella che contiene bin e targets/m68k-amigaos.' }
|
|
$Toolchain = (Resolve-Path -LiteralPath $Toolchain).Path
|
|
$targetPath = Join-Path $Toolchain 'targets/m68k-amigaos'
|
|
$buildPath = Join-Path $PSScriptRoot 'build'
|
|
$configPath = Join-Path $buildPath 'vbcc'
|
|
New-Item -ItemType Directory -Path (Join-Path $configPath 'config') -Force | Out-Null
|
|
$config = [IO.File]::ReadAllText((Join-Path $PSScriptRoot 'vbcc-config.in')).Replace('@TARGET@', $targetPath.Replace('\','/'))
|
|
[IO.File]::WriteAllText((Join-Path $configPath 'config/boing'), $config)
|
|
$previousVBCC = $env:VBCC
|
|
$previousPath = $env:PATH
|
|
try {
|
|
$env:VBCC = $configPath
|
|
$env:PATH = (Join-Path $Toolchain 'bin') + ';' + $env:PATH
|
|
Push-Location -LiteralPath $PSScriptRoot
|
|
try {
|
|
& (Join-Path $Toolchain 'bin/vc.exe') +boing -O2 -c99 -o build/Boing boing.c
|
|
if ($LASTEXITCODE -ne 0) { throw 'Compilazione fallita.' }
|
|
Copy-Item -LiteralPath assets/background.bin,assets/sprites.bin,assets/Boing.info -Destination $buildPath -Force
|
|
} finally { Pop-Location }
|
|
} finally {
|
|
$env:VBCC = $previousVBCC
|
|
$env:PATH = $previousPath
|
|
}
|
|
Write-Output ('Pronto per Amiga: ' + $buildPath)
|