Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,35 @@ statedir = $(localstatedir)/lib/ghostscript-printer-app
spooldir = $(localstatedir)/spool/ghostscript-printer-app
serverbin = $(prefix)/lib/ghostscript-printer-app
resourcedir = $(prefix)/share/ghostscript-printer-app
cupsserverbin = `cups-config --serverbin`
unitdir := $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`
# CUPS detection: prioritize CUPS 3.x (cups3), then CUPS 2.5 (cups), then legacy cups-config
CUPS_PKG := $(shell pkg-config --exists cups3 && echo cups3 || (pkg-config --exists cups && echo cups || echo ""))

ifneq ($(CUPS_PKG),)
CUPS_CFLAGS := $(shell pkg-config --cflags $(CUPS_PKG))
CUPS_LDFLAGS :=
CUPS_LIBS := $(shell pkg-config --libs $(CUPS_PKG))
cupsserverbin := $(shell pkg-config --variable=prefix $(CUPS_PKG))/lib/cups
else
CUPSCONFIG := $(shell which cups-config 2>/dev/null)
ifneq ($(CUPSCONFIG),)
CUPS_CFLAGS := $(shell cups-config --cflags)
CUPS_LDFLAGS := $(shell cups-config --ldflags)
CUPS_LIBS := $(shell cups-config --image --libs 2>/dev/null || cups-config --libs)
cupsserverbin := $(shell cups-config --serverbin)
else
cupsserverbin :=
endif
endif

# PAPPL detection: prioritize PAPPL 2.x (pappl2), fallback to PAPPL 1.x (pappl)
PAPPL_PKG := $(shell pkg-config --exists pappl2 && echo pappl2 || echo pappl)

unitdir := $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd 2>/dev/null || echo ""`


# Compiler/linker options...
OPTIM = -Os -g
CFLAGS += `pkg-config --cflags pappl` `cups-config --cflags` `pkg-config --cflags libppd` `pkg-config --cflags libcupsfilters` `pkg-config --cflags libpappl-retrofit` $(OPTIM)
CFLAGS += `pkg-config --cflags $(PAPPL_PKG)` $(CUPS_CFLAGS) `pkg-config --cflags libppd` `pkg-config --cflags libcupsfilters` `pkg-config --cflags libpappl-retrofit` $(OPTIM)
ifdef VERSION
CFLAGS += -DSYSTEM_VERSION_STR="\"$(VERSION)\""
ifndef MAJOR
Expand Down Expand Up @@ -58,8 +80,8 @@ endif
ifdef SNAP
CFLAGS += -DSNAP=$(SNAP)
endif
LDFLAGS += $(OPTIM) `cups-config --ldflags`
LIBS += `pkg-config --libs pappl` `cups-config --image --libs` `pkg-config --libs libppd` `pkg-config --libs libcupsfilters` `pkg-config --libs libpappl-retrofit`
LDFLAGS += $(OPTIM) $(CUPS_LDFLAGS)
LIBS += `pkg-config --libs $(PAPPL_PKG)` $(CUPS_LIBS) `pkg-config --libs libppd` `pkg-config --libs libcupsfilters` `pkg-config --libs libpappl-retrofit`


# Targets...
Expand Down
6 changes: 3 additions & 3 deletions ghostscript-printer-app.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ main(int argc, // I - Number of command-line arguments
// Keeping vector formats (like PS -> PDF) is usually more desirable
// but as many printers have buggy PS interpreters we prefer converting
// PDF to Raster and not to PS
spooling_conversions = cupsArrayNew(NULL, NULL);
spooling_conversions = cupsArrayNew(NULL, NULL, NULL, 0, NULL, NULL);

// Special conversion rule for fxlinuxprint driver (Fuji Xerox
// non-IPP-driverless PDF printers)
Expand All @@ -168,14 +168,14 @@ main(int argc, // I - Number of command-line arguments
// PDF comes last because it is generally not streamable.
// PostScript comes second as it is Ghostscript's streamable
// input format.
stream_formats = cupsArrayNew(NULL, NULL);
stream_formats = cupsArrayNew(NULL, NULL, NULL, 0, NULL, NULL);
cupsArrayAdd(stream_formats, (void *)&PR_STREAM_CUPS_RASTER);
cupsArrayAdd(stream_formats, (void *)&PR_STREAM_POSTSCRIPT);
cupsArrayAdd(stream_formats, (void *)&PR_STREAM_PDF);

// Array of regular expressions for driver priorization
// For some printers the "(recommended)" is missing ...
driver_selection_regex_list = cupsArrayNew(NULL, NULL);
driver_selection_regex_list = cupsArrayNew(NULL, NULL, NULL, 0, NULL, NULL);
cupsArrayAdd(driver_selection_regex_list, "-recommended-");
cupsArrayAdd(driver_selection_regex_list, "-pdf-");
cupsArrayAdd(driver_selection_regex_list, "-postscript-");
Expand Down
Loading