Commit | Line | Data |
---|---|---|
45c151d9 | 1 | ;;; GNU Guix --- Functional package management for GNU |
3b71b36c AW |
2 | ;;; Copyright © 2014 John Darrington <jmd@gnu.org> |
3 | ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com> | |
4c928743 | 4 | ;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca> |
4ed390a0 | 5 | ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> |
45c151d9 JD |
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) | |
4c928743 | 25 | #:use-module (guix utils) |
45c151d9 | 26 | #:use-module (guix build-system gnu) |
3b71b36c AW |
27 | #:use-module (gnu packages pkg-config) |
28 | #:use-module (gnu packages libusb) | |
45c151d9 JD |
29 | #:use-module ((guix licenses) |
30 | #:prefix licence:)) | |
31 | ||
32aa37a2 | 32 | (define-public sane-backends-minimal |
45c151d9 | 33 | (package |
32aa37a2 | 34 | (name "sane-backends-minimal") |
4febd4b0 | 35 | (version "1.0.27") |
45c151d9 JD |
36 | (source (origin |
37 | (method url-fetch) | |
d976eccd | 38 | (uri (string-append |
4febd4b0 | 39 | "https://alioth.debian.org/frs/download.php/latestfile/176/" |
32aa37a2 | 40 | "sane-backends-" version ".tar.gz")) |
45c151d9 JD |
41 | (sha256 |
42 | (base32 | |
4febd4b0 | 43 | "1j9nbqspaj0rlgalafb5z6r606k0i22kz0rcpd744p176yzlfdr9")) |
a32d0c83 LC |
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 \\(¤t_time\\)\\)") | |
50 | "\"1970-01-01\""))))) | |
45c151d9 | 51 | (build-system gnu-build-system) |
3b71b36c AW |
52 | (native-inputs |
53 | `(("pkg-config" ,pkg-config))) | |
54 | (inputs | |
55 | `(("libusb-compat" ,libusb-compat))) | |
45c151d9 | 56 | (arguments |
4ed390a0 | 57 | `(#:phases |
3b71b36c | 58 | (modify-phases %standard-phases |
33a14e29 AP |
59 | (add-before 'configure 'disable-backends |
60 | (lambda _ | |
61 | (setenv "BACKENDS" " ") | |
62 | #t)) | |
4ed390a0 TGR |
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")))))))) | |
45c151d9 | 85 | (home-page "http://www.sane-project.org") |
32aa37a2 AP |
86 | (synopsis |
87 | "Raster image scanner library and drivers, without scanner support") | |
45c151d9 JD |
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 | |
32aa37a2 | 91 | package contains the library, but no drivers.") |
45c151d9 | 92 | (license licence:gpl2+))) ; plus linking exception |
4c928743 AP |
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."))) |