-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
49 lines (42 loc) · 1.38 KB
/
build.sh
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
#!/usr/bin/env bash
# Set bash strict mode
set -euo pipefail
IFS=$'\n\t'
# Binaries names
linux_amd64_file='gurl-linux-x86_64'
linux_arm64_file='gurl-linux-arm64'
mac_amd64_file='gurl-mac-x86_64'
mac_arm64_file='gurl-mac-arm64'
windows_amd64_file='gurl-windows-x86_64.exe'
windows_arm64_file='gurl-windows-arm64.exe'
# Show go version
go version
echo
# Linux
echo "------- Linux Build -------"
echo "- Building for amd64..."
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o "$linux_amd64_file"
gzip -f "$linux_amd64_file"
echo "- Building for arm64..."
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o "$linux_arm64_file"
gzip -f "$linux_arm64_file"
echo
# Mac
echo "------- Mac Build -------"
echo "- Building for amd64..."
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o "$mac_amd64_file"
gzip -f "$mac_amd64_file"
echo "- Building for arm64..."
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o "$mac_arm64_file"
gzip -f "$mac_arm64_file"
echo
# Windows
echo "------- Windows Build -------"
echo "- Building for amd64..."
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o "$windows_amd64_file"
gzip -f "$windows_amd64_file"
echo "- Building for arm64..."
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -o "$windows_arm64_file"
gzip -f "$windows_arm64_file"
echo
echo -e "Build successfully! :)"