Browse code

use code generation for GITCOMMIT/VERSION too

Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>

Michael Hudson-Doyle authored on 2014/10/01 10:56:45
Showing 2 changed files
... ...
@@ -28,3 +28,4 @@ docs/GIT_BRANCH
28 28
 docs/VERSION
29 29
 docs/GITCOMMIT
30 30
 dockerversion/static.go
31
+dockerversion/details.go
... ...
@@ -94,14 +94,19 @@ if [ -z "$DOCKER_CLIENTONLY" ]; then
94 94
 	DOCKER_BUILDTAGS+=" daemon"
95 95
 fi
96 96
 
97
-rm -f dockerversion/static.go
97
+rm -f dockerversion/static.go dockerversion/details.go
98
+cat > dockerversion/details.go <<EOF
99
+// AUTOGENERATED FILE; see hack/make.sh
100
+package dockerversion
101
+
102
+func init() {
103
+	GITCOMMIT = "$GITCOMMIT"
104
+	VERSION = "$VERSION"
105
+}
106
+EOF
98 107
 
99 108
 # Use these flags when compiling the tests and final binary
100
-LDFLAGS='
101
-	-w
102
-	-X '$DOCKER_PKG'/dockerversion.GITCOMMIT "'$GITCOMMIT'"
103
-	-X '$DOCKER_PKG'/dockerversion.VERSION "'$VERSION'"
104
-'
109
+LDFLAGS='-w'
105 110
 LDFLAGS_STATIC='-linkmode external'
106 111
 EXTLDFLAGS_STATIC='-static'
107 112
 # ORIG_BUILDFLAGS is necessary for the cross target which cannot always build