-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
30 lines (28 loc) · 1.05 KB
/
build.ps1
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
$oses = @("windows", "darwin", "linux")
$arches = @("amd64", "386", "arm")
foreach ($os in $oses) {
foreach ($arch in $arches) {
if (($arch -eq "arm" -and $os -eq "linux") -or ($arch -ne "arm")) {
# Delete any existing binary
if ($os -eq "windows") {
if (Test-Path binaries\tcmd-$os-$arch.exe -PathType Leaf) {
rm binaries\tcmd-$os-$arch.exe
}
} else {
if (Test-Path binaries\tcmd-$os-$arch -PathType Leaf) {
rm binaries\tcmd-$os-$arch
}
}
# Build the new binary
$env:GOOS = $os
$env:GOARCH = $arch
go build -v -o binaries\tcmd-$os-$arch
# Rename to .exe if it's windows
if ($os -eq "windows") {
mv binaries\tcmd-$os-$arch binaries\tcmd-$os-$arch.exe
}
}
}
}
Copy-Item .\binaries\tcmd-windows-amd64.exe .\binaries\tcmd.exe
Copy-Item .\binaries\tcmd-windows-386.exe .\binaries\tcmd_32bit.exe