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