Skip to content

Commit 443096e

Browse files
Auto-detect btrfs headers to fix build on systems without btrfs-progs-devel (#65)
Add hack/btrfs_installed_tag.sh (same pattern as Podman/Buildah) that probes for btrfs/ioctl.h and emits exclude_graphdriver_btrfs when the headers are missing. Wire it into the Makefile via BUILDTAGS so `make build-bink` works out of the box on any system. Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
1 parent d30220c commit 443096e

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ LDFLAGS := -X $(VERSION_PKG).Version=$(VERSION) \
2121
-X $(VERSION_PKG).GitCommit=$(GIT_COMMIT) \
2222
-X $(VERSION_PKG).BuildDate=$(BUILD_DATE)
2323

24+
# Build tags (auto-detect optional C dependencies)
25+
BUILDTAGS ?= \
26+
$(shell hack/btrfs_installed_tag.sh)
27+
2428
# Directories
2529
VM_DIR := containerfiles/cluster-image
2630

@@ -29,7 +33,7 @@ all: build-bink
2933
# Build the bink CLI binary
3034
build-bink:
3135
@echo "=== Building bink CLI binary ==="
32-
go build -ldflags "$(LDFLAGS)" -o $(BINK_BINARY) ./cmd/bink
36+
go build -tags "$(BUILDTAGS)" -ldflags "$(LDFLAGS)" -o $(BINK_BINARY) ./cmd/bink
3337
@echo "✅ bink binary built: $(BINK_BINARY)"
3438

3539

hack/btrfs_installed_tag.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF
3+
#include <btrfs/ioctl.h>
4+
EOF
5+
if test $? -ne 0; then
6+
echo exclude_graphdriver_btrfs
7+
fi

0 commit comments

Comments
 (0)