mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
25 lines
727 B
Bash
Executable File
25 lines
727 B
Bash
Executable File
#!/bin/sh -e
|
|
|
|
ORG_PATH="github.com/coreos"
|
|
REPO_PATH="${ORG_PATH}/etcd"
|
|
|
|
export GO15VENDOREXPERIMENT="1"
|
|
|
|
eval $(go env)
|
|
|
|
GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"`
|
|
|
|
LINK_OPERATOR="="
|
|
|
|
host_arch=$(GOARCH="" go env | egrep 'GOARCH=' | sed 's/^GOARCH="\(.*\)".*/\1/')
|
|
|
|
if [ -z "${GOARCH}" ] || [ "${GOARCH}" = "${host_arch}" ]; then
|
|
out="bin"
|
|
else
|
|
out="bin/${GOARCH}"
|
|
fi
|
|
|
|
# Static compilation is useful when etcd is run in a container
|
|
CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "-s -X ${REPO_PATH}/version.GitSHA${LINK_OPERATOR}${GIT_SHA}" -o ${out}/etcd ${REPO_PATH}/cmd
|
|
CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "-s" -o ${out}/etcdctl ${REPO_PATH}/cmd/etcdctl
|