Gentoo Archives: gentoo-commits

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/bircoph:master commit in: media-gfx/zbar/, media-gfx/zbar/files/
Date: Wed, 27 Jul 2016 10:55:34
Message-Id: 1469616909.859b08f5bf70945a8db33bf7a9253f2563dfd4e5.bircoph@gentoo
1 commit: 859b08f5bf70945a8db33bf7a9253f2563dfd4e5
2 Author: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 27 10:55:09 2016 +0000
4 Commit: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 27 10:55:09 2016 +0000
6 URL: https://gitweb.gentoo.org/dev/bircoph.git/commit/?id=859b08f5
7
8 media-gfx/zbar: fix bug 589834
9
10 Add USE="java" to handle automagic.
11
12 Package-Manager: portage-2.3.0
13 Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>
14
15 media-gfx/zbar/Manifest | 1 +
16 media-gfx/zbar/files/zbar-0.10-errors.patch | 10 +++
17 media-gfx/zbar/files/zbar-0.10-python-crash.patch | 19 +++++
18 media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch | 49 +++++++++++
19 media-gfx/zbar/metadata.xml | 11 +++
20 media-gfx/zbar/zbar-0.10_p20121015.ebuild | 96 ++++++++++++++++++++++
21 6 files changed, 186 insertions(+)
22
23 diff --git a/media-gfx/zbar/Manifest b/media-gfx/zbar/Manifest
24 new file mode 100644
25 index 0000000..288b151
26 --- /dev/null
27 +++ b/media-gfx/zbar/Manifest
28 @@ -0,0 +1 @@
29 +DIST zbar-0.10_p20121015.zip 991578 SHA256 1e2ba2a6f27bcc93b74e57ff46cc69c0f5c8d22ae277aa3d6c9da6892b892abe SHA512 7bb74ea5b096093b283c44787547ad0b886281628d012aa7b03ddb477732feb1e12d4d5a661191d34b53b7b272a237f67840e219b0ac5e2803da478a1ddba7a1 WHIRLPOOL be6307740b7e15c344c05c60a842d2ad01c6954ada71677cb8dbcbd0720a35f7f86d673a0f92a98d5968dc8394e9917c2a80880cb17a8d54bdc16827aa5d1eeb
30
31 diff --git a/media-gfx/zbar/files/zbar-0.10-errors.patch b/media-gfx/zbar/files/zbar-0.10-errors.patch
32 new file mode 100644
33 index 0000000..63328ce
34 --- /dev/null
35 +++ b/media-gfx/zbar/files/zbar-0.10-errors.patch
36 @@ -0,0 +1,10 @@
37 +--- zbar-0.10/include/zbar/Exception.h
38 ++++ zbar-0.10/include/zbar/Exception.h
39 +@@ -32,6 +32,7 @@
40 +
41 + #include <exception>
42 + #include <new>
43 ++#include <cstddef>
44 +
45 + namespace zbar {
46 +
47
48 diff --git a/media-gfx/zbar/files/zbar-0.10-python-crash.patch b/media-gfx/zbar/files/zbar-0.10-python-crash.patch
49 new file mode 100644
50 index 0000000..a6f7a96
51 --- /dev/null
52 +++ b/media-gfx/zbar/files/zbar-0.10-python-crash.patch
53 @@ -0,0 +1,19 @@
54 +https://sourceforge.net/p/zbar/patches/37/
55 +
56 +fix from Debian for crashes when importing the python module.
57 +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702499
58 +
59 +this doesn't happen on some arches as the data naturally ends up with zero
60 +data after the structure, but on some (like arm), it isn't so we crash when
61 +python walks the list.
62 +
63 +--- a/python/imagescanner.c
64 ++++ b/python/imagescanner.c
65 +@@ -68,6 +68,7 @@ imagescanner_get_results (zbarImageScanner *self,
66 +
67 + static PyGetSetDef imagescanner_getset[] = {
68 + { "results", (getter)imagescanner_get_results, },
69 ++ { NULL },
70 + };
71 +
72 + static PyObject*
73
74 diff --git a/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch b/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch
75 new file mode 100644
76 index 0000000..4fde95e
77 --- /dev/null
78 +++ b/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch
79 @@ -0,0 +1,49 @@
80 +--- zbar-0.10/zbar/video/v4l2.c 2009-10-23 18:16:44.000000000 +0000
81 ++++ zbar-0.10/zbar/video/v4l2.c 2015-03-07 05:46:36.000000000 +0000
82 +@@ -241,6 +241,21 @@
83 + return(0);
84 + }
85 +
86 ++static int v4l2_request_buffers (zbar_video_t *vdo)
87 ++{
88 ++ struct v4l2_requestbuffers rb;
89 ++ memset(&rb, 0, sizeof(rb));
90 ++ rb.count = vdo->num_images;
91 ++ rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
92 ++ rb.memory = V4L2_MEMORY_USERPTR;
93 ++ if(ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
94 ++ return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
95 ++ "requesting video frame buffers (VIDIOC_REQBUFS)"));
96 ++ if(rb.count)
97 ++ vdo->num_images = rb.count;
98 ++ return(0);
99 ++}
100 ++
101 + static int v4l2_set_format (zbar_video_t *vdo,
102 + uint32_t fmt)
103 + {
104 +@@ -308,6 +323,8 @@
105 + return(-1);
106 + if(vdo->iomode == VIDEO_MMAP)
107 + return(v4l2_mmap_buffers(vdo));
108 ++ if(vdo->iomode == VIDEO_USERPTR)
109 ++ return(v4l2_request_buffers(vdo));
110 + return(0);
111 + }
112 +
113 +@@ -337,8 +354,13 @@
114 + else {
115 + if(!vdo->iomode)
116 + vdo->iomode = VIDEO_USERPTR;
117 +- if(rb.count)
118 +- vdo->num_images = rb.count;
119 ++ /* releasing buffers
120 ++ * lest the driver may later refuse to change format
121 ++ */
122 ++ rb.count = 0;
123 ++ if (ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
124 ++ zprintf(0, "WARNING: releasing video buffers failed: error %d\n",
125 ++ errno);
126 + }
127 + return(0);
128 + }
129
130 diff --git a/media-gfx/zbar/metadata.xml b/media-gfx/zbar/metadata.xml
131 new file mode 100644
132 index 0000000..4c17cb6
133 --- /dev/null
134 +++ b/media-gfx/zbar/metadata.xml
135 @@ -0,0 +1,11 @@
136 +<?xml version="1.0" encoding="UTF-8"?>
137 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
138 +<pkgmetadata>
139 + <maintainer type="person">
140 + <email>xmw@g.o</email>
141 + <name>Michael Weber</name>
142 + </maintainer>
143 + <upstream>
144 + <remote-id type="sourceforge">zbar</remote-id>
145 + </upstream>
146 +</pkgmetadata>
147
148 diff --git a/media-gfx/zbar/zbar-0.10_p20121015.ebuild b/media-gfx/zbar/zbar-0.10_p20121015.ebuild
149 new file mode 100644
150 index 0000000..8a10c4b
151 --- /dev/null
152 +++ b/media-gfx/zbar/zbar-0.10_p20121015.ebuild
153 @@ -0,0 +1,96 @@
154 +# Copyright 1999-2016 Gentoo Foundation
155 +# Distributed under the terms of the GNU General Public License v2
156 +# $Id$
157 +
158 +EAPI=5
159 +
160 +PYTHON_COMPAT=( python2_7 )
161 +
162 +inherit autotools eutils flag-o-matic java-pkg-opt-2 multilib python-single-r1
163 +
164 +DESCRIPTION="Library and tools for reading barcodes from images or video"
165 +HOMEPAGE="http://zbar.sourceforge.net/"
166 +SRC_URI="https://dev.gentoo.org/~xmw/zbar-0.10_p20121015.zip"
167 +
168 +LICENSE="LGPL-2.1"
169 +SLOT="0"
170 +KEYWORDS="~amd64 ~arm ~x86"
171 +IUSE="gtk imagemagick java jpeg python qt4 static-libs +threads v4l X xv"
172 +
173 +CDEPEND="gtk? ( dev-libs/glib:2 x11-libs/gtk+:2 )
174 + imagemagick? (
175 + || ( media-gfx/imagemagick
176 + media-gfx/graphicsmagick[imagemagick] ) )
177 + jpeg? ( virtual/jpeg:0 )
178 + python? ( ${PYTHON_DEPS}
179 + gtk? ( >=dev-python/pygtk-2[${PYTHON_USEDEP}] ) )
180 + qt4? ( dev-qt/qtcore:4 dev-qt/qtgui:4 )
181 + X? ( x11-libs/libXext
182 + xv? ( x11-libs/libXv ) )"
183 +REPEND="${CDEPEND}
184 + java? ( >=virtual/jre-1.4 ) "
185 +DEPEND="${CDEPEND}
186 + java? ( >=virtual/jdk-1.4 )
187 + sys-devel/gettext
188 + virtual/pkgconfig"
189 +
190 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
191 +
192 +pkg_setup() {
193 + use python && python-single-r1_pkg_setup
194 + java-pkg-opt-2_pkg_setup
195 +}
196 +
197 +src_unpack() {
198 + #vcs-snapshot doesn't work on .zip
199 + default
200 + mv * ${P} || die
201 +}
202 +
203 +src_prepare() {
204 + epatch "${FILESDIR}"/${PN}-0.10-errors.patch \
205 + "${FILESDIR}"/${PN}-0.10-python-crash.patch \
206 + "${FILESDIR}"/${PN}-0.10-v4l2-uvcvideo.patch
207 +
208 + use python && python_fix_shebang examples/upcrpc.py test/*.py
209 + java-pkg-opt-2_src_prepare
210 +
211 + sed -e '/AM_INIT_AUTOMAKE/s: -Werror : :' \
212 + -e '/^AM_CFLAGS=/s: -Werror::' \
213 + -i configure.ac || die
214 + sed "s|javadir = \$(pkgdatadir)|javadir = /usr/$(get_libdir)/zbar|" \
215 + -i java/Makefile.am
216 + eautoreconf
217 +}
218 +
219 +src_configure() {
220 + if use java; then
221 + export JAVACFLAGS="$(java-pkg_javac-args)"
222 + export JAVA_CFLAGS="$(java-pkg_get-jni-cflags)"
223 + fi
224 +
225 + append-cppflags -DNDEBUG
226 + econf \
227 + $(use_with java) \
228 + $(use_with jpeg) \
229 + $(use_with gtk) \
230 + $(use_with imagemagick) \
231 + $(use_with python) \
232 + $(use_with qt4 qt) \
233 + $(use_enable static-libs static) \
234 + $(use_enable threads pthread) \
235 + $(use_with X x) \
236 + $(use_with xv xv) \
237 + $(use_enable v4l video)
238 +}
239 +
240 +src_install() {
241 + emake DESTDIR="${D}" install
242 + dodoc HACKING NEWS README TODO
243 + rm -r "${ED}"/usr/share/doc/${PN}
244 + prune_libtool_files --all
245 +}
246 +
247 +pkg_preinst() {
248 + java-pkg-opt-2_pkg_preinst
249 +}