From d3d85d38fb5bdd0327fdc9fe8b637cb0f4e1dcf2 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Sun, 9 Feb 2014 18:21:01 -0700 Subject: [PATCH] Add slightly better GOPATH detection/handling This also adds a new "AUTO_GOPATH" environment variable that will create an appropriate GOPATH as part of the build process. Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) --- hack/make.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hack/make.sh b/hack/make.sh index ef13c1a283..d73b33a4fa 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -68,6 +68,19 @@ else exit 1 fi +if [ "$AUTO_GOPATH" ]; then + rm -rf .gopath + mkdir -p .gopath/src/github.com/dotcloud + ln -sf ../../../.. .gopath/src/github.com/dotcloud/docker + export GOPATH="$(pwd)/.gopath:$(pwd)/vendor" +fi + +if [ ! "$GOPATH" ]; then + echo >&2 'error: missing GOPATH; please see http://golang.org/doc/code.html#GOPATH' + echo >&2 ' alternatively, set AUTO_GOPATH=1' + exit 1 +fi + # Use these flags when compiling the tests and final binary LDFLAGS='-X main.GITCOMMIT "'$GITCOMMIT'" -X main.VERSION "'$VERSION'" -w' LDFLAGS_STATIC='-X github.com/dotcloud/docker/utils.IAMSTATIC true -linkmode external -extldflags "-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files"'