From 071f5aec857d02476dc7c72936b3ba565f60696c Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Wed, 4 Mar 2026 20:15:32 +0100 Subject: [PATCH] Fix CI/CD: Add fallback for systems without pkg-config - detect_fuse.sh now checks for pkg-config availability first - Falls back to checking for header files in standard locations - Makefile provides default CFLAGS when pkg-config unavailable - Fixes build on minimal CI/CD environments Fallback locations checked: - /usr/include/fuse3/fuse.h (FUSE 3) - /usr/local/include/fuse3/fuse.h (FUSE 3) - /usr/include/fuse/fuse.h (FUSE 2) - /usr/local/include/fuse/fuse.h (FUSE 2) --- Makefile | 4 ++-- detect_fuse.sh | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f372179..60e5c27 100644 --- a/Makefile +++ b/Makefile @@ -19,11 +19,11 @@ else endif ifeq ($(FUSE_VERSION),FUSE3) - FUSE_CFLAGS := $(shell pkg-config --cflags fuse3) + FUSE_CFLAGS := $(shell pkg-config --cflags fuse3 2>/dev/null || echo "-I/usr/include/fuse3 -D_FILE_OFFSET_BITS=64") FUSE_LIBS := -lfuse3 FUSE_USE_VERSION := 30 else ifeq ($(FUSE_VERSION),FUSE2) - FUSE_CFLAGS := $(shell pkg-config --cflags fuse) + FUSE_CFLAGS := $(shell pkg-config --cflags fuse 2>/dev/null || echo "-I/usr/include/fuse -D_FILE_OFFSET_BITS=64") FUSE_LIBS := -lfuse FUSE_USE_VERSION := 26 else diff --git a/detect_fuse.sh b/detect_fuse.sh index 3f051d0..07d8e9c 100755 --- a/detect_fuse.sh +++ b/detect_fuse.sh @@ -1,9 +1,24 @@ #!/bin/bash # Detect FUSE version and set appropriate flags -if pkg-config --exists fuse3; then +# Check if pkg-config is available +if ! command -v pkg-config >/dev/null 2>&1; then + # Fallback: check for header files + if [ -f /usr/include/fuse3/fuse.h ] || [ -f /usr/local/include/fuse3/fuse.h ]; then + echo "FUSE3" + elif [ -f /usr/include/fuse/fuse.h ] || [ -f /usr/local/include/fuse/fuse.h ]; then + echo "FUSE2" + else + echo "NONE" + exit 1 + fi + exit 0 +fi + +# Use pkg-config if available +if pkg-config --exists fuse3 2>/dev/null; then echo "FUSE3" -elif pkg-config --exists fuse; then +elif pkg-config --exists fuse 2>/dev/null; then echo "FUSE2" else echo "NONE"