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