Commit | Line | Data |
---|---|---|
51002318 RW |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> | |
7a7d5f66 | 3 | ;;; Copyright © 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org> |
8e189596 | 4 | ;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il> |
2b56dc01 | 5 | ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org> |
8afabb2e | 6 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> |
7020a6ab | 7 | ;;; Copyright © 2017 Mark H Weaver <mhw@netris.org> |
e074a655 | 8 | ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
51002318 RW |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
13 | ;;; under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
15 | ;;; your option) any later version. | |
16 | ;;; | |
17 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | (define-module (gnu packages cups) | |
51002318 | 26 | #:use-module (gnu packages) |
d02aabaf LC |
27 | #:use-module (gnu packages algebra) |
28 | #:use-module (gnu packages autotools) | |
51002318 RW |
29 | #:use-module (gnu packages avahi) |
30 | #:use-module (gnu packages compression) | |
d9cdcad1 TGR |
31 | #:use-module (gnu packages fonts) ; font-dejavu |
32 | #:use-module (gnu packages fontutils) | |
33 | #:use-module (gnu packages ghostscript) | |
34 | #:use-module (gnu packages glib) | |
d02aabaf | 35 | #:use-module (gnu packages groff) |
d9cdcad1 | 36 | #:use-module (gnu packages image) |
2b56dc01 | 37 | #:use-module (gnu packages libusb) |
d9cdcad1 | 38 | #:use-module (gnu packages pdf) |
d02aabaf | 39 | #:use-module (gnu packages perl) |
d9cdcad1 | 40 | #:use-module (gnu packages pkg-config) |
12255b3d | 41 | #:use-module (gnu packages polkit) |
d02aabaf | 42 | #:use-module (gnu packages pretty-print) |
2b56dc01 | 43 | #:use-module (gnu packages python) |
44d10b1f | 44 | #:use-module (gnu packages python-xyz) |
407ef4b3 | 45 | #:use-module (gnu packages qt) |
2b56dc01 | 46 | #:use-module (gnu packages scanner) |
d9cdcad1 TGR |
47 | #:use-module (gnu packages tls) |
48 | #:use-module (guix build-system gnu) | |
dd6f309d | 49 | #:use-module (guix build-system python) |
d9cdcad1 TGR |
50 | #:use-module (guix download) |
51 | #:use-module ((guix licenses) #:prefix license:) | |
8e189596 EF |
52 | #:use-module (guix packages) |
53 | #:use-module (guix utils) | |
c9b3a72b LC |
54 | #:use-module (srfi srfi-1) |
55 | #:use-module (ice-9 match)) | |
51002318 RW |
56 | |
57 | (define-public cups-filters | |
58 | (package | |
59 | (name "cups-filters") | |
657e025d | 60 | (version "1.23.0") |
4ab016e0 | 61 | (source(origin |
51002318 RW |
62 | (method url-fetch) |
63 | (uri | |
96b44a94 | 64 | (string-append "https://openprinting.org/download/cups-filters/" |
51002318 RW |
65 | "cups-filters-" version ".tar.xz")) |
66 | (sha256 | |
67 | (base32 | |
657e025d | 68 | "1lyzxf03kdfvkbb6p7hxlarbb35lq5bh094g49v3bz9z4z9065p2")) |
51002318 RW |
69 | (modules '((guix build utils))) |
70 | (snippet | |
71 | ;; install backends, banners and filters to cups-filters output | |
72 | ;; directory, not the cups server directory | |
085cca5b AW |
73 | '(begin |
74 | (substitute* "Makefile.in" | |
75 | (("CUPS_DATADIR = @CUPS_DATADIR@") | |
76 | "CUPS_DATADIR = $(PREFIX)/share/cups") | |
77 | (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)") | |
78 | "pkgcupsserverrootdir = $(PREFIX)") | |
79 | ;; Choose standard directories notably so that binaries are | |
80 | ;; stripped. | |
81 | (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend") | |
82 | "pkgbackenddir = $(PREFIX)/lib/cups/backend") | |
83 | (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter") | |
84 | "pkgfilterdir = $(PREFIX)/lib/cups/filter")) | |
85 | ;; Find bannertopdf data such as the print test page in our | |
86 | ;; output directory, not CUPS's prefix. | |
87 | (substitute* "configure" | |
88 | (("\\{CUPS_DATADIR\\}/data") | |
6cbee49d MW |
89 | "{prefix}/share/cups/data")) |
90 | #t)))) | |
51002318 RW |
91 | (build-system gnu-build-system) |
92 | (arguments | |
93 | `(#:make-flags (list (string-append "PREFIX=" %output)) | |
94 | #:configure-flags | |
f8489f16 | 95 | `("--disable-driverless" ; TODO: enable this |
79e90f05 | 96 | "--disable-mutool" ; depends on yet another PDF library (mupdf) |
b2639670 LC |
97 | |
98 | ;; Look for the "domain socket of CUPS" in /var/run/cups. | |
99 | "--localstatedir=/var" | |
100 | ||
f40aef6b LC |
101 | ;; Free software for the win. |
102 | "--with-acroread-path=evince" | |
103 | ||
f8489f16 | 104 | ,(string-append "--with-test-font-path=" |
51002318 RW |
105 | (assoc-ref %build-inputs "font-dejavu") |
106 | "/share/fonts/truetype/DejaVuSans.ttf") | |
95264cc6 AW |
107 | ,(string-append "--with-gs-path=" |
108 | (assoc-ref %build-inputs "ghostscript") | |
109 | "/bin/gsc") | |
f8489f16 EF |
110 | ,(string-append "--with-shell=" |
111 | (assoc-ref %build-inputs "bash") | |
112 | "/bin/bash") | |
51002318 | 113 | ,(string-append "--with-rcdir=" |
1728c411 LC |
114 | (assoc-ref %outputs "out") "/etc/rc.d")) |
115 | ||
116 | #:phases (modify-phases %standard-phases | |
117 | (add-after 'unpack 'patch-foomatic-hardcoded-file-names | |
118 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
119 | ;; Foomatic has hardcoded file names we need to fix. | |
120 | (let ((out (assoc-ref outputs "out")) | |
121 | (gs (assoc-ref inputs "ghostscript"))) | |
122 | (substitute* "filter/foomatic-rip/foomaticrip.c" | |
123 | (("/usr/local/lib/cups/filter") | |
124 | (string-append out "/lib/cups/filter"))) | |
125 | #t))) | |
a6d378e2 RW |
126 | (add-after 'unpack 'patch-for-poppler |
127 | (lambda _ | |
128 | (substitute* "filter/pdf.cxx" | |
129 | (("GooString \\*field_name;" m) | |
130 | (string-append "const " m))) | |
131 | #t)) | |
1728c411 LC |
132 | (add-after 'install 'wrap-filters |
133 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
134 | ;; Some filters expect to find 'gs' in $PATH. We cannot | |
135 | ;; just hard-code its absolute file name in the source | |
136 | ;; because foomatic-rip, for example, has tests like | |
137 | ;; 'startswith(cmd, "gs")'. | |
138 | (let ((out (assoc-ref outputs "out")) | |
139 | (ghostscript (assoc-ref inputs "ghostscript"))) | |
140 | (for-each (lambda (file) | |
141 | (wrap-program file | |
142 | `("PATH" ":" prefix | |
143 | (,(string-append ghostscript | |
144 | "/bin"))))) | |
145 | (find-files (string-append | |
146 | out "/lib/cups/filter"))) | |
147 | #t)))))) | |
51002318 | 148 | (native-inputs |
b76b1dcb AE |
149 | `(("glib" ,glib "bin") ; for gdbus-codegen |
150 | ("pkg-config" ,pkg-config))) | |
51002318 | 151 | (inputs |
7e214019 EF |
152 | `(("avahi" ,avahi) |
153 | ("fontconfig" ,fontconfig) | |
51002318 | 154 | ("freetype" ,freetype) |
f8489f16 | 155 | ("font-dejavu" ,font-dejavu) ; also needed by test suite |
3e442f85 | 156 | ("ghostscript" ,ghostscript/cups) |
51002318 RW |
157 | ("ijs" ,ijs) |
158 | ("dbus" ,dbus) | |
159 | ("lcms" ,lcms) | |
f8489f16 | 160 | ("libjpeg" ,libjpeg) |
51002318 RW |
161 | ("libpng" ,libpng) |
162 | ("libtiff" ,libtiff) | |
163 | ("glib" ,glib) | |
164 | ("qpdf" ,qpdf) | |
165 | ("poppler" ,poppler) | |
166 | ("cups-minimal" ,cups-minimal))) | |
6c474253 | 167 | (home-page "https://wiki.linuxfoundation.org/openprinting/cups-filters") |
51002318 RW |
168 | (synopsis "OpenPrinting CUPS filters and backends") |
169 | (description | |
170 | "Contains backends, filters, and other software that was once part of the | |
171 | core CUPS distribution but is no longer maintained by Apple Inc. In addition | |
172 | it contains additional filters developed independently of Apple, especially | |
173 | filters for the PDF-centric printing workflow introduced by OpenPrinting.") | |
174 | ;; Different filters and backends have different licenses; see COPYING for | |
175 | ;; details | |
176 | (license (list license:gpl2 | |
177 | license:gpl2+ | |
178 | license:gpl3 | |
179 | license:gpl3+ | |
180 | license:lgpl2.0+ | |
181 | license:expat)))) | |
182 | ||
183 | ;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also | |
184 | ;; depends on CUPS libraries and binaries, cups-minimal has been added to | |
185 | ;; satisfy this dependency. | |
186 | (define-public cups-minimal | |
187 | (package | |
188 | (name "cups-minimal") | |
2261ef66 | 189 | (version "2.2.11") |
88dfd8b8 TGR |
190 | (source |
191 | (origin | |
192 | (method url-fetch) | |
193 | (uri (string-append "https://github.com/apple/cups/releases/download/v" | |
194 | version "/cups-" version "-source.tar.gz")) | |
195 | (sha256 | |
196 | (base32 | |
2261ef66 | 197 | "0v5p10lyv8wv48s8ghkhjmdrxg6iwj8hn36v1ilkz46n7y0i107m")))) |
51002318 RW |
198 | (build-system gnu-build-system) |
199 | (arguments | |
200 | `(#:configure-flags | |
201 | '("--disable-launchd" | |
202 | "--disable-systemd" | |
203 | "--disable-avahi" | |
204 | "--disable-dnssd") | |
205 | ;; Seven tests fail, mostly because of files that are provided by the | |
206 | ;; cups-filters package. | |
207 | #:tests? #f | |
208 | #:phases | |
6ea06a0e LC |
209 | (modify-phases %standard-phases |
210 | (add-before 'configure 'patch-makedefs | |
211 | (lambda _ | |
212 | (substitute* "Makedefs.in" | |
213 | (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") | |
74c164e0 MW |
214 | (("/bin/sh") (which "sh"))) |
215 | #t)) | |
d043ceed LF |
216 | ;; Make the compressed manpages writable so that the |
217 | ;; reset-gzip-timestamps phase does not error out. | |
218 | (add-before 'reset-gzip-timestamps 'make-manpages-writable | |
219 | (lambda* (#:key outputs #:allow-other-keys) | |
220 | (let* ((out (assoc-ref outputs "out")) | |
221 | (man (string-append out "/share/man"))) | |
222 | (for-each (lambda (file) (chmod file #o644)) | |
74c164e0 MW |
223 | (find-files man "\\.gz")) |
224 | #t))) | |
6ea06a0e LC |
225 | (add-before 'build 'patch-tests |
226 | (lambda _ | |
227 | (substitute* "test/ippserver.c" | |
228 | (("# else /\\* HAVE_AVAHI \\*/") | |
74c164e0 MW |
229 | "#elif defined(HAVE_AVAHI)")) |
230 | #t))))) | |
51002318 RW |
231 | (native-inputs |
232 | `(("pkg-config" ,pkg-config))) | |
233 | (inputs | |
234 | `(("zlib" ,zlib) | |
235 | ("gnutls" ,gnutls))) | |
d2a79db4 | 236 | (home-page "https://www.cups.org") |
51002318 RW |
237 | (synopsis "The Common Unix Printing System") |
238 | (description | |
9ced1033 TGR |
239 | "CUPS is a printing system that uses the Internet Printing Protocol |
240 | (@dfn{IPP}). It provides System V and BSD command-line interfaces, as well | |
51002318 RW |
241 | as a Web interface and a C programming interface to manage printers and print |
242 | jobs. It supports printing to both local (parallel, serial, USB) and | |
243 | networked printers, and printers can be shared from one computer to another. | |
9ced1033 TGR |
244 | Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to |
245 | describe printer capabilities and features, and a wide variety of generic and | |
51002318 RW |
246 | device-specific programs to convert and print many types of files.") |
247 | (license license:gpl2))) | |
248 | ||
249 | (define-public cups | |
250 | (package (inherit cups-minimal) | |
251 | (name "cups") | |
252 | (arguments | |
253 | `(;; Three tests fail: | |
254 | ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6: | |
255 | ;; Get-Jobs Operation" | |
256 | ;; * test of number of error/warning messages, probably related to a | |
257 | ;; missing font. | |
258 | #:tests? #f | |
259 | #:configure-flags | |
260 | '("--disable-launchd" | |
261 | "--disable-systemd") | |
262 | #:phases | |
3064d176 EF |
263 | (modify-phases %standard-phases |
264 | (add-before 'configure 'patch-makedefs | |
265 | (lambda _ | |
266 | (substitute* "Makedefs.in" | |
267 | (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") | |
74c164e0 MW |
268 | (("/bin/sh") (which "sh"))) |
269 | #t)) | |
3064d176 EF |
270 | (add-before 'check 'patch-tests |
271 | (lambda _ | |
272 | (let ((filters (assoc-ref %build-inputs "cups-filters")) | |
273 | (catpath (string-append | |
274 | (assoc-ref %build-inputs "coreutils") "/bin/")) | |
275 | (testdir (string-append (getcwd) "/tmp/"))) | |
276 | (mkdir testdir) | |
277 | (substitute* "test/run-stp-tests.sh" | |
278 | ((" *BASE=/tmp/") (string-append "BASE=" testdir)) | |
51002318 | 279 | |
3064d176 EF |
280 | ;; allow installation of filters from output dir and from |
281 | ;; cups-filters | |
282 | (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter") | |
283 | (string-append | |
284 | "for dir in " | |
285 | (assoc-ref %outputs "out") "/lib/cups/filter " | |
286 | filters "/lib/cups/filter")) | |
51002318 | 287 | |
3064d176 EF |
288 | ;; check for charsets in cups-filters output |
289 | (("/usr/share/cups/charsets") | |
290 | (string-append filters "/share/cups/charsets")) | |
51002318 | 291 | |
3064d176 EF |
292 | ;; install additional required filters |
293 | (("instfilter texttopdf texttopdf pdf") | |
294 | (string-append | |
295 | "instfilter texttopdf texttopdf pdf;" | |
296 | "instfilter imagetoraster imagetoraster raster;" | |
297 | "instfilter gstoraster gstoraster raster;" | |
298 | "instfilter urftopdf urftopdf pdf;" | |
299 | "instfilter rastertopdf rastertopdf pdf;" | |
300 | "instfilter pstopdf pstopdf pdf")) | |
51002318 | 301 | |
3064d176 EF |
302 | ;; specify location of lpstat binary |
303 | (("description=\"`lpstat -l") | |
304 | "description=\"`../systemv/lpstat -l") | |
51002318 | 305 | |
3064d176 EF |
306 | ;; patch shebangs of embedded scripts |
307 | (("#!/bin/sh") (string-append "#!" (which "sh"))) | |
51002318 | 308 | |
3064d176 EF |
309 | ;; also link mime definitions from cups-filters |
310 | ;; to enable the additional filters for the test suite | |
311 | (("ln -s \\$root/conf/mime\\.types") | |
312 | (string-append | |
313 | "ln -s " filters | |
314 | "/share/cups/mime/cupsfilters.types $BASE/share/mime; " | |
315 | "ln -s $root/conf/mime.types")) | |
316 | (("ln -s \\$root/conf/mime\\.convs") | |
317 | (string-append | |
318 | "ln -s " filters | |
319 | "/share/cups/mime/cupsfilters.convs $BASE/share/mime; " | |
320 | "ln -s $root/conf/mime.convs"))) | |
51002318 | 321 | |
3064d176 EF |
322 | ;; fix search path for "cat" |
323 | (substitute* "cups/testfile.c" | |
324 | (("cupsFileFind\\(\"cat\", \"/bin\"") | |
325 | (string-append "cupsFileFind(\"cat\", \"" catpath "\"")) | |
326 | (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"") | |
74c164e0 MW |
327 | (string-append "cupsFileFind(\"cat\", \"" catpath "\""))) |
328 | #t))) | |
29796b3f LF |
329 | ;; Make the compressed manpages writable so that the |
330 | ;; reset-gzip-timestamps phase does not error out. | |
331 | (add-before 'reset-gzip-timestamps 'make-manpages-writable | |
332 | (lambda* (#:key outputs #:allow-other-keys) | |
333 | (let* ((out (assoc-ref outputs "out")) | |
334 | (man (string-append out "/share/man"))) | |
335 | (for-each (lambda (file) (chmod file #o644)) | |
74c164e0 MW |
336 | (find-files man "\\.gz")) |
337 | #t))) | |
3064d176 EF |
338 | (add-after 'install 'install-cups-filters-symlinks |
339 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
340 | (let ((out (assoc-ref outputs "out")) | |
341 | (cups-filters (assoc-ref inputs "cups-filters"))) | |
342 | ;; charsets | |
343 | (symlink | |
344 | (string-append cups-filters "/share/cups/charsets") | |
345 | (string-append out "/share/charsets")) | |
51002318 | 346 | |
3064d176 EF |
347 | ;; mime types, driver file, ppds |
348 | (for-each | |
349 | (lambda (f) | |
350 | (symlink (string-append cups-filters f) | |
351 | (string-append out f))) | |
352 | '("/share/cups/mime/cupsfilters.types" | |
353 | "/share/cups/mime/cupsfilters.convs" | |
354 | "/share/cups/drv/cupsfilters.drv" | |
355 | "/share/ppd")) | |
51002318 | 356 | |
3064d176 EF |
357 | ;; filters |
358 | (for-each | |
359 | (lambda (f) | |
360 | (symlink f | |
361 | (string-append out "/lib/cups/filter" (basename f)))) | |
362 | (find-files (string-append cups-filters "/lib/cups/filter"))) | |
51002318 | 363 | |
3064d176 EF |
364 | ;; backends |
365 | (for-each | |
366 | (lambda (f) | |
367 | (symlink (string-append cups-filters f) | |
368 | (string-append out "/lib/cups/backend/" | |
369 | (basename f)))) | |
370 | '("/lib/cups/backend/parallel" | |
371 | "/lib/cups/backend/serial")) | |
51002318 | 372 | |
3064d176 EF |
373 | ;; banners |
374 | (let ((banners "/share/cups/banners")) | |
375 | (delete-file-recursively (string-append out banners)) | |
376 | (symlink (string-append cups-filters banners) | |
377 | (string-append out banners))) | |
51002318 | 378 | |
3064d176 EF |
379 | ;; assorted data |
380 | (let ((data "/share/cups/data")) | |
381 | (delete-file-recursively (string-append out data)) | |
382 | (symlink (string-append cups-filters data) | |
74c164e0 MW |
383 | (string-append out data))) |
384 | ||
385 | #t)))))) | |
51002318 RW |
386 | (inputs |
387 | `(("avahi" ,avahi) | |
388 | ("gnutls" ,gnutls) | |
389 | ("cups-filters" ,cups-filters) | |
390 | ("zlib" ,zlib))))) | |
2b56dc01 | 391 | |
12255b3d CB |
392 | (define-public cups-pk-helper |
393 | (package | |
394 | (name "cups-pk-helper") | |
395 | (version "0.2.6") | |
396 | (source (origin | |
397 | (method url-fetch) | |
398 | (uri (string-append "https://freedesktop.org/software/" | |
399 | name "/releases/" name "-" version ".tar.xz")) | |
400 | (sha256 | |
401 | (base32 | |
402 | "0a52jw6rm7lr5nbyksiia0rn7sasyb5cjqcb95z1wxm2yprgi6lm")))) | |
403 | (build-system gnu-build-system) | |
404 | (native-inputs | |
405 | `(("intltool" ,intltool) | |
406 | ("pkg-config" ,pkg-config) | |
407 | ("glib" ,glib) | |
408 | ("polkit" ,polkit) | |
409 | ("cups" ,cups))) | |
410 | (home-page "https://www.freedesktop.org/wiki/Software/cups-pk-helper/") | |
411 | (synopsis "PolicyKit helper to configure CUPS with fine-grained privileges") | |
412 | (description | |
413 | "This package provides the org.opensuse.CupsPkHelper.Mechanism DBus | |
414 | system service which uses @file{cups-pk-helper-mechanism}. This package | |
415 | should only be used as part of the Guix cups-pk-helper service.") | |
416 | (license license:gpl2+))) | |
417 | ||
2b56dc01 DM |
418 | (define-public hplip |
419 | (package | |
420 | (name "hplip") | |
b17004f9 | 421 | (version "3.18.9") |
2b56dc01 DM |
422 | (source (origin |
423 | (method url-fetch) | |
de67e922 LF |
424 | (uri (string-append "mirror://sourceforge/hplip/hplip/" version |
425 | "/hplip-" version ".tar.gz")) | |
2b56dc01 DM |
426 | (sha256 |
427 | (base32 | |
b17004f9 | 428 | "0g3q5mm2crjyc1z4z6gv4lam6sc5d3diz704djrnpqadk4q3h290")) |
86c979b7 | 429 | (modules '((guix build utils))) |
b44b1f08 | 430 | (patches (search-patches "hplip-remove-imageprocessor.patch")) |
86c979b7 | 431 | (snippet |
6cbee49d | 432 | '(begin |
7a7d5f66 LC |
433 | ;; Delete non-free blobs: .so files, pre-compiled |
434 | ;; 'locatedriver' executable, etc. | |
435 | (for-each delete-file | |
436 | (find-files "." | |
437 | (lambda (file stat) | |
438 | (elf-file? file)))) | |
b44b1f08 | 439 | (delete-file "prnt/hpcups/ImageProcessor.h") |
ea843715 | 440 | |
b44b1f08 | 441 | ;; Fix type mismatch. |
6cbee49d MW |
442 | (substitute* "prnt/hpcups/genPCLm.cpp" |
443 | (("boolean") "bool")) | |
ea843715 LC |
444 | |
445 | ;; Install binaries under libexec/hplip instead of | |
446 | ;; share/hplip; that'll at least ensure they get stripped. | |
447 | ;; It's not even clear that they're of any use though... | |
448 | (substitute* "Makefile.in" | |
449 | (("^dat2drvdir =.*") | |
450 | "dat2drvdir = $(pkglibexecdir)\n") | |
451 | (("^locatedriverdir =.*") | |
452 | "locatedriverdir = $(pkglibexecdir)\n")) | |
6cbee49d | 453 | #t)))) |
2b56dc01 | 454 | (build-system gnu-build-system) |
21c51ebd | 455 | (home-page "https://developers.hp.com/hp-linux-imaging-and-printing") |
6a163a3f TGR |
456 | (synopsis "HP printer drivers") |
457 | (description | |
458 | "Hewlett-Packard printer drivers and PostScript Printer Descriptions | |
459 | (@dfn{PPD}s).") | |
2b56dc01 DM |
460 | |
461 | ;; The 'COPYING' file lists directories where each of these 3 licenses | |
462 | ;; applies. | |
463 | (license (list license:gpl2+ license:bsd-3 license:expat)) | |
464 | ||
465 | ;; TODO install apparmor profile files eventually. | |
466 | (arguments | |
467 | `(#:configure-flags | |
468 | `("--disable-network-build" | |
469 | ,(string-append "--prefix=" (assoc-ref %outputs "out")) | |
470 | ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc") | |
b17004f9 TGR |
471 | ,(string-append "LDFLAGS=-Wl,-rpath=" |
472 | (assoc-ref %outputs "out") "/lib") | |
2b56dc01 DM |
473 | ;; Disable until mime.types merging works (FIXME). |
474 | "--disable-fax-build" | |
475 | "--enable-hpcups-install" | |
476 | "--enable-new-hpcups" | |
477 | "--enable-cups_ppd_install" | |
478 | "--enable-cups_drv_install" | |
479 | ;; TODO add foomatic drv install eventually. | |
480 | ;; TODO --enable-policykit eventually. | |
481 | ,(string-append "--with-cupsfilterdir=" | |
482 | (assoc-ref %outputs "out") "/lib/cups/filter") | |
483 | ,(string-append "--with-cupsbackenddir=" | |
484 | (assoc-ref %outputs "out") "/lib/cups/backend") | |
485 | ,(string-append "--with-icondir=" | |
486 | (assoc-ref %outputs "out") "/share/applications") | |
487 | ,(string-append "--with-systraydir=" | |
407ef4b3 TGR |
488 | (assoc-ref %outputs "out") "/etc/xdg") |
489 | "--enable-qt5" "--disable-qt4") | |
2b56dc01 DM |
490 | |
491 | #:imported-modules ((guix build python-build-system) | |
492 | ,@%gnu-build-system-modules) | |
493 | #:modules ((guix build gnu-build-system) | |
494 | (guix build utils) | |
495 | ((guix build python-build-system) #:prefix python:)) | |
496 | ||
497 | #:phases (modify-phases %standard-phases | |
498 | (add-after 'unpack 'fix-hard-coded-file-names | |
499 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
500 | (let ((out (assoc-ref outputs "out")) | |
501 | ;; FIXME: use merged ppds (I think actually only | |
502 | ;; drvs need to be merged). | |
503 | (cupsdir (assoc-ref inputs "cups-minimal"))) | |
504 | (substitute* "base/g.py" | |
505 | (("'/usr/share;[^']*'") | |
506 | (string-append "'" cupsdir "/share'")) | |
507 | (("'/etc/hp/hplip.conf'") | |
508 | (string-append "'" out | |
509 | "/etc/hp/hplip.conf" "'"))) | |
510 | ||
511 | (substitute* "Makefile.in" | |
512 | (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ") | |
513 | ;; FIXME Use beginning-of-word in regexp. | |
514 | (("[[:blank:]]plugin\\.py[[:blank:]]") " ") | |
515 | (("/usr/include/libusb-1.0") | |
516 | (string-append (assoc-ref inputs "libusb") | |
517 | "/include/libusb-1.0")) | |
86c979b7 LC |
518 | (("hplip_statedir =.*$") |
519 | ;; Don't bail out while trying to create | |
520 | ;; /var/lib/hplip. We can safely change its value | |
521 | ;; here because it's hard-coded in the code anyway. | |
522 | "hplip_statedir = $(prefix)\n") | |
2b56dc01 DM |
523 | (("hplip_confdir = /etc/hp") |
524 | ;; This is only used for installing the default config. | |
525 | (string-append "hplip_confdir = " out | |
526 | "/etc/hp")) | |
527 | (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor") | |
407ef4b3 | 528 | ;; We don't use hal. |
2b56dc01 DM |
529 | (string-append "halpredir = " out |
530 | "/share/hal/fdi/preprobe/10osvendor")) | |
531 | (("rulesdir = /etc/udev/rules.d") | |
532 | ;; udev rules will be merged by base service. | |
533 | (string-append "rulesdir = " out | |
534 | "/lib/udev/rules.d")) | |
535 | (("rulessystemdir = /usr/lib/systemd/system") | |
536 | ;; We don't use systemd. | |
537 | (string-append "rulessystemdir = " out | |
538 | "/lib/systemd/system")) | |
539 | (("/etc/sane.d") | |
540 | (string-append out "/etc/sane.d")))))) | |
541 | ||
407ef4b3 | 542 | ;; Wrap bin/* so that the Python libraries are found. |
2b56dc01 DM |
543 | (add-after 'install 'wrap-binaries |
544 | (assoc-ref python:%standard-phases 'wrap))))) | |
545 | ||
407ef4b3 TGR |
546 | ;; Note that the error messages printed by the tools in the case of |
547 | ;; missing dependencies are often downright misleading. | |
548 | ;; TODO: hp-toolbox still fails to start with: | |
549 | ;; from dbus.mainloop.pyqt5 import DBusQtMainLoop | |
550 | ;; ModuleNotFoundError: No module named 'dbus.mainloop.pyqt5' | |
551 | (inputs | |
552 | `(("cups-minimal" ,cups-minimal) | |
553 | ("dbus" ,dbus) | |
554 | ("libjpeg" ,libjpeg) | |
555 | ("libusb" ,libusb) | |
556 | ("python" ,python) | |
557 | ("python-dbus" ,python-dbus) | |
558 | ("python-pygobject" ,python-pygobject) | |
559 | ("python-pyqt" ,python-pyqt) | |
560 | ("python-wrapper" ,python-wrapper) | |
561 | ("sane-backends" ,sane-backends-minimal) | |
562 | ("zlib" ,zlib))) | |
563 | (native-inputs | |
564 | `(("perl" ,perl) | |
565 | ("pkg-config" ,pkg-config))))) | |
d02aabaf | 566 | |
8e189596 EF |
567 | (define-public hplip-minimal |
568 | (package | |
569 | (inherit hplip) | |
570 | (name "hplip-minimal") | |
571 | (arguments | |
572 | (substitute-keyword-arguments (package-arguments hplip) | |
573 | ((#:configure-flags cf) | |
c9b3a72b LC |
574 | ;; Produce a "light build", meaning that only the printer (CUPS) and |
575 | ;; scanner (SANE) support gets built, without all the 'hp-*' | |
576 | ;; command-line tools. | |
577 | `(cons "--enable-lite-build" | |
578 | (delete "--enable-qt5" ,cf))) | |
579 | ((#:phases phases) | |
580 | ;; The 'wrap-binaries' is not needed here since the 'hp-*' programs | |
581 | ;; are not installed. | |
582 | `(alist-delete 'wrap-binaries ,phases)))) | |
583 | (inputs (remove (match-lambda | |
584 | ((label . _) | |
585 | (string-prefix? "python" label))) | |
586 | (package-inputs hplip))) | |
8e189596 EF |
587 | (synopsis "GUI-less version of hplip"))) |
588 | ||
d02aabaf LC |
589 | (define-public foomatic-filters |
590 | (package | |
591 | (name "foomatic-filters") | |
4bd05a21 | 592 | (version "4.0.17") |
d02aabaf LC |
593 | (source (origin |
594 | (method url-fetch) | |
595 | (uri (string-append | |
596 | "http://www.openprinting.org/download/foomatic/" | |
597 | name "-" version ".tar.gz")) | |
598 | (sha256 | |
599 | (base32 | |
4bd05a21 | 600 | "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2")) |
d02aabaf LC |
601 | (patches |
602 | (search-patches "foomatic-filters-CVE-2015-8327.patch" | |
603 | "foomatic-filters-CVE-2015-8560.patch")))) | |
604 | (build-system gnu-build-system) | |
605 | (home-page | |
606 | "https://wiki.linuxfoundation.org/openprinting/database/foomatic") | |
607 | (native-inputs | |
608 | `(("perl" ,perl) | |
609 | ("pkg-config" ,pkg-config))) | |
610 | (inputs | |
611 | `(("dbus" ,dbus) | |
612 | ("a2ps" ,a2ps))) | |
613 | (arguments | |
614 | '( ;; Specify the installation directories. | |
615 | #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS=" | |
616 | (assoc-ref %outputs "out") | |
617 | "/lib/cups/backend") | |
618 | (string-append "ac_cv_path_CUPS_FILTERS=" | |
619 | (assoc-ref %outputs "out") | |
620 | "/lib/cups/filter") | |
621 | (string-append "ac_cv_path_PPR_INTERFACES=" | |
622 | (assoc-ref %outputs "out") | |
623 | "/lib/ppr/interfaces") | |
624 | (string-append "ac_cv_path_PPR_LIB=" | |
625 | (assoc-ref %outputs "out") | |
626 | "/lib/ppr/lib") | |
627 | ||
628 | ;; For some reason these are misdiagnosed. | |
629 | "ac_cv_func_malloc_0_nonnull=yes" | |
630 | "ac_cv_func_realloc_0_nonnull=yes") | |
631 | #:test-target "tests")) | |
632 | (synopsis "Convert PostScript to the printer's native format") | |
633 | (description | |
634 | "This package contains filter scripts used by the printer spoolers to | |
635 | convert the incoming PostScript data into the printer's native format using a | |
636 | printer/driver specific, but spooler-independent PPD file.") | |
637 | (license license:gpl2+))) | |
5db0a1cd LC |
638 | |
639 | (define-public foo2zjs | |
640 | (package | |
5db0a1cd | 641 | (name "foo2zjs") |
f465562b | 642 | (version "20190413") |
5db0a1cd LC |
643 | (source (origin |
644 | (method url-fetch) | |
645 | ;; XXX: This is an unversioned URL! | |
646 | (uri "http://foo2zjs.rkkda.com/foo2zjs.tar.gz") | |
647 | (sha256 | |
648 | (base32 | |
8df90c1b | 649 | "0djzp3ddslmzyxkjhzkhkg6qqqm02whjfnfvh5glprkshcskzlg9")))) |
5db0a1cd LC |
650 | (build-system gnu-build-system) |
651 | (arguments | |
652 | '(#:phases (modify-phases %standard-phases | |
653 | (replace 'configure | |
654 | (lambda* (#:key outputs #:allow-other-keys) | |
655 | (substitute* (find-files "." "^Makefile$") | |
656 | ;; Set the installation directory. | |
657 | (("^PREFIX[[:blank:]]*=.*$") | |
658 | (string-append "PREFIX = " | |
659 | (assoc-ref outputs "out") | |
660 | "\n")) | |
661 | (("^UDEVBIN[[:blank:]]*=.*$") | |
662 | "UDEVBIN = $(PREFIX)/bin\n") | |
663 | ;; Don't try to chown/chgrp the installed files. | |
664 | (("-oroot") | |
665 | "") | |
666 | (("-glp") | |
667 | "") | |
668 | ;; Placate the dependency checks. | |
669 | (("/usr/include/stdio.h") | |
670 | "/etc/passwd") | |
671 | (("/usr/") | |
672 | "$(PREFIX)/") | |
673 | ;; Ensure fixed timestamps in man pages. | |
674 | (("^MODTIME[[:blank:]]*=.*$") | |
675 | "MODTIME = echo Thu Jan 01 01:00:00 1970\n")) | |
676 | #t)) | |
677 | (add-after 'install 'remove-pdf | |
678 | (lambda* (#:key outputs #:allow-other-keys) | |
679 | ;; Remove 'manual.pdf' which is (1) useless (it's a | |
680 | ;; concatenation of man pages), and (2) not | |
681 | ;; bit-reproducible due to <https://bugs.gnu.org/27593>. | |
682 | (let ((out (assoc-ref outputs "out"))) | |
683 | (for-each delete-file | |
684 | (find-files out "^manual\\.pdf$")) | |
685 | #t)))) | |
686 | #:parallel-build? #f ;broken makefile | |
687 | #:tests? #f ;no tests | |
688 | #:make-flags '("CC=gcc"))) | |
689 | (inputs | |
690 | `(("ghostscript" ,ghostscript) | |
691 | ("foomatic-filters" ,foomatic-filters))) ;for 'foomatic-rip' | |
692 | (native-inputs | |
693 | `(("bc" ,bc) | |
694 | ("groff" ,groff))) | |
0a7d3e1e TGR |
695 | (home-page "http://foo2zjs.rkkda.com/") |
696 | (synopsis "Printer driver for ZjStream-based printers") | |
5db0a1cd | 697 | (description |
0a7d3e1e TGR |
698 | "foo2zjs is a printer driver for printers that use the Zenographics |
699 | ZjStream wire protocol for their print data, often erroneously referred to as | |
700 | winprinters or GDI printers. | |
701 | ||
702 | It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro, | |
703 | HP@tie{}LaserJet, and possibly other printers. See @file{README} for details.") | |
704 | (license (list license:expat ; icc2ps/*.[ch] | |
705 | license:gpl2+)))) ; everything else | |
011f5769 DNB |
706 | |
707 | (define-public escpr | |
708 | (package | |
709 | (name "escpr") | |
ff30bb01 | 710 | (version "1.6.30") |
011f5769 DNB |
711 | ;; XXX: This currently works. But it will break as soon as a newer |
712 | ;; version is available since the URLs for older versions are not | |
713 | ;; preserved. An alternative source will be added as soon as | |
714 | ;; available. | |
715 | (source (origin | |
716 | (method url-fetch) | |
717 | ;; The uri has to be chopped up in order to satisfy guix lint. | |
ff30bb01 DNB |
718 | (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/08/18/20/" |
719 | "e94de600e28e510c1cfa158929d8b2c0aadc8aa0/" | |
720 | "epson-inkjet-printer-escpr-1.6.30-1lsb3.2.tar.gz")) | |
011f5769 DNB |
721 | (sha256 |
722 | (base32 | |
ff30bb01 | 723 | "0m8pyfkixisp0vclwxj340isn15zzisal0v2xvv66kxfd68dzf12")))) |
011f5769 DNB |
724 | (build-system gnu-build-system) |
725 | (arguments | |
726 | `(#:configure-flags | |
727 | `(,(string-append "--prefix=" | |
728 | (assoc-ref %outputs "out")) | |
729 | ,(string-append "--with-cupsfilterdir=" | |
730 | (assoc-ref %outputs "out") "/lib/cups/filter") | |
731 | ,(string-append "--with-cupsppddir=" | |
732 | (assoc-ref %outputs "out") "/share/ppd")))) | |
733 | (inputs `(("cups" ,cups-minimal))) | |
734 | (synopsis "ESC/P-R printer driver") | |
735 | (description | |
736 | "This package provides a filter for the Common UNIX Printing | |
737 | System (CUPS). It offers high-quality printing with Seiko Epson color ink jet | |
738 | printers. It can only be used with printers that support the Epson ESC/P-R | |
739 | language.") | |
740 | (home-page "http://download.ebz.epson.net/dsc/search/01/search") | |
741 | (license license:gpl2+))) | |
dd6f309d CB |
742 | |
743 | (define-public python-pycups | |
744 | (package | |
745 | (name "python-pycups") | |
746 | (version "1.9.74") | |
747 | (source | |
748 | (origin | |
749 | (method url-fetch) | |
750 | (uri (pypi-uri "pycups" version ".tar.bz2")) | |
751 | (sha256 | |
752 | (base32 | |
753 | "1ffp7sswhdsfpy88zg0cc8kl04wygkjs01rlm9f0spbwk8jhy2c6")))) | |
754 | (build-system python-build-system) | |
755 | (arguments | |
756 | '(;; Tests require CUPS to be running | |
757 | #:tests? #f)) | |
758 | (inputs | |
759 | `(("cups" ,cups))) | |
760 | (home-page "https://github.com/zdohnal/pycups") | |
761 | (synopsis "Python bindings for libcups") | |
762 | (description | |
763 | "This package provides Python bindings for libcups, wrapping the CUPS | |
764 | API.") | |
765 | (license license:gpl2+))) |