mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-19 02:59:50 +00:00
chore: windows build script
This commit is contained in:
parent
17ba89ea03
commit
7cc5e9e41a
31
build.ps1
Normal file
31
build.ps1
Normal file
@ -0,0 +1,31 @@
|
||||
# Hysteria local build script for Windows (PowerShell)
|
||||
|
||||
$platforms = @("windows/amd64", "linux/amd64", "darwin/amd64")
|
||||
$ldflags = "-s -w"
|
||||
|
||||
if (!(Get-Command go -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "Error: go is not installed." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (Test-Path build) {
|
||||
Remove-Item -Recurse -Force build
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path build
|
||||
|
||||
Write-Host "Starting build..." -ForegroundColor Green
|
||||
|
||||
foreach ($platform in $platforms) {
|
||||
$env:GOOS = $platform.Split("/")[0]
|
||||
$env:GOARCH = $platform.Split("/")[1]
|
||||
Write-Host "Building $env:GOOS/$env:GOARCH" -ForegroundColor Green
|
||||
$output = "build/hysteria-$env:GOOS-$env:GOARCH"
|
||||
if ($env:GOOS -eq "windows") {
|
||||
$output = "$output.exe"
|
||||
}
|
||||
go build -o $output -ldflags $ldflags ./cmd/
|
||||
}
|
||||
|
||||
Write-Host "Build complete." -ForegroundColor Green
|
||||
|
||||
Get-ChildItem -Path build | Format-Table -AutoSize
|
Loading…
x
Reference in New Issue
Block a user