use code generation for GITCOMMIT/VERSION too

Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>
This commit is contained in:
Michael Hudson-Doyle 2014-10-01 14:56:45 +13:00
parent 3e10b93106
commit 85744a35de
2 changed files with 12 additions and 6 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ docs/GIT_BRANCH
docs/VERSION
docs/GITCOMMIT
dockerversion/static.go
dockerversion/details.go

View File

@ -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