mirror of https://github.com/linkerd/linkerd2.git
Fix build-cli-bin (#4876)
Fix `bin/build-cli-bin` on Linux to put the binary in the correctly named architecture directory. Signed-off-by: Ali Ariff <ali.ariff12@gmail.com>
This commit is contained in:
parent
72aadb540f
commit
66d2c6b74b
|
@ -11,12 +11,35 @@ rootdir=$( cd "$bindir"/.. && pwd )
|
||||||
# shellcheck source=_tag.sh
|
# shellcheck source=_tag.sh
|
||||||
. "$bindir"/_tag.sh
|
. "$bindir"/_tag.sh
|
||||||
|
|
||||||
|
arch=""
|
||||||
case $(uname) in
|
case $(uname) in
|
||||||
Darwin)
|
Darwin)
|
||||||
host_platform=darwin
|
host_platform=darwin
|
||||||
;;
|
;;
|
||||||
Linux)
|
Linux)
|
||||||
host_platform=linux
|
host_platform=linux
|
||||||
|
arch=$(uname -m)
|
||||||
|
case $arch in
|
||||||
|
x86_64)
|
||||||
|
arch=amd64
|
||||||
|
;;
|
||||||
|
armv8*)
|
||||||
|
arch=arm64
|
||||||
|
;;
|
||||||
|
aarch64*)
|
||||||
|
arch=arm64
|
||||||
|
;;
|
||||||
|
armv*)
|
||||||
|
arch=arm
|
||||||
|
;;
|
||||||
|
amd64|arm64)
|
||||||
|
arch=$arch
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unsupported architecture: $arch" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
host_platform=windows
|
host_platform=windows
|
||||||
|
@ -27,6 +50,9 @@ esac
|
||||||
cd "$rootdir"
|
cd "$rootdir"
|
||||||
cd "$(pwd -P)"
|
cd "$(pwd -P)"
|
||||||
target=target/cli/$host_platform/linkerd
|
target=target/cli/$host_platform/linkerd
|
||||||
|
if [ -n "$arch" ]; then
|
||||||
|
target=target/cli/$host_platform-$arch/linkerd
|
||||||
|
fi
|
||||||
GO111MODULE=on go generate -mod=readonly ./pkg/charts/static # TODO: `go generate` does not honor -mod=readonly
|
GO111MODULE=on go generate -mod=readonly ./pkg/charts/static # TODO: `go generate` does not honor -mod=readonly
|
||||||
root_tag=$("$bindir"/root-tag)
|
root_tag=$("$bindir"/root-tag)
|
||||||
GO111MODULE=on CGO_ENABLED=0 go build -o $target -tags prod -mod=readonly -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=$root_tag" ./cli
|
GO111MODULE=on CGO_ENABLED=0 go build -o $target -tags prod -mod=readonly -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=$root_tag" ./cli
|
||||||
|
|
Loading…
Reference in New Issue