1 |
commit: 2d6b57e2a291f675341c026a67e452db1ea15227 |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 29 08:42:23 2022 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 29 08:42:23 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d6b57e2 |
7 |
|
8 |
media-gfx/sane-backends: Fix crash in genesys driver |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org> |
12 |
|
13 |
.../sane-backends-1.1.1-genesys-gl845-crash.patch | 12 + |
14 |
.../sane-backends/sane-backends-1.1.1-r2.ebuild | 365 +++++++++++++++++++++ |
15 |
2 files changed, 377 insertions(+) |
16 |
|
17 |
diff --git a/media-gfx/sane-backends/files/sane-backends-1.1.1-genesys-gl845-crash.patch b/media-gfx/sane-backends/files/sane-backends-1.1.1-genesys-gl845-crash.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..f63a8e2100b9 |
20 |
--- /dev/null |
21 |
+++ b/media-gfx/sane-backends/files/sane-backends-1.1.1-genesys-gl845-crash.patch |
22 |
@@ -0,0 +1,12 @@ |
23 |
+diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp |
24 |
+index 9552fa9..c95de7b 100644 |
25 |
+--- a/backend/genesys/genesys.cpp |
26 |
++++ b/backend/genesys/genesys.cpp |
27 |
+@@ -367,6 +367,7 @@ void sanei_genesys_create_default_gamma_table(Genesys_Device* dev, |
28 |
+ } |
29 |
+ max = size - 1; |
30 |
+ } else if (dev->model->asic_type == AsicType::GL124 || |
31 |
++ dev->model->asic_type == AsicType::GL845 || |
32 |
+ dev->model->asic_type == AsicType::GL846 || |
33 |
+ dev->model->asic_type == AsicType::GL847) { |
34 |
+ size = 257; |
35 |
|
36 |
diff --git a/media-gfx/sane-backends/sane-backends-1.1.1-r2.ebuild b/media-gfx/sane-backends/sane-backends-1.1.1-r2.ebuild |
37 |
new file mode 100644 |
38 |
index 000000000000..010ba000e55f |
39 |
--- /dev/null |
40 |
+++ b/media-gfx/sane-backends/sane-backends-1.1.1-r2.ebuild |
41 |
@@ -0,0 +1,365 @@ |
42 |
+# Copyright 1999-2022 Gentoo Authors |
43 |
+# Distributed under the terms of the GNU General Public License v2 |
44 |
+ |
45 |
+EAPI=8 |
46 |
+ |
47 |
+PYTHON_COMPAT=( python3_{8..10} ) |
48 |
+ |
49 |
+# python-any-r1 required for a script in |
50 |
+# backends/pixma/scripts/ |
51 |
+inherit autotools flag-o-matic multilib-minimal optfeature python-any-r1 systemd toolchain-funcs udev |
52 |
+ |
53 |
+# gphoto and v4l are handled by their usual USE flags. |
54 |
+# The pint backend was disabled because I could not get it to compile. |
55 |
+IUSE_SANE_BACKENDS=( |
56 |
+ abaton |
57 |
+ agfafocus |
58 |
+ apple |
59 |
+ artec |
60 |
+ artec_eplus48u |
61 |
+ as6e |
62 |
+ avision |
63 |
+ bh |
64 |
+ canon |
65 |
+ canon630u |
66 |
+ canon_dr |
67 |
+ canon_lide70 |
68 |
+ canon_pp |
69 |
+ cardscan |
70 |
+ coolscan |
71 |
+ coolscan2 |
72 |
+ coolscan3 |
73 |
+ dc210 |
74 |
+ dc240 |
75 |
+ dc25 |
76 |
+ dell1600n_net |
77 |
+ dmc |
78 |
+ epjitsu |
79 |
+ epson |
80 |
+ epson2 |
81 |
+ escl |
82 |
+ fujitsu |
83 |
+ genesys |
84 |
+ gt68xx |
85 |
+ hp |
86 |
+ hp3500 |
87 |
+ hp3900 |
88 |
+ hp4200 |
89 |
+ hp5400 |
90 |
+ hp5590 |
91 |
+ hpljm1005 |
92 |
+ hpsj5s |
93 |
+ hs2p |
94 |
+ ibm |
95 |
+ kodak |
96 |
+ kodakaio |
97 |
+ kvs1025 |
98 |
+ kvs20xx |
99 |
+ kvs40xx |
100 |
+ leo |
101 |
+ lexmark |
102 |
+ ma1509 |
103 |
+ magicolor |
104 |
+ matsushita |
105 |
+ microtek |
106 |
+ microtek2 |
107 |
+ mustek |
108 |
+ mustek_pp |
109 |
+ mustek_usb |
110 |
+ mustek_usb2 |
111 |
+ nec |
112 |
+ net |
113 |
+ niash |
114 |
+ p5 |
115 |
+ pie |
116 |
+ pieusb |
117 |
+ pixma |
118 |
+ plustek |
119 |
+ plustek_pp |
120 |
+ pnm |
121 |
+ qcam |
122 |
+ ricoh |
123 |
+ ricoh2 |
124 |
+ rts8891 |
125 |
+ s9036 |
126 |
+ sceptre |
127 |
+ sharp |
128 |
+ sm3600 |
129 |
+ sm3840 |
130 |
+ snapscan |
131 |
+ sp15c |
132 |
+ st400 |
133 |
+ stv680 |
134 |
+ tamarack |
135 |
+ teco1 |
136 |
+ teco2 |
137 |
+ teco3 |
138 |
+ test |
139 |
+ u12 |
140 |
+ umax |
141 |
+ umax1220u |
142 |
+ umax_pp |
143 |
+ xerox_mfp |
144 |
+) |
145 |
+ |
146 |
+IUSE="gphoto2 ipv6 snmp systemd threads usb v4l xinetd +zeroconf" |
147 |
+ |
148 |
+for GBACKEND in ${IUSE_SANE_BACKENDS[@]}; do |
149 |
+ case ${GBACKEND} in |
150 |
+ # Disable backends that require parallel ports as no one has those anymore. |
151 |
+ canon_pp|hpsj5s|mustek_pp|\ |
152 |
+ pnm|mustek_usb2|kvs40xx) |
153 |
+ IUSE+=" sane_backends_${GBACKEND}" |
154 |
+ ;; |
155 |
+ *) |
156 |
+ IUSE+=" +sane_backends_${GBACKEND}" |
157 |
+ esac |
158 |
+done |
159 |
+ |
160 |
+REQUIRED_USE=" |
161 |
+ sane_backends_escl? ( zeroconf ) |
162 |
+ sane_backends_kvs40xx? ( threads ) |
163 |
+ sane_backends_mustek_usb2? ( threads ) |
164 |
+" |
165 |
+ |
166 |
+DESCRIPTION="Scanner Access Now Easy - Backends" |
167 |
+HOMEPAGE="http://www.sane-project.org/" |
168 |
+SRC_URI="https://gitlab.com/sane-project/backends/uploads/7d30fab4e115029d91027b6a58d64b43/${P}.tar.gz" |
169 |
+ |
170 |
+LICENSE="GPL-2 public-domain" |
171 |
+SLOT="0" |
172 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" |
173 |
+ |
174 |
+# For pixma: see https://gitlab.com/sane-project/backends/-/releases/1.0.28#build |
175 |
+RDEPEND=" |
176 |
+ acct-user/saned |
177 |
+ gphoto2? ( |
178 |
+ >=media-libs/libgphoto2-2.5.3.1:=[${MULTILIB_USEDEP}] |
179 |
+ >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] |
180 |
+ ) |
181 |
+ sane_backends_canon_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] ) |
182 |
+ sane_backends_dc210? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] ) |
183 |
+ sane_backends_dc240? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] ) |
184 |
+ sane_backends_dell1600n_net? ( |
185 |
+ >=media-libs/tiff-3.9.7-r1:0=[${MULTILIB_USEDEP}] |
186 |
+ >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] |
187 |
+ ) |
188 |
+ sane_backends_escl? ( |
189 |
+ app-text/poppler[cairo] |
190 |
+ || ( |
191 |
+ net-dns/avahi[dbus] |
192 |
+ net-dns/avahi[gtk] |
193 |
+ ) |
194 |
+ net-dns/avahi[${MULTILIB_USEDEP}] |
195 |
+ net-misc/curl[${MULTILIB_USEDEP}] |
196 |
+ ) |
197 |
+ sane_backends_hpsj5s? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] ) |
198 |
+ sane_backends_mustek_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] ) |
199 |
+ sane_backends_pixma? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] ) |
200 |
+ snmp? ( net-analyzer/net-snmp:0= ) |
201 |
+ systemd? ( sys-apps/systemd:0= ) |
202 |
+ usb? ( >=virtual/libusb-1-r1:1=[${MULTILIB_USEDEP}] ) |
203 |
+ v4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] ) |
204 |
+ xinetd? ( sys-apps/xinetd ) |
205 |
+ zeroconf? ( >=net-dns/avahi-0.6.31-r2[${MULTILIB_USEDEP}] ) |
206 |
+" |
207 |
+ |
208 |
+DEPEND="${RDEPEND} |
209 |
+ dev-libs/libxml2 |
210 |
+ v4l? ( sys-kernel/linux-headers ) |
211 |
+" |
212 |
+BDEPEND=" |
213 |
+ ${PYTHON_DEPS} |
214 |
+ sys-devel/autoconf-archive |
215 |
+ sys-devel/gettext |
216 |
+ virtual/pkgconfig |
217 |
+" |
218 |
+ |
219 |
+PATCHES=( |
220 |
+ "${FILESDIR}"/${PN}-1.0.24-saned_pidfile_location.patch |
221 |
+ "${FILESDIR}"/${PN}-1.0.27-disable-usb-tests.patch |
222 |
+ "${FILESDIR}"/${PN}-1.0.30-add_hpaio_epkowa_dll.conf.patch |
223 |
+ # https://gitlab.com/sane-project/backends/-/merge_requests/688 |
224 |
+ "${FILESDIR}"/${PN}-1.1.1-genesys-gl845-crash.patch |
225 |
+) |
226 |
+ |
227 |
+MULTILIB_CHOST_TOOLS=( |
228 |
+ /usr/bin/sane-config |
229 |
+) |
230 |
+ |
231 |
+src_prepare() { |
232 |
+ default |
233 |
+ |
234 |
+ # Patch out the git reference so we can run eautoreconf |
235 |
+ sed \ |
236 |
+ -e "s/m4_esyscmd_s(\[git describe --dirty\])/${PV}/" \ |
237 |
+ -e '/^AM_MAINTAINER_MODE/d' \ |
238 |
+ -i configure.ac || die |
239 |
+ eautoreconf |
240 |
+ |
241 |
+ # Fix for "make check". Upstream sometimes forgets to update this. |
242 |
+ local ver=$(./configure --version | awk '{print $NF; exit 0}') |
243 |
+ sed -i \ |
244 |
+ -e "/by sane-desc 3.5 from sane-backends/s:sane-backends .*:sane-backends ${ver}:" \ |
245 |
+ testsuite/tools/data/html* || die |
246 |
+ |
247 |
+ # don't bleed user LDFLAGS into pkgconfig files |
248 |
+ sed 's|@LDFLAGS@ ||' -i tools/*.pc.in || die |
249 |
+ |
250 |
+ # Needed for udev rules generation/installation |
251 |
+ multilib_copy_sources |
252 |
+} |
253 |
+ |
254 |
+src_configure() { |
255 |
+ # From Fedora |
256 |
+ append-flags -fno-strict-aliasing |
257 |
+ multilib-minimal_src_configure |
258 |
+} |
259 |
+ |
260 |
+multilib_src_configure() { |
261 |
+ # the blank is intended - an empty string would result in building ALL backends. |
262 |
+ local lbackends=" " |
263 |
+ |
264 |
+ use gphoto2 && lbackends="gphoto2" |
265 |
+ use v4l && lbackends+=" v4l" |
266 |
+ use sane_backends_escl && multilib_is_native_abi && lbackends+=" escl" |
267 |
+ local backend |
268 |
+ for backend in ${IUSE_SANE_BACKENDS[@]} ; do |
269 |
+ if use "sane_backends_${backend}" && [[ "${backend}" != pnm ]] && [[ "${backend}" != escl ]] ; then |
270 |
+ lbackends+=" ${backend}" |
271 |
+ fi |
272 |
+ done |
273 |
+ |
274 |
+ local myconf=( |
275 |
+ $(use_with usb) |
276 |
+ $(multilib_native_use_with snmp) |
277 |
+ |
278 |
+ $(multilib_native_use_with sane_backends_escl poppler-glib) |
279 |
+ # you can only enable this backend, not disable it... |
280 |
+ $(usex sane_backends_pnm --enable-pnm-backend '') |
281 |
+ $(usex sane_backends_mustek_pp --enable-parport-directio '') |
282 |
+ ) |
283 |
+ |
284 |
+ if ! { use sane_backends_canon_pp || use sane_backends_hpsj5s || use sane_backends_mustek_pp ; } ; then |
285 |
+ myconf+=( sane_cv_use_libieee1284=no ) |
286 |
+ fi |
287 |
+ |
288 |
+ # relative path must be used for tests to work properly |
289 |
+ # All distributions pass --disable-locking because /var/lock/sane/ would be a world-writable directory |
290 |
+ # that break in many ways, bug #636202, #668232, #668350 |
291 |
+ # People can refer to the "Programmer's Documentation" at http://www.sane-project.org/docs.html |
292 |
+ myconf+=( |
293 |
+ --disable-locking |
294 |
+ $(use_with gphoto2) |
295 |
+ $(multilib_native_use_with systemd) |
296 |
+ $(use_with v4l) |
297 |
+ $(use_enable ipv6) |
298 |
+ $(use_enable threads pthread) |
299 |
+ $(use_with zeroconf avahi) |
300 |
+ ) |
301 |
+ ECONF_SOURCE="${S}" \ |
302 |
+ SANEI_JPEG="sanei_jpeg.o" SANEI_JPEG_LO="sanei_jpeg.lo" \ |
303 |
+ BACKENDS="${lbackends}" \ |
304 |
+ econf "${myconf[@]}" |
305 |
+} |
306 |
+ |
307 |
+multilib_src_compile() { |
308 |
+ emake VARTEXFONTS="${T}/fonts" |
309 |
+ |
310 |
+ if tc-is-cross-compiler ; then |
311 |
+ pushd "${BUILD_DIR}"/tools >/dev/null || die |
312 |
+ |
313 |
+ # The build system sucks and doesn't handle this properly. |
314 |
+ # https://alioth.debian.org/tracker/index.php?func=detail&aid=314236&group_id=30186&atid=410366 |
315 |
+ tc-export_build_env BUILD_CC |
316 |
+ ${BUILD_CC} ${BUILD_CPPFLAGS} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} \ |
317 |
+ -I. -I../include -I"${S}"/include \ |
318 |
+ "${S}"/sanei/sanei_config.c "${S}"/sanei/sanei_constrain_value.c \ |
319 |
+ "${S}"/sanei/sanei_init_debug.c "${S}"/tools/sane-desc.c -o sane-desc || die |
320 |
+ local dirs=( hal hotplug hotplug-ng udev ) |
321 |
+ local targets=( |
322 |
+ hal/libsane.fdi |
323 |
+ hotplug/libsane.usermap |
324 |
+ hotplug-ng/libsane.db |
325 |
+ udev/libsane.rules |
326 |
+ ) |
327 |
+ mkdir -p "${dirs[@]}" || die |
328 |
+ emake "${targets[@]}" |
329 |
+ |
330 |
+ popd >/dev/null || die |
331 |
+ fi |
332 |
+ |
333 |
+ if use usb ; then |
334 |
+ sed -i -e '/^$/d' \ |
335 |
+ tools/hotplug/libsane.usermap || die |
336 |
+ fi |
337 |
+} |
338 |
+ |
339 |
+multilib_src_install() { |
340 |
+ emake INSTALL_LOCKPATH="" DESTDIR="${D}" install \ |
341 |
+ docdir="${EPREFIX}"/usr/share/doc/${PF} |
342 |
+ |
343 |
+ if multilib_is_native_abi ; then |
344 |
+ if use usb ; then |
345 |
+ insinto /etc/hotplug/usb |
346 |
+ doins tools/hotplug/libsane.usermap |
347 |
+ fi |
348 |
+ |
349 |
+ insinto "/usr/share/pkgconfig" |
350 |
+ doins tools/sane-backends.pc |
351 |
+ |
352 |
+ # From Fedora and Arch, prevent permission conflicts |
353 |
+ # https://github.com/OpenPrinting/cups/issues/314 |
354 |
+ # https://gitlab.com/sane-project/backends/-/issues/546 |
355 |
+ # |
356 |
+ # Generate udev udev+hwdb, not needing scanner group |
357 |
+ install -vdm 755 "${ED}/$(get_udevdir)/rules.d/" || die |
358 |
+ tools/sane-desc -m udev+hwdb -s doc/descriptions/ > "${ED}/$(get_udevdir)/rules.d/65-${PN}.rules" || die |
359 |
+ tools/sane-desc -m udev+hwdb -s doc/descriptions-external/ >> "${ED}/$(get_udevdir)/rules.d/65-${PN}.rules" || die |
360 |
+ # generate udev hwdb |
361 |
+ install -vdm 755 "${ED}/$(get_udevdir)/hwdb.d/" || die |
362 |
+ tools/sane-desc -m hwdb -s doc/descriptions/ > "${ED}/$(get_udevdir)/hwdb.d/20-${PN}.hwdb" |
363 |
+ # NOTE: an empty new line is required between the two .desc collections |
364 |
+ printf "\n" >> "${ED}/$(get_udevdir)/hwdb.d/20-${PN}.hwdb" || die |
365 |
+ tools/sane-desc -m hwdb -s doc/descriptions-external/ >> "${ED}/$(get_udevdir)/hwdb.d/20-${PN}.hwdb" || die |
366 |
+ # udev rule for saned (SANE scanning daemon) to be able to write on usb port |
367 |
+ udev_dorules "${FILESDIR}/66-saned.rules" |
368 |
+ fi |
369 |
+} |
370 |
+ |
371 |
+multilib_src_install_all() { |
372 |
+ dodir /etc/env.d |
373 |
+ |
374 |
+ if use systemd ; then |
375 |
+ systemd_newunit "${FILESDIR}"/saned_at.service "saned@.service" |
376 |
+ systemd_newunit "${FILESDIR}"/saned.socket saned.socket |
377 |
+ fi |
378 |
+ |
379 |
+ if use usb ; then |
380 |
+ exeinto /etc/hotplug/usb |
381 |
+ doexe tools/hotplug/libusbscanner |
382 |
+ newdoc tools/hotplug/README README.hotplug |
383 |
+ fi |
384 |
+ |
385 |
+ dodoc NEWS AUTHORS PROBLEMS README README.linux |
386 |
+ find "${ED}" -name '*.la' -delete || die |
387 |
+ |
388 |
+ if use xinetd ; then |
389 |
+ insinto /etc/xinetd.d |
390 |
+ doins "${FILESDIR}"/saned |
391 |
+ fi |
392 |
+ |
393 |
+ newinitd "${FILESDIR}"/saned.initd saned |
394 |
+ newconfd "${FILESDIR}"/saned.confd saned |
395 |
+} |
396 |
+ |
397 |
+pkg_postinst() { |
398 |
+ optfeature "Network scanner backend" media-gfx/sane-airscan |
399 |
+ optfeature "Epson-specific backend" media-gfx/iscan |
400 |
+ optfeature "HP-specific backend" net-print/hplip |
401 |
+ |
402 |
+ if use xinetd ; then |
403 |
+ elog "If you want remote clients to connect, edit" |
404 |
+ elog "/etc/sane.d/saned.conf and /etc/hosts.allow" |
405 |
+ fi |
406 |
+} |