From 1e9d6491714f81d5284f411014c53e76cfae3ed9 Mon Sep 17 00:00:00 2001 From: Luca <291285409+zeddapuras@users.noreply.github.com> Date: Tue, 6 Oct 2026 16:00:59 +0200 Subject: [PATCH] Fix build on macOS macOS has no cups.pc, so the pkg-config calls in module.mk expand to nothing and the build fails (see #3). The raster API also lives in libcups itself, so -lcupsimage is not needed. On Darwin: - use cups-config for compiler/linker flags and CUPS directories - look for jbigkit in Homebrew (Apple Silicon and Intel) and MacPorts, overridable with JBIGDIR - honour ARCHFLAGS, e.g. ARCHFLAGS="-arch arm64 -arch x86_64" for a universal binary Other platforms are unchanged. Co-Authored-By: Claude Opus 5.5 --- module.mk | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/module.mk b/module.mk index f9881a44..b2be0cd2 100644 --- a/module.mk +++ b/module.mk @@ -28,13 +28,24 @@ DRV_ONLY ?= 0 # Flags +ifeq ($(ARCHI),Darwin) +# macOS ships no cups.pc, and the raster API lives in libcups itself. +# jbigkit is searched in Homebrew (Apple Silicon, Intel) and MacPorts. +# Set ARCHFLAGS="-arch arm64 -arch x86_64" for a universal binary. +JBIGDIR ?= $(firstword $(wildcard /opt/homebrew/opt/jbigkit /usr/local/opt/jbigkit /opt/local)) +CXXFLAGS += $(ARCHFLAGS) `cups-config --cflags` -Iinclude -Wall -I$(JBIGDIR)/include +LDFLAGS += $(ARCHFLAGS) -L$(JBIGDIR)/lib +CUPSLIBS := `cups-config --libs` +else CXXFLAGS += `pkg-config --cflags cups` -Iinclude -Wall -I/opt/local/include +CUPSLIBS := `pkg-config --libs cups` -lcupsimage +endif DEBUG_CXXFLAGS += -DDEBUG -DDUMP_CACHE OPTIM_CXXFLAGS += -g rastertoqpdl_LDFLAGS := $(LDFLAGS) -L/opt/local/lib -rastertoqpdl_LIBS := `pkg-config --libs cups` -lcupsimage +rastertoqpdl_LIBS := $(CUPSLIBS) pstoqpdl_LDFLAGS := $(LDFLAGS) -pstoqpdl_LIBS := `pkg-config --libs cups` -lcupsimage +pstoqpdl_LIBS := $(CUPSLIBS) # Update compilation flags with defined options @@ -56,16 +67,23 @@ endif # Get some information +ifeq ($(ARCHI),Darwin) +CUPSFILTER := `cups-config --serverbin`/filter +CUPSPPD ?= `cups-config --datadir`/model +CUPSDRV ?= `cups-config --datadir`/drv +CUPSPROFILE := `cups-config --datadir`/profiles +else CUPSFILTER := `pkg-config --variable=cups_serverbin cups`/filter CUPSPPD ?= `pkg-config --variable=cups_datadir cups`/model CUPSDRV ?= `pkg-config --variable=cups_datadir cups`/drv +CUPSPROFILE := `pkg-config --variable=cups_datadir cups`/profiles +endif ifeq ($(ARCHI),Darwin) PSTORASTER := pstocupsraster else PSTORASTER := pstoraster endif GSTORASTER := gstoraster -CUPSPROFILE := `pkg-config --variable=cups_datadir cups`/profiles export CUPSFILTER CUPSPPD CUPSDRV