-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
30 lines (25 loc) · 1.09 KB
/
Copy pathbuild.ps1
File metadata and controls
30 lines (25 loc) · 1.09 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
# Build NodeOS release binaries (Linux amd64 + arm64) from Windows.
# NodeOS ships as a Linux appliance; there is no Windows build target.
# Local dev/testing on Windows: go run ./cmd/nodeosd --demo --listen 127.0.0.1:8080
param([switch]$Bundle)
$ErrorActionPreference = "Stop"
if (-not (Get-Command go -ErrorAction SilentlyContinue)) {
Write-Error "Go not found. Install it (winget install GoLang.Go) and retry."
exit 1
}
New-Item -ItemType Directory -Force dist | Out-Null
# vet against the linux target: internal/health uses syscall.Statfs, which
# does not exist on windows — the product only ships on linux anyway
$env:CGO_ENABLED = "0"
$env:GOOS = "linux"
go vet ./...
foreach ($arch in "amd64", "arm64") {
$env:GOARCH = $arch
go build -trimpath -ldflags "-s -w" -o "dist/nodeosd-linux-$arch" ./cmd/nodeosd
Write-Host "built dist/nodeosd-linux-$arch"
}
Remove-Item Env:GOOS, Env:GOARCH, Env:CGO_ENABLED
if ($Bundle) {
tar -czf dist/nodeos-bundle.tar.gz -C dist nodeosd-linux-amd64 nodeosd-linux-arm64 -C ../deploy install.sh
Write-Host "built dist/nodeos-bundle.tar.gz"
}