2017-05-11 18:52:17 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
|
2017-12-01 08:47:20 -05:00
|
|
|
PLATFORM=${PLATFORM:-}
|
2017-05-11 18:52:17 -04:00
|
|
|
VERSION=${VERSION:-"unknown-version"}
|
|
|
|
GITCOMMIT=${GITCOMMIT:-$(git rev-parse --short HEAD 2> /dev/null || true)}
|
|
|
|
BUILDTIME=${BUILDTIME:-$(date --utc --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')}
|
|
|
|
|
2017-12-01 08:47:20 -05:00
|
|
|
PLATFORM_LDFLAGS=
|
|
|
|
if test -n "${PLATFORM}"; then
|
2019-01-08 10:03:51 -05:00
|
|
|
PLATFORM_LDFLAGS="-X \"github.com/docker/cli/cli/version.PlatformName=${PLATFORM}\""
|
2017-12-01 08:47:20 -05:00
|
|
|
fi
|
|
|
|
|
2017-05-11 18:52:17 -04:00
|
|
|
export LDFLAGS="\
|
|
|
|
-w \
|
2017-12-01 08:47:20 -05:00
|
|
|
${PLATFORM_LDFLAGS} \
|
2019-01-08 10:03:51 -05:00
|
|
|
-X \"github.com/docker/cli/cli/version.GitCommit=${GITCOMMIT}\" \
|
|
|
|
-X \"github.com/docker/cli/cli/version.BuildTime=${BUILDTIME}\" \
|
|
|
|
-X \"github.com/docker/cli/cli/version.Version=${VERSION}\" \
|
2017-05-11 18:52:17 -04:00
|
|
|
${LDFLAGS:-} \
|
|
|
|
"
|
|
|
|
|
2017-05-25 12:41:56 -04:00
|
|
|
GOOS="${GOOS:-$(go env GOHOSTOS)}"
|
|
|
|
GOARCH="${GOARCH:-$(go env GOHOSTARCH)}"
|
|
|
|
export TARGET="build/docker-$GOOS-$GOARCH"
|
2017-05-11 18:52:17 -04:00
|
|
|
export SOURCE="github.com/docker/cli/cmd/docker"
|