diff --git a/Makefile b/Makefile index 35ccab5..5875fe3 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,10 @@ LDFLAGS := -X $(VERSION_PKG).Version=$(VERSION) \ -X $(VERSION_PKG).GitCommit=$(GIT_COMMIT) \ -X $(VERSION_PKG).BuildDate=$(BUILD_DATE) +# Build tags (auto-detect optional C dependencies) +BUILDTAGS ?= \ + $(shell hack/btrfs_installed_tag.sh) + # Directories VM_DIR := containerfiles/cluster-image @@ -29,7 +33,7 @@ all: build-bink # Build the bink CLI binary build-bink: @echo "=== Building bink CLI binary ===" - go build -ldflags "$(LDFLAGS)" -o $(BINK_BINARY) ./cmd/bink + go build -tags "$(BUILDTAGS)" -ldflags "$(LDFLAGS)" -o $(BINK_BINARY) ./cmd/bink @echo "✅ bink binary built: $(BINK_BINARY)" diff --git a/hack/btrfs_installed_tag.sh b/hack/btrfs_installed_tag.sh new file mode 100755 index 0000000..5cc687b --- /dev/null +++ b/hack/btrfs_installed_tag.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF +#include +EOF +if test $? -ne 0; then + echo exclude_graphdriver_btrfs +fi