From 3b383c2267bf561fcc1883d74c4b7a343c46517a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Tue, 13 Oct 2020 22:16:38 +0700 Subject: [PATCH] zbar: switch to active fork, update to 0.23.1 --- common/shlibs | 2 +- srcpkgs/zbar-qt | 1 + srcpkgs/zbar/patches/check-qt5-first.patch | 70 -------------- srcpkgs/zbar/patches/compile-with-qt5.patch | 94 ------------------- srcpkgs/zbar/patches/imagemagick-7.patch | 11 --- .../patches/new_autotools_build_fix.patch | 16 ---- srcpkgs/zbar/patches/no-v4l1-check.patch | 74 --------------- srcpkgs/zbar/patches/python-3.9.patch | 55 +++++++++++ srcpkgs/zbar/template | 65 ++++++++++--- 9 files changed, 107 insertions(+), 281 deletions(-) create mode 120000 srcpkgs/zbar-qt delete mode 100644 srcpkgs/zbar/patches/check-qt5-first.patch delete mode 100644 srcpkgs/zbar/patches/compile-with-qt5.patch delete mode 100644 srcpkgs/zbar/patches/imagemagick-7.patch delete mode 100644 srcpkgs/zbar/patches/new_autotools_build_fix.patch delete mode 100644 srcpkgs/zbar/patches/no-v4l1-check.patch create mode 100644 srcpkgs/zbar/patches/python-3.9.patch diff --git a/common/shlibs b/common/shlibs index 1a12253c004..a2aeb72dd00 100644 --- a/common/shlibs +++ b/common/shlibs @@ -3018,7 +3018,7 @@ libslopy.so.7.5 slop-7.5_1 libbcunit.so.1 bcunit-3.0_1 libzbar.so.0 libzbar-0.10_1 libzbargtk.so.0 libzbar-0.10_1 -libzbarqt.so.0 libzbar-0.10_10 +libzbarqt.so.0 libzbar-qt-0.10_10 libargtable2.so.0 argtable-2.13_1 libomxil-bellagio.so.0 libomxil-bellagio-0.9.3_1 libomxdynamicloader.so.0 libomxil-bellagio-0.9.3_1 diff --git a/srcpkgs/zbar-qt b/srcpkgs/zbar-qt new file mode 120000 index 00000000000..8660d16a458 --- /dev/null +++ b/srcpkgs/zbar-qt @@ -0,0 +1 @@ +zbar \ No newline at end of file diff --git a/srcpkgs/zbar/patches/check-qt5-first.patch b/srcpkgs/zbar/patches/check-qt5-first.patch deleted file mode 100644 index d0b240b8806..00000000000 --- a/srcpkgs/zbar/patches/check-qt5-first.patch +++ /dev/null @@ -1,70 +0,0 @@ -From aab155cde51e44334022bcaddb694c014f800ae8 Mon Sep 17 00:00:00 2001 -From: Mauro Carvalho Chehab -Date: Sun, 26 Mar 2017 08:35:16 -0300 -Subject: [PATCH] configure.ac: check for Qt5 version first - -Despite zbar can be compiled with either Qt4 or Qt5, the -current logic seeks only Qt4. Change it to try first Qt5. - -Yet, as people may have both but want to build it with -Qt4, add a --without-qt5 configuration option that will -make it to check only for Qt4, just like before. - -Signed-off-by: Mauro Carvalho Chehab ---- - configure.ac | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -diff --git a/configure.ac b/configure.ac -index d49094c..70b759d 100644 ---- configure.ac -+++ configure.ac -@@ -364,18 +364,26 @@ 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"]) - - 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"]) - -@@ -453,9 +461,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 "NPAPI Plugin --with-npapi=$with_npapi" - #AS_IF([test "x$with_mozilla" != "xyes"], - # [echo " => the Mozilla/Firefox/OpenOffice plugin will *NOT* be built"]) --- -2.19.0 - - diff --git a/srcpkgs/zbar/patches/compile-with-qt5.patch b/srcpkgs/zbar/patches/compile-with-qt5.patch deleted file mode 100644 index ed59c308941..00000000000 --- a/srcpkgs/zbar/patches/compile-with-qt5.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 3e81367fa16773b0e4cb89baf269ed9bd464c220 Mon Sep 17 00:00:00 2001 -From: Mauro Carvalho Chehab -Date: Sun, 26 Mar 2017 08:25:16 -0300 -Subject: [PATCH] Add support to compile zbar with qt5 - -There aren't many changes for it to support both qt4 and qt5. -Add the needed stuff for qt5, without breaking backard compatible. - -Signed-off-by: Mauro Carvalho Chehab ---- - include/zbar/QZBar.h | 7 ++++++- - include/zbar/QZBarImage.h | 4 ++++ - qt/QZBar.cpp | 15 ++++++++++++++- - 3 files changed, 24 insertions(+), 2 deletions(-) - ---- include/zbar/QZBar.h -+++ 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 ce98401..775f2e0 100644 ---- include/zbar/QZBarImage.h -+++ include/zbar/QZBarImage.h -@@ -54,7 +54,7 @@ public: - unsigned height = qimg.height(); - set_size(width, height); - set_format('B' | ('G' << 8) | ('R' << 16) | ('4' << 24)); -- unsigned long datalen = qimg.numBytes(); -+ unsigned long datalen = qimg.byteCount(); - set_data(qimg.bits(), datalen); - - if((width * 4 != bpl) || - ---- qt/QZBar.cpp -+++ 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/srcpkgs/zbar/patches/imagemagick-7.patch b/srcpkgs/zbar/patches/imagemagick-7.patch deleted file mode 100644 index a0d5299b0ba..00000000000 --- a/srcpkgs/zbar/patches/imagemagick-7.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- zbarimg/zbarimg.c.orig 2018-09-13 17:48:15.659285113 +0200 -+++ zbarimg/zbarimg.c 2018-09-13 17:54:59.436644182 +0200 -@@ -38,7 +38,7 @@ - #include - - #include --#include -+#include - - /* in 6.4.5.4 MagickGetImagePixels changed to MagickExportImagePixels. - * (still not sure this check is quite right... diff --git a/srcpkgs/zbar/patches/new_autotools_build_fix.patch b/srcpkgs/zbar/patches/new_autotools_build_fix.patch deleted file mode 100644 index 4ab34e3f19c..00000000000 --- a/srcpkgs/zbar/patches/new_autotools_build_fix.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- configure.ac.orig -+++ configure.ac -@@ -1,9 +1,11 @@ - dnl Process this file with autoconf to produce a configure script. --AC_PREREQ([2.61]) -+AC_PREREQ([2.68]) -+m4_ifndef([AC_LANG_DEFINES_PROVIDED], -+ [m4_define([AC_LANG_DEFINES_PROVIDED])]) - AC_INIT([zbar], [0.10], [spadix@users.sourceforge.net]) - AC_CONFIG_AUX_DIR(config) - AC_CONFIG_MACRO_DIR(config) --AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects std-options dist-bzip2]) -+AM_INIT_AUTOMAKE([1.13 foreign subdir-objects std-options dist-bzip2]) - AC_CONFIG_HEADERS([include/config.h]) - AC_CONFIG_SRCDIR(zbar/scanner.c) - LT_PREREQ([2.2]) diff --git a/srcpkgs/zbar/patches/no-v4l1-check.patch b/srcpkgs/zbar/patches/no-v4l1-check.patch deleted file mode 100644 index 45a494323b1..00000000000 --- a/srcpkgs/zbar/patches/no-v4l1-check.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- configure.ac.orig -+++ configure.ac -@@ -147,19 +147,13 @@ - with_video="no" - AS_IF([test "x$enable_video" != "xno"], - [AS_IF([test "x$win32" = "xno"], -- [AC_CHECK_HEADERS([linux/videodev.h], [with_video="v4l1"], -- [AC_MSG_FAILURE([test for video support failed! --rebuild your kernel to include video4linux support or --configure --disable-video to skip building video support.])]) -- AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"], -+ [AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"], - [AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])], - [AC_CHECK_HEADERS([vfw.h], [with_video="vfw"], - [AC_MSG_FAILURE([test for VfW video support failed! - configure --disable-video to skip building vidoe support.])])]) - ]) - AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"]) --AM_CONDITIONAL([HAVE_V4L1], -- [test "x$with_video" = "xv4l1" || test "x$with_video" = "xv4l2"]) - AM_CONDITIONAL([HAVE_V4L2], [test "x$with_video" = "xv4l2"]) - - dnl X ---- zbar/Makefile.am.inc.orig -+++ zbar/Makefile.am.inc -@@ -53,12 +53,9 @@ - zbar_libzbar_la_SOURCES += zbar/processor/posix.h zbar/processor/posix.c - endif - --if HAVE_V4L1 --zbar_libzbar_la_SOURCES += zbar/video/v4l1.c - if HAVE_V4L2 - zbar_libzbar_la_SOURCES += zbar/video/v4l2.c - endif --endif - if WIN32 - if HAVE_VIDEO - zbar_libzbar_la_SOURCES += zbar/video/vfw.c ---- zbar/video/v4l2.c.orig -+++ zbar/video/v4l2.c -@@ -39,6 +39,9 @@ - # include - #endif - #include -+#include -+#include -+#include - - #include "video.h" - #include "image.h" -@@ -507,3 +507,23 @@ - vdo->dq = v4l2_dq; - return(0); - } -+ -+int _zbar_video_open (zbar_video_t *vdo, -+ const char *dev) -+{ -+ vdo->fd = open(dev, O_RDWR); -+ if(vdo->fd < 0) -+ return(err_capture_str(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, -+ "opening video device '%s'", dev)); -+ zprintf(1, "opened camera device %s (fd=%d)\n", dev, vdo->fd); -+ -+ int rc = -1; -+ if(vdo->intf != VIDEO_V4L1) -+ rc = _zbar_v4l2_probe(vdo); -+ -+ if(rc && vdo->fd >= 0) { -+ close(vdo->fd); -+ vdo->fd = -1; -+ } -+ return(rc); -+} diff --git a/srcpkgs/zbar/patches/python-3.9.patch b/srcpkgs/zbar/patches/python-3.9.patch new file mode 100644 index 00000000000..9d8575ef669 --- /dev/null +++ b/srcpkgs/zbar/patches/python-3.9.patch @@ -0,0 +1,55 @@ +From 938d39716488b545b92c28f48acc94a7b8fc9138 Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Tue, 28 Jul 2020 10:27:30 +0200 +Subject: [PATCH] python: enum: make it compatible with Python 3.9 + +As reported by: + https://github.com/mchehab/zbar/issues/92 + +python bindings don't build with Python 3.9, because it is +using tp_print, which has been silently ignored since Python +3.0, according with[1]: + + "The tp_print slot of PyTypeObject has been removed. + It was used for printing objects to files in Python 2.7 + and before. + Since Python 3.0, it has been ignored and unused." + +[1] https://docs.python.org/3.9/whatsnew/3.9.html#id3 + +Signed-off-by: Mauro Carvalho Chehab +--- + python/enum.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git python/enum.c python/enum.c +index a113553..dfe1b1e 100644 +--- python/enum.c ++++ python/enum.c +@@ -76,6 +76,8 @@ enumitem_str (zbarEnumItem *self) + return(self->name); + } + ++#if PY_MAJOR_VERSION < 3 ++/* tp_print was dropped on Python 3.9 */ + static int + enumitem_print (zbarEnumItem *self, + FILE *fp, +@@ -83,6 +85,7 @@ enumitem_print (zbarEnumItem *self, + { + return(self->name->ob_type->tp_print(self->name, fp, flags)); + } ++#endif + + static PyObject* + enumitem_repr (zbarEnumItem *self) +@@ -115,7 +118,9 @@ PyTypeObject zbarEnumItem_Type = { + .tp_new = (newfunc)enumitem_new, + .tp_dealloc = (destructor)enumitem_dealloc, + .tp_str = (reprfunc)enumitem_str, ++#if PY_MAJOR_VERSION < 3 + .tp_print = (printfunc)enumitem_print, ++#endif + .tp_repr = (reprfunc)enumitem_repr, + }; + diff --git a/srcpkgs/zbar/template b/srcpkgs/zbar/template index a1249a664f1..5daa84f4811 100644 --- a/srcpkgs/zbar/template +++ b/srcpkgs/zbar/template @@ -1,20 +1,21 @@ # Template file for 'zbar' pkgname=zbar -version=0.10 -revision=10 +version=0.23.1 +revision=1 build_style=gnu-configure -configure_args="ac_cv_header_wand_MagickWand_h=yes $(vopt_with qt) --with-gtk" -hostmakedepends="automake pkg-config libtool gettext-devel python - $(vopt_if qt 'qt5-qmake qt5-host-tools') glib-devel" -makedepends="libmagick-devel libXv-devel pygtk-devel v4l-utils-devel - $(vopt_if qt qt5-x11extras-devel)" +build_helper=gir +configure_args="$(vopt_with qt) --with-gir --with-python=python3" +hostmakedepends="pkg-config python3 glib-devel + $(vopt_if qt 'qt5-qmake qt5-host-tools')" +makedepends="libmagick-devel libXv-devel python3-devel v4l-utils-devel + gtk+3-devel $(vopt_if qt qt5-x11extras-devel)" depends="libzbar-${version}_${revision}" short_desc="Barcode reading library and application" maintainer="Jürgen Buchmüller " license="LGPL-2.1-or-later" -homepage="https://zbar.sourceforge.net/" -distfiles="${SOURCEFORGE_SITE}/zbar/${version}/${pkgname}-${version}.tar.bz2" -checksum=234efb39dbbe5cef4189cc76f37afbe3cfcfb45ae52493bfe8e191318bdbadc6 +homepage="https://git.linuxtv.org/zbar.git/" +distfiles="https://linuxtv.org/downloads/zbar/${pkgname}-${version}.tar.bz2" +checksum=dad260b47ef887a639e840a89e5e6e132217b6bba2a8473565d1f459bcb97c1f build_options="qt" case "$XBPS_TARGET_MACHINE" in @@ -22,17 +23,40 @@ case "$XBPS_TARGET_MACHINE" in *) build_options_default="qt" ;; esac -CFLAGS="-DNDEBUG" +CFLAGS="-DNDEBUG -I$XBPS_CROSS_BASE/usr/include/python$py3_ver" subpackages="libzbar libzbar-devel" if [ "$build_option_qt" ]; then - subpackages+=" libzbar-qt" + subpackages+=" zbar-qt libzbar-qt" fi -pre_configure() { - export PYTHON_CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/python2.7" - autoreconf -fi +post_extract() { + # 0.23.1 doesn't ship this file, corrected in master + cat >zbar-qt5.pc.in <<-'_EOF' + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ + includedir=@includedir@ + + Name: zbar-qt + Description: bar code scanning and decoding Qt5 widget + URL: http://zbar.sourceforge.net + Version: @VERSION@ + Requires: zbar, Qt5Core >= 5, Qt5Gui >= 5 + Libs: -L${libdir} -lzbarqt + Cflags: -I${includedir} + _EOF +} + +post_patch() { + # https://github.com/mchehab/zbar/commit/a133aea7880bbb56d7553 + vsed -i -e 's/^.include.*gettext[.]h.*/#include /' \ + zbarcam/zbarcam.c zbarimg/zbarimg.c +} + +xpre_configure() { + gettextize zbar } libzbar_package() { @@ -40,9 +64,19 @@ libzbar_package() { pkg_install() { vmove "usr/lib/libzbar.so.*" vmove "usr/lib/libzbargtk.so.*" + vmove "$py3_lib" + vmove "usr/lib/girepository-1.0" } } +zbar-qt_package() { + short_desc+=" - Qt frontend" + pkg_install() { + vmove "usr/bin/*-qt" + } +} + + libzbar-qt_package() { conflicts="libzbar<0.10_10" short_desc+=" - Qt bindings" @@ -59,5 +93,6 @@ libzbar-devel_package() { vmove usr/lib/pkgconfig vmove "usr/lib/*.a" vmove "usr/lib/*.so" + vmove "usr/share/gir-1.0" } }