github.com/ali-iotechsys/cli@v20.10.0+incompatible/scripts/build/.variables (about)

     1  #!/usr/bin/env bash
     2  set -eu
     3  
     4  PLATFORM=${PLATFORM:-}
     5  VERSION=${VERSION:-"unknown-version"}
     6  GITCOMMIT=${GITCOMMIT:-$(git rev-parse --short HEAD 2> /dev/null || true)}
     7  BUILDTIME=${BUILDTIME:-$(date -u +"%Y-%m-%dT%H:%M:%SZ")}
     8  
     9  PLATFORM_LDFLAGS=
    10  if test -n "${PLATFORM}"; then
    11  	PLATFORM_LDFLAGS="-X \"github.com/docker/cli/cli/version.PlatformName=${PLATFORM}\""
    12  fi
    13  
    14  export LDFLAGS="\
    15      -w \
    16      ${PLATFORM_LDFLAGS} \
    17      -X \"github.com/docker/cli/cli/version.GitCommit=${GITCOMMIT}\" \
    18      -X \"github.com/docker/cli/cli/version.BuildTime=${BUILDTIME}\" \
    19      -X \"github.com/docker/cli/cli/version.Version=${VERSION}\" \
    20      ${LDFLAGS:-} \
    21  "
    22  
    23  GOOS="${GOOS:-$(go env GOHOSTOS)}"
    24  GOARCH="${GOARCH:-$(go env GOHOSTARCH)}"
    25  if [ "${GOARCH}" = "arm" ]; then
    26  	GOARM="${GOARM:-$(go env GOHOSTARM)}"
    27  fi
    28  
    29  TARGET="build/docker-$GOOS-$GOARCH"
    30  if [ "${GOARCH}" = "arm" ] && [ -n "${GOARM}" ]; then
    31  	TARGET="${TARGET}-v${GOARM}"
    32  fi
    33  
    34  if [ "${GOOS}" = "windows" ]; then
    35  	TARGET="${TARGET}.exe"
    36  fi
    37  export TARGET
    38  
    39  export SOURCE="github.com/docker/cli/cmd/docker"