File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ BUILD_DIR=$( dirname " $0 " ) /build
4+ mkdir -p $BUILD_DIR
5+ cd $BUILD_DIR
6+
7+ sum=" sha1sum"
8+
9+ export GO111MODULE=on
10+ echo " BUILDING SAFEBOX"
11+ echo " Setting GO111MODULE to" $GO111MODULE
12+
13+ if ! hash sha1sum 2> /dev/null; then
14+ if ! hash shasum 2> /dev/null; then
15+ echo " I can't see 'sha1sum' or 'shasum'"
16+ echo " Please install one of them!"
17+ exit
18+ fi
19+ sum=" shasum"
20+ fi
21+
22+ UPX=false
23+ if hash upx 2> /dev/null; then
24+ UPX=true
25+ fi
26+
27+ VERSION=" 1.0.1"
28+ LDFLAGS=" -X main.VERSION=$VERSION -s -w"
29+ GCFLAGS=" "
30+
31+ # AMD64
32+ OSES=(linux darwin windows freebsd openbsd)
33+ for os in ${OSES[@]} ; do
34+ suffix=" "
35+ if [ " $os " == " windows" ]
36+ then
37+ suffix=" .exe"
38+ fi
39+ env CGO_ENABLED=0 GOOS=$os GOARCH=amd64 go build -mod=vendor -ldflags " $LDFLAGS " -gcflags " $GCFLAGS " -o safebox_${os} _amd64${suffix} github.com/xtaci/safebox
40+ if $UPX ; then upx -9 safebox_${os} _amd64${suffix} ; fi
41+ tar -zcf safebox-${os} -amd64-$VERSION .tar.gz safebox_${os} _amd64${suffix}
42+ $sum safebox-${os} -amd64-$VERSION .tar.gz
43+ done
44+
45+ # Apple M1 device
46+ env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -mod=vendor -ldflags " $LDFLAGS " -gcflags " $GCFLAGS " -o safebox_darwin_arm64$v github.com/xtaci/safebox
47+ tar -zcf safebox-darwin-arm64-$VERSION .tar.gz safebox_darwin_arm64
48+ $sum safebox-darwin-arm64-$VERSION .tar.gz
49+
50+ # ARM64
51+ env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=vendor -ldflags " $LDFLAGS " -gcflags " $GCFLAGS " -o safebox_linux_arm64 github.com/xtaci/safebox
52+ if $UPX ; then upx -9 safebox_linux_arm64 ; fi
53+ tar -zcf safebox-linux-arm64-$VERSION .tar.gz safebox_linux_arm64
54+ $sum safebox-linux-arm64-$VERSION .tar.gz
File renamed without changes.
You can’t perform that action at this time.
0 commit comments