diff --git a/scripts/build b/scripts/build index 45dc22ac94..d48a6068b7 100755 --- a/scripts/build +++ b/scripts/build @@ -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=" diff --git a/scripts/package-cli b/scripts/package-cli index 19c253a9ec..ec31409d12 100755 --- a/scripts/package-cli +++ b/scripts/package-cli @@ -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