commit: 859b08f5bf70945a8db33bf7a9253f2563dfd4e5 Author: Andrew Savchenko <bircoph <AT> gentoo <DOT> org> AuthorDate: Wed Jul 27 10:55:09 2016 +0000 Commit: Andrew Savchenko <bircoph <AT> gentoo <DOT> org> CommitDate: Wed Jul 27 10:55:09 2016 +0000 URL: https://gitweb.gentoo.org/dev/bircoph.git/commit/?id=859b08f5
media-gfx/zbar: fix bug 589834 Add USE="java" to handle automagic. Package-Manager: portage-2.3.0 Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org> media-gfx/zbar/Manifest | 1 + media-gfx/zbar/files/zbar-0.10-errors.patch | 10 +++ media-gfx/zbar/files/zbar-0.10-python-crash.patch | 19 +++++ media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch | 49 +++++++++++ media-gfx/zbar/metadata.xml | 11 +++ media-gfx/zbar/zbar-0.10_p20121015.ebuild | 96 ++++++++++++++++++++++ 6 files changed, 186 insertions(+) diff --git a/media-gfx/zbar/Manifest b/media-gfx/zbar/Manifest new file mode 100644 index 0000000..288b151 --- /dev/null +++ b/media-gfx/zbar/Manifest @@ -0,0 +1 @@ +DIST zbar-0.10_p20121015.zip 991578 SHA256 1e2ba2a6f27bcc93b74e57ff46cc69c0f5c8d22ae277aa3d6c9da6892b892abe SHA512 7bb74ea5b096093b283c44787547ad0b886281628d012aa7b03ddb477732feb1e12d4d5a661191d34b53b7b272a237f67840e219b0ac5e2803da478a1ddba7a1 WHIRLPOOL be6307740b7e15c344c05c60a842d2ad01c6954ada71677cb8dbcbd0720a35f7f86d673a0f92a98d5968dc8394e9917c2a80880cb17a8d54bdc16827aa5d1eeb diff --git a/media-gfx/zbar/files/zbar-0.10-errors.patch b/media-gfx/zbar/files/zbar-0.10-errors.patch new file mode 100644 index 0000000..63328ce --- /dev/null +++ b/media-gfx/zbar/files/zbar-0.10-errors.patch @@ -0,0 +1,10 @@ +--- zbar-0.10/include/zbar/Exception.h ++++ zbar-0.10/include/zbar/Exception.h +@@ -32,6 +32,7 @@ + + #include <exception> + #include <new> ++#include <cstddef> + + namespace zbar { + diff --git a/media-gfx/zbar/files/zbar-0.10-python-crash.patch b/media-gfx/zbar/files/zbar-0.10-python-crash.patch new file mode 100644 index 0000000..a6f7a96 --- /dev/null +++ b/media-gfx/zbar/files/zbar-0.10-python-crash.patch @@ -0,0 +1,19 @@ +https://sourceforge.net/p/zbar/patches/37/ + +fix from Debian for crashes when importing the python module. +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702499 + +this doesn't happen on some arches as the data naturally ends up with zero +data after the structure, but on some (like arm), it isn't so we crash when +python walks the list. + +--- a/python/imagescanner.c ++++ b/python/imagescanner.c +@@ -68,6 +68,7 @@ imagescanner_get_results (zbarImageScanner *self, + + static PyGetSetDef imagescanner_getset[] = { + { "results", (getter)imagescanner_get_results, }, ++ { NULL }, + }; + + static PyObject* diff --git a/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch b/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch new file mode 100644 index 0000000..4fde95e --- /dev/null +++ b/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch @@ -0,0 +1,49 @@ +--- zbar-0.10/zbar/video/v4l2.c 2009-10-23 18:16:44.000000000 +0000 ++++ zbar-0.10/zbar/video/v4l2.c 2015-03-07 05:46:36.000000000 +0000 +@@ -241,6 +241,21 @@ + return(0); + } + ++static int v4l2_request_buffers (zbar_video_t *vdo) ++{ ++ struct v4l2_requestbuffers rb; ++ memset(&rb, 0, sizeof(rb)); ++ rb.count = vdo->num_images; ++ rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ rb.memory = V4L2_MEMORY_USERPTR; ++ if(ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0) ++ return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, ++ "requesting video frame buffers (VIDIOC_REQBUFS)")); ++ if(rb.count) ++ vdo->num_images = rb.count; ++ return(0); ++} ++ + static int v4l2_set_format (zbar_video_t *vdo, + uint32_t fmt) + { +@@ -308,6 +323,8 @@ + return(-1); + if(vdo->iomode == VIDEO_MMAP) + return(v4l2_mmap_buffers(vdo)); ++ if(vdo->iomode == VIDEO_USERPTR) ++ return(v4l2_request_buffers(vdo)); + return(0); + } + +@@ -337,8 +354,13 @@ + else { + if(!vdo->iomode) + vdo->iomode = VIDEO_USERPTR; +- if(rb.count) +- vdo->num_images = rb.count; ++ /* releasing buffers ++ * lest the driver may later refuse to change format ++ */ ++ rb.count = 0; ++ if (ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0) ++ zprintf(0, "WARNING: releasing video buffers failed: error %d\n", ++ errno); + } + return(0); + } diff --git a/media-gfx/zbar/metadata.xml b/media-gfx/zbar/metadata.xml new file mode 100644 index 0000000..4c17cb6 --- /dev/null +++ b/media-gfx/zbar/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>x...@gentoo.org</email> + <name>Michael Weber</name> + </maintainer> + <upstream> + <remote-id type="sourceforge">zbar</remote-id> + </upstream> +</pkgmetadata> diff --git a/media-gfx/zbar/zbar-0.10_p20121015.ebuild b/media-gfx/zbar/zbar-0.10_p20121015.ebuild new file mode 100644 index 0000000..8a10c4b --- /dev/null +++ b/media-gfx/zbar/zbar-0.10_p20121015.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 ) + +inherit autotools eutils flag-o-matic java-pkg-opt-2 multilib python-single-r1 + +DESCRIPTION="Library and tools for reading barcodes from images or video" +HOMEPAGE="http://zbar.sourceforge.net/" +SRC_URI="https://dev.gentoo.org/~xmw/zbar-0.10_p20121015.zip" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="gtk imagemagick java jpeg python qt4 static-libs +threads v4l X xv" + +CDEPEND="gtk? ( dev-libs/glib:2 x11-libs/gtk+:2 ) + imagemagick? ( + || ( media-gfx/imagemagick + media-gfx/graphicsmagick[imagemagick] ) ) + jpeg? ( virtual/jpeg:0 ) + python? ( ${PYTHON_DEPS} + gtk? ( >=dev-python/pygtk-2[${PYTHON_USEDEP}] ) ) + qt4? ( dev-qt/qtcore:4 dev-qt/qtgui:4 ) + X? ( x11-libs/libXext + xv? ( x11-libs/libXv ) )" +REPEND="${CDEPEND} + java? ( >=virtual/jre-1.4 ) " +DEPEND="${CDEPEND} + java? ( >=virtual/jdk-1.4 ) + sys-devel/gettext + virtual/pkgconfig" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +pkg_setup() { + use python && python-single-r1_pkg_setup + java-pkg-opt-2_pkg_setup +} + +src_unpack() { + #vcs-snapshot doesn't work on .zip + default + mv * ${P} || die +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-0.10-errors.patch \ + "${FILESDIR}"/${PN}-0.10-python-crash.patch \ + "${FILESDIR}"/${PN}-0.10-v4l2-uvcvideo.patch + + use python && python_fix_shebang examples/upcrpc.py test/*.py + java-pkg-opt-2_src_prepare + + sed -e '/AM_INIT_AUTOMAKE/s: -Werror : :' \ + -e '/^AM_CFLAGS=/s: -Werror::' \ + -i configure.ac || die + sed "s|javadir = \$(pkgdatadir)|javadir = /usr/$(get_libdir)/zbar|" \ + -i java/Makefile.am + eautoreconf +} + +src_configure() { + if use java; then + export JAVACFLAGS="$(java-pkg_javac-args)" + export JAVA_CFLAGS="$(java-pkg_get-jni-cflags)" + fi + + append-cppflags -DNDEBUG + econf \ + $(use_with java) \ + $(use_with jpeg) \ + $(use_with gtk) \ + $(use_with imagemagick) \ + $(use_with python) \ + $(use_with qt4 qt) \ + $(use_enable static-libs static) \ + $(use_enable threads pthread) \ + $(use_with X x) \ + $(use_with xv xv) \ + $(use_enable v4l video) +} + +src_install() { + emake DESTDIR="${D}" install + dodoc HACKING NEWS README TODO + rm -r "${ED}"/usr/share/doc/${PN} + prune_libtool_files --all +} + +pkg_preinst() { + java-pkg-opt-2_pkg_preinst +}