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>
7 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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)
32 (define-public sane-backends-minimal
34 (name "sane-backends-minimal")
39 "https://alioth.debian.org/frs/download.php/latestfile/176/"
40 "sane-backends-" version ".tar.gz"))
43 "1j9nbqspaj0rlgalafb5z6r606k0i22kz0rcpd744p176yzlfdr9"))
44 (modules '((guix build utils)))
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 \\(¤t_time\\)\\)")
51 (build-system gnu-build-system)
53 `(("pkg-config" ,pkg-config)))
55 `(("libusb-compat" ,libusb-compat)))
58 (modify-phases %standard-phases
59 (add-before 'configure 'disable-backends
61 (setenv "BACKENDS" " ")
63 ;; Disable unmaintained tests that that fail with errors resembling:
65 ;; < # by sane-desc 3.5 from sane-backends 1.0.24git on Jul 31 2013
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
73 (substitute* "testsuite/tools/Makefile.in"
74 (((string-append " " pattern " ")) " ")))
75 (list "usermap" "db" "udev" "udev\\+acl" "udev\\+hwdb" "hwdb"))
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"
84 "60-libsane.rules"))))))))
85 (home-page "http://www.sane-project.org")
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
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
99 (inherit sane-backends-minimal)
100 (name "sane-backends")
102 `(("hplip" ,(@ (gnu packages cups) hplip))
103 ,@(package-inputs sane-backends-minimal)))
105 (substitute-keyword-arguments (package-arguments sane-backends-minimal)
107 `(modify-phases ,phases
108 (delete 'disable-backends)
109 (add-after 'unpack 'add-backends
111 (substitute* "backend/dll.conf.in"
112 (("hp5590" all) (format #f "~a~%~a" all "hpaio")))
114 (add-after 'install 'install-hpaio
115 (lambda* (#:key inputs outputs #:allow-other-keys)
116 (define hplip (string-append (assoc-ref inputs "hplip")
118 (define out (string-append (assoc-ref outputs "out")
122 (symlink file (string-append out "/" (basename file))))
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.")))