mirror of https://github.com/linkerd/linkerd2.git
32 lines
946 B
Bash
Executable File
32 lines
946 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
# Builds CLI binary for current platform only and outside docker to speed up things. Suitable for local development.
|
|
# Note: This script is used by Brew when running `brew install linkerd`:
|
|
# https://github.com/Homebrew/homebrew-core/pull/36957
|
|
|
|
bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
rootdir="$( cd $bindir/.. && pwd )"
|
|
. $bindir/_tag.sh
|
|
|
|
current_platform=$(uname)
|
|
host_platform="windows"
|
|
if [ "${current_platform}" = 'Darwin' ]; then
|
|
host_platform="darwin"
|
|
elif [ "${current_platform}" = 'Linux' ]; then
|
|
host_platform="linux"
|
|
fi
|
|
|
|
(
|
|
cd $rootdir
|
|
cd "$(pwd -P)"
|
|
if [ -z "${LINKERD_SKIP_DEP:-}" ]; then
|
|
$bindir/dep ensure -vendor-only -v
|
|
fi
|
|
target="target/cli/${host_platform}/linkerd"
|
|
go generate ./cli
|
|
CGO_ENABLED=0 go build -o $target -tags prod -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=$($bindir/root-tag)" ./cli
|
|
echo "$target"
|
|
)
|