projects/guix·blob python-team · refs

475 lines · 19.8 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 John Darrington <[email protected]>
3;;; Copyright © 2015 Andy Wingo <[email protected]>
4;;; Copyright © 2016 Andy Patterson <[email protected]>
5;;; Copyright © 2017, 2019, 2020, 2022 Tobias Geerinckx-Rice <[email protected]>
6;;; Copyright © 2018 Efraim Flashner <[email protected]>
7;;; Copyright © 2022 João Gabriel <[email protected]>
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages scanner)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages bash)
29 #:use-module (gnu packages boost)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages dns)
32 #:use-module (gnu packages freedesktop)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages ghostscript)
35 #:use-module (gnu packages glib)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages image)
38 #:use-module (gnu packages imagemagick)
39 #:use-module (gnu packages libusb)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages ocr)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages textutils)
45 #:use-module (gnu packages tls)
46 #:use-module (gnu packages xml)
47 #:use-module (guix build-system gnu)
48 #:use-module (guix deprecation)
49 #:use-module (guix download)
50 #:use-module (guix gexp)
51 #:use-module (guix git-download)
52 #:use-module ((guix licenses) #:prefix license:)
53 #:use-module (guix packages)
54 #:use-module (guix search-paths)
55 #:use-module (guix utils))
56
57(define-public sane-airscan
58 (package
59 (name "sane-airscan")
60 (version "0.99.36")
61 (source
62 (origin
63 (method git-fetch)
64 (uri (git-reference
65 (url "https://github.com/alexpevzner/sane-airscan")
66 (commit version)))
67 (file-name (git-file-name name version))
68 (sha256
69 (base32 "1dh7rq1g120gqhkr7ac3p7yizm330dj3xqrrg08dff7ra1jx955y"))))
70 (build-system gnu-build-system)
71 (arguments
72 (list #:make-flags
73 #~(list (string-append "prefix=" #$output)
74 (string-append "libdir=$(prefix)/lib"))
75 #:phases
76 #~(modify-phases %standard-phases
77 (delete 'configure )))) ; no configure script
78 (native-inputs
79 (list pkg-config))
80 (inputs
81 (list avahi
82 gnutls
83 libjpeg-turbo
84 libpng
85 libtiff
86 libxml2
87 sane))
88 (home-page "https://github.com/alexpevzner/sane-airscan")
89 (synopsis "SANE backend for eSCL (AirScan) and WSD document scanners")
90 (description ; no @acronym{eSCL} because the meaning isn't officially known
91 "This SANE backend lets you scan documents and images from scanners and
92multi-function printers that speak eSCL (marketed as ``AirScan'') or
93@acronym{WSD, Web Services for Devices} (or ``WS-Scan'').
94
95Both are vendor-neutral protocols that allow ``driverless'' scanning over IPv4
96and IPv6 networks without the vendor-specific drivers that make up most of the
97sane-backends collection. This is similar to how most contemporary printers
98speak the universal @acronym{IPP, Internet Printing Protocol}.
99
100Only scanners that support eSCL will also work over USB. This requires a
101suitable IPP-over-USB daemon like ipp-usb to be installed and configured.
102
103Any eSCL or WSD-capable scanner should just work. sane-airscan automatically
104discovers and configures devices, including which protocol to use. It was
105successfully tested with many devices from Brother, Canon, Dell, Kyocera,
106Lexmark, Epson, HP, OKI, Panasonic, Pantum, Ricoh, Samsung, and Xerox, with
107both WSD and eSCL.")
108 (license (list license:gpl2+ ; the combined work
109 license:expat)))) ; http_parser.[ch]
110
111(define-deprecated/public-alias sane-backends-minimal sane)
112(define-public sane
113 (package
114 (name "sane")
115 (version "1.4.0")
116 (source (origin
117 (method git-fetch)
118 (uri (git-reference
119 (url "https://gitlab.com/sane-project/backends")
120 (commit version)))
121 (file-name (git-file-name name version))
122 (sha256
123 (base32 "09hcqrli127amdxjlj6xd9lvc0rhlhhm8vxrnldbd8c2mxss7dbv"))
124 (patches (search-patches
125 "sane-look-for-plugins-in-SANE_BACKEND_LIB_PATH.patch"))
126 (modules '((guix build utils)))
127 (snippet
128 ;; Generated HTML files and udev rules normally embed a
129 ;; timestamp. Work around that to build things reproducibly.
130 '(begin
131 (substitute* "tools/sane-desc.c"
132 (("asctime \\(localtime \\(&current_time\\)\\)")
133 "\"1970-01-01\""))))))
134 (build-system gnu-build-system)
135 (arguments
136 (list
137 #:phases
138 #~(modify-phases %standard-phases
139 (add-before 'bootstrap 'zap-unnecessary-git-dependency
140 (lambda _
141 ;; This runs before default patch-shebangs phase.
142 (substitute* "tools/git-version-gen"
143 (("/bin/sh")
144 (which "sh")))
145 (with-output-to-file ".tarball-version"
146 (lambda _
147 (format #t #$version)))))
148 (add-before 'configure 'disable-backends
149 (lambda _
150 (setenv "BACKENDS" " ")
151
152 ;; Disable tests that may require back ends to be built.
153 (substitute* "testsuite/Makefile.in"
154 ((" backend ")
155 " "))))
156 (add-before 'configure 'disable-failing-tests
157 (lambda _
158 ;; Disable unmaintained tests that that fail with errors resembling:
159 ;;
160 ;; < # by sane-desc 3.5 from sane-backends 1.0.24git on Jul 31 2013
161 ;; ---
162 ;; > # by sane-desc 3.5 from sane-backends 1.0.27 on 1970-01-01#
163 ;; FAIL: sane-desc -m usermap -s ./data
164 (for-each (lambda (pattern)
165 (substitute* "testsuite/tools/Makefile.in"
166 (((string-append " " pattern " "))
167 " ")))
168 (list "usermap"
169 "db"
170 "udev"
171 "udev\\+acl"
172 "udev\\+hwdb"
173 "hwdb"))
174
175 ;; Disable tests that try to connect to actual USB hardware & fail
176 ;; with the following error when no USB access is allowed at all:
177 ;;
178 ;; sanei_usb_test: sanei_usb_test.c:849: main: Assertion
179 ;; `test_init (1)' failed.
180 (substitute* "testsuite/sanei/Makefile.in"
181 (("sanei_usb_test\\$\\(EXEEXT\\) ")
182 ""))))
183 (add-before 'build 'build-pixma_sane_options.c
184 ;; "No rule to make target '../backend/pixma/pixma_sane_options.c',
185 ;; needed by 'sane-backends.pot-update'."
186 (lambda _
187 (invoke "make" "-C" "backend" "pixma/pixma_sane_options.c")))
188 (add-after 'install 'install-udev-rules
189 (lambda _
190 (let ((dest (string-append #$output "/lib/udev/rules.d/"
191 "60-libsane.rules")))
192 (mkdir-p (dirname dest))
193 (copy-file "tools/udev/libsane.rules" dest))))
194 (add-after 'install 'remove-dll.conf
195 (lambda _
196 ;; dll.conf lists enabled backends, so it should be removed as
197 ;; there are none in this package
198 (delete-file (string-append #$output "/etc/sane.d/dll.conf"))))
199 (add-after 'install 'make-reproducible
200 ;; XXX Work around an old bug <https://issues.guix.gnu.org/26247>.
201 ;; Then work around "Throw to key `decoding-error' ..." by using sed.
202 (lambda _
203 (with-directory-excursion (string-append #$output "/share/locale")
204 (for-each (lambda (file)
205 (invoke "sed" "-i" "/^PO-Revision-Date:/d" file))
206 (list "en@boldquot/LC_MESSAGES/sane-backends.mo"
207 "en@quot/LC_MESSAGES/sane-backends.mo"))))))))
208 (native-inputs
209 (list autoconf
210 autoconf-archive
211 automake
212 gettext-minimal
213 libtool
214 pkg-config
215 ;; For scripts/pixma_gen_options.py.
216 python-wrapper))
217 (inputs (list libusb))
218 (native-search-paths
219 (list (search-path-specification
220 (variable "SANE_CONFIG_DIR")
221 (files '("etc/sane.d")))
222 (search-path-specification
223 (variable "SANE_BACKEND_LIB_PATH")
224 (files '("lib/sane")))))
225 (home-page "http://www.sane-project.org")
226 (synopsis
227 "Raster image scanner library and drivers, without scanner support")
228 (description
229 "SANE stands for \"Scanner Access Now Easy\" and is an API proving access
230to any raster image scanner hardware (flatbed scanner, hand-held scanner,
231video- and still-cameras, frame-grabbers, etc.). The package contains the
232library, but no drivers.")
233 (license license:gpl2+))) ; plus linking exception
234
235(define-public sane-backends
236 (package/inherit sane
237 (name "sane-backends")
238 (arguments
239 (substitute-keyword-arguments arguments
240 ((#:phases phases)
241 #~(modify-phases #$phases
242 (delete 'disable-backends)
243 (delete 'remove-dll.conf)
244 (add-after 'disable-failing-tests 'disable-failing-backend-tests
245 (lambda _
246 ;; Disable test that fails on i686:
247 ;; <https://bugs.gnu.org/39449>
248 (substitute* "testsuite/backend/genesys/Makefile.in"
249 ((" genesys_unit_tests\\$\\(EXEEXT\\)") ""))))))))
250 (inputs (modify-inputs inputs
251 (prepend libjpeg-turbo ;for pixma/epsonds/other back ends
252 libpng ;support 'scanimage --format=png'
253 libxml2))) ;for pixma back end
254 (synopsis "Raster image scanner library and drivers, with scanner support")
255 (description "SANE stands for \"Scanner Access Now Easy\" and is an API
256proving access to any raster image scanner hardware (flatbed scanner,
257hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
258package contains the library and drivers.")))
259
260(define-public utsushi
261 (let ((commit "b296671703ea3317ae1621f8ae67f7086208369d")
262 (revision "2"))
263 (package
264 (name "utsushi")
265 (version (git-version "0.65.0" revision commit))
266 (source
267 (origin
268 (method git-fetch)
269 (uri (git-reference
270 (url "https://gitlab.com/utsushi/utsushi")
271 (commit commit)))
272 (file-name (git-file-name name version))
273 (sha256
274 (base32 "0sa2im75ymrkhxhhm93g81vv02yjwg3wn9myrjzlrfl2xnwk3bzb"))))
275 (build-system gnu-build-system)
276 (arguments
277 (list
278 #:configure-flags
279 #~(list (string-append "--with-boost-libdir="
280 #$(this-package-input "boost") "/lib")
281 "CXXFLAGS=-Wno-error")
282 #:phases
283 #~(modify-phases %standard-phases
284 (add-after 'unpack 'patch-bootstrap-fail-on-error
285 (lambda _
286 (substitute* "bootstrap"
287 ;; Don't continue when errors occurred.
288 (("^usage") "set -e\n\nusage"))))
289 (add-after 'unpack 'fix-escaped-comment-marker
290 (lambda _
291 (substitute* "drivers/esci/Makefile.am"
292 ;; Fixes a fatal warning: "escaping \# comment markers
293 ;; is not portable".
294 (("\\\\#") "\\x23"))))
295 (add-after 'unpack 'zap-unnecessary-git-dependency
296 (lambda _
297 (substitute* "configure.ac"
298 (("-m4_esyscmd_s\\(\\[git describe --always\\]\\)")
299 ""))))
300 (add-after 'unpack 'update-gettext-version
301 (lambda _
302 (substitute* "configure.ac"
303 (("AM_GNU_GETTEXT_VERSION\\(.*\\)")
304 (format #f "AM_GNU_GETTEXT_VERSION([~a])"
305 #$(package-version (this-package-native-input
306 "gettext-minimal")))))))
307 (add-after 'unpack 'fix-newer-sane-support
308 (lambda _
309 (substitute* "sane/version.hpp"
310 (("#error \"SANE.*violates.*versioning.*\"" all)
311 (string-append "//" all)))))
312 (add-after 'unpack 'patch-shell-paths
313 (lambda _
314 (for-each (lambda (file)
315 (substitute* file
316 (("/bin/sh") (which "sh"))))
317 '("filters/shell-pipe.cpp"
318 "lib/run-time.cpp"
319 "utsushi/test/command-line.hpp"))))
320 (add-after 'install 'install-udev-rules
321 (lambda _
322 (install-file "drivers/esci/utsushi-esci.rules"
323 (string-append #$output "/lib/udev/rules.d")))))))
324 (inputs
325 (list bash-minimal
326 boost
327 eudev
328 gtkmm-2
329 imagemagick
330 libjpeg-turbo
331 libtiff
332 libusb
333 sane
334 zlib))
335 (native-inputs
336 (list autoconf
337 autoconf-archive
338 automake
339 gettext-minimal
340 libtool
341 libxslt
342 pkg-config
343 util-linux
344 ;; For tests.
345 coreutils
346 tesseract-ocr-tessdata-fast tesseract-ocr)) ; order matters
347 (home-page "https://gitlab.com/utsushi/utsushi")
348 (synopsis "Image scanning software for EPSON devices")
349 (description
350 "Utsushi is a set of applications for image scanning with support for a
351number of EPSON scanners, including a compatibility driver to interface with
352software built around the @acronym{SANE, Scanner Access Now Easy} standard.
353
354To enable auto-rotation functionality, install the @code{tesseract-ocr} and
355@code{tesseract-ocr-tessdata-fast} packages.")
356 (license license:gpl3+))))
357
358(define-public scanbd
359 (package
360 (name "scanbd")
361 (version "1.5.1")
362 (source
363 (origin
364 (method url-fetch)
365 (uri (string-append "mirror://sourceforge/scanbd/releases/"
366 "scanbd-" version ".tgz"))
367 (sha256
368 (base32 "0pvy4qirfjdfm8aj6x5rkbgl7hk3jfa2s21qkk8ic5dqfjjab75n"))))
369 (build-system gnu-build-system)
370 (arguments
371 (list #:configure-flags
372 #~(list "--disable-debug"
373 "--sysconfdir=/etc"
374 "CFLAGS=-Wno-error") ; warnings should never be fatal
375 #:phases
376 #~(modify-phases %standard-phases
377 (replace 'install
378 (lambda* (#:key make-flags #:allow-other-keys)
379 (let ((conf (string-append #$output "/etc/scanbd")))
380 (apply invoke "make" "install"
381 ;; Install example configuration to the store, not
382 ;; /etc. These don't inherit from each other, so
383 ;; we need both.
384 (string-append "scanbdconfdir=" conf)
385 (string-append "scannerconfdir=" conf "/scanner.d")
386 make-flags))))
387 (add-after 'install 'install-extra-documentation
388 ;; The README provides more detailed set-up instructions than
389 ;; the man page.
390 (lambda _
391 (let ((doc (string-append #$output "/share/doc/"
392 #$name "-" #$version)))
393 (install-file "doc/README.txt" doc)))))))
394 (native-inputs
395 (list pkg-config))
396 (inputs
397 (list dbus libconfuse sane eudev zlib))
398 (home-page "https://scanbd.sourceforge.io")
399 (synopsis "Configurable scanner button monitor")
400 (description "Scanbd stands for scanner button daemon. It regularly polls
401scanners for pressed buttons, function knob changes, or other events such
402as (un)plugging the scanner or inserting and removing paper. Then it performs
403the desired action(s) such as saving, copying, or e-mailing the image.
404
405Actions can be fully customized through scripts, based on any combination of
406switch or knob settings. Events are also signaled over D-Bus and scans can
407even be triggered over D-Bus from foreign applications.
408
409Scanbd talks to scanners through the @acronym{SANE, Scanner Access Now Easy}
410back-end library. This means that it supports almost all existing scanners,
411provided the driver also exposes the buttons.")
412 (license license:gpl2+)))
413
414(define-public xsane
415 (let ((commit "87edc38e6886ad8f31c2b7b289ddf162c88099c8")
416 (revision "0"))
417 (package
418 (name "xsane")
419 (version (git-version "0.0.0" revision commit))
420 (source
421 (origin
422 (method git-fetch)
423 (uri (git-reference
424 (url "https://gitlab.com/sane-project/frontend/xsane.git")
425 (commit commit)))
426 (file-name (git-file-name name version))
427 (sha256
428 (base32 "0hgkpb5dfiwrhprsslahrkjfrkg8fgc8f8ssmqng1aywq3sqpd5l"))
429 (modules '((guix build utils)))
430 (snippet
431 #~(begin
432 ;; Remove ancient bundled lprng code under a non-free licence. See
433 ;; <https://trisquel.info/en/issues/10713>, which solves the problem
434 ;; by replacing it with a newer (free) copy. We let the build fall
435 ;; back to the system version instead, which appears to work fine.
436 (delete-file "lib/snprintf.c")
437 (substitute* "lib/Makefile.am"
438 (("snprintf\\.c ") ""))
439 (substitute* "po/POTFILES.in"
440 (("lib/snprintf\\.c") ""))))))
441 (build-system gnu-build-system)
442 (arguments
443 (list
444 #:tests? #f ; no test suite
445 #:phases
446 #~(modify-phases %standard-phases
447 (add-after 'unpack 'use-sane-help-browser
448 (lambda* (#:key inputs #:allow-other-keys)
449 (substitute* "src/xsane.h"
450 (("netscape")
451 (search-input-file inputs "bin/xdg-open"))))))))
452 (native-inputs
453 (list autoconf-2.71
454 automake
455 gettext-minimal
456 pkg-config))
457 (inputs
458 (list gtk+
459 lcms
460 libjpeg-turbo
461 libtiff
462 sane
463 xdg-utils)) ;to open the manual from the Help menu
464 (home-page "https://gitlab.com/sane-project/frontend/xsane")
465 (synopsis "Featureful graphical interface for document and image scanners")
466 (description
467 "XSane is a graphical interface for controlling a scanner and acquiring
468images from it. You can photocopy multi-page documents and save, fax, print,
469or e-mail your scanned images. It is highly configurable and exposes all
470device settings, letting you fine-tune the final result. It can also be used
471as a GIMP plugin to acquire images directly from a scanner.
472
473XSane talks to scanners through the @acronym{SANE, Scanner Access Now Easy}
474back-end library, which supports almost all existing scanners.")
475 (license license:gpl2+))))