zbar: switch to active fork, update to 0.23.1

This commit is contained in:
Đoàn Trần Công Danh 2020-10-13 22:16:38 +07:00
parent 7a20e4c184
commit b4c7108964
9 changed files with 103 additions and 280 deletions

View File

@ -3016,7 +3016,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

1
srcpkgs/zbar-qt Symbolic link
View File

@ -0,0 +1 @@
zbar

View File

@ -1,70 +0,0 @@
From aab155cde51e44334022bcaddb694c014f800ae8 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
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 <mchehab@s-opensource.com>
---
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

View File

@ -1,94 +0,0 @@
From 3e81367fa16773b0e4cb89baf269ed9bd464c220 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
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 <mchehab@s-opensource.com>
---
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 <qwidget.h>
+#include <QtGui>
+#if QT_VERSION >= 0x050000
+# include <QtWidgets>
+#else
+# include <qwidget.h>
+#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 <qevent.h>
#include <qurl.h>
-#include <qx11info_x11.h>
+#include <QX11Info>
#include <zbar/QZBar.h>
#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();

View File

@ -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 <assert.h>
#include <zbar.h>
-#include <wand/MagickWand.h>
+#include <MagickWand/MagickWand.h>
/* in 6.4.5.4 MagickGetImagePixels changed to MagickExportImagePixels.
* (still not sure this check is quite right...

View File

@ -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])

View File

@ -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 <sys/mman.h>
#endif
#include <linux/videodev2.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
#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);
+}

View File

@ -0,0 +1,55 @@
From 938d39716488b545b92c28f48acc94a7b8fc9138 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
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 <mchehab+huawei@kernel.org>
---
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,
};

View File

@ -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 <pullmoll@t-online.de>"
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,37 @@ case "$XBPS_TARGET_MACHINE" in
*) build_options_default="qt" ;;
esac
export PYTHON_CFLAGS="-I$XBPS_CROSS_BASE/usr/include/python$py3_ver"
CFLAGS="-DNDEBUG"
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 <locale.h>/' \
zbarcam/zbarcam.c zbarimg/zbarimg.c
}
libzbar_package() {
@ -40,9 +61,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 +90,6 @@ libzbar-devel_package() {
vmove usr/lib/pkgconfig
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
vmove "usr/share/gir-1.0"
}
}