summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-01-26 00:41:48 -0500
committerSolomon Peachy <pizza@shaftnet.org>2020-01-26 00:41:48 -0500
commit4c199b587f3a5e32af855bd541a5391f519485f3 (patch)
tree33e8fc7b32bab35b95c7b86e391c73a97331a6cd
parentc5c7a88a4845a34b5951960a2dd48f85ecca87c5 (diff)
downloadselphy_print-4c199b587f3a5e32af855bd541a5391f519485f3.tar.gz
selphy_print-4c199b587f3a5e32af855bd541a5391f519485f3.tar.bz2
selphy_print-4c199b587f3a5e32af855bd541a5391f519485f3.zip
build: MinGW now compiles selphy_print cleanly.
Need to test it out. Especially the dynamic DLL loading.
-rw-r--r--.gitignore2
-rw-r--r--Makefile13
-rw-r--r--README12
-rw-r--r--backend_common.h5
-rw-r--r--backend_mitsu70x.c2
-rw-r--r--backend_mitsu9550.c2
-rw-r--r--backend_shinkos6145.c4
-rw-r--r--lib6145/Makefile14
-rw-r--r--lib70x/Makefile12
9 files changed, 51 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index f48e3e9..74f6acd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
*~
*.o
*.so
+*.exe
+*.dll
sonyupd
sonyupdneo
diff --git a/Makefile b/Makefile
index fd15781..20bafd9 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README b/README
index 4a1f5eb..1fac7ad 100644
--- a/README
+++ b/README
@@ -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:
diff --git a/backend_common.h b/backend_common.h
index 1e7abba..5f3f061 100644
--- a/backend_common.h
+++ b/backend_common.h
@@ -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 */
diff --git a/backend_mitsu70x.c b/backend_mitsu70x.c
index 28bcbfa..1ca91e4 100644
--- a/backend_mitsu70x.c
+++ b/backend_mitsu70x.c
@@ -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);
diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c
index ec10bdb..75bd834 100644
--- a/backend_mitsu9550.c
+++ b/backend_mitsu9550.c
@@ -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);
diff --git a/backend_shinkos6145.c b/backend_shinkos6145.c
index 64f4345..e84c4a2 100644
--- a/backend_shinkos6145.c
+++ b/backend_shinkos6145.c
@@ -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,
diff --git a/lib6145/Makefile b/lib6145/Makefile
index c984312..2008e76 100644
--- a/lib6145/Makefile
+++ b/lib6145/Makefile
@@ -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
diff --git a/lib70x/Makefile b/lib70x/Makefile
index f778287..b925bd8 100644
--- a/lib70x/Makefile
+++ b/lib70x/Makefile
@@ -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