summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hudson-Doyle <michael.hudson@linaro.org>2014-10-01 14:56:45 +1300
committerMichael Hudson-Doyle <michael.hudson@linaro.org>2014-10-24 10:58:39 +1300
commit85744a35de0e30c2dd6741b833f38ff218c8a3fc (patch)
tree9bc6d3d80612f9d49524604ea868bf2e0d3c5470
parent3e10b93106dea94e5747ab32fe4ac765aa22f9bc (diff)
downloaddocker-85744a35de0e30c2dd6741b833f38ff218c8a3fc.tar.gz
use code generation for GITCOMMIT/VERSION too
Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>
-rw-r--r--.gitignore1
-rwxr-xr-xhack/make.sh17
2 files changed, 12 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 6f6cfa1682..d7dae009d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,4 @@ docs/GIT_BRANCH
docs/VERSION
docs/GITCOMMIT
dockerversion/static.go
+dockerversion/details.go
diff --git a/hack/make.sh b/hack/make.sh
index 5d0ddd879f..eda96b5e26 100755
--- a/hack/make.sh
+++ b/hack/make.sh
@@ -94,14 +94,19 @@ if [ -z "$DOCKER_CLIENTONLY" ]; then
DOCKER_BUILDTAGS+=" daemon"
fi
-rm -f dockerversion/static.go
+rm -f dockerversion/static.go dockerversion/details.go
+cat > dockerversion/details.go <<EOF
+// AUTOGENERATED FILE; see hack/make.sh
+package dockerversion
+
+func init() {
+ GITCOMMIT = "$GITCOMMIT"
+ VERSION = "$VERSION"
+}
+EOF
# Use these flags when compiling the tests and final binary
-LDFLAGS='
- -w
- -X '$DOCKER_PKG'/dockerversion.GITCOMMIT "'$GITCOMMIT'"
- -X '$DOCKER_PKG'/dockerversion.VERSION "'$VERSION'"
-'
+LDFLAGS='-w'
LDFLAGS_STATIC='-linkmode external'
EXTLDFLAGS_STATIC='-static'
# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build