chore: add Windows build and service scripts

This commit is contained in:
coolxll
2026-03-25 22:32:22 +08:00
parent c09fdddaa1
commit 8020723985
5 changed files with 229 additions and 0 deletions

31
scripts/build.ps1 Normal file
View File

@@ -0,0 +1,31 @@
param(
[string]$OutputDir = "dist",
[string]$BinaryName = "lingma-ipc-proxy.exe",
[switch]$Clean
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$distDir = Join-Path $repoRoot $OutputDir
$binaryPath = Join-Path $distDir $BinaryName
if ($Clean -and (Test-Path $distDir)) {
Remove-Item -Recurse -Force $distDir
}
New-Item -ItemType Directory -Force $distDir | Out-Null
Push-Location $repoRoot
try {
$env:CGO_ENABLED = "0"
$env:GOOS = "windows"
$env:GOARCH = "amd64"
Write-Host "Building $binaryPath"
go build -trimpath -ldflags "-s -w" -o $binaryPath .\cmd\lingma-ipc-proxy
Write-Host "Build completed: $binaryPath"
}
finally {
Pop-Location
}