forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·27 lines (20 loc) · 761 Bytes
/
build
File metadata and controls
executable file
·27 lines (20 loc) · 761 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
#!/bin/sh -e
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/etcd"
export GOPATH=${PWD}/gopath
rm -f $GOPATH/src/${REPO_PATH}
mkdir -p $GOPATH/src/${ORG_PATH}
ln -s ${PWD} $GOPATH/src/${REPO_PATH}
eval $(go env)
GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"`
IFS=' ' read -a ver <<< "$(go version)"
IFS='.' read -a ver <<< ${ver[2]}
IFS=' ' read -a ver <<< ${ver}
if [[ ver[1] -gt 4 ]]; then
LINK_OPERATOR="="
else
LINK_OPERATOR=" "
fi
# Static compilation is useful when etcd is run in a container
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-s -X ${REPO_PATH}/version.GitSHA${LINK_OPERATOR}${GIT_SHA}" -o bin/etcd ${REPO_PATH}
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-s" -o bin/etcdctl ${REPO_PATH}/etcdctl