Build: Use 'pkg-config' to figure out where to put backend data files.

(If it doesn't work, then default to '/usr/local/')
This commit is contained in:
Solomon Peachy 2019-10-15 22:09:24 -04:00
parent edd1facf8c
commit 7647aa7c3a
2 changed files with 17 additions and 6 deletions

View File

@ -10,10 +10,15 @@ CPUS ?= $(shell nproc)
REVISION ?= -g$(shell if [ -d .git ] ; then git rev-parse --short HEAD; else echo "NONE" ; fi)
# Destination directories (rely on CUPS to tell us where)
GP_PREFIX ?= $(shell pkg-config --variable=prefix gutenprint)
PREFIX ?=
CUPS_BACKEND_DIR ?= $(PREFIX)`cups-config --serverbin`/backend
CUPS_DATA_DIR ?= $(PREFIX)`cups-config --datadir`
BACKEND_DATA_DIR ?= $(PREFIX)/usr/local/share/gutenprint/backend_data
CUPS_BACKEND_DIR ?= $(PREFIX)$(shell cups-config --serverbin)/backend
CUPS_DATA_DIR ?= $(PREFIX)$(shell cups-config --datadir)
ifeq ($(GP_PREFIX),)
GP_PREFIX=/usr/local
endif
BACKEND_DATA_DIR ?= $(GP_PREFIX)/share/gutenprint/backend_data
# Figure out what the backend name needs to be
ifeq ($(NO_GUTENPRINT),)
@ -42,8 +47,8 @@ RM ?= rm
# Flags
CFLAGS += -Wall -Wextra -Wformat-security -g -Og -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -std=c99 # -Wconversion
LDFLAGS += `pkg-config --libs libusb-1.0`
CPPFLAGS += `pkg-config --cflags libusb-1.0`
LDFLAGS += $(shell pkg-config --libs libusb-1.0)
CPPFLAGS += $(shell pkg-config --cflags libusb-1.0)
# CPPFLAGS += -DLIBUSB_PRE_1_0_10
CPPFLAGS += -DURI_PREFIX=\"$(BACKEND_NAME)\" $(OLD_URI)

View File

@ -4,7 +4,13 @@ LIBMITSUD70_NAME ?= MitsuD70ImageReProcess
# Destination directories
DESTDIR ?=
LIBDIR ?= $(DESTDIR)/usr/local/lib
BACKEND_DATA_DIR ?= $(PREFIX)/usr/local/share/gutenprint/backend_data
GP_PREFIX ?= $(shell pkg-config --variable=prefix gutenprint)
ifeq ($(GP_PREFIX),)
GP_PREFIX=/usr/local
endif
BACKEND_DATA_DIR ?= $(GP_PREFIX)/share/gutenprint/backend_data
# Tools
CC ?= $(CROSS_COMPILE)gcc