-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
74 lines (63 loc) · 1.99 KB
/
build.ps1
File metadata and controls
74 lines (63 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Burnmail Build Script for Windows (PowerShell)
# Usage: .\build.ps1 [amd64|arm64|all]
param(
[string]$Platform = "amd64"
)
$BinaryName = "burnmail"
$Version = "1.4.1"
Write-Host "🔨 Building Burnmail v$Version for Windows" -ForegroundColor Cyan
Write-Host ""
function Write-Success {
param([string]$Message)
Write-Host "✓ $Message" -ForegroundColor Green
}
function Write-Info {
param([string]$Message)
Write-Host "$Message" -ForegroundColor Blue
}
function Build-Windows {
param([string]$Arch)
Write-Info "📦 Building for Windows $Arch..."
$env:GOOS = "windows"
$env:GOARCH = $Arch
$OutputName = "$BinaryName-windows-$Arch.exe"
go build -ldflags="-s -w -X main.Version=$Version" -o $OutputName
if ($LASTEXITCODE -eq 0) {
Write-Success "Built: $OutputName"
} else {
Write-Host "✗ Build failed for $Arch" -ForegroundColor Red
exit 1
}
}
Write-Info "📦 Downloading dependencies..."
go mod download
go mod tidy
switch ($Platform.ToLower()) {
"amd64" {
Build-Windows "amd64"
}
"arm64" {
Build-Windows "arm64"
}
"all" {
Build-Windows "amd64"
Build-Windows "arm64"
}
default {
Write-Host "Unknown platform: $Platform" -ForegroundColor Red
Write-Host "Usage: .\build.ps1 [amd64|arm64|all]" -ForegroundColor Yellow
exit 1
}
}
Write-Host ""
Write-Success "🎉 Build complete!"
Write-Host ""
Write-Host "To install globally:" -ForegroundColor Yellow
Write-Host " Move the exe to C:\Windows\System32\" -ForegroundColor White
Write-Host " Or add current directory to PATH" -ForegroundColor White
Write-Host ""
Write-Host "To test:" -ForegroundColor Yellow
Write-Host " .\$BinaryName-windows-amd64.exe g" -ForegroundColor White
Write-Host " .\$BinaryName-windows-amd64.exe m" -ForegroundColor White
Write-Host " .\$BinaryName-windows-amd64.exe me" -ForegroundColor White
Write-Host " .\$BinaryName-windows-amd64.exe d" -ForegroundColor White