gnu: r-scater: Update to 1.8.0.
[jackhill/guix/guix.git] / gnu / packages / scanner.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
4 ;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca>
5 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages scanner)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix utils)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages pkg-config)
28 #:use-module (gnu packages libusb)
29 #:use-module ((guix licenses)
30 #:prefix licence:))
31
32 (define-public sane-backends-minimal
33 (package
34 (name "sane-backends-minimal")
35 (version "1.0.27")
36 (source (origin
37 (method url-fetch)
38 (uri (string-append
39 "https://alioth.debian.org/frs/download.php/latestfile/176/"
40 "sane-backends-" version ".tar.gz"))
41 (sha256
42 (base32
43 "1j9nbqspaj0rlgalafb5z6r606k0i22kz0rcpd744p176yzlfdr9"))
44 (modules '((guix build utils)))
45 (snippet
46 ;; Generated HTML files and udev rules normally embed a
47 ;; timestamp. Work around that to build things reproducibly.
48 '(substitute* "tools/sane-desc.c"
49 (("asctime \\(localtime \\(&current_time\\)\\)")
50 "\"1970-01-01\"")))))
51 (build-system gnu-build-system)
52 (native-inputs
53 `(("pkg-config" ,pkg-config)))
54 (inputs
55 `(("libusb-compat" ,libusb-compat)))
56 (arguments
57 `(#:phases
58 (modify-phases %standard-phases
59 (add-before 'configure 'disable-backends
60 (lambda _
61 (setenv "BACKENDS" " ")
62 #t))
63 ;; Disable unmaintained tests that that fail with errors resembling:
64 ;;
65 ;; < # by sane-desc 3.5 from sane-backends 1.0.24git on Jul 31 2013
66 ;; ---
67 ;; > # by sane-desc 3.5 from sane-backends 1.0.27 on 1970-01-01#
68 ;; FAIL: sane-desc -m usermap -s ./data
69 (add-before 'configure 'disable-failing-tests
70 (lambda _
71 (for-each
72 (lambda (pattern)
73 (substitute* "testsuite/tools/Makefile.in"
74 (((string-append " " pattern " ")) " ")))
75 (list "usermap" "db" "udev" "udev\\+acl" "udev\\+hwdb" "hwdb"))
76 #t))
77 (add-after 'install 'install-udev-rules
78 (lambda* (#:key outputs #:allow-other-keys)
79 (let ((out (assoc-ref outputs "out")))
80 (mkdir-p (string-append out "/lib/udev/rules.d"))
81 (copy-file "tools/udev/libsane.rules"
82 (string-append out
83 "/lib/udev/rules.d/"
84 "60-libsane.rules"))))))))
85 (home-page "http://www.sane-project.org")
86 (synopsis
87 "Raster image scanner library and drivers, without scanner support")
88 (description "SANE stands for \"Scanner Access Now Easy\" and is an API
89 proving access to any raster image scanner hardware (flatbed scanner,
90 hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
91 package contains the library, but no drivers.")
92 (license licence:gpl2+))) ; plus linking exception
93
94 ;; This variant links in the hpaio backend, provided by hplip, which adds
95 ;; support for HP scanners whose backends are not maintained by
96 ;; 'sane-backends'. It also builds all of those backends.
97 (define-public sane-backends
98 (package
99 (inherit sane-backends-minimal)
100 (name "sane-backends")
101 (inputs
102 `(("hplip" ,(@ (gnu packages cups) hplip))
103 ,@(package-inputs sane-backends-minimal)))
104 (arguments
105 (substitute-keyword-arguments (package-arguments sane-backends-minimal)
106 ((#:phases phases)
107 `(modify-phases ,phases
108 (delete 'disable-backends)
109 (add-after 'unpack 'add-backends
110 (lambda _
111 (substitute* "backend/dll.conf.in"
112 (("hp5590" all) (format #f "~a~%~a" all "hpaio")))
113 #t))
114 (add-after 'install 'install-hpaio
115 (lambda* (#:key inputs outputs #:allow-other-keys)
116 (define hplip (string-append (assoc-ref inputs "hplip")
117 "/lib/sane"))
118 (define out (string-append (assoc-ref outputs "out")
119 "/lib/sane"))
120 (for-each
121 (lambda (file)
122 (symlink file (string-append out "/" (basename file))))
123 (find-files hplip))
124 #t))))))
125 (synopsis
126 "Raster image scanner library and drivers, with scanner support")
127 (description "SANE stands for \"Scanner Access Now Easy\" and is an API
128 proving access to any raster image scanner hardware (flatbed scanner,
129 hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
130 package contains the library and drivers.")))