From 4602c3289ad31f1b03ec383b5c96ed29562cc849 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 1 Oct 2014 13:37:30 +1300 Subject: [PATCH] Use code generation to set IAMSTATIC instead of -X Signed-off-by: Michael Hudson-Doyle Upstream-commit: 3e10b93106dea94e5747ab32fe4ac765aa22f9bc Component: engine --- components/engine/.gitignore | 1 + components/engine/hack/make.sh | 3 ++- components/engine/hack/make/binary | 11 +++++++++++ components/engine/hack/make/dynbinary | 9 +++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/components/engine/.gitignore b/components/engine/.gitignore index 2a86e41caf..6f6cfa1682 100644 --- a/components/engine/.gitignore +++ b/components/engine/.gitignore @@ -27,3 +27,4 @@ docs/AWS_S3_BUCKET docs/GIT_BRANCH docs/VERSION docs/GITCOMMIT +dockerversion/static.go diff --git a/components/engine/hack/make.sh b/components/engine/hack/make.sh index d6da3057fa..5d0ddd879f 100755 --- a/components/engine/hack/make.sh +++ b/components/engine/hack/make.sh @@ -94,6 +94,8 @@ if [ -z "$DOCKER_CLIENTONLY" ]; then DOCKER_BUILDTAGS+=" daemon" fi +rm -f dockerversion/static.go + # Use these flags when compiling the tests and final binary LDFLAGS=' -w @@ -115,7 +117,6 @@ TESTFLAGS+=" -test.timeout=${TIMEOUT}" EXTLDFLAGS_STATIC_DOCKER="$EXTLDFLAGS_STATIC -lpthread -Wl,--unresolved-symbols=ignore-in-object-files" LDFLAGS_STATIC_DOCKER=" $LDFLAGS_STATIC - -X $DOCKER_PKG/dockerversion.IAMSTATIC true -extldflags \"$EXTLDFLAGS_STATIC_DOCKER\" " diff --git a/components/engine/hack/make/binary b/components/engine/hack/make/binary index b97069a856..2c71f201b9 100755 --- a/components/engine/hack/make/binary +++ b/components/engine/hack/make/binary @@ -3,6 +3,17 @@ set -e DEST=$1 +: ${IAMSTATIC:=true} + +cat > dockerversion/static.go < dockerversion/static.go <