MinGW compatibility patches
Subsystems (2)
cover MinGW compatibility patches
Here's a few patches that might be useful.
Руслан Ижбулатов (8):
Include windows.h for vfw
Specify correct path to barcode.png
Check for clock_gettime on pthread library as well Disable zbarcam-gtk on Windows
Use -no-undefined for libzbargtk
Make zbargtk build on Windows
Make use of glib thread names
Correctly generate version.xml and reldate.xml
Makefile.am | 2 +- configure.ac | 8 ++++---- gtk/Makefile.am.inc | 2 +- gtk/zbargtk.c | 12 +++++++++++- zbarcam/Makefile.am.inc | 2 ++ 5 files changed, 19 insertions(+), 7 deletions(-)
Signature · 1 line
2.4.0
PATCH 1/8 Include windows.h for vfw
vfw.h can't be included without windows.h to supply basic type definitions.
--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
@@ -257,7 +257,7 @@ configure --disable-video to skip building video support.])], )], [AC_CHECK_HEADERS([vfw.h], [with_video="vfw"], [AC_MSG_FAILURE([test for VfW video support failed! -configure --disable-video to skip building video support.])])]) +configure --disable-video to skip building video support.])],[#include <windows.h>])]) AS_IF([test "x$have_libv4l" = "xyes"], [PKG_CHECK_MODULES([V4L2], [libv4l2], [],
Signature · 1 line
2.4.0
PATCH 2/8 Specify correct path to barcode.png
In reply to Руслан Ижбулатов$(srcdir)/examples/barcode.png does not exist anymore.
--- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.am +1 -1
@@ -73,7 +73,7 @@ EXTRA_DIST += perl/MANIFEST perl/README perl/Changes perl/COPYING.LIB \ if WIN32 dist_doc_DATA += README.windows -pkgdata_DATA = $(srcdir)/examples/barcode.png \ +pkgdata_DATA = $(srcdir)/python/test/barcode.png \ $(srcdir)/examples/scan_image.cpp $(srcdir)/examples/scan_image.vcproj %-rc.o: %.rc
Signature · 1 line
2.4.0
PATCH 3/8 Check for clock_gettime on pthread library as well
In reply to Руслан ИжбулатовOn Windows that function might be in libpthread.
--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
@@ -183,7 +183,7 @@ ZBAR_CHK_CODE([pdf417], [PDF417 symbology (incomplete)]) dnl libraries -AC_SEARCH_LIBS([clock_gettime], [rt]) +AC_SEARCH_LIBS([clock_gettime], [rt pthread]) AM_ICONV() dnl libraries linkage
Signature · 1 line
2.4.0
PATCH 4/8 Disable zbarcam-gtk on Windows
In reply to Руслан ИжбулатовIt requires scan_video.c, which includes linux/videodev2.h, so the code is clearly not meant to be built for Windows, even if GTK is available there.
--- zbarcam/Makefile.am.inc | 2 ++ 1 file changed, 2 insertions(+)
zbarcam/Makefile.am.inc +2 -0
@@ -5,12 +5,14 @@ zbarcam_zbarcam_LDADD = zbar/libzbar.la CLEANFILES += zbarcam/.libs/zbarcam zbarcam/moc_zbarcam_qt.h if HAVE_GTK +if !WIN32 bin_PROGRAMS += zbarcam/zbarcam-gtk zbarcam_zbarcam_gtk_SOURCES = zbarcam/zbarcam-gtk.c zbarcam/scan_video.c zbarcam_zbarcam_gtk_CPPFLAGS = $(GTK_CFLAGS) $(AM_CPPFLAGS) zbarcam_zbarcam_gtk_LDADD = $(GTK_LIBS) gtk/libzbargtk.la zbar/libzbar.la \ $(AM_LDADD) endif +endif if HAVE_QT bin_PROGRAMS += zbarcam/zbarcam-qt
Signature · 1 line
2.4.0
PATCH 5/8 Use -no-undefined for libzbargtk
In reply to Руслан Ижбулатов-no-undefined is required to build shlibs on Windows. Doesn't hurt on other platforms either (unless a shlib is built with undefined symbols by design, which is not the case here).
--- gtk/Makefile.am.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
gtk/Makefile.am.inc +1 -1
@@ -1,7 +1,7 @@ lib_LTLIBRARIES += gtk/libzbargtk.la gtk_libzbargtk_la_CPPFLAGS = -Igtk $(GTK_CFLAGS) $(AM_CPPFLAGS) gtk_libzbargtk_la_LDFLAGS = -version-info $(ZGTK_LIB_VERSION) \ - -export-symbols-regex "^zbar_gtk_.*" $(AM_LDFLAGS) + -export-symbols-regex "^zbar_gtk_.*" $(AM_LDFLAGS) -no-undefined gtk_libzbargtk_la_LIBADD = $(GTK_LIBS) zbar/libzbar.la $(AM_LIBADD) dist_gtk_libzbargtk_la_SOURCES = gtk/zbargtk.c gtk/zbargtkprivate.h
Signature · 1 line
2.4.0
PATCH 6/8 Make zbargtk build on Windows
In reply to Руслан ИжбулатовThe code is mostly platform-agnostic, except for this small part that is written for X. Add ifdefs with an appropriate W32 header, and call zbar_window_attach() with correct W32 arguments. Use HAVE_X as a condition.
--- gtk/zbargtk.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
gtk/zbargtk.c +10 -0
@@ -22,7 +22,11 @@*------------------------------------------------------------------------*/ #include <gtk/gtksignal.h> +#ifdef HAVE_X #include <gdk/gdkx.h> +#elif defined(_WIN32) +#include <gdk/gdkwin32.h> +#endif #include <zbar/zbargtk.h> #include "zbargtkprivate.h"
@@ -380,9 +384,15 @@ static void zbar_gtk_realize (GtkWidget *widget)gdk_window_set_back_pixmap (widget->window,NULL , TRUE);/* attach zbar_window to underlying X window */ +#ifdef HAVE_X if (zbar_window_attach (zbar->window,gdk_x11_drawable_get_xdisplay (widget->window), gdk_x11_drawable_get_xid(widget->window))) +#elif defined(_WIN32) +if (zbar_window_attach (zbar->window, +GDK_WINDOW_HWND (widget->window), + 0)) +#endif zbar_window_error_spew (zbar->window,0 ); }
Signature · 1 line
2.4.0
PATCH 7/8 Make use of glib thread names
In reply to Руслан ИжбулатовThis is optional, but why not use it?
--- gtk/zbargtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
gtk/zbargtk.c +1 -1
@@ -637,7 +637,7 @@ static void zbar_gtk_init (ZBarGtk *self)/* spawn a thread to handle decoding and video */ zbar->queue =g_async_queue_new (); - zbar->thread =g_thread_new (NULL , zbar_gtk_processing_thread, self); + zbar->thread =g_thread_new ("zbar gtk processing thread" , zbar_gtk_processing_thread, self);g_assert (zbar->thread); }
Signature · 1 line
2.4.0
PATCH 8/8 Correctly generate version.xml and reldate.xml
In reply to Руслан ИжбулатовThe buildsystem expects these files to be in srcdir, so put them there. Otherwise documentation won't build (xmlto complains that it can't find the files. Note that it uses an absolute path, so there's no way to solve this with its --searchpath argument).
--- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +2 -2
@@ -667,14 +667,14 @@ AC_CONFIG_COMMANDS([doc/version.xml], [AS_IF([test -f doc/version.xml && \ ! echo $VERSION | diff doc/version.xml - >/dev/null 2>&1 || \ ! echo $VERSION | diff $srcdir/doc/version.xml - >/dev/null 2>&1 ], - [echo "writing new doc/version.xml" ; echo $VERSION > doc/version.xml ])], + [echo "writing new doc/version.xml" ; echo $VERSION > $srcdir/doc/version.xml ])], [VERSION="$VERSION"] ) AC_CONFIG_COMMANDS([doc/reldate.xml], [AS_IF([test -f doc/reldate.xml && \ ! echo $RELDATE | diff doc/reldate.xml - >/dev/null 2>&1 || \ ! echo $RELDATE | diff $srcdir/doc/reldate.xml - >/dev/null 2>&1 ], - [echo "writing new doc/reldate.xml" ; echo $RELDATE > doc/reldate.xml ])], + [echo "writing new doc/reldate.xml" ; echo $RELDATE > $srcdir/doc/reldate.xml ])], [RELDATE="$RELDATE"] )
Signature · 1 line
2.4.0
Em Tue, 9 Apr 2019 12:38:34 +0000
Руслан Ижбулатов <[email protected]> escreveu:
Quoted 11 lines
Here's a few patches that might be useful.
Руслан Ижбулатов (8):
Includewindows.hfor vfw
Specify correct path to barcode.png
Check forclock_gettimeon pthread library as well Disable zbarcam-gtk on Windows
Use -no-undefined for libzbargtk
Make zbargtk build on Windows
Make use of glib thread names
Correctly generate version.xml and reldate.xml
Thank you for the patches. Applied today, and launched a new ZBar version (0.22.1) with the build corrections.
Quoted 8 lines
Makefile.am | 2 +- configure.ac | 8 ++++---- gtk/Makefile.am.inc | 2 +- gtk/zbargtk.c | 12 +++++++++++- zbarcam/Makefile.am.inc | 2 ++ 5 files changed, 19 insertions(+), 7 deletions(-)
Thanks,
Mauro