-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·48 lines (37 loc) · 743 Bytes
/
build.sh
File metadata and controls
executable file
·48 lines (37 loc) · 743 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
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -euo pipefail
ARCH="$1" # in `uname -m` format
ROOT_DIR=$(dirname "$0")
VERSION=${VERSION:-HEAD}
cd "$ROOT_DIR"
mkdir -p build
case $ARCH in
source)
git clean -fdx -e build
go mod vendor
tar --create --zst --exclude build --file build/host-spawn-vendor.tar.zst "$ROOT_DIR"
exit
;;
i386 | i686)
GOARCH=386
;;
x86_64)
GOARCH=amd64
;;
armv7)
GOARCH=arm
;;
aarch64)
GOARCH=arm64
;;
loongarch64)
GOARCH=loong64
;;
*)
GOARCH=$ARCH
;;
esac
export GOARCH
CGO_ENABLED=0 go build \
-ldflags "-X main.Version=$VERSION" \
-o "build/host-spawn-$ARCH"