Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/zbar/, media-gfx/zbar/files/
Date: Sun, 25 Nov 2018 18:00:54
Message-Id: 1543168816.c8cae200f832c7d05452540a32a925d1e6f16112.asturm@gentoo
1 commit: c8cae200f832c7d05452540a32a925d1e6f16112
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 25 17:59:41 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 25 18:00:16 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8cae200
7
8 media-gfx/zbar: Can't drop 0.10_p20121015-r3 yet
9
10 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
11
12 media-gfx/zbar/Manifest | 1 +
13 media-gfx/zbar/files/zbar-0.10-python-crash.patch | 19 +++
14 media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch | 49 ++++++++
15 media-gfx/zbar/zbar-0.10_p20121015-r3.ebuild | 130 +++++++++++++++++++++
16 4 files changed, 199 insertions(+)
17
18 diff --git a/media-gfx/zbar/Manifest b/media-gfx/zbar/Manifest
19 index 00a21a631d2..b5bf4950fae 100644
20 --- a/media-gfx/zbar/Manifest
21 +++ b/media-gfx/zbar/Manifest
22 @@ -1 +1,2 @@
23 +DIST zbar-0.10_p20121015.zip 991578 BLAKE2B 021dfa3920a838fd7bab12b09600ac6949c1495045691c4cc547bfb6ec647658c60984da248b882eabfc0bb123b90401dd3a32adcd66726b1e7072662e303d18 SHA512 7bb74ea5b096093b283c44787547ad0b886281628d012aa7b03ddb477732feb1e12d4d5a661191d34b53b7b272a237f67840e219b0ac5e2803da478a1ddba7a1
24 DIST zbar-0.20.1.tar.gz 555199 BLAKE2B f224a2207fa0603da4cc3a0e1d05bc73f3cf0cc9d13c26b3b801d3418f4f6a001b52e468b721552af61f4c8d7357934abd0560c24d3b233107785c69cfe14753 SHA512 21ad9d8fcdecb41bd4b8979366ab8ec6e8eac815f52270b0dc72ce6a126ccef933d048ce8bbe28f46ada5defadf85ba8c97c5c1870c9560a9dab28c585dfaf42
25
26 diff --git a/media-gfx/zbar/files/zbar-0.10-python-crash.patch b/media-gfx/zbar/files/zbar-0.10-python-crash.patch
27 new file mode 100644
28 index 00000000000..a6f7a96e34d
29 --- /dev/null
30 +++ b/media-gfx/zbar/files/zbar-0.10-python-crash.patch
31 @@ -0,0 +1,19 @@
32 +https://sourceforge.net/p/zbar/patches/37/
33 +
34 +fix from Debian for crashes when importing the python module.
35 +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702499
36 +
37 +this doesn't happen on some arches as the data naturally ends up with zero
38 +data after the structure, but on some (like arm), it isn't so we crash when
39 +python walks the list.
40 +
41 +--- a/python/imagescanner.c
42 ++++ b/python/imagescanner.c
43 +@@ -68,6 +68,7 @@ imagescanner_get_results (zbarImageScanner *self,
44 +
45 + static PyGetSetDef imagescanner_getset[] = {
46 + { "results", (getter)imagescanner_get_results, },
47 ++ { NULL },
48 + };
49 +
50 + static PyObject*
51
52 diff --git a/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch b/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch
53 new file mode 100644
54 index 00000000000..4fde95e2b56
55 --- /dev/null
56 +++ b/media-gfx/zbar/files/zbar-0.10-v4l2-uvcvideo.patch
57 @@ -0,0 +1,49 @@
58 +--- zbar-0.10/zbar/video/v4l2.c 2009-10-23 18:16:44.000000000 +0000
59 ++++ zbar-0.10/zbar/video/v4l2.c 2015-03-07 05:46:36.000000000 +0000
60 +@@ -241,6 +241,21 @@
61 + return(0);
62 + }
63 +
64 ++static int v4l2_request_buffers (zbar_video_t *vdo)
65 ++{
66 ++ struct v4l2_requestbuffers rb;
67 ++ memset(&rb, 0, sizeof(rb));
68 ++ rb.count = vdo->num_images;
69 ++ rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
70 ++ rb.memory = V4L2_MEMORY_USERPTR;
71 ++ if(ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
72 ++ return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
73 ++ "requesting video frame buffers (VIDIOC_REQBUFS)"));
74 ++ if(rb.count)
75 ++ vdo->num_images = rb.count;
76 ++ return(0);
77 ++}
78 ++
79 + static int v4l2_set_format (zbar_video_t *vdo,
80 + uint32_t fmt)
81 + {
82 +@@ -308,6 +323,8 @@
83 + return(-1);
84 + if(vdo->iomode == VIDEO_MMAP)
85 + return(v4l2_mmap_buffers(vdo));
86 ++ if(vdo->iomode == VIDEO_USERPTR)
87 ++ return(v4l2_request_buffers(vdo));
88 + return(0);
89 + }
90 +
91 +@@ -337,8 +354,13 @@
92 + else {
93 + if(!vdo->iomode)
94 + vdo->iomode = VIDEO_USERPTR;
95 +- if(rb.count)
96 +- vdo->num_images = rb.count;
97 ++ /* releasing buffers
98 ++ * lest the driver may later refuse to change format
99 ++ */
100 ++ rb.count = 0;
101 ++ if (ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
102 ++ zprintf(0, "WARNING: releasing video buffers failed: error %d\n",
103 ++ errno);
104 + }
105 + return(0);
106 + }
107
108 diff --git a/media-gfx/zbar/zbar-0.10_p20121015-r3.ebuild b/media-gfx/zbar/zbar-0.10_p20121015-r3.ebuild
109 new file mode 100644
110 index 00000000000..719be7784d5
111 --- /dev/null
112 +++ b/media-gfx/zbar/zbar-0.10_p20121015-r3.ebuild
113 @@ -0,0 +1,130 @@
114 +# Copyright 1999-2018 Gentoo Foundation
115 +# Distributed under the terms of the GNU General Public License v2
116 +
117 +EAPI=6
118 +
119 +PYTHON_COMPAT=( python2_7 )
120 +inherit autotools flag-o-matic java-pkg-opt-2 multilib-minimal python-single-r1 virtualx
121 +
122 +DESCRIPTION="Library and tools for reading barcodes from images or video"
123 +HOMEPAGE="http://zbar.sourceforge.net/"
124 +SRC_URI="https://dev.gentoo.org/~xmw/zbar-0.10_p20121015.zip"
125 +
126 +LICENSE="LGPL-2.1"
127 +SLOT="0"
128 +KEYWORDS="amd64 ~arm x86"
129 +IUSE="gtk imagemagick java jpeg python static-libs test +threads v4l X xv"
130 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )
131 + test? ( X ${PYTHON_REQUIRED_USE} )"
132 +
133 +CDEPEND="gtk? ( dev-libs/glib:2[${MULTILIB_USEDEP}]
134 + x11-libs/gtk+:2[${MULTILIB_USEDEP}] )
135 + imagemagick? ( virtual/imagemagick-tools )
136 + jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
137 + python? (
138 + ${PYTHON_DEPS}
139 + gtk? ( >=dev-python/pygtk-2[${PYTHON_USEDEP}] )
140 + )
141 + X? (
142 + x11-libs/libXext[${MULTILIB_USEDEP}]
143 + xv? ( x11-libs/libXv[${MULTILIB_USEDEP}] )
144 + )"
145 +RDEPEND="${CDEPEND}
146 + java? ( >=virtual/jre-1.4 )"
147 +DEPEND="${CDEPEND}
148 + java? ( >=virtual/jdk-1.4
149 + test? ( dev-java/junit:4
150 + dev-java/hamcrest-core:1.3 ) )
151 + test? ( ${PYTHON_DEPS} )
152 + app-arch/unzip
153 + sys-devel/gettext
154 + virtual/pkgconfig"
155 +
156 +pkg_setup() {
157 + if use python || use test; then
158 + python-single-r1_pkg_setup
159 + fi
160 + java-pkg-opt-2_pkg_setup
161 +}
162 +
163 +src_unpack() {
164 + #vcs-snapshot doesn't work on .zip
165 + default
166 + mv * ${P} || die
167 +}
168 +
169 +src_prepare() {
170 + eapply "${FILESDIR}"/${PN}-0.10-errors.patch \
171 + "${FILESDIR}"/${PN}-0.10-python-crash.patch \
172 + "${FILESDIR}"/${PN}-0.10-v4l2-uvcvideo.patch
173 +
174 + # fix use of deprecated qt4 function, bug 572488
175 + sed -e 's:numBytes:byteCount:g' \
176 + -i "${S}"/include/zbar/QZBarImage.h || die
177 +
178 + if has_version '>=media-gfx/imagemagick-7.0.1.0' ; then
179 + eapply "${FILESDIR}/${P}-ImageMagick-7.patch"
180 + fi
181 +
182 + use python && python_fix_shebang examples/upcrpc.py test/*.py
183 + java-pkg-opt-2_src_prepare
184 +
185 + sed -e '/AM_INIT_AUTOMAKE/s: -Werror : :' \
186 + -e '/^AM_CFLAGS=/s: -Werror::' \
187 + -i configure.ac || die
188 + sed "s|javadir = \$(pkgdatadir)|javadir = /usr/$(get_libdir)/zbar|" \
189 + -i java/Makefile.am
190 + eautoreconf
191 +}
192 +
193 +multilib_src_configure() {
194 + if multilib_is_native_abi && use java; then
195 + export JAVACFLAGS="$(java-pkg_javac-args)"
196 + export JAVA_CFLAGS="$(java-pkg_get-jni-cflags)"
197 + if use test ; then # bug 629078
198 + java-pkg_append_ CLASSPATH .
199 + java-pkg_append_ CLASSPATH $(java-pkg_getjar --build-only junit-4 junit.jar)
200 + java-pkg_append_ CLASSPATH $(java-pkg_getjar --build-only hamcrest-core-1.3 hamcrest-core.jar)
201 + fi
202 + fi
203 +
204 + append-cppflags -DNDEBUG
205 +
206 + # different flags for image/graphics magick (bug 552350)
207 + myimagemagick="--without-imagemagick"
208 + has_version media-gfx/imagemagick &&
209 + myimagemagick="$(multilib_native_use_with imagemagick)"
210 + mygraphicsmagick="--without-graphicsmagick"
211 + has_version media-gfx/graphicsmagick &&
212 + mygraphicsmagick="$(multilib_native_use_with imagemagick graphicsmagick)"
213 + ECONF_SOURCE=${S} \
214 + econf \
215 + $(multilib_native_use_with java) \
216 + $(use_with jpeg) \
217 + $(use_with gtk) \
218 + ${myimagemagick} \
219 + ${mygraphicsmagick} \
220 + $(multilib_native_use_with python) \
221 + --without-qt \
222 + $(use_enable static-libs static) \
223 + $(use_enable threads pthread) \
224 + $(use_with X x) \
225 + $(use_with xv xv) \
226 + $(use_enable v4l video)
227 +
228 + # work-around out-of-source build issue
229 + mkdir gtk pygtk qt test || die
230 +}
231 +
232 +src_test() {
233 + virtx multilib-minimal_src_test
234 +}
235 +
236 +multilib_src_install_all() {
237 + dodoc HACKING NEWS README TODO
238 + find "${D}" -name '*.la' -delete || die
239 +}
240 +
241 +pkg_preinst() {
242 + java-pkg-opt-2_pkg_preinst
243 +}