-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.sh
45 lines (40 loc) · 1.61 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
#!/bin/bash
executable="iris-cli"
output="./bin"
input="./main.go"
# disable CGO
export CGO_ENABLED=0
# [-------Windows-------]
echo "Building windows binaries..."
# windows-x64
export GOOS=windows
export GOARCH=amd64
go build -ldflags="-s -w -X main.buildRevision=$(git rev-parse HEAD) -X main.buildTime=$(date +%s)" -o $output/$executable-windows-amd64.exe $input
# windows-x86
export GOOS=windows
export GOARCH=386
go build -ldflags="-s -w -X main.buildRevision=$(git rev-parse HEAD) -X main.buildTime=$(date +%s)" -o $output/$executable-windows-386.exe $input
# [---------Linux--------]
echo "Building linux binaries..."
# linux-x64
export GOOS=linux
export GOARCH=amd64
go build -ldflags="-s -w -X main.buildRevision=$(git rev-parse HEAD) -X main.buildTime=$(date +%s)" -o $output/$executable-linux-amd64 $input
# linux-x86
export GOOS=linux
export GOARCH=386
go build -ldflags="-s -w -X main.buildRevision=$(git rev-parse HEAD) -X main.buildTime=$(date +%s)" -o $output/$executable-linux-386 $input
# linux-arm64
export GOOS=linux
export GOARCH=arm64
go build -ldflags="-s -w -X main.buildRevision=$(git rev-parse HEAD) -X main.buildTime=$(date +%s)" -o $output/$executable-linux-arm64 $input
# linux-arm
export GOOS=linux
export GOARCH=arm
go build -ldflags="-s -w -X main.buildRevision=$(git rev-parse HEAD) -X main.buildTime=$(date +%s)" -o $output/$executable-linux-arm $input
# [---------OSX--------]
echo "Building darwin (osx) x64 binary..."
#darwin-x64
export GOOS=darwin
export GOARCH=amd64
go build -ldflags="-s -w -X main.buildRevision=$(git rev-parse HEAD) -X main.buildTime=$(date +%s)" -o $output/$executable-darwin-amd64 $input