github.com/vmware/govmomi@v0.37.2/govc/build.sh (about)

     1  #!/bin/bash -e
     2  
     3  # TODO: deprecate this script as it will be superseded by goreleaser and misses additional build variables defined in
     4  # flags
     5  git_version=$(git describe --dirty)
     6   if [[ $git_version == *-dirty ]] ; then
     7    echo 'Working tree is dirty.'
     8    echo 'NOTE: This script is meant for building govc releases via release.sh'
     9    echo 'To build govc from source see: https://github.com/vmware/govmomi/blob/main/govc/README.md#source'
    10    exit 1
    11  fi
    12  
    13  PROGRAM_NAME=govc
    14  PROJECT_PKG="github.com/vmware/govmomi"
    15  PROGRAM_PKG="${PROJECT_PKG}/${PROGRAM_NAME}"
    16  
    17  export LDFLAGS="-w -X ${PROGRAM_PKG}/flags.BuildVersion=${git_version}"
    18  export BUILD_OS="${BUILD_OS:-darwin linux windows freebsd}"
    19  export BUILD_ARCH="${BUILD_ARCH:-amd64}"
    20  
    21  set -x
    22  make -C "$(go env GOPATH)/src/${PROGRAM_PKG}" -j build-all
    23  set +x