shinko_s6145: Make the build more intelligent with respect to the library
* backend reports which one is in use (internal,proprietary,r_eng) * make flags determine which one is used * only use proprietary one if we actually have one.
This commit is contained in:
parent
173e1f1bc9
commit
77023b85bc
62
Makefile
62
Makefile
|
@ -6,6 +6,12 @@ EXEC_NAME ?= dyesub_backend
|
|||
DESTDIR ?=
|
||||
CUPS_BACKEND_DIR ?= $(DESTDIR)/usr/lib/cups/backend
|
||||
CUPS_DATA_DIR ?= $(DESTDIR)/usr/share/cups
|
||||
LIBDIR ?= $(DESTDIR)/usr/local/lib
|
||||
|
||||
# Don't compile with libS6145ImageProcess by default.
|
||||
LIBS6145 ?=
|
||||
# If set, we have the reverse-engineered libS6145ImageProcess.
|
||||
RE_LIBS6145 ?=
|
||||
|
||||
# Tools
|
||||
CC ?= $(CROSS_COMPILE)gcc
|
||||
|
@ -15,6 +21,41 @@ INSTALL ?= install
|
|||
LN ?= ln
|
||||
RM ?= rm
|
||||
|
||||
### libS6145 nonsense
|
||||
# Figure out which library to use
|
||||
ifneq ($(LIBS6145),)
|
||||
# Figure out OS
|
||||
UNAME_S := $(shell uname -s)
|
||||
# Figure out Arch
|
||||
UNAME_P := $(shell uname -p)
|
||||
|
||||
# Lib6145 only works under Linux, and we only have the binary versions
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
ifeq ($(UNAME_P),x86_64)
|
||||
LIBS6145_NAME = S6145ImageProcess-x64
|
||||
endif
|
||||
ifneq ($(filter %86,$(UNAME_P)),)
|
||||
LIBS6145_NAME = S6145ImageProcess-x32
|
||||
else
|
||||
LIBS6145 =
|
||||
endif
|
||||
endif # Linux
|
||||
endif # libS6145
|
||||
|
||||
ifneq ($(LIBS6145_RE),)
|
||||
LIBS6145 = $(LIBS6145_RE)
|
||||
LIBS6145_NAME = S6145ImageProcessRE
|
||||
DEPS += $(LIBS6145)/libS6145ImageProcessRE.so
|
||||
CPPFLAGS += -DWITH_6145_LIB -DS6145_RE -I$(LIBS6145)
|
||||
endif
|
||||
|
||||
# Finally, if we have any version of the library, use it.
|
||||
ifneq ($(LIBS6145),)
|
||||
CPPFLAGS += -DWITH_6145_LIB -I$(LIBS6145)
|
||||
LDFLAGS += -L$(LIBS6145) -l$(LIBS6145_NAME)
|
||||
endif
|
||||
### libS6145 nonsense
|
||||
|
||||
# Flags
|
||||
CFLAGS += -Wall -Wextra -g -Os -D_GNU_SOURCE -std=c99
|
||||
LDFLAGS += `pkg-config --libs libusb-1.0`
|
||||
|
@ -22,19 +63,6 @@ CPPFLAGS += `pkg-config --cflags libusb-1.0`
|
|||
# CPPFLAGS += -DLIBUSB_PRE_1_0_10
|
||||
CPPFLAGS += -DURI_PREFIX=\"$(BACKEND_NAME)\"
|
||||
|
||||
# If you have the binary s6145 library, use it..
|
||||
# The result is *NOT* GPL compatible.
|
||||
ifneq ($(LIBS6145),)
|
||||
CFLAGS += -DWITH_6145_LIB -I$(LIBS6145)
|
||||
|
||||
#LIBS6145_NAME = S6145ImageProcess-x64 # x86_64
|
||||
#LIBS6145_NAME = S6145ImageProcess-x32 # x86_32
|
||||
LIBS6145_NAME = S6145ImageProcessRE # Reverse-engineered
|
||||
DEPS += $(LIBS6145)/libS6145ImageProcessRE.so
|
||||
|
||||
LDFLAGS += -L$(LIBS6145) -l$(LIBS6145_NAME) -lm
|
||||
endif
|
||||
|
||||
# List of backends
|
||||
BACKENDS = sonyupdr150 kodak6800 kodak1400 shinkos2145 shinkos1245 canonselphy mitsu70x kodak605 dnpds40 citizencw01 mitsu9550 shinkos6245 shinkos6145
|
||||
|
||||
|
@ -59,15 +87,19 @@ install:
|
|||
$(INSTALL) -o root -m 700 $(EXEC_NAME) $(CUPS_BACKEND_DIR)/$(BACKEND_NAME)
|
||||
$(MKDIR) -p $(CUPS_DATA_DIR)/usb
|
||||
$(INSTALL) -o root -m 644 blacklist $(CUPS_DATA_DIR)/usb/net.sf.gimp-print.usb-quirks
|
||||
ifneq ($(LIBS6145),)
|
||||
$(INSTALL) -o root -m 755 $(LIBS6145)/lib$(LIBS6145_NAME).so $(LIBDIR)
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(RM) -f $(EXEC_NAME) $(BACKENDS)
|
||||
|
||||
ifneq ($(LIBS6145),)
|
||||
# Reverse-engineered LibS6145ImageProcess
|
||||
ifneq ($(RE_LIBS6145),)
|
||||
$(LIBS6145)/libS6145ImageProcessRE.so: $(LIBS6145)/libS6145ImageProcess.o
|
||||
$(CC) -lm -Os -g -shared -o $@ $<
|
||||
|
||||
$(LIBS6145)/libS6145ImageProcess.o: $(LIBS6145)/libS6145ImageProcess.c
|
||||
$(CC) -c -Wall -Wextra -o $@ -fPIC $<
|
||||
$(CC) -c -Wall -Wextra -fno-strict-overflow -o $@ -fPIC $<
|
||||
|
||||
endif
|
||||
|
|
|
@ -2143,7 +2143,11 @@ top:
|
|||
}
|
||||
|
||||
#if defined(WITH_6145_LIB)
|
||||
INFO("Calling Sinfonia Image Processing Library...\n");
|
||||
#if defined(S6145_RE)
|
||||
INFO("Calling Reverse-Engineered Image Processing Library...\n");
|
||||
#else
|
||||
INFO("Calling Sinfonia Image Processing Library...\n");
|
||||
#endif
|
||||
if (ImageAvrCalc(ctx->databuf, le32_to_cpu(ctx->hdr.columns), le32_to_cpu(ctx->hdr.rows), ctx->image_avg)) {
|
||||
ERROR("Library returned error!\n");
|
||||
return CUPS_BACKEND_FAILED;
|
||||
|
@ -2151,7 +2155,7 @@ top:
|
|||
|
||||
ImageProcessing(ctx->databuf, databuf2, ctx->corrdata);
|
||||
#else
|
||||
INFO("Calling Internal Image Processing Library...\n");
|
||||
INFO("Calling Internal Fallback Image Processing Library...\n");
|
||||
|
||||
lib6145_calc_avg(ctx, le32_to_cpu(ctx->hdr.columns), le32_to_cpu(ctx->hdr.rows));
|
||||
lib6145_process_image(ctx->databuf, databuf2, ctx->corrdata, oc_mode);
|
||||
|
|
Loading…
Reference in a new issue