media-gfx/zbar: version bump to 0.23
authorYury Martynov <email@linxon.ru>
Mon, 6 Jan 2020 15:35:20 +0000 (18:35 +0300)
committerAndreas Sturmlechner <asturm@gentoo.org>
Mon, 3 Feb 2020 17:35:38 +0000 (18:35 +0100)
Closes: https://bugs.gentoo.org/689406
Package-Manager: Portage-2.3.79, Repoman-2.3.16
Signed-off-by: Yury Martynov <email@linxon.ru>
Closes: https://github.com/gentoo/gentoo/pull/14266
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
media-gfx/zbar/Manifest
media-gfx/zbar/files/zbar-0.23_create_correct_pkconfig_file_for_zbar-qt5.patch [new file with mode: 0644]
media-gfx/zbar/files/zbar-0.23_fix_Qt5X11Extras_detect.patch [new file with mode: 0644]
media-gfx/zbar/files/zbar-0.23_fix_detection_of_errors_in_the_v4l_read.patch [new file with mode: 0644]
media-gfx/zbar/files/zbar-0.23_fix_python_detect.patch [new file with mode: 0644]
media-gfx/zbar/files/zbar-0.23_reset_conversion_descriptor_after_close.patch [new file with mode: 0644]
media-gfx/zbar/metadata.xml
media-gfx/zbar/zbar-0.23.ebuild [new file with mode: 0644]

index 00a21a631d2b1ef4166f17423f4bf3faee80ece8..8d5d753531a20afd617d1b02166b82fcca76fed4 100644 (file)
@@ -1 +1,2 @@
 DIST zbar-0.20.1.tar.gz 555199 BLAKE2B f224a2207fa0603da4cc3a0e1d05bc73f3cf0cc9d13c26b3b801d3418f4f6a001b52e468b721552af61f4c8d7357934abd0560c24d3b233107785c69cfe14753 SHA512 21ad9d8fcdecb41bd4b8979366ab8ec6e8eac815f52270b0dc72ce6a126ccef933d048ce8bbe28f46ada5defadf85ba8c97c5c1870c9560a9dab28c585dfaf42
+DIST zbar-0.23.tar.gz 1301948 BLAKE2B dd74ce44bcb10f8a7cf180b982e5bd82f1f5674540931377d207ab730bb2d080fe222bfc42d4a3d70895ad53b78638e73c2294018b80d30dc28f7e6ecc14c761 SHA512 9737f9dca42c29f92aa1eca5c0808da34f1d16c88c65241c9e3984c487e502f398437e7a707a1edd2c440f784db537ba33ea4008a2d1c1caaf5eea6431b1400b
diff --git a/media-gfx/zbar/files/zbar-0.23_create_correct_pkconfig_file_for_zbar-qt5.patch b/media-gfx/zbar/files/zbar-0.23_create_correct_pkconfig_file_for_zbar-qt5.patch
new file mode 100644 (file)
index 0000000..3be9c22
--- /dev/null
@@ -0,0 +1,71 @@
+From cac1fffce80f0835e4d8d234023a775b4243b916 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
+Date: Sun, 20 Oct 2019 01:44:02 +0200
+Subject: [PATCH] Create correct pkconfig file for zbar-qt5
+
+Although zbar supports Qt5, the created pkgconfig file always requested
+the Qt(4) components.
+
+Fixes issue #62.
+---
+ configure.ac   | 13 ++++++++++---
+ zbar-qt5.pc.in | 12 ++++++++++++
+ 2 files changed, 22 insertions(+), 3 deletions(-)
+ create mode 100644 zbar-qt5.pc.in
+
+diff --git a/configure.ac b/configure.ac
+index 935110a..49ef6a8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -659,15 +659,23 @@ AS_IF([test "x$with_qt" != "xno"],
+      CPPFLAGS="$CPPFLAGS $QT_CPPFLAGS"
+ dnl -fPIC has no effect on Windows and breaks windres
+      AS_IF([test "x$win32" = "xno"], [CPPFLAGS="$CPPFLAGS -fPIC"])
+-     AC_MSG_NOTICE([using Qt version $QT_VERSION])],
++     AC_MSG_NOTICE([using Qt version $QT_VERSION])
++     qt_pkgconfig_file="zbar-qt5.pc"
++     ],
+     [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])]))
++     AC_MSG_NOTICE([using Qt version $QT_VERSION])
++     qt_pkgconfig_file="zbar-qt.pc"
++     ]))
+ AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"])
++AM_COND_IF([HAVE_QT],
++     [AC_CONFIG_FILES([zbar-qt.pc:"${qt_pkgconfig_file}.in"])]
++)
++
+ dnl Java
+ have_java="maybe"
+@@ -820,7 +828,6 @@ java/Makefile
+ zbar/Makefile
+ zbar.pc
+ zbar-gtk.pc
+-zbar-qt.pc
+ doc/doxygen.conf])
+ AC_CONFIG_FILES([test/test_examples.sh],[chmod 755 test/test_examples.sh])
+diff --git a/zbar-qt5.pc.in b/zbar-qt5.pc.in
+new file mode 100644
+index 0000000..3378993
+--- /dev/null
++++ b/zbar-qt5.pc.in
+@@ -0,0 +1,12 @@
++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}
diff --git a/media-gfx/zbar/files/zbar-0.23_fix_Qt5X11Extras_detect.patch b/media-gfx/zbar/files/zbar-0.23_fix_Qt5X11Extras_detect.patch
new file mode 100644 (file)
index 0000000..7692db4
--- /dev/null
@@ -0,0 +1,18 @@
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac     2019-05-23 23:37:12.000000000 +0300
++++ b/configure.ac     2020-01-22 12:27:14.190755156 +0300
+@@ -638,13 +638,9 @@
+ AC_ARG_VAR([MOC], [full path to Qt moc program])
+-AS_IF([test "x$have_x" = "xyes"],
+-      [qt_extra="Qt5X11Extras >= 5.0"],
+-      [qt_extra=""])
+-
+ AS_IF([test "x$with_qt" != "xno"],
+       [PKG_CHECK_MODULES([QT],
+-                       [Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 $qt_extra],,
++                       [Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 Qt5X11Extras >= 5.0],,
+                        [with_qt5 = "no"
+                         PKG_CHECK_MODULES([QT],
+                                           [QtCore >= 4 QtGui >= 4],,
diff --git a/media-gfx/zbar/files/zbar-0.23_fix_detection_of_errors_in_the_v4l_read.patch b/media-gfx/zbar/files/zbar-0.23_fix_detection_of_errors_in_the_v4l_read.patch
new file mode 100644 (file)
index 0000000..8484e31
--- /dev/null
@@ -0,0 +1,29 @@
+From 52a4fa5242af5da770b3cab1713f87e8d899e7ed Mon Sep 17 00:00:00 2001
+From: Dan Fandrich <dan@coneharvesters.com>
+Date: Fri, 27 Dec 2019 18:33:17 +0100
+Subject: [PATCH] Fix detection of errors in the v4l read.
+
+The return type must be signed in order to detect a read failure. Also,
+display an error message after such a failure.
+---
+ zbar/video/v4l2.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/zbar/video/v4l2.c b/zbar/video/v4l2.c
+index daed38b..c0398ea 100644
+--- a/zbar/video/v4l2.c
++++ b/zbar/video/v4l2.c
+@@ -133,9 +133,11 @@ static zbar_image_t *v4l2_dq (zbar_video_t *vdo)
+             return(NULL);
+         /* FIXME should read entire image */
+-        unsigned long datalen = read(fd, (void*)img->data, img->datalen);
+-        if(datalen < 0)
++        ssize_t datalen = read(fd, (void*)img->data, img->datalen);
++        if(datalen < 0) {
++            perror("v4l2_dq read");
+             return(NULL);
++        }
+         else if(datalen != img->datalen)
+             zprintf(0, "WARNING: read() size mismatch: 0x%lx != 0x%lx\n",
+                     datalen, img->datalen);
diff --git a/media-gfx/zbar/files/zbar-0.23_fix_python_detect.patch b/media-gfx/zbar/files/zbar-0.23_fix_python_detect.patch
new file mode 100644 (file)
index 0000000..54e1018
--- /dev/null
@@ -0,0 +1,13 @@
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac     2019-05-23 23:37:12.000000000 +0300
++++ b/configure.ac     2020-01-06 12:30:41.621264633 +0300
+@@ -559,8 +559,7 @@
+                            [with_python="no"])
+                     ])
+              ]
+-      )],
+-      [with_python="auto"]
++      )]
+ )
+ AS_IF([test "x$with_python" != "xno"],
diff --git a/media-gfx/zbar/files/zbar-0.23_reset_conversion_descriptor_after_close.patch b/media-gfx/zbar/files/zbar-0.23_reset_conversion_descriptor_after_close.patch
new file mode 100644 (file)
index 0000000..75d02cb
--- /dev/null
@@ -0,0 +1,25 @@
+From ba0bcb39c4fa57634c05597464352d4e630f1ea2 Mon Sep 17 00:00:00 2001
+From: hz-mk <51707958+hz-mk@users.noreply.github.com>
+Date: Tue, 11 Jun 2019 16:32:18 +0200
+Subject: [PATCH] Reset conversion descriptor after close (prevent double free)
+
+---
+ zbar/qrcode/qrdectxt.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/zbar/qrcode/qrdectxt.c b/zbar/qrcode/qrdectxt.c
+index 2ab7b9b..4be7635 100644
+--- a/zbar/qrcode/qrdectxt.c
++++ b/zbar/qrcode/qrdectxt.c
+@@ -409,7 +409,10 @@ int qr_code_data_list_extract_text(const qr_code_data_list *_qrlist,
+       /*If eci should be reset between codes, do so.*/
+       if(eci<=QR_ECI_GLI1){
+         eci=-1;
+-        if(eci_cd!=(iconv_t)-1)iconv_close(eci_cd);
++        if(eci_cd!=(iconv_t)-1){
++        iconv_close(eci_cd);
++        eci_cd=(iconv_t)-1;
++      }
+       }
+     }
index fd5ad454e03af975eb5b58f46b5c4df9ff94c93a..064f2be75872b8f7a83eeb0fb250f83442169512 100644 (file)
@@ -1,10 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-       <!-- maintainer-needed -->
+       <maintainer type="person">
+               <email>email@linxon.ru</email>
+               <name>Yury Martynov</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-maint@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
        <upstream>
                <remote-id type="sourceforge">zbar</remote-id>
                <remote-id type="github">mchehab/zbar</remote-id>
                <bugs-to>https://github.com/mchehab/zbar/issues</bugs-to>
        </upstream>
+       <longdescription>
+               The ZBar Bar Code Reader is a library for scanning and decoding bar
+               codes from various sources such as video streams, image files or raw
+               intensity sensors.  It supports EAN, UPC, Code 128, Code 93, Code 39
+               and Interleaved 2 of 5. The flexible, layered architecture features a
+               fast, streaming interface with a minimal memory footprint.
+       </longdescription>
 </pkgmetadata>
diff --git a/media-gfx/zbar/zbar-0.23.ebuild b/media-gfx/zbar/zbar-0.23.ebuild
new file mode 100644 (file)
index 0000000..34eb41b
--- /dev/null
@@ -0,0 +1,216 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit autotools flag-o-matic java-pkg-opt-2 multilib-minimal python-single-r1 virtualx
+
+DESCRIPTION="Library and tools for reading barcodes from images or video"
+HOMEPAGE="https://github.com/mchehab/zbar"
+SRC_URI="https://linuxtv.org/downloads/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+
+IUSE="dbus graphicsmagick gtk +imagemagick introspection java jpeg python qt5 static-libs test +threads v4l X xv"
+REQUIRED_USE="
+       introspection? ( gtk )
+       python? ( ${PYTHON_REQUIRED_USE} )
+       test? (
+               ${PYTHON_REQUIRED_USE}
+               X? ( imagemagick )
+       )
+       xv? ( X )"
+
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="
+       dbus? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+       gtk? (
+               dev-libs/glib:2[${MULTILIB_USEDEP}]
+               x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+               introspection? ( dev-libs/gobject-introspection )
+       )
+       imagemagick? (
+               !graphicsmagick? ( media-gfx/imagemagick:=[png,jpeg?] )
+               graphicsmagick? ( media-gfx/graphicsmagick:=[png,jpeg?] )
+       )
+       jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
+       python? ( ${PYTHON_DEPS} )
+       qt5? (
+               dev-qt/qtcore:5
+               dev-qt/qtgui:5
+               dev-qt/qtwidgets:5
+               dev-qt/qtx11extras:5
+       )
+       v4l? ( media-libs/libv4l:0=[${MULTILIB_USEDEP}] )
+       X? (
+               x11-libs/libX11[${MULTILIB_USEDEP}]
+               x11-libs/libXext[${MULTILIB_USEDEP}]
+               xv? ( x11-libs/libXv[${MULTILIB_USEDEP}] )
+       )"
+
+RDEPEND="${COMMON_DEPEND}
+       java? ( virtual/jre )"
+
+DEPEND="${COMMON_DEPEND}
+       java? (
+               >=virtual/jdk-1.8
+               test? (
+                       dev-java/hamcrest-core:1.3
+                       dev-java/junit:4
+               )
+       )
+       test? (
+               ${PYTHON_DEPS}
+               dev-python/pillow[${PYTHON_USEDEP}]
+       )"
+
+BDEPEND="
+       sys-devel/gettext
+       virtual/pkgconfig
+       gtk? ( dev-util/glib-utils )"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.10-errors.patch"
+       "${FILESDIR}/${P}_create_correct_pkconfig_file_for_zbar-qt5.patch"
+       "${FILESDIR}/${P}_fix_detection_of_errors_in_the_v4l_read.patch"
+       "${FILESDIR}/${P}_fix_python_detect.patch"
+       "${FILESDIR}/${P}_fix_Qt5X11Extras_detect.patch"
+       "${FILESDIR}/${P}_reset_conversion_descriptor_after_close.patch"
+)
+
+DOCS=( README.md NEWS.md TODO.md HACKING.md TODO.md ChangeLog )
+
+pkg_setup() {
+       if use python || use test; then
+               python-single-r1_pkg_setup
+       fi
+       use java && java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       if use python || use test; then
+               if use test; then
+                       # make tests happy
+                       # because one of the test requires loadable py module from the current ${BUILD_DIR}
+                       sed -i \
+                               -e "s|PYTHONPATH=@abs_top_srcdir@|PYTHONPATH=@builddir@|g" \
+                               test/Makefile.am.inc || die
+               fi
+
+               python_fix_shebang \
+                       examples/*.py \
+                       test/{test_python,barcodetest}.py # test_pygtk.py — py2 only
+       fi
+
+       if use java; then
+               java-pkg-opt-2_src_prepare
+               sed "s|javadir = \$(pkgdatadir)|javadir = /usr/$(get_libdir)/zbar|" \
+                       -i java/Makefile.am || die
+       fi
+
+       # do not install {LICENSE,INSTALL,etc}.md doc files with 'make install' (use DOCS=() instead)
+       sed -i \
+               -e "s|^dist_doc_DATA =\(.*\)|dist_doc_DATA =|" Makefile.am || die
+
+       eautoreconf
+}
+
+multilib_src_configure() {
+       append-cppflags -DNDEBUG
+
+       local myeconfargs=(
+               $(use_with dbus)
+               $(use_with gtk gtk gtk3) # default is gtk2
+               $(use_with jpeg)
+               $(multilib_native_use_with introspection gir)
+               $(multilib_native_use_with java)
+               $(multilib_native_use_with python python auto)
+               $(use_enable static-libs static)
+               $(use_enable threads pthread)
+               $(use_enable v4l video)
+               $(use_with X x)
+               $(use_with X xshm)
+               $(use_with xv xv)
+       )
+
+       if multilib_is_native_abi; then
+               # both must be enabled to use GraphicsMagick
+               if use graphicsmagick; then
+                       myeconfargs+=(
+                               --with-graphicsmagick
+                               --without-imagemagick
+                       )
+               elif use imagemagick; then
+                       myeconfargs+=(
+                               --with-imagemagick
+                               --without-graphicsmagick
+                       )
+               else
+                       myeconfargs+=(
+                               --without-imagemagick
+                               --without-graphicsmagick
+                       )
+               fi
+
+               if use java; then
+                       export JAVACFLAGS="$(java-pkg_javac-args)"
+                       append-cflags "$(java-pkg_get-jni-cflags)"
+                       if use test; then # bug 629078
+                               java-pkg_append_ CLASSPATH .
+                               java-pkg_append_ CLASSPATH $(java-pkg_getjar --build-only junit-4 junit.jar)
+                               java-pkg_append_ CLASSPATH $(java-pkg_getjar --build-only hamcrest-core-1.3 hamcrest-core.jar)
+                       fi
+               fi
+
+               if use qt5; then
+                       myeconfargs+=(
+                               --with-qt
+                               --with-qt5
+                       )
+               else
+                       myeconfargs+=( --without-qt )
+               fi
+       else
+               myeconfargs+=(
+                       --without-qt
+                       --without-imagemagick
+                       --without-graphicsmagick
+               )
+       fi
+
+       ECONF_SOURCE="${S}" \
+               econf "${myeconfargs[@]}"
+
+       # work around out-of-source build issues for multilib systems (bug 672184)
+       mkdir qt zbarcam || die
+}
+
+src_test() {
+       virtx multilib-minimal_src_test
+}
+
+src_install() {
+       if use qt5; then
+               local MULTILIB_WRAPPED_HEADERS=(
+                       /usr/include/zbar/QZBar.h
+                       /usr/include/zbar/QZBarImage.h
+               )
+       fi
+       multilib-minimal_src_install
+       einstalldocs
+}
+
+multilib_src_install_all() {
+       find "${D}" -name '*.la' -delete || die
+}
+
+pkg_preinst() {
+       use java && java-pkg-opt-2_pkg_preinst
+}