1 |
commit: 5588a45209bdffafdf680a85c1724be657c5b596 |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 2 12:21:34 2018 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 2 12:23:52 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5588a452 |
7 |
|
8 |
media-gfx/sane-backends: Multiple bug fixes |
9 |
|
10 |
- Fix sandbox violation (#635022) |
11 |
- Fix genesys driver (#635348) |
12 |
- Apply ArchLinux patch to prevent interruptions with network scanners |
13 |
|
14 |
Package-Manager: Portage-2.3.27, Repoman-2.3.9 |
15 |
|
16 |
.../sane-backends-1.0.27-canon-lide-100.patch | 17 ++ |
17 |
.../files/sane-backends-1.0.27-network.patch | 42 +++ |
18 |
.../sane-backends/sane-backends-1.0.27-r1.ebuild | 340 +++++++++++++++++++++ |
19 |
3 files changed, 399 insertions(+) |
20 |
|
21 |
diff --git a/media-gfx/sane-backends/files/sane-backends-1.0.27-canon-lide-100.patch b/media-gfx/sane-backends/files/sane-backends-1.0.27-canon-lide-100.patch |
22 |
new file mode 100644 |
23 |
index 00000000000..504f9e666e6 |
24 |
--- /dev/null |
25 |
+++ b/media-gfx/sane-backends/files/sane-backends-1.0.27-canon-lide-100.patch |
26 |
@@ -0,0 +1,17 @@ |
27 |
+diff -up sane-backends-1.0.27/backend/genesys.c.canon-lide-100 sane-backends-1.0.27/backend/genesys.c |
28 |
+--- sane-backends-1.0.27/backend/genesys.c.canon-lide-100 2018-02-01 10:37:26.160044539 +0100 |
29 |
++++ sane-backends-1.0.27/backend/genesys.c 2018-02-01 10:45:44.616653277 +0100 |
30 |
+@@ -2070,11 +2070,9 @@ genesys_white_shading_calibration (Genes |
31 |
+ dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_TRUE); |
32 |
+ dev->model->cmd_set->set_motor_power (dev->calib_reg, motor); |
33 |
+ |
34 |
+- /* if needed, go back before doin next scan, by using rewind, registers and |
35 |
+- * slopes table are kept intact from previous scan */ |
36 |
+- if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK && dev->model->cmd_set->rewind) |
37 |
++ if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK) |
38 |
+ { |
39 |
+- status = dev->model->cmd_set->rewind (dev); |
40 |
++ status = dev->model->cmd_set->slow_back_home (dev, SANE_TRUE); |
41 |
+ } |
42 |
+ |
43 |
+ status = |
44 |
|
45 |
diff --git a/media-gfx/sane-backends/files/sane-backends-1.0.27-network.patch b/media-gfx/sane-backends/files/sane-backends-1.0.27-network.patch |
46 |
new file mode 100644 |
47 |
index 00000000000..2605ea83578 |
48 |
--- /dev/null |
49 |
+++ b/media-gfx/sane-backends/files/sane-backends-1.0.27-network.patch |
50 |
@@ -0,0 +1,42 @@ |
51 |
+diff --git a/sanei/sanei_tcp.c b/sanei/sanei_tcp.c |
52 |
+index a57d7c7..d0a1e92 100644 |
53 |
+--- a/sanei/sanei_tcp.c |
54 |
++++ b/sanei/sanei_tcp.c |
55 |
+@@ -45,6 +45,7 @@ |
56 |
+ #include <unistd.h> |
57 |
+ #include <stdlib.h> |
58 |
+ #include <string.h> |
59 |
++#include <time.h> |
60 |
+ |
61 |
+ #ifdef HAVE_WINSOCK2_H |
62 |
+ #include <winsock2.h> |
63 |
+@@ -123,14 +124,27 @@ sanei_tcp_write(int fd, const u_char * buf, int count) |
64 |
+ ssize_t |
65 |
+ sanei_tcp_read(int fd, u_char * buf, int count) |
66 |
+ { |
67 |
+- ssize_t bytes_recv = 0, rc = 1; |
68 |
++ ssize_t bytes_recv = 0, rc = 1; |
69 |
++ int retry = 5; |
70 |
+ |
71 |
+ while (bytes_recv < count && rc > 0) |
72 |
+ { |
73 |
+ rc = recv(fd, buf+bytes_recv, count-bytes_recv, 0); |
74 |
++ DBG(1, "%s: bytes received %d\n", __FUNCTION__, rc); |
75 |
+ if (rc > 0) |
76 |
+ bytes_recv += rc; |
77 |
+- |
78 |
++ else { |
79 |
++ if ( errno == EAGAIN && retry-- ) { |
80 |
++ DBG(1, "%s: waiting %d\n", __FUNCTION__, retry); |
81 |
++ /* wait for max 1s */ |
82 |
++ struct timespec req; |
83 |
++ struct timespec rem; |
84 |
++ req.tv_sec = 0; |
85 |
++ req.tv_nsec= 100000000; |
86 |
++ nanosleep(&req, &rem); |
87 |
++ rc = 1; |
88 |
++ } |
89 |
++ } |
90 |
+ } |
91 |
+ return bytes_recv; |
92 |
+ } |
93 |
|
94 |
diff --git a/media-gfx/sane-backends/sane-backends-1.0.27-r1.ebuild b/media-gfx/sane-backends/sane-backends-1.0.27-r1.ebuild |
95 |
new file mode 100644 |
96 |
index 00000000000..4b7b9d954cd |
97 |
--- /dev/null |
98 |
+++ b/media-gfx/sane-backends/sane-backends-1.0.27-r1.ebuild |
99 |
@@ -0,0 +1,340 @@ |
100 |
+# Copyright 1999-2018 Gentoo Foundation |
101 |
+# Distributed under the terms of the GNU General Public License v2 |
102 |
+ |
103 |
+EAPI=6 |
104 |
+inherit flag-o-matic multilib-minimal systemd toolchain-funcs udev user xdg-utils |
105 |
+ |
106 |
+# gphoto and v4l are handled by their usual USE flags. |
107 |
+# The pint backend was disabled because I could not get it to compile. |
108 |
+IUSE_SANE_BACKENDS=" |
109 |
+ abaton |
110 |
+ agfafocus |
111 |
+ apple |
112 |
+ artec |
113 |
+ artec_eplus48u |
114 |
+ as6e |
115 |
+ avision |
116 |
+ bh |
117 |
+ canon |
118 |
+ canon630u |
119 |
+ canon_dr |
120 |
+ canon_pp |
121 |
+ cardscan |
122 |
+ coolscan |
123 |
+ coolscan2 |
124 |
+ coolscan3 |
125 |
+ dc210 |
126 |
+ dc240 |
127 |
+ dc25 |
128 |
+ dell1600n_net |
129 |
+ dmc |
130 |
+ epjitsu |
131 |
+ epson |
132 |
+ epson2 |
133 |
+ fujitsu |
134 |
+ genesys |
135 |
+ gt68xx |
136 |
+ hp |
137 |
+ hp3500 |
138 |
+ hp3900 |
139 |
+ hp4200 |
140 |
+ hp5400 |
141 |
+ hp5590 |
142 |
+ hpljm1005 |
143 |
+ hpsj5s |
144 |
+ hs2p |
145 |
+ ibm |
146 |
+ kodak |
147 |
+ kodakaio |
148 |
+ kvs1025 |
149 |
+ kvs20xx |
150 |
+ kvs40xx |
151 |
+ leo |
152 |
+ lexmark |
153 |
+ ma1509 |
154 |
+ magicolor |
155 |
+ matsushita |
156 |
+ microtek |
157 |
+ microtek2 |
158 |
+ mustek |
159 |
+ mustek_pp |
160 |
+ mustek_usb |
161 |
+ mustek_usb2 |
162 |
+ nec |
163 |
+ net |
164 |
+ niash |
165 |
+ p5 |
166 |
+ pie |
167 |
+ pixma |
168 |
+ plustek |
169 |
+ plustek_pp |
170 |
+ pnm |
171 |
+ qcam |
172 |
+ ricoh |
173 |
+ rts8891 |
174 |
+ s9036 |
175 |
+ sceptre |
176 |
+ sharp |
177 |
+ sm3600 |
178 |
+ sm3840 |
179 |
+ snapscan |
180 |
+ sp15c |
181 |
+ st400 |
182 |
+ stv680 |
183 |
+ tamarack |
184 |
+ teco1 |
185 |
+ teco2 |
186 |
+ teco3 |
187 |
+ test |
188 |
+ u12 |
189 |
+ umax |
190 |
+ umax1220u |
191 |
+ umax_pp |
192 |
+ xerox_mfp" |
193 |
+ |
194 |
+IUSE="gphoto2 ipv6 snmp systemd threads usb v4l xinetd zeroconf" |
195 |
+ |
196 |
+for backend in ${IUSE_SANE_BACKENDS}; do |
197 |
+ case ${backend} in |
198 |
+ # Disable backends that require parallel ports as no one has those anymore. |
199 |
+ canon_pp|hpsj5s|mustek_pp|\ |
200 |
+ pnm) |
201 |
+ IUSE+=" -sane_backends_${backend}" |
202 |
+ ;; |
203 |
+ mustek_usb2|kvs40xx) |
204 |
+ IUSE+=" sane_backends_${backend}" |
205 |
+ ;; |
206 |
+ *) |
207 |
+ IUSE+=" +sane_backends_${backend}" |
208 |
+ esac |
209 |
+done |
210 |
+ |
211 |
+REQUIRED_USE=" |
212 |
+ sane_backends_mustek_usb2? ( threads ) |
213 |
+ sane_backends_kvs40xx? ( threads ) |
214 |
+" |
215 |
+ |
216 |
+DESCRIPTION="Scanner Access Now Easy - Backends" |
217 |
+HOMEPAGE="http://www.sane-project.org/" |
218 |
+MY_P="${P}" |
219 |
+FRS_ID="4224" |
220 |
+SRC_URI="https://alioth.debian.org/frs/download.php/file/${FRS_ID}/${P}.tar.gz" |
221 |
+ |
222 |
+LICENSE="GPL-2 public-domain" |
223 |
+SLOT="0" |
224 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux" |
225 |
+ |
226 |
+RDEPEND=" |
227 |
+ sane_backends_dc210? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] ) |
228 |
+ sane_backends_dc240? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] ) |
229 |
+ sane_backends_dell1600n_net? ( |
230 |
+ >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] |
231 |
+ >=media-libs/tiff-3.9.7-r1:0=[${MULTILIB_USEDEP}] |
232 |
+ ) |
233 |
+ sane_backends_canon_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] ) |
234 |
+ sane_backends_hpsj5s? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] ) |
235 |
+ sane_backends_mustek_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] ) |
236 |
+ usb? ( >=virtual/libusb-1-r1:1=[${MULTILIB_USEDEP}] ) |
237 |
+ gphoto2? ( |
238 |
+ >=media-libs/libgphoto2-2.5.3.1:=[${MULTILIB_USEDEP}] |
239 |
+ >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] |
240 |
+ ) |
241 |
+ v4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] ) |
242 |
+ xinetd? ( sys-apps/xinetd ) |
243 |
+ snmp? ( net-analyzer/net-snmp ) |
244 |
+ systemd? ( sys-apps/systemd:0= ) |
245 |
+ zeroconf? ( >=net-dns/avahi-0.6.31-r2[${MULTILIB_USEDEP}] ) |
246 |
+" |
247 |
+ |
248 |
+DEPEND="${RDEPEND} |
249 |
+ v4l? ( sys-kernel/linux-headers ) |
250 |
+ >=sys-devel/gettext-0.18.1 |
251 |
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}] |
252 |
+" |
253 |
+ |
254 |
+# We now use new syntax construct (SUBSYSTEMS!="usb|usb_device) |
255 |
+RDEPEND="${RDEPEND} |
256 |
+ !<sys-fs/udev-114 |
257 |
+" |
258 |
+ |
259 |
+MULTILIB_CHOST_TOOLS=( |
260 |
+ /usr/bin/sane-config |
261 |
+) |
262 |
+ |
263 |
+pkg_setup() { |
264 |
+ enewgroup scanner |
265 |
+ enewuser saned -1 -1 -1 scanner |
266 |
+} |
267 |
+ |
268 |
+src_prepare() { |
269 |
+ default |
270 |
+ |
271 |
+ xdg_environment_reset |
272 |
+ |
273 |
+ cat >> backend/dll.conf.in <<-EOF |
274 |
+ # Add support for the HP-specific backend. Needs net-print/hplip installed. |
275 |
+ hpaio |
276 |
+ # Add support for the Epson-specific backend. Needs media-gfx/iscan installed. |
277 |
+ epkowa |
278 |
+ EOF |
279 |
+ |
280 |
+ eapply "${FILESDIR}"/${PN}-1.0.24-saned_pidfile_location.patch |
281 |
+ eapply "${FILESDIR}"/${PN}-1.0.27-disable-usb-tests.patch |
282 |
+ |
283 |
+ # From Arch |
284 |
+ eapply "${FILESDIR}"/${PN}-1.0.27-network.patch |
285 |
+ |
286 |
+ # From Fedora |
287 |
+ # Fix https://bugs.gentoo.org/635348 |
288 |
+ eapply "${FILESDIR}"/${PN}-1.0.27-canon-lide-100.patch |
289 |
+ |
290 |
+ # Fix for "make check". Upstream sometimes forgets to update this. |
291 |
+ local ver=$(./configure --version | awk '{print $NF; exit 0}') |
292 |
+ sed -i \ |
293 |
+ -e "/by sane-desc 3.5 from sane-backends/s:sane-backends .*:sane-backends ${ver}:" \ |
294 |
+ testsuite/tools/data/html* || die |
295 |
+} |
296 |
+ |
297 |
+src_configure() { |
298 |
+ append-flags -fno-strict-aliasing # From Fedora |
299 |
+ |
300 |
+ # if LINGUAS is set, just use the listed and supported localizations. |
301 |
+ if [[ ${LINGUAS+set} == "set" ]]; then |
302 |
+ mkdir -p po || die |
303 |
+ strip-linguas -u po |
304 |
+ printf '%s\n' ${LINGUAS} > po/LINGUAS |
305 |
+ fi |
306 |
+ |
307 |
+ multilib-minimal_src_configure |
308 |
+} |
309 |
+ |
310 |
+multilib_src_configure() { |
311 |
+ # the blank is intended - an empty string would result in building ALL backends. |
312 |
+ local BACKENDS=" " |
313 |
+ |
314 |
+ use gphoto2 && BACKENDS="gphoto2" |
315 |
+ use v4l && BACKENDS="${BACKENDS} v4l" |
316 |
+ for backend in ${IUSE_SANE_BACKENDS}; do |
317 |
+ if use "sane_backends_${backend}" && [ ${backend} != pnm ]; then |
318 |
+ BACKENDS="${BACKENDS} ${backend}" |
319 |
+ fi |
320 |
+ done |
321 |
+ |
322 |
+ local myconf=( |
323 |
+ $(use_with usb) |
324 |
+ $(multilib_native_use_with snmp) |
325 |
+ ) |
326 |
+ |
327 |
+ # you can only enable this backend, not disable it... |
328 |
+ if use sane_backends_pnm; then |
329 |
+ myconf+=( --enable-pnm-backend ) |
330 |
+ fi |
331 |
+ if use sane_backends_mustek_pp; then |
332 |
+ myconf+=( --enable-parport-directio ) |
333 |
+ fi |
334 |
+ if ! { use sane_backends_canon_pp || use sane_backends_hpsj5s || use sane_backends_mustek_pp; }; then |
335 |
+ myconf+=( sane_cv_use_libieee1284=no ) |
336 |
+ fi |
337 |
+ |
338 |
+ # relative path must be used for tests to work properly |
339 |
+ ECONF_SOURCE=${S} \ |
340 |
+ SANEI_JPEG="sanei_jpeg.o" SANEI_JPEG_LO="sanei_jpeg.lo" \ |
341 |
+ BACKENDS="${BACKENDS}" \ |
342 |
+ econf \ |
343 |
+ $(use_with gphoto2) \ |
344 |
+ $(multilib_native_use_with systemd) \ |
345 |
+ $(use_with v4l) \ |
346 |
+ $(use_enable ipv6) \ |
347 |
+ $(use_enable threads pthread) \ |
348 |
+ $(use_enable zeroconf avahi) \ |
349 |
+ "${myconf[@]}" |
350 |
+} |
351 |
+ |
352 |
+multilib_src_compile() { |
353 |
+ emake VARTEXFONTS="${T}/fonts" |
354 |
+ |
355 |
+ if tc-is-cross-compiler; then |
356 |
+ pushd "${BUILD_DIR}"/tools >/dev/null || die |
357 |
+ |
358 |
+ # The build system sucks and doesn't handle this properly. |
359 |
+ # https://alioth.debian.org/tracker/index.php?func=detail&aid=314236&group_id=30186&atid=410366 |
360 |
+ tc-export_build_env BUILD_CC |
361 |
+ ${BUILD_CC} ${BUILD_CPPFLAGS} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} \ |
362 |
+ -I. -I../include -I"${S}"/include \ |
363 |
+ "${S}"/sanei/sanei_config.c "${S}"/sanei/sanei_constrain_value.c \ |
364 |
+ "${S}"/sanei/sanei_init_debug.c "${S}"/tools/sane-desc.c -o sane-desc || die |
365 |
+ local dirs=( hal hotplug hotplug-ng udev ) |
366 |
+ local targets=( |
367 |
+ hal/libsane.fdi |
368 |
+ hotplug/libsane.usermap |
369 |
+ hotplug-ng/libsane.db |
370 |
+ udev/libsane.rules |
371 |
+ ) |
372 |
+ mkdir -p "${dirs[@]}" || die |
373 |
+ emake "${targets[@]}" |
374 |
+ |
375 |
+ popd >/dev/null |
376 |
+ fi |
377 |
+ |
378 |
+ if use usb; then |
379 |
+ sed -i -e '/^$/d' \ |
380 |
+ tools/hotplug/libsane.usermap || die |
381 |
+ fi |
382 |
+} |
383 |
+ |
384 |
+multilib_src_install() { |
385 |
+ emake INSTALL_LOCKPATH="" DESTDIR="${D}" install \ |
386 |
+ docdir="${EPREFIX}"/usr/share/doc/${PF} |
387 |
+ |
388 |
+ if multilib_is_native_abi; then |
389 |
+ if use usb; then |
390 |
+ insinto /etc/hotplug/usb |
391 |
+ doins tools/hotplug/libsane.usermap |
392 |
+ fi |
393 |
+ |
394 |
+ udev_newrules tools/udev/libsane.rules 41-libsane.rules |
395 |
+ insinto "/usr/share/pkgconfig" |
396 |
+ doins tools/sane-backends.pc |
397 |
+ fi |
398 |
+} |
399 |
+ |
400 |
+multilib_src_install_all() { |
401 |
+ keepdir /var/lib/lock/sane |
402 |
+ fowners root:scanner /var/lib/lock/sane |
403 |
+ fperms g+w /var/lib/lock/sane |
404 |
+ dodir /etc/env.d |
405 |
+ |
406 |
+ if use systemd; then |
407 |
+ systemd_newunit "${FILESDIR}"/saned_at.service "saned@.service" |
408 |
+ systemd_newunit "${FILESDIR}"/saned.socket saned.socket |
409 |
+ fi |
410 |
+ |
411 |
+ if use usb; then |
412 |
+ exeinto /etc/hotplug/usb |
413 |
+ doexe tools/hotplug/libusbscanner |
414 |
+ newdoc tools/hotplug/README README.hotplug |
415 |
+ fi |
416 |
+ |
417 |
+ dodoc NEWS AUTHORS ChangeLog* PROBLEMS README README.linux |
418 |
+ find "${D}" -name '*.la' -delete || die |
419 |
+ |
420 |
+ if use xinetd; then |
421 |
+ insinto /etc/xinetd.d |
422 |
+ doins "${FILESDIR}"/saned |
423 |
+ fi |
424 |
+ |
425 |
+ newinitd "${FILESDIR}"/saned.initd saned |
426 |
+ newconfd "${FILESDIR}"/saned.confd saned |
427 |
+} |
428 |
+ |
429 |
+pkg_postinst() { |
430 |
+ if use xinetd; then |
431 |
+ elog "If you want remote clients to connect, edit" |
432 |
+ elog "/etc/sane.d/saned.conf and /etc/hosts.allow" |
433 |
+ fi |
434 |
+ |
435 |
+ if ! use systemd; then |
436 |
+ elog "If you are using a USB scanner, add all users who want" |
437 |
+ elog "to access your scanner to the \"scanner\" group." |
438 |
+ fi |
439 |
+} |