mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
32 lines
828 B
Plaintext
32 lines
828 B
Plaintext
|
#!/bin/bash
|
||
|
set -e
|
||
|
|
||
|
source $(dirname $0)/version
|
||
|
|
||
|
cd $(dirname $0)/..
|
||
|
|
||
|
LDFLAGS="-X github.com/rancher/rio/version.Version=$VERSION -w -s"
|
||
|
STATIC="-extldflags -static"
|
||
|
STATIC_SQLITE="-extldflags '-static -lm -ldl -lz -lpthread'"
|
||
|
|
||
|
cross()
|
||
|
{
|
||
|
echo Building windows CLI
|
||
|
GOOS=windows GOARCH=amd64 go build -ldflags "$LDFLAGS" -o bin/rio-windows ./cli/main.go
|
||
|
echo Building mac CLI
|
||
|
GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o bin/rio-darwin ./cli/main.go
|
||
|
}
|
||
|
|
||
|
mkdir -p bin
|
||
|
|
||
|
if [ -n "$CROSS" ]; then
|
||
|
cross
|
||
|
fi
|
||
|
|
||
|
echo Building incluster
|
||
|
GOOS=linux GOARCH=amd64
|
||
|
CGO_ENABLED=0 go build -ldflags "$LDFLAGS $STATIC" -o bin/rio-incluster
|
||
|
|
||
|
echo Building cli full
|
||
|
CGO_ENABLED=1 go build -tags "static_build libsqlite3 k8s ctr no_etcd netgo osusergo" -ldflags "$LDFLAGS $STATIC_SQLITE" -o bin/rio-full ./cli/main.go
|