build: MinGW now compiles selphy_print cleanly.

Need to test it out. Especially the dynamic DLL loading.
This commit is contained in:
Solomon Peachy 2020-01-26 00:41:48 -05:00
parent d6109815c9
commit 9abe62b115
9 changed files with 51 additions and 15 deletions

2
.gitignore vendored
View file

@ -1,6 +1,8 @@
*~
*.o
*.so
*.exe
*.dll
sonyupd
sonyupdneo

View file

@ -4,7 +4,11 @@
#
# Basic stuff
ifneq (,$(findstring mingw,$(CC)))
EXEC_NAME ?= dyesub_backend.exe
else
EXEC_NAME ?= dyesub_backend
endif
CPUS ?= $(shell nproc)
#NO_GUTENPRINT = 1
REVISION ?= -g$(shell if [ -d .git ] ; then git rev-parse --short HEAD; else echo "NONE" ; fi)
@ -58,13 +62,16 @@ CPPFLAGS += -DURI_PREFIX=\"$(BACKEND_NAME)\" $(OLD_URI)
CFLAGS += -funit-at-a-time
# List of backends
BACKENDS = canonselphy canonselphyneo dnpds40 hiti kodak605 kodak1400 kodak6800 magicard mitsu70x mitsu9550 mitsud90 mitsup95d shinkos1245 shinkos2145 shinkos6145 shinkos6245 sonyupd sonyupdneo
BACKENDS = canonselphy canonselphyneo dnpds40 hiti kodak605 kodak1400 kodak6800 magicard mitsu70x mitsu9550 mitsud90 mitsup95d shinkos1245 shinkos2145 shinkos6145 shinkos6245 sonyupd sonyupdneo
# For the s6145, mitsu70x, and mitsu9550 backends
ifneq (,$(findstring mingw,$(CC)))
CPPFLAGS += -DUSE_LTDL
LDFLAGS += -lltdl
else
CPPFLAGS += -DUSE_DLOPEN
LDFLAGS += -ldl
#CPPFLAGS += -DUSE_LTDL
#LDFLAGS += -lltdl
endif
# Build stuff
DEPS += backend_common.h

12
README
View file

@ -153,7 +153,17 @@
Debian/Ubuntu
apt-get install libusbx-dev libusb-1.0-0-dev libcups2-dev gutenprint-dev
All you need to do after that is type 'make'
All you need to do after that is type 'make'
Compilation for Windows:
This is highly experimental.
Currently only MinGW is supported. You will need the 'libltdl' and
'libusbx' MinGW packages.
Once the necessary packages are installed, run 'mingw64-make' and
everything should compile cleanly.
***************************************************************************
CUPS backend usage:

View file

@ -373,5 +373,10 @@ extern struct dyesub_backend BACKEND;
#define DL_CLOSE(__x) do {} while(0)
#define DL_EXIT() do {} while(0)
#endif
#ifdef _WIN32
#define DLL_SUFFIX ".dll"
#else
#define DLL_SUFFIX ".so"
#endif
#endif /* __BACKEND_COMMON_H */

View file

@ -57,7 +57,7 @@ struct BandImage {
#define REQUIRED_LIB_APIVERSION 4
/* Image processing library function prototypes */
#define LIB_NAME_RE "libMitsuD70ImageReProcess.so" // Reimplemented library
#define LIB_NAME_RE "libMitsuD70ImageReProcess" DLL_SUFFIX
typedef int (*lib70x_getapiversionFN)(void);
typedef int (*Get3DColorTableFN)(uint8_t *buf, const char *filename);

View file

@ -57,7 +57,7 @@ struct BandImage {
#define REQUIRED_LIB_APIVERSION 4
/* Image processing library function prototypes */
#define LIB_NAME_RE "libMitsuD70ImageReProcess.so" // Reimplemented library
#define LIB_NAME_RE "libMitsuD70ImageReProcess" DLL_SUFFIX
typedef int (*lib70x_getapiversionFN)(void);
typedef int (*Get3DColorTableFN)(uint8_t *buf, const char *filename);

View file

@ -55,8 +55,8 @@
typedef int (*ImageProcessingFN)(unsigned char *, unsigned short *, void *);
typedef int (*ImageAvrCalcFN)(unsigned char *, unsigned short, unsigned short, unsigned char *);
#define LIB_NAME "libS6145ImageProcess.so" // Official library
#define LIB_NAME_RE "libS6145ImageReProcess.so" // Reimplemented library
#define LIB_NAME "libS6145ImageProcess" DLL_SUFFIX // Official library
#define LIB_NAME_RE "libS6145ImageReProcess" DLL_SUFFIX // Reimplemented library
enum {
S_IDLE = 0,

View file

@ -18,24 +18,30 @@ CFLAGS += -Wall -Wextra -g -Os -std=c99 -D_FORTIFY_SOURCE=2 -fPIC --no-strict-ov
#CPPFLAGS +=
CFLAGS += -funit-at-a-time
ifneq (,$(findstring mingw,$(CC)))
SUFFIX=dll
else
SUFFIX=so
endif
# Build stuff
SOURCES = libS6145ImageReProcess.c
# And now the rules!
.PHONY: clean all install cppcheck
all: lib$(LIBS6145_NAME).so
all: lib$(LIBS6145_NAME).$(SUFFIX)
cppcheck:
$(CPPCHECK) -q -v --std=c99 --enable=all -I/usr/include $(CPPFLAGS) $(SOURCES)
install:
$(MKDIR) -p $(LIBDIR)
$(INSTALL) -o root -m 755 lib$(LIBS6145_NAME).so $(LIBDIR)
$(INSTALL) -o root -m 755 lib$(LIBS6145_NAME).$(SUFFIX) $(LIBDIR)
clean:
$(RM) -f lib$(LIBS6145_NAME).so *.o
$(RM) -f lib$(LIBS6145_NAME).$(SUFFIX) *.o
lib$(LIBS6145_NAME).so: $(SOURCES:.c=.o)
lib$(LIBS6145_NAME).$(SUFFIX): $(SOURCES:.c=.o)
$(CC) $(LDFLAGS) -g -shared -o $@ $^
%.o: %.c

View file

@ -25,13 +25,19 @@ CFLAGS += -Wall -Wextra -g -Os -std=c99 -D_FORTIFY_SOURCE=2 -fPIC --no-strict-ov
#CPPFLAGS +=
CFLAGS += -funit-at-a-time
ifneq (,$(findstring mingw,$(CC)))
SUFFIX=dll
else
SUFFIX=so
endif
# Build stuff
SOURCES = libMitsuD70ImageReProcess.c
# And now the rules!
.PHONY: clean all install cppcheck
all: lib$(LIBMITSUD70_NAME).so
all: lib$(LIBMITSUD70_NAME).$(SUFFIX)
cppcheck:
$(CPPCHECK) -q -v --std=c99 --enable=all -I/usr/include $(CPPFLAGS) $(SOURCES)
@ -46,9 +52,9 @@ install:
$(INSTALL) -o root -m 644 data/*dat $(BACKEND_DATA_DIR)
clean:
$(RM) -f lib$(LIBMITSUD70_NAME).so *.o
$(RM) -f lib$(LIBMITSUD70_NAME).$(SUFFIX) *.o
lib$(LIBMITSUD70_NAME).so: $(SOURCES:.c=.o)
lib$(LIBMITSUD70_NAME).$(SUFFIX): $(SOURCES:.c=.o)
$(CC) $(LDFLAGS) -g -shared -o $@ $^
%.o: %.c