mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-12-27 10:12:16 +08:00
31 lines
No EOL
609 B
Bash
Executable file
31 lines
No EOL
609 B
Bash
Executable file
if [ ! -z $1 ]
|
|
then
|
|
SHA=$1
|
|
else
|
|
SHA=`git rev-parse HEAD`
|
|
fi
|
|
|
|
|
|
PKG=github.com/StackExchange/dnscontrol
|
|
DATE=`date +%s`
|
|
FLAGS="-s -w -X main.SHA=$SHA -X main.BuildTime=$DATE"
|
|
echo $FLAGS
|
|
set +e
|
|
echo 'Building Linux'
|
|
go build -o dnscontrol-Linux -ldflags "$FLAGS" $PKG
|
|
|
|
echo 'Building Windows'
|
|
export GOOS=windows
|
|
go build -o dnscontrol.exe -ldflags "$FLAGS" $PKG
|
|
|
|
echo 'Building Darwin'
|
|
export GOOS=darwin
|
|
go build -o dnscontrol-Darwin -ldflags "$FLAGS" $PKG
|
|
|
|
if [ "$COMPRESS" = "1" ]
|
|
then
|
|
echo 'Compressing executables'
|
|
upx dnscontrol.exe
|
|
upx dnscontrol-Linux
|
|
upx dnscontrol-Darwin
|
|
fi |