Optionally enabled dqlite in build scripts

This commit is contained in:
Darren Shepherd 2019-11-12 05:48:43 +00:00
parent 16ec08d425
commit 1f9e92e91f
2 changed files with 12 additions and 3 deletions

View File

@ -24,10 +24,16 @@ LDFLAGS="
STATIC="
-extldflags '-static'
"
if [ "$DQLITE" = "true" ]; then
DQLITE_TAGS="dqlite"
DQLITE_STATIC_SQLITE="-luv -lraft -lco"
fi
STATIC_SQLITE="
-extldflags '-static -lm -ldl -lz -lpthread'
-extldflags '-static -lm -ldl -lz -lpthread $DQLITE_STATIC_SQLITE'
"
TAGS="ctrd apparmor seccomp no_btrfs netgo osusergo providerless"
TAGS="ctrd apparmor seccomp no_btrfs netgo osusergo providerless $DQLITE_TAGS"
if [ "$STATIC_BUILD" != "true" ]; then
STATIC="

View File

@ -43,4 +43,7 @@ LDFLAGS="
-w -s
"
STATIC="-extldflags '-static'"
CGO_ENABLED=0 go build -ldflags "$LDFLAGS $STATIC" -o ${CMD_NAME} ./cmd/k3s/main.go
if [ "$DQLITE" = "true" ]; then
DQLITE_TAGS="dqlite"
fi
CGO_ENABLED=0 go build -tags "$DQLITE_TAGS" -ldflags "$LDFLAGS $STATIC" -o ${CMD_NAME} ./cmd/k3s/main.go