forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test, build: make build script source-able without doing a build
- Loading branch information
Anthony Romano
committed
Jun 21, 2016
1 parent
22bae02
commit 6009e88
Showing
2 changed files
with
22 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#!/bin/sh -e | ||
|
||
# set some environment variables | ||
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="=" | ||
|
||
if [ -z "${GOARCH}" ] || [ "${GOARCH}" = "$(go env GOHOSTARCH)" ]; then | ||
out="bin" | ||
else | ||
out="bin/${GOARCH}" | ||
fi | ||
etcd_build() { | ||
if [ -z "${GOARCH}" ] || [ "${GOARCH}" = "$(go env GOHOSTARCH)" ]; 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}/cmd/vendor/${REPO_PATH}/version.GitSHA=${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 | ||
} | ||
|
||
# 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}/cmd/vendor/${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 | ||
# don't build when sourced | ||
(echo "$0" | grep "/build$") && etcd_build || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters