forked from vtolstov/cloudmeta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·36 lines (27 loc) · 998 Bytes
/
build
File metadata and controls
executable file
·36 lines (27 loc) · 998 Bytes
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
#!/bin/bash -x
ORG_PATH="github.com/vtolstov"
REPO_PATH="${ORG_PATH}/cloudmeta"
VERSION=`git describe --long`
BUILD_TIME=`date +%FT%T%z`
LDFLAGS="-X main.Version=${VERSION} -X main.BuildTime=${BUILD_TIME}"
rm -rf bin tmp
export GO15VENDOREXPERIMENT=1
export GOPATH=$(pwd)/gopath
export PATH=$(pwd)/goroot/bin:$PATH
mkdir -p $GOPATH
mkdir -p bin
mkdir -p tmp
go version | grep -q devel
if [ "x$?" != "x0" ]; then
export GOROOT=$(pwd)/goroot
mkdir -p $GOROOT
wget -q https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz -O tmp/go.tar.gz
tar --strip-components=1 -C $GOROOT -xf tmp/go.tar.gz
fi
if [ ! -h $GOPATH/src/${REPO_PATH} ]; then
mkdir -p $GOPATH/src/${ORG_PATH}
ln -sv ../../../.. $GOPATH/src/${REPO_PATH} || echo "exit 255"
fi
set -e
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -tags netgo -o bin/svirtnet ${REPO_PATH}
#GOOS=linux GOARCH=amd64 go build -race -ldflags "${LDFLAGS}" -tags netgo -o bin/svirtnet-race ${REPO_PATH}