Permalink
Browse files

Improve build script

  • Loading branch information...
abh committed Feb 13, 2017
1 parent 7a0e8cc commit 80440db4bb75052e3c97f93b1e9b574fb582dc59
Showing with 31 additions and 4 deletions.
  1. +21 −1 Makefile
  2. +10 −3 build
View
@@ -5,10 +5,30 @@ templates.go: templates/*.html monitor.go
go generate
test:
go test -race $(go list ./... | grep -v /vendor/)
go test $(shell go list ./... | grep -v /vendor/)
testrace:
go test -race $(shell go list ./... | grep -v /vendor/)
devel:
go build -tags devel
bench:
go test -check.b -check.bmem
TARS=$(wildcard geodns-*-*.tar)
push: $(TARS) tmp-install.sh
rsync -avz tmp-install.sh $(TARS) x3.dev:webtmp/2016/07/
builds: linux-build linux-build-i386 freebsd-build push
linux-build:
docker run --rm -v `pwd`:/go/src/github.com/abh/geodns geodns-build ./build
linux-build-i386:
docker run --rm -v `pwd`:/go/src/github.com/abh/geodns geodns-build-i386 ./build
freebsd-build:
ssh 192.168.64.5 'cd go/src/github.com/abh/geodns; GOPATH=~/go ./build'
ssh root@192.168.64.5 'jexec -U ask fbsd32 /home/ask/build'
View
13 build
@@ -1,8 +1,15 @@
#!/bin/sh
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
go build \
-ldflags "-X main.gitVersion $REVISION -X main.buildTime $BUILDTIME" \
-v
OS=`go env GOOS`
ARCH=`go env GOARCH`
go build -i -o geodns-$OS-$ARCH \
-ldflags "-X main.gitVersion=$REVISION -X main.buildTime=$BUILDTIME" \
-v && \
(cd geodns-influxdb && go build -i -v -o geodns-influxdb-$OS-$ARCH && cd ..) && \
tar cvf geodns-$OS-$ARCH.tar geodns-$OS-$ARCH geodns-influxdb/geodns-influxdb-$OS-$ARCH service service-influxdb

0 comments on commit 80440db

Please sign in to comment.