mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
6fa7f5b3ae
Switch binaries to armhf suffix to be more clean on the on architecture
42 lines
1.6 KiB
Bash
Executable File
42 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e -x
|
|
|
|
source $(dirname $0)/version.sh
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
LDFLAGS="-X github.com/rancher/k3s/version.Version=$VERSION -w -s"
|
|
STATIC="-extldflags '-static'"
|
|
STATIC_SQLITE="-extldflags '-static -lm -ldl -lz -lpthread'"
|
|
TAGS="ctrd apparmor seccomp no_btrfs netgo osusergo"
|
|
|
|
if [ "$STATIC_BUILD" != "true" ]; then
|
|
STATIC=""
|
|
STATIC_SQLITE=""
|
|
else
|
|
TAGS="static_build libsqlite3 $TAGS"
|
|
fi
|
|
|
|
mkdir -p bin
|
|
|
|
rm -f bin/k3s-agent bin/hyperkube bin/containerd bin/cni ./bin/runc bin/containerd-shim bin/k3s-server bin/kubectl
|
|
# echo Building agent
|
|
# CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/k3s-agent ./cmd/agent/main.go
|
|
echo Building server
|
|
CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC_SQLITE" -o bin/containerd ./cmd/server/main.go
|
|
ln -s containerd ./bin/k3s-agent
|
|
ln -s containerd ./bin/k3s-server
|
|
ln -s containerd ./bin/kubectl
|
|
echo Building hyperkube
|
|
CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC_SQLITE" -o bin/hyperkube ./vendor/k8s.io/kubernetes/cmd/hyperkube/
|
|
# echo Building containerd
|
|
# CGO_ENABLED=0 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/containerd ./cmd/containerd/
|
|
echo Building cni
|
|
CGO_ENABLED=0 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/cni ./cmd/cni/main.go
|
|
echo Building runc
|
|
make EXTRA_LDFLAGS="-w -s" BUILDTAGS="apparmor seccomp" -C ./vendor/github.com/opencontainers/runc static
|
|
cp -f ./vendor/github.com/opencontainers/runc/runc ./bin/runc
|
|
echo Building containerd-shim
|
|
make -C ./vendor/github.com/containerd/containerd bin/containerd-shim
|
|
cp -f ./vendor/github.com/containerd/containerd/bin/containerd-shim ./bin/containerd-shim
|