diff --git a/.gitignore b/.gitignore index f0c8280..4776e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ zbar-0.10.tar.bz2 /zbar-0.10.tar.bz2 +/zbar-0.20.tar.bz2 diff --git a/sources b/sources index e58d80a..4148b2d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d8b9dddcf28d6603d8b066816941a9d2 zbar-0.10.tar.bz2 +SHA512 (zbar-0.20.tar.bz2) = d967b250d2bf021aa02583751dc62ffc3f8d220224df1a3644f52eee6d0ec5bd5c5cceb36c3d765a85afafd7a0ba182ed9d8263ef1be1852456687b687de5375 diff --git a/zbar.spec b/zbar.spec index 4f7ff68..a3597f3 100644 --- a/zbar.spec +++ b/zbar.spec @@ -1,31 +1,28 @@ %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -Name: zbar -Version: 0.10 -Release: 28%{?dist} -Summary: Bar code reader +Name: zbar +Version: 0.20 +Release: 1%{?dist} +Summary: Bar code reader + +Group: User Interface/X Hardware Support +License: LGPLv2+ +URL: http://zbar.sourceforge.net/ +Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2 + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Group: User Interface/X Hardware Support -License: LGPLv2+ -URL: http://zbar.sourceforge.net/ -Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 -Patch0: zbar_update_to_hg.patch -Patch1: zbar_use_libv4l.patch -Patch2: zbar_choose_supported_format_first.patch -Patch3: zbar_use_REQBUFS_properly.patch -Patch4: zbar_configure_ac_use_m4_pattern_allow.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - BuildRequires: autoconf automake libtool python-devel gettext-devel -BuildRequires: qt4-devel gtk2-devel pygtk2-devel GraphicsMagick-c++-devel +BuildRequires: qt5-qtbase-devel qt5-qtx11extras-devel +BuildRequires: gtk2-devel pygtk2-devel GraphicsMagick-c++-devel BuildRequires: libv4l-devel libXv-devel xmlto %description -A layered barcode scanning and decoding library. Supports EAN, UPC, Code 128, +A layered bar code scanning and decoding library. Supports EAN, UPC, Code 128, Code 39 and Interleaved 2 of 5. -Includes applications for decoding captured barcode images and using a video -device (eg, webcam) as a barcode scanner. +Includes applications for decoding captured bar code images and using a video +device (e. g., webcam) as a bar code scanner. %package devel Group: Development/Libraries @@ -85,15 +82,10 @@ scanning widget. %prep %setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 %build autoreconf -vfi -%configure --with-graphicsmagick --docdir=%{_docdir}/%{name}-%{version} +%configure --without-java --with-graphicsmagick --docdir=%{_docdir}/%{name}-%{version} # rpath sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool @@ -109,7 +101,7 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" find ${RPM_BUILD_ROOT} -name '*.la' -or -name '*.a' | xargs rm -f # Remove installed doc -rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-0.10/ +rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-%{version}/ %clean rm -rf $RPM_BUILD_ROOT @@ -160,6 +152,7 @@ rm -rf $RPM_BUILD_ROOT %files gtk %defattr(-,root,root,-) %{_libdir}/libzbargtk.so.* +%{_bindir}/zbarcam-gtk %files gtk-devel %defattr(-,root,root,-) @@ -175,6 +168,7 @@ rm -rf $RPM_BUILD_ROOT %files qt %defattr(-,root,root,-) %{_libdir}/libzbarqt.so.* +%{_bindir}/zbarcam-qt %files qt-devel %defattr(-,root,root,-) @@ -183,6 +177,12 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/zbar/QZBar*.h %changelog +* Tue Apr 11 2017 Mauro Carvalho Chehab - 0.20-1 +- Update it to version 0.20 with brings V4L2 controls to zbarcam-qt + +* Sun Mar 26 2017 Mauro Carvalho Chehab - 0.10-29 +- Make zbar-qt to use Qt5 and generate gtk and qt applications + * Sat Feb 11 2017 Fedora Release Engineering - 0.10-28 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild @@ -282,7 +282,7 @@ rm -rf $RPM_BUILD_ROOT - Removed ldconfig calls to devel subpackages - Fixed directory ownership issue -pygtk - Added %%{name} to URL -- Added comment to rpath +- Added comment to rpath - Improved comment for removing .la and .a files * Mon Jul 27 2009 Douglas Schilling Landgraf - 0.8-4 @@ -292,7 +292,7 @@ rm -rf $RPM_BUILD_ROOT - Removed Provides for not included static libs - Removed redundant requires to subpackages -qt and -gtk - Removed redundant {name} = %%{version}-%%{release} from -pygtk -- Replaced macros from % to %% in changelog +- Replaced macros from % to %% in changelog - Fixed ownership issue - Added ldconfig call to devel, qt-devel and gtk-devel @@ -319,8 +319,8 @@ rm -rf $RPM_BUILD_ROOT - Fixed rpath error * Thu Jul 16 2009 Douglas Schilling Landgraf - 0.8-2 -- Added pkgconfig to devel package -- Fixed syntax to ldconfig +- Added pkgconfig to devel package +- Fixed syntax to ldconfig - Fixed warnings from rpmlint - Fixed static path to docs diff --git a/zbar_add_support_for_qt5.patch b/zbar_add_support_for_qt5.patch new file mode 100644 index 0000000..519645f --- /dev/null +++ b/zbar_add_support_for_qt5.patch @@ -0,0 +1,140 @@ +diff --git a/configure.ac b/configure.ac +index dbd7153fb13b..7bcb18219853 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -476,18 +476,33 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "x$with_python" = "xyes"]) + dnl Qt + AC_ARG_WITH([qt], + [AS_HELP_STRING([--without-qt], +- [disable support for Qt4 widget])], ++ [disable support for Qt widget])], + [], + [with_qt="yes"]) + ++dnl Qt5 ++AC_ARG_WITH([qt5], ++ [AS_HELP_STRING([--without-qt5], ++ [disable support for Qt5 widget. if --with-qt, it will seek only for Qt4])], ++ [], ++ [with_qt5="yes"]) ++ + AC_ARG_VAR([MOC], [full path to Qt moc program]) + + AS_IF([test "x$with_qt" != "xno"], +- [PKG_CHECK_MODULES([QT], [QtCore >= 4 QtGui >= 4]) +- MOC=`$PKG_CONFIG QtGui --variable=moc_location` +- AC_MSG_NOTICE([using moc from $MOC]) +- QT_VERSION=`$PKG_CONFIG QtGui --modversion` +- AC_MSG_NOTICE([using Qt version $QT_VERSION])]) ++ AS_IF([test "x$with_qt5" != "xno"], ++ [PKG_CHECK_MODULES([QT], [Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 Qt5X11Extras >= 5.0]) ++ AC_CHECK_PROGS(MOC, [moc-qt5 moc]) ++ AC_MSG_NOTICE([using moc from $MOC]) ++ QT_VERSION=`$PKG_CONFIG Qt5Gui --modversion` ++ CPPFLAGS="$CPPFLAGS $QT_CPPFLAGS -fPIC" ++ AC_MSG_NOTICE([using Qt version $QT_VERSION])], ++ ++ [PKG_CHECK_MODULES([QT], [QtCore >= 4 QtGui >= 4]) ++ MOC=`$PKG_CONFIG QtGui --variable=moc_location` ++ AC_MSG_NOTICE([using moc from $MOC]) ++ QT_VERSION=`$PKG_CONFIG QtGui --modversion` ++ AC_MSG_NOTICE([using Qt version $QT_VERSION])])) + + AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"]) + +@@ -596,9 +611,9 @@ AS_IF([test "x$with_gtk" != "xyes"], + [echo " => the GTK+ widget will *NOT* be built"], + [AS_IF([test "x$with_python" != "xyes"], + [echo " => the PyGTK widget wrapper will *NOT* be built"])]) +-echo "Qt4 --with-qt=$with_qt" ++echo "Qt${QT_VERSION} --with-qt=$with_qt" + AS_IF([test "x$with_qt" != "xyes"], +- [echo " => the Qt4 widget will *NOT* be built"]) ++ [echo " => the Qt widget will *NOT* be built"]) + echo "Java --with-java=$with_java" + AS_IF([test "x$with_java" != "xyes"], + [echo " => the Java interface will *NOT* be built"]) +diff --git a/include/zbar/QZBar.h b/include/zbar/QZBar.h +index 104449928e2d..1a4716565047 100644 +--- a/include/zbar/QZBar.h ++++ b/include/zbar/QZBar.h +@@ -26,7 +26,12 @@ + /// @file + /// Barcode Reader Qt4 Widget + +-#include ++#include ++#if QT_VERSION >= 0x050000 ++# include ++#else ++# include ++#endif + + namespace zbar { + +diff --git a/include/zbar/QZBarImage.h b/include/zbar/QZBarImage.h +index 1505177e07a9..b862c8085576 100644 +--- a/include/zbar/QZBarImage.h ++++ b/include/zbar/QZBarImage.h +@@ -54,7 +54,11 @@ public: + unsigned height = qimg.height(); + set_size(width, height); + set_format(zbar_fourcc('B','G','R','4')); ++#if QT_VERSION >= 0x050000 ++ unsigned long datalen = qimg.byteCount(); ++#else + unsigned long datalen = qimg.numBytes(); ++#endif + set_data(qimg.bits(), datalen); + + if((width * 4 != bpl) || +diff --git a/qt/QZBar.cpp b/qt/QZBar.cpp +index e1001b09cff5..a5b956b342ad 100644 +--- a/qt/QZBar.cpp ++++ b/qt/QZBar.cpp +@@ -23,7 +23,7 @@ + + #include + #include +-#include ++#include + #include + #include "QZBarThread.h" + +@@ -49,7 +49,11 @@ QZBar::QZBar (QWidget *parent) + + thread = new QZBarThread; + if(testAttribute(Qt::WA_WState_Created)) { ++#if QT_VERSION >= 0x050000 ++ thread->window.attach(QX11Info::display(), winId()); ++#else + thread->window.attach(x11Info().display(), winId()); ++#endif + _attached = 1; + } + connect(thread, SIGNAL(videoOpened(bool)), +@@ -204,7 +208,12 @@ void QZBar::changeEvent(QEvent *event) + try { + QMutexLocker locker(&thread->mutex); + if(event->type() == QEvent::ParentChange) ++#if QT_VERSION >= 0x050000 ++ thread->window.attach(QX11Info::display(), winId()); ++#else + thread->window.attach(x11Info().display(), winId()); ++#endif ++ + } + catch(Exception) { /* ignore (FIXME do something w/error) */ } + } +@@ -215,7 +224,11 @@ void QZBar::attach () + return; + + try { ++#if QT_VERSION >= 0x050000 ++ thread->window.attach(QX11Info::display(), winId()); ++#else + thread->window.attach(x11Info().display(), winId()); ++#endif + _attached = 1; + + _videoEnabled = !_videoDevice.isEmpty(); diff --git a/zbar_generate_qt_gtk_apps.patch b/zbar_generate_qt_gtk_apps.patch new file mode 100644 index 0000000..17c6856 --- /dev/null +++ b/zbar_generate_qt_gtk_apps.patch @@ -0,0 +1,148 @@ +From 76a286fd34d5159b55de4d4f276dcbf69d1b263e Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Sun, 26 Mar 2017 09:43:07 -0300 +Subject: [PATCH] zbarcam: add qt and gtk variants + +The original zbarcam use standard X11 libraries to display +video. That provides an ugly interface, and could be +slow on high resolutions. + +As Zbar has already test examples for qt and gtk, let's +promote them to real applications. One advantage is that +both qt and gtk libraries will be tested when building +those. + +Signed-off-by: Mauro Carvalho Chehab + +diff --git a/qt/Makefile.am.inc b/qt/Makefile.am.inc +index dc1525e0d52a..5f860bfa31bc 100644 +--- a/qt/Makefile.am.inc ++++ b/qt/Makefile.am.inc +@@ -7,6 +7,7 @@ qt_libzbarqt_la_SOURCES = qt/QZBar.cpp qt/QZBarThread.h qt/QZBarThread.cpp + nodist_qt_libzbarqt_la_SOURCES = qt/moc_QZBar.cpp qt/moc_QZBarThread.cpp + BUILT_SOURCES += $(nodist_qt_libzbarqt_la_SOURCES) + DISTCLEANFILES += $(nodist_qt_libzbarqt_la_SOURCES) ++CLEANFILES += qt/moc_%.cpp + + qt/moc_%.cpp: qt/%.h + $(MOC) $(qt_libzbarqt_la_CPPFLAGS) $< -o $@ +diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc +index 7340a7f2f61f..8496eb30f3cc 100644 +--- a/test/Makefile.am.inc ++++ b/test/Makefile.am.inc +@@ -45,26 +45,6 @@ test_dbg_scan_CPPFLAGS = $(MAGICK_CFLAGS) $(AM_CPPFLAGS) + test_dbg_scan_LDADD = $(MAGICK_LIBS) -lMagick++ zbar/libzbar.la $(AM_LDADD) + endif + +-if HAVE_GTK +-check_PROGRAMS += test/test_gtk +-test_test_gtk_SOURCES = test/test_gtk.c test/scan_video.c +-test_test_gtk_CPPFLAGS = $(GTK_CFLAGS) $(AM_CPPFLAGS) +-test_test_gtk_LDADD = $(GTK_LIBS) gtk/libzbargtk.la $(AM_LDADD) +-endif +- +-if HAVE_QT +-check_PROGRAMS += test/test_qt +-test_test_qt_SOURCES = test/test_qt.cpp test/scan_video.c +-nodist_test_test_qt_SOURCES = test/moc_test_qt.h +-test_test_qt_CPPFLAGS = -Itest $(QT_CFLAGS) $(AM_CPPFLAGS) +-test_test_qt_LDADD = $(QT_LIBS) qt/libzbarqt.la $(AM_LDADD) +-BUILT_SOURCES += $(nodist_test_test_qt_SOURCES) +-DISTCLEANFILES += $(nodist_test_test_qt_SOURCES) +- +-test/moc_%.h: test/%.cpp +- $(MOC) -i $(test_test_qt_CPPFLAGS) $< -o $@ +-endif +- + EXTRA_DIST += test/test_pygtk.py test/test_perl.pl + + # automake bug in "monolithic mode"? +diff --git a/zbarcam/Makefile.am.inc b/zbarcam/Makefile.am.inc +index ea869bcd2e11..5aa788a23da5 100644 +--- a/zbarcam/Makefile.am.inc ++++ b/zbarcam/Makefile.am.inc +@@ -2,7 +2,32 @@ bin_PROGRAMS += zbarcam/zbarcam + zbarcam_zbarcam_SOURCES = zbarcam/zbarcam.c + zbarcam_zbarcam_LDADD = zbar/libzbar.la + # automake bug in "monolithic mode"? +-CLEANFILES += zbarcam/.libs/zbarcam ++CLEANFILES += zbarcam/.libs/zbarcam zbarcam/moc_zbarcam_qt.h ++ ++if HAVE_GTK ++bin_PROGRAMS += zbarcam/zbarcam-gtk ++check_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 $(AM_LDADD) ++endif ++ ++if HAVE_QT ++bin_PROGRAMS += zbarcam/zbarcam-qt ++check_PROGRAMS += zbarcam/zbarcam-qt ++ ++zbarcam_zbarcam_qt_SOURCES = zbarcam/zbarcam-qt.cpp zbarcam/scan_video.c ++nodist_zbarcam_zbarcam_qt_SOURCES = zbarcam/moc_zbarcam_qt.h ++zbarcam_zbarcam_qt_CPPFLAGS = -Izbarcam $(QT_CFLAGS) $(AM_CPPFLAGS) ++zbarcam_zbarcam_qt_LDADD = $(QT_LIBS) qt/libzbarqt.la $(AM_LDADD) ++BUILT_SOURCES += $(nodist_zbarcam_zbarcam_qt_SOURCES) ++DISTCLEANFILES += $(nodist_zbarcam_zbarcam_qt_SOURCES) zbarcam/moc_zbarcam_qt.h ++ ++ ++zbarcam/moc_zbarcam_qt.h: zbarcam/zbarcam-qt.cpp ++ $(MOC) -i $(zbarcam_zbarcam_qt_CPPFLAGS) $< -o $@ ++endif ++ + + if WIN32 + zbarcam_zbarcam_SOURCES += zbarcam/zbarcam.rc +diff --git a/test/scan_video.c b/zbarcam/scan_video.c +similarity index 100% +rename from test/scan_video.c +rename to zbarcam/scan_video.c +diff --git a/test/test_gtk.c b/zbarcam/zbarcam-gtk.c +similarity index 100% +rename from test/test_gtk.c +rename to zbarcam/zbarcam-gtk.c +diff --git a/test/test_qt.cpp b/zbarcam/zbarcam-qt.cpp +similarity index 97% +rename from test/test_qt.cpp +rename to zbarcam/zbarcam-qt.cpp +index 96d2f9541453..3a39a338b59d 100644 +--- a/test/test_qt.cpp ++++ b/zbarcam/zbarcam-qt.cpp +@@ -40,7 +40,7 @@ int scan_video(void *add_device, + const char *default_device); + } + +-class TestQZBar : public QWidget ++class ZbarcamQZBar : public QWidget + { + Q_OBJECT + +@@ -52,7 +52,7 @@ protected: + } + + public: +- TestQZBar (const char *default_device) ++ ZbarcamQZBar (const char *default_device) + { + // drop-down list of video devices + QComboBox *videoList = new QComboBox; +@@ -142,7 +142,7 @@ private: + zbar::QZBar *zbar; + }; + +-#include "moc_test_qt.h" ++#include "moc_zbarcam_qt.h" + + int main (int argc, char *argv[]) + { +@@ -152,7 +152,7 @@ int main (int argc, char *argv[]) + if(argc > 1) + dev = argv[1]; + +- TestQZBar window(dev); ++ ZbarcamQZBar window(dev); + window.show(); + return(app.exec()); + }