-
Notifications
You must be signed in to change notification settings - Fork 191
/
build
executable file
·27 lines (22 loc) · 703 Bytes
/
build
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
#!/bin/sh
set -ex
echo building
# git describe --always --tags --dirty --long)
REVISION=`git rev-parse --short=5 HEAD`
BUILDTIME=`TZ=UTC date "+%Y-%m-%dT%H:%MZ"`
echo $REVISION > REVISION
OS=${GOOS:-`go env GOOS`}
ARCH=${GOARCH:-`go env GOARCH`}
set -ex
go build -o dist/geodns-$OS-$ARCH \
-trimpath \
-ldflags "-X main.gitVersion=$REVISION -X main.buildTime=$BUILDTIME" \
-v && \
(cd geodns-logs && go build -trimpath -v -o ../dist/geodns-logs-$OS-$ARCH && cd ..) && \
cd dist && \
rm -f service service-logs && \
ln -s ../service . && \
ln -s ../service-logs . && \
tar -cvhf geodns-$OS-$ARCH.tar \
--exclude \*~ geodns-$OS-$ARCH \
geodns-logs-$OS-$ARCH service service-logs