-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
37 lines (30 loc) · 759 Bytes
/
Copy pathbuild.ps1
File metadata and controls
37 lines (30 loc) · 759 Bytes
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
# Create the build folder if it doesn't exist
if (-not (Test-Path -Path .\build)) {
New-Item -ItemType Directory -Path .\build
}
# Specify target platforms
$platforms = @(
"windows/386",
"windows/amd64",
"linux/386",
"linux/amd64",
"linux/arm",
"linux/arm64",
"darwin/amd64",
"darwin/arm64"
)
# Loop through platforms and build
foreach ($platform in $platforms) {
Write-Host "Building for platform: $platform"
$os, $arch = $platform -split '/'
$outputName = "build/sleepsage_${os}_${arch}"
$env:GOOS = $os
$env:GOARCH = $arch
if ($os -eq "windows") {
$outputName += ".exe"
}
go build -o $outputName sleepsage.go
}
# Clear environment variables
$env:GOOS = ""
$env:GOARCH = ""