Use code generation to set IAMSTATIC instead of -X

Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>
This commit is contained in:
Michael Hudson-Doyle
2014-10-24 10:56:51 +13:00
parent 6ce4f82ebe
commit 3e10b93106
4 changed files with 23 additions and 1 deletions
+9
View File
@@ -5,6 +5,14 @@ DEST=$1
if [ -z "$DOCKER_CLIENTONLY" ]; then
# dockerinit still needs to be a static binary, even if docker is dynamic
cat > dockerversion/static.go <<EOF
// AUTOGENERATED FILE; see hack/make/binary and hack/make/dynbinary
package dockerversion
func init() {
IAMSTATIC = true
}
EOF
go build \
-o "$DEST/dockerinit-$VERSION" \
"${BUILDFLAGS[@]}" \
@@ -40,6 +48,7 @@ fi
(
export LDFLAGS_STATIC_DOCKER="-X $DOCKER_PKG/dockerversion.INITSHA1 \"$DOCKER_INITSHA1\" -X $DOCKER_PKG/dockerversion.INITPATH \"$DOCKER_INITPATH\""
export IAMSTATIC=false
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
source "$(dirname "$BASH_SOURCE")/binary"
)