Files
leleka/scripts/windows/build-release.ps1
T

46 lines
2.3 KiB
PowerShell

# Build the Leleka binaries natively for x86_64-pc-windows-msvc and collect them in dist\bin.
#
# powershell -ExecutionPolicy Bypass -File scripts\windows\build-release.ps1 [-OutDir dist] [-NoSm86]
#
# Needs: Rust 1.99 (rust-toolchain.toml pins it), Visual Studio Build Tools (MSVC linker and cl.exe for the ggml C
# bridge of strata-next). No CUDA toolkit: every PTX image is sealed in the repository and nvcuda.dll comes with the
# NVIDIA driver. The default build carries the sm86 companions (RTX 30-series, e.g. the 3080 laptop); -NoSm86 builds
# the sm_120-only variant.
#
# Produces dist\bin\{leleka,strata-next,leleka-inference,leleka-daemon,leleka-cli,leleka-seal-exec}.exe.
# leleka-seal-exec.exe is the stub that prints "sealed memfd archives require Linux": the Windows engine opens the KAR
# archive as a read-only file (kar_source=file), so nothing runs it; it is copied only because `leleka` lists six binaries.
param(
[string]$OutDir = "dist",
[switch]$NoSm86
)
$ErrorActionPreference = "Stop"
$root = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
Set-Location $root
function Invoke-Cargo {
& cargo @args
if ($LASTEXITCODE -ne 0) { throw "cargo $($args -join ' ') failed with exit code $LASTEXITCODE" }
}
$features = @()
if (-not $NoSm86) { $features = @("--features", "sm86") }
Invoke-Cargo build --release --locked -p strata-desktop-core @features --bin leleka-inference --bin leleka-daemon --bin leleka-cli --bin leleka-seal-exec
Invoke-Cargo build --release --locked -p strata-control --bin strata-next
Invoke-Cargo build --release --locked -p leleka-deploy --bin leleka
$target = if ($env:CARGO_TARGET_DIR) { $env:CARGO_TARGET_DIR } else { Join-Path $root "target" }
$bin = Join-Path $OutDir "bin"
New-Item -ItemType Directory -Force -Path $bin | Out-Null
foreach ($name in "leleka", "strata-next", "leleka-inference", "leleka-daemon", "leleka-cli", "leleka-seal-exec") {
$source = Join-Path $target "release\$name.exe"
if (-not (Test-Path $source)) { throw "missing build output: $source" }
Copy-Item -Force $source (Join-Path $bin "$name.exe")
}
Get-ChildItem $bin | ForEach-Object {
$hash = (Get-FileHash -Algorithm SHA256 $_.FullName).Hash.ToLower()
"{0} {1} {2:N1} MiB" -f $hash, $_.Name, ($_.Length / 1MB)
}
Write-Host "binaries are in $((Resolve-Path $bin).Path)"