1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
6 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
7 ;;; Copyright © 2017 Mark H Weaver <mhw@netris.org>
8 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages cups)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages algebra)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages avahi)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages fonts) ; font-dejavu
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages ghostscript)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages groff)
38 #:use-module (gnu packages image)
39 #:use-module (gnu packages libusb)
40 #:use-module (gnu packages pdf)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages polkit)
44 #:use-module (gnu packages pretty-print)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages python-xyz)
47 #:use-module (gnu packages qt)
48 #:use-module (gnu packages scanner)
49 #:use-module (gnu packages tls)
50 #:use-module (guix build-system cmake)
51 #:use-module (guix build-system gnu)
52 #:use-module (guix build-system python)
53 #:use-module (guix download)
54 #:use-module (guix git-download)
55 #:use-module ((guix licenses) #:prefix license:)
56 #:use-module (guix packages)
57 #:use-module (guix utils)
58 #:use-module (srfi srfi-1)
59 #:use-module (ice-9 match))
61 (define-public brlaser
62 (let ((commit "9d7ddda8383bfc4d205b5e1b49de2b8bcd9137f1")
66 (version (git-version "6" revision commit))
70 (url "https://github.com/pdewacht/brlaser")
72 (file-name (git-file-name name version))
75 "1drh0nk7amn9a8wykki4l9maqa4vy7vwminypfy1712alwj31nd4"))))
76 (build-system cmake-build-system)
79 (list (string-append "-DCUPS_DATA_DIR="
80 (assoc-ref %outputs "out")
82 (string-append "-DCUPS_SERVER_BIN="
83 (assoc-ref %outputs "out")
86 `(("ghostscript" ,ghostscript)
89 (home-page "https://github.com/pdewacht/brlaser")
90 (synopsis "Brother laser printer driver")
91 (description "Brlaser is a CUPS driver for Brother laser printers. This
92 driver is known to work with these printers:
95 @item Brother DCP-1510 series
96 @item Brother DCP-1600 series
97 @item Brother DCP-7030
98 @item Brother DCP-7040
99 @item Brother DCP-7055
100 @item Brother DCP-7055W
101 @item Brother DCP-7060D
102 @item Brother DCP-7065DN
103 @item Brother DCP-7080
104 @item Brother DCP-L2500D series
105 @item Brother DCP-L2520D series
106 @item Brother DCP-L2540DW series
107 @item Brother HL-1110 series
108 @item Brother HL-1200 series
109 @item Brother HL-2030 series
110 @item Brother HL-2140 series
111 @item Brother HL-2220 series
112 @item Brother HL-2270DW series
113 @item Brother HL-5030 series
114 @item Brother HL-L2300D series
115 @item Brother HL-L2320D series
116 @item Brother HL-L2340D series
117 @item Brother HL-L2360D series
118 @item Brother MFC-1910W
119 @item Brother MFC-7240
120 @item Brother MFC-7360N
121 @item Brother MFC-7365DN
122 @item Brother MFC-7840W
123 @item Brother MFC-L2710DW series
126 (license license:gpl2+))))
128 (define-public cups-filters
130 (name "cups-filters")
135 (string-append "https://openprinting.org/download/cups-filters/"
136 "cups-filters-" version ".tar.xz"))
139 "110b1xhb5vfpcx0zq9kkas7pj281skx5dpnnr22idx509jfdzj8b"))
140 (modules '((guix build utils)))
142 ;; install backends, banners and filters to cups-filters output
143 ;; directory, not the cups server directory
145 (substitute* "Makefile.in"
146 (("CUPS_DATADIR = @CUPS_DATADIR@")
147 "CUPS_DATADIR = $(PREFIX)/share/cups")
148 (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)")
149 "pkgcupsserverrootdir = $(PREFIX)")
150 ;; Choose standard directories notably so that binaries are
152 (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend")
153 "pkgbackenddir = $(PREFIX)/lib/cups/backend")
154 (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter")
155 "pkgfilterdir = $(PREFIX)/lib/cups/filter"))
156 ;; Find bannertopdf data such as the print test page in our
157 ;; output directory, not CUPS's prefix.
158 (substitute* "configure"
159 (("\\{CUPS_DATADIR\\}/data")
160 "{prefix}/share/cups/data"))
162 (build-system gnu-build-system)
164 `(#:make-flags (list (string-append "PREFIX=" %output))
166 `("--disable-driverless" ; TODO: enable this
167 "--disable-mutool" ; depends on yet another PDF library (mupdf)
169 ;; Look for the "domain socket of CUPS" in /var/run/cups.
170 "--localstatedir=/var"
172 ;; Free software for the win.
173 "--with-acroread-path=evince"
175 ,(string-append "--with-test-font-path="
176 (assoc-ref %build-inputs "font-dejavu")
177 "/share/fonts/truetype/DejaVuSans.ttf")
178 ,(string-append "--with-gs-path="
179 (assoc-ref %build-inputs "ghostscript")
181 ,(string-append "--with-shell="
182 (assoc-ref %build-inputs "bash")
184 ,(string-append "--with-rcdir="
185 (assoc-ref %outputs "out") "/etc/rc.d"))
187 #:phases (modify-phases %standard-phases
188 (add-after 'unpack 'patch-foomatic-hardcoded-file-names
189 (lambda* (#:key inputs outputs #:allow-other-keys)
190 ;; Foomatic has hardcoded file names we need to fix.
191 (let ((out (assoc-ref outputs "out"))
192 (gs (assoc-ref inputs "ghostscript")))
193 (substitute* "filter/foomatic-rip/foomaticrip.c"
194 (("/usr/local/lib/cups/filter")
195 (string-append out "/lib/cups/filter")))
197 (add-after 'install 'wrap-filters
198 (lambda* (#:key inputs outputs #:allow-other-keys)
199 ;; Some filters expect to find 'gs' in $PATH. We cannot
200 ;; just hard-code its absolute file name in the source
201 ;; because foomatic-rip, for example, has tests like
202 ;; 'startswith(cmd, "gs")'.
203 (let ((out (assoc-ref outputs "out"))
204 (ghostscript (assoc-ref inputs "ghostscript")))
205 (for-each (lambda (file)
208 (,(string-append ghostscript
210 (find-files (string-append
211 out "/lib/cups/filter")))
214 `(("glib" ,glib "bin") ; for gdbus-codegen
215 ("pkg-config" ,pkg-config)))
218 ("fontconfig" ,fontconfig)
219 ("freetype" ,freetype)
220 ("font-dejavu" ,font-dejavu) ; also needed by test suite
221 ("ghostscript" ,ghostscript/cups)
225 ("libjpeg" ,libjpeg-turbo)
231 ("cups-minimal" ,cups-minimal)))
232 (home-page "https://wiki.linuxfoundation.org/openprinting/cups-filters")
233 (synopsis "OpenPrinting CUPS filters and backends")
235 "Contains backends, filters, and other software that was once part of the
236 core CUPS distribution but is no longer maintained by Apple Inc. In addition
237 it contains additional filters developed independently of Apple, especially
238 filters for the PDF-centric printing workflow introduced by OpenPrinting.")
239 ;; Different filters and backends have different licenses; see COPYING for
241 (license (list license:gpl2
248 ;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also
249 ;; depends on CUPS libraries and binaries, cups-minimal has been added to
250 ;; satisfy this dependency.
251 (define-public cups-minimal
253 (name "cups-minimal")
258 (uri (string-append "https://github.com/apple/cups/releases/download/v"
259 version "/cups-" version "-source.tar.gz"))
262 "1vpk0b2vq830f8fvf9z8qjsm5k141i7pi8djbinpnr78pi4dj7r6"))))
263 (build-system gnu-build-system)
266 '("--disable-launchd"
270 ;; Seven tests fail, mostly because of files that are provided by the
271 ;; cups-filters package.
274 (modify-phases %standard-phases
275 (add-before 'configure 'patch-makedefs
277 (substitute* "Makedefs.in"
278 (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
279 (("/bin/sh") (which "sh")))
281 ;; Make the compressed manpages writable so that the
282 ;; reset-gzip-timestamps phase does not error out.
283 (add-before 'reset-gzip-timestamps 'make-manpages-writable
284 (lambda* (#:key outputs #:allow-other-keys)
285 (let* ((out (assoc-ref outputs "out"))
286 (man (string-append out "/share/man")))
287 (for-each (lambda (file) (chmod file #o644))
288 (find-files man "\\.gz"))
290 (add-before 'build 'patch-tests
292 (substitute* "tools/ippeveprinter.c"
293 (("# else /\\* HAVE_AVAHI \\*/")
294 "#elif defined(HAVE_AVAHI)"))
297 `(("pkg-config" ,pkg-config)))
301 (home-page "https://www.cups.org")
302 (synopsis "The Common Unix Printing System")
304 "CUPS is a printing system that uses the Internet Printing Protocol
305 (@dfn{IPP}). It provides System V and BSD command-line interfaces, as well
306 as a Web interface and a C programming interface to manage printers and print
307 jobs. It supports printing to both local (parallel, serial, USB) and
308 networked printers, and printers can be shared from one computer to another.
309 Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to
310 describe printer capabilities and features, and a wide variety of generic and
311 device-specific programs to convert and print many types of files.")
312 ;; CUPS is Apache 2.0 with exceptions, see the NOTICE file.
313 (license license:asl2.0)))
316 (package/inherit cups-minimal
319 `(;; Three tests fail:
320 ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
321 ;; Get-Jobs Operation"
322 ;; * test of number of error/warning messages, probably related to a
326 '("--disable-launchd"
329 (modify-phases %standard-phases
330 (add-before 'configure 'patch-makedefs
332 (substitute* "Makedefs.in"
333 (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
334 (("/bin/sh") (which "sh")))
336 (add-before 'check 'patch-tests
338 (let ((filters (assoc-ref %build-inputs "cups-filters"))
339 (catpath (string-append
340 (assoc-ref %build-inputs "coreutils") "/bin/"))
341 (testdir (string-append (getcwd) "/tmp/")))
343 (substitute* "test/run-stp-tests.sh"
344 ((" *BASE=/tmp/") (string-append "BASE=" testdir))
346 ;; allow installation of filters from output dir and from
348 (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
351 (assoc-ref %outputs "out") "/lib/cups/filter "
352 filters "/lib/cups/filter"))
354 ;; check for charsets in cups-filters output
355 (("/usr/share/cups/charsets")
356 (string-append filters "/share/cups/charsets"))
358 ;; install additional required filters
359 (("instfilter texttopdf texttopdf pdf")
361 "instfilter texttopdf texttopdf pdf;"
362 "instfilter imagetoraster imagetoraster raster;"
363 "instfilter gstoraster gstoraster raster;"
364 "instfilter urftopdf urftopdf pdf;"
365 "instfilter rastertopdf rastertopdf pdf;"
366 "instfilter pstopdf pstopdf pdf"))
368 ;; specify location of lpstat binary
369 (("description=\"`lpstat -l")
370 "description=\"`../systemv/lpstat -l")
372 ;; patch shebangs of embedded scripts
373 (("#!/bin/sh") (string-append "#!" (which "sh")))
375 ;; also link mime definitions from cups-filters
376 ;; to enable the additional filters for the test suite
377 (("ln -s \\$root/conf/mime\\.types")
380 "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
381 "ln -s $root/conf/mime.types"))
382 (("ln -s \\$root/conf/mime\\.convs")
385 "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
386 "ln -s $root/conf/mime.convs")))
388 ;; fix search path for "cat"
389 (substitute* "cups/testfile.c"
390 (("cupsFileFind\\(\"cat\", \"/bin\"")
391 (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
392 (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
393 (string-append "cupsFileFind(\"cat\", \"" catpath "\"")))
395 ;; Make the compressed manpages writable so that the
396 ;; reset-gzip-timestamps phase does not error out.
397 (add-before 'reset-gzip-timestamps 'make-manpages-writable
398 (lambda* (#:key outputs #:allow-other-keys)
399 (let* ((out (assoc-ref outputs "out"))
400 (man (string-append out "/share/man")))
401 (for-each (lambda (file) (chmod file #o644))
402 (find-files man "\\.gz"))
404 (add-after 'install 'install-cups-filters-symlinks
405 (lambda* (#:key inputs outputs #:allow-other-keys)
406 (let ((out (assoc-ref outputs "out"))
407 (cups-filters (assoc-ref inputs "cups-filters")))
410 (string-append cups-filters "/share/cups/charsets")
411 (string-append out "/share/charsets"))
413 ;; mime types, driver file, ppds
416 (symlink (string-append cups-filters f)
417 (string-append out f)))
418 '("/share/cups/mime/cupsfilters.types"
419 "/share/cups/mime/cupsfilters.convs"
420 "/share/cups/drv/cupsfilters.drv"
427 (string-append out "/lib/cups/filter" (basename f))))
428 (find-files (string-append cups-filters "/lib/cups/filter")))
433 (symlink (string-append cups-filters f)
434 (string-append out "/lib/cups/backend/"
436 '("/lib/cups/backend/parallel"
437 "/lib/cups/backend/serial"))
440 (let ((banners "/share/cups/banners"))
441 (delete-file-recursively (string-append out banners))
442 (symlink (string-append cups-filters banners)
443 (string-append out banners)))
446 (let ((data "/share/cups/data"))
447 (delete-file-recursively (string-append out data))
448 (symlink (string-append cups-filters data)
449 (string-append out data)))
455 ("cups-filters" ,cups-filters)
458 (define-public cups-pk-helper
460 (name "cups-pk-helper")
464 (uri (string-append "https://freedesktop.org/software/"
465 name "/releases/" name "-" version ".tar.xz"))
468 "0a52jw6rm7lr5nbyksiia0rn7sasyb5cjqcb95z1wxm2yprgi6lm"))))
469 (build-system gnu-build-system)
471 `(("intltool" ,intltool)
472 ("pkg-config" ,pkg-config)
476 (home-page "https://www.freedesktop.org/wiki/Software/cups-pk-helper/")
477 (synopsis "PolicyKit helper to configure CUPS with fine-grained privileges")
479 "This package provides the org.opensuse.CupsPkHelper.Mechanism DBus
480 system service which uses @file{cups-pk-helper-mechanism}. This package
481 should only be used as part of the Guix cups-pk-helper service.")
482 (license license:gpl2+)))
490 (uri (string-append "mirror://sourceforge/hplip/hplip/" version
491 "/hplip-" version ".tar.gz"))
494 "0hbwx9d4c8177vi0gavz9pxi7rc97jciacndp90ms8327shj2121"))
495 (modules '((guix build utils)))
496 (patches (search-patches "hplip-remove-imageprocessor.patch"))
499 ;; Delete non-free blobs: .so files, pre-compiled
500 ;; 'locatedriver' executable, etc.
501 (for-each delete-file
505 (delete-file "prnt/hpcups/ImageProcessor.h")
507 ;; Install binaries under libexec/hplip instead of
508 ;; share/hplip; that'll at least ensure they get stripped.
509 ;; It's not even clear that they're of any use though...
510 (substitute* "Makefile.in"
512 "dat2drvdir = $(pkglibexecdir)\n")
513 (("^locatedriverdir =.*")
514 "locatedriverdir = $(pkglibexecdir)\n"))
516 (build-system gnu-build-system)
517 (outputs (list "out" "ppd"))
518 (home-page "https://developers.hp.com/hp-linux-imaging-and-printing")
519 (synopsis "HP printer drivers")
521 "Hewlett-Packard printer drivers and PostScript Printer Descriptions
524 ;; The 'COPYING' file lists directories where each of these 3 licenses
526 (license (list license:gpl2+ license:bsd-3 license:expat))
528 ;; TODO install apparmor profile files eventually.
531 `("--disable-network-build"
532 ,(string-append "--prefix=" (assoc-ref %outputs "out"))
533 ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
534 ,(string-append "LDFLAGS=-Wl,-rpath="
535 (assoc-ref %outputs "out") "/lib")
536 ;; Disable until mime.types merging works (FIXME).
537 "--disable-fax-build"
538 "--enable-new-hpcups"
539 ;; TODO add foomatic drv install eventually.
540 ;; TODO --enable-policykit eventually.
541 ,(string-append "--with-cupsfilterdir="
542 (assoc-ref %outputs "out") "/lib/cups/filter")
543 ,(string-append "--with-cupsbackenddir="
544 (assoc-ref %outputs "out") "/lib/cups/backend")
545 ,(string-append "--with-hpppddir="
546 (assoc-ref %outputs "ppd") "/share/ppd/HP")
547 ,(string-append "--with-icondir="
548 (assoc-ref %outputs "out") "/share/applications")
549 ,(string-append "--with-systraydir="
550 (assoc-ref %outputs "out") "/etc/xdg")
551 "--enable-qt5" "--disable-qt4")
553 #:imported-modules ((guix build python-build-system)
554 ,@%gnu-build-system-modules)
555 #:modules ((guix build gnu-build-system)
557 ((guix build python-build-system) #:prefix python:))
560 (modify-phases %standard-phases
561 (add-after 'unpack 'fix-hard-coded-file-names
562 (lambda* (#:key inputs outputs #:allow-other-keys)
563 (let ((out (assoc-ref outputs "out"))
564 ;; FIXME: use merged ppds (I think actually only
565 ;; drvs need to be merged).
566 (cupsdir (assoc-ref inputs "cups-minimal")))
567 (substitute* "base/g.py"
568 (("'/usr/share;[^']*'")
569 (string-append "'" cupsdir "/share'"))
570 (("'/etc/hp/hplip.conf'")
571 (string-append "'" out
572 "/etc/hp/hplip.conf" "'")))
574 (substitute* "Makefile.in"
575 (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
576 ;; FIXME Use beginning-of-word in regexp.
577 (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
578 (("/usr/include/libusb-1.0")
579 (string-append (assoc-ref inputs "libusb")
580 "/include/libusb-1.0"))
581 (("hplip_statedir =.*$")
582 ;; Don't bail out while trying to create
583 ;; /var/lib/hplip. We can safely change its value
584 ;; here because it's hard-coded in the code anyway.
585 "hplip_statedir = $(prefix)\n")
586 (("hplip_confdir = /etc/hp")
587 ;; This is only used for installing the default config.
588 (string-append "hplip_confdir = " out
590 (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
592 (string-append "halpredir = " out
593 "/share/hal/fdi/preprobe/10osvendor"))
594 (("rulesdir = /etc/udev/rules.d")
595 ;; udev rules will be merged by base service.
596 (string-append "rulesdir = " out
597 "/lib/udev/rules.d"))
598 (("rulessystemdir = /usr/lib/systemd/system")
599 ;; We don't use systemd.
600 (string-append "rulessystemdir = " out
601 "/lib/systemd/system"))
603 (string-append out "/etc/sane.d")))
605 (add-before 'configure 'fix-build-with-python-3.8
606 (lambda* (#:key inputs #:allow-other-keys)
607 (let ((python (assoc-ref inputs "python")))
608 ;; XXX: The configure script looks for Python headers in the
609 ;; wrong places as of version 3.20.3. Help it by adding the
610 ;; include directory on C_INCLUDE_PATH.
612 (setenv "C_INCLUDE_PATH"
613 (string-append python "/include/python"
614 (python:python-version python)
615 ":" (getenv "C_INCLUDE_PATH"))))
617 (add-after 'install 'install-models-dat
618 (lambda* (#:key outputs #:allow-other-keys)
619 (let* ((out (assoc-ref outputs "out"))
620 (models-dir (string-append out
621 "/share/hplip/data/models")))
622 (install-file "data/models/models.dat" models-dir))
624 (add-after 'install 'wrap-binaries
625 ;; Scripts in /bin are all symlinks to .py files in /share/hplip.
626 ;; Symlinks are immune to the Python build system's 'WRAP phase,
627 ;; and the .py files can't be wrapped because they are reused as
628 ;; modules. Replacing the symlinks in /bin with copies and
629 ;; wrapping them also doesn't work (“ModuleNotFoundError:
630 ;; No module named 'base'”). Behold: a custom WRAP-PROGRAM.
631 (lambda* (#:key inputs outputs #:allow-other-keys)
632 (let* ((out (assoc-ref outputs "out"))
633 (bin (string-append out "/bin"))
634 (python (assoc-ref inputs "python")))
635 (with-directory-excursion bin
636 (for-each (lambda (file)
637 (let ((target (readlink file)))
639 (with-output-to-file file
643 export PYTHONPATH=\"~a:~a\"~@
644 exec -a \"$0\" \"~a/~a\" \"$@\"~%"
648 (python:python-version python)
650 (getenv "PYTHONPATH")
653 (find-files "." (lambda (file stat)
654 (eq? 'symlink (stat:type stat)))))
657 ;; Note that the error messages printed by the tools in the case of
658 ;; missing dependencies are often downright misleading.
659 ;; TODO: hp-toolbox still fails to start with:
660 ;; from dbus.mainloop.pyqt5 import DBusQtMainLoop
661 ;; ModuleNotFoundError: No module named 'dbus.mainloop.pyqt5'
663 `(("cups-minimal" ,cups-minimal)
665 ("libjpeg" ,libjpeg-turbo)
668 ("python-dbus" ,python-dbus)
669 ("python-pygobject" ,python-pygobject)
670 ("python-pyqt" ,python-pyqt)
671 ("python-wrapper" ,python-wrapper)
672 ("sane-backends" ,sane-backends-minimal)
676 ("pkg-config" ,pkg-config)))))
678 (define-public hplip-minimal
679 (package/inherit hplip
680 (name "hplip-minimal")
682 (substitute-keyword-arguments (package-arguments hplip)
683 ((#:configure-flags cf)
684 ;; Produce a "light build", meaning that only the printer (CUPS) and
685 ;; scanner (SANE) support gets built, without all the 'hp-*'
686 ;; command-line tools.
687 `(cons "--enable-lite-build"
688 (delete "--enable-qt5" ,cf)))
690 ;; The 'wrap-binaries' is not needed here since the 'hp-*' programs
691 ;; are not installed.
692 `(alist-delete 'wrap-binaries ,phases))))
693 (inputs (remove (match-lambda
695 (string-prefix? "python" label)))
696 (package-inputs hplip)))
697 (synopsis "GUI-less version of hplip")))
699 (define-public foomatic-filters
701 (name "foomatic-filters")
706 "http://www.openprinting.org/download/foomatic/"
707 "foomatic-filters-" version ".tar.gz"))
710 "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2"))
712 (search-patches "foomatic-filters-CVE-2015-8327.patch"
713 "foomatic-filters-CVE-2015-8560.patch"))))
714 (build-system gnu-build-system)
716 "https://wiki.linuxfoundation.org/openprinting/database/foomatic")
719 ("pkg-config" ,pkg-config)))
724 '( ;; Specify the installation directories.
725 #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS="
726 (assoc-ref %outputs "out")
728 (string-append "ac_cv_path_CUPS_FILTERS="
729 (assoc-ref %outputs "out")
731 (string-append "ac_cv_path_PPR_INTERFACES="
732 (assoc-ref %outputs "out")
733 "/lib/ppr/interfaces")
734 (string-append "ac_cv_path_PPR_LIB="
735 (assoc-ref %outputs "out")
738 ;; For some reason these are misdiagnosed.
739 "ac_cv_func_malloc_0_nonnull=yes"
740 "ac_cv_func_realloc_0_nonnull=yes")
741 #:test-target "tests"))
742 (synopsis "Convert PostScript to the printer's native format")
744 "This package contains filter scripts used by the printer spoolers to
745 convert the incoming PostScript data into the printer's native format using a
746 printer/driver specific, but spooler-independent PPD file.")
747 (license license:gpl2+)))
749 (define-public foo2zjs
752 (version "20200610.1")
756 ;; The upstream tarball is unversioned: use a stable snapshot.
757 (uri (string-append "https://web.archive.org/web/20210224094943if_/"
758 "http://foo2zjs.rkkda.com/foo2zjs.tar.gz"))
760 (base32 "03ncif50n7ck7drggqxbc7w0kgzdb90ha0dbvqk98ky8lw3k76xd"))))
761 (build-system gnu-build-system)
763 '(#:phases (modify-phases %standard-phases
765 (lambda* (#:key outputs #:allow-other-keys)
766 (substitute* (find-files "." "^Makefile$")
767 ;; Set the installation directory.
768 (("^PREFIX[[:blank:]]*=.*$")
769 (string-append "PREFIX = "
770 (assoc-ref outputs "out")
772 (("^UDEVBIN[[:blank:]]*=.*$")
773 "UDEVBIN = $(PREFIX)/bin\n")
774 ;; Don't try to chown/chgrp the installed files.
779 ;; Placate the dependency checks.
780 (("/usr/include/stdio.h")
784 ;; Ensure fixed timestamps in man pages.
785 (("^MODTIME[[:blank:]]*=.*$")
786 "MODTIME = echo Thu Jan 01 01:00:00 1970\n"))
788 (add-before 'install 'make-install-dirs
789 (lambda* (#:key outputs #:allow-other-keys)
790 ;; Make missing install dirs
791 (let ((out (assoc-ref outputs "out"))
792 (dirs '("/share/cups/model"
793 "/share/foomatic/db/source/opt"
794 "/share/foomatic/db/source/printer"
795 "/share/foomatic/db/source/driver"
796 "/lib/cups/filter")))
797 (for-each (lambda (dir)
798 (mkdir-p (string-append out dir)))
800 (add-after 'install 'wrap-wrappers
801 (lambda* (#:key inputs outputs #:allow-other-keys)
802 (let ((out (assoc-ref outputs "out"))
803 (ghostscript (assoc-ref inputs "ghostscript"))
804 (coreutils (assoc-ref inputs "coreutils"))
805 (sed (assoc-ref inputs "sed")))
806 (for-each (lambda (file)
809 (,(string-append ghostscript "/bin:"
812 (find-files (string-append
813 out "/bin") "wrapper$")))))
814 (add-after 'install 'install-cups-filters-symlinks
815 (lambda* (#:key inputs outputs #:allow-other-keys)
816 (let ((out (assoc-ref outputs "out")))
820 (string-append out "/lib/cups/filter/"
822 (find-files (string-append out "/bin"))))))
823 (add-after 'install 'remove-pdf
824 (lambda* (#:key outputs #:allow-other-keys)
825 ;; Remove 'manual.pdf' which is (1) useless (it's a
826 ;; concatenation of man pages), and (2) not
827 ;; bit-reproducible due to <https://bugs.gnu.org/27593>.
828 (let ((out (assoc-ref outputs "out")))
829 (for-each delete-file
830 (find-files out "^manual\\.pdf$"))
832 #:parallel-build? #f ;broken makefile
833 #:tests? #f ;no tests
834 #:make-flags '("CC=gcc")))
836 `(("coreutils" ,coreutils)
838 ("ghostscript" ,ghostscript)
839 ("foomatic-filters" ,foomatic-filters))) ;for 'foomatic-rip'
843 (home-page "http://foo2zjs.rkkda.com/")
844 (synopsis "Printer driver for ZjStream-based printers")
846 "foo2zjs is a printer driver for printers that use the Zenographics
847 ZjStream wire protocol for their print data, often erroneously referred to as
848 winprinters or GDI printers.
850 It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro,
851 HP@tie{}LaserJet, and possibly other printers. See @file{README} for details.")
852 (license (list license:expat ; icc2ps/*.[ch]
853 license:gpl2+)))) ; everything else
855 (define-public epson-inkjet-printer-escpr
857 (name "epson-inkjet-printer-escpr")
859 ;; XXX: This currently works. But it will break as soon as a newer
860 ;; version is available since the URLs for older versions are not
861 ;; preserved. An alternative source will be added as soon as
866 (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/12/50/95/"
867 "322b8d6b915ab85add33d41f04ba5130866aadbe/"
868 "epson-inkjet-printer-escpr-1.7.9-1lsb3.2.tar.gz"))
870 (base32 "136hhvhimxfnrdn3ksbiswjxgsifrwlp3zz8h0v63w4k1vkzpgc0"))))
871 (build-system gnu-build-system)
875 ,@%gnu-build-system-modules)
878 ,(string-append "--prefix="
879 (assoc-ref %outputs "out"))
880 ,(string-append "--with-cupsfilterdir="
881 (assoc-ref %outputs "out") "/lib/cups/filter")
882 ,(string-append "--with-cupsppddir="
883 (assoc-ref %outputs "out") "/share/cups/model"))
885 (modify-phases %standard-phases
886 (add-after 'unpack 'patch-autotools-version-requirement
888 (substitute* "aclocal.m4"
890 ,(package-version automake)))
891 (substitute* "configure"
892 (("^(ACLOCAL=).*" _ match)
893 (string-append match "aclocal"))
894 (("^(AUTOMAKE=).*" _ match)
895 (string-append match "automake")))
897 (add-after 'install 'compress-PPDs
898 (lambda* (#:key outputs #:allow-other-keys)
899 (let ((out (assoc-ref outputs "out")))
900 (with-directory-excursion out
901 (for-each (cut invoke "gzip" "-9" <>)
902 (find-files "share/cups" "\\.ppd$")))))))))
904 `(("autoconf" ,autoconf)
905 ("automake" ,automake)))
907 `(("cups" ,cups-minimal)))
908 (synopsis "ESC/P-R printer driver")
910 "This package provides a filter for @acronym{CUPS, the Common UNIX Printing
911 System} that offers high-quality printing with Seiko@tie{}Epson color ink jet
912 printers. It can be used only with printers that support the Epson@tie{}ESC/P-R
914 (home-page "http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX")
915 (license license:gpl2+)))
918 (deprecated-package "escpr" epson-inkjet-printer-escpr))
921 ;; Last released in 2009 <https://sourceforge.net/projects/splix/files/>.
922 ;; Last SVN commit was 2013 <https://svn.code.sf.net/p/splix/code/splix/>.
923 ;; Use a more maintained fork with several bug fixes and support for newer
925 (let ((commit "76268c4dd7dbc8218ea7426401104c3b40cc707a")
929 (version (git-version "2.0.0" revision commit))
934 (url "https://gitlab.com/ScumCoder/splix")
936 (file-name (git-file-name name version))
938 (base32 "1mxsvllwwr1v8sgrax0b7gkajjhnm0l06s67spmaxz47lyll1qab"))))
939 (build-system gnu-build-system)
940 ;; PPDs have been obsolete since CUPS 1.2 and make up 90% of total size.
941 (outputs (list "out" "ppd"))
945 ,@%gnu-build-system-modules)
947 (list (string-append "CUPSDRV="
948 (assoc-ref %outputs "out") "/share/cups/drv")
949 (string-append "CUPSFILTER="
950 (assoc-ref %outputs "out") "/lib/cups/filter")
951 (string-append "CUPSPPD="
952 (assoc-ref %outputs "ppd") "/share/cups/model")
953 "CACHESIZE=100" ; pages in RAM, ±300 KiB each
954 "THREADS=4") ; compress and print faster
956 (modify-phases %standard-phases
957 (add-after 'unpack 'enter-subdirectory
958 ;; The git repository replicates the top-level SVN layout.
962 (delete 'configure) ; no configure script
963 (add-before 'build 'build-.drv-files
964 (lambda* (#:key make-flags #:allow-other-keys)
965 (apply invoke "make" "drv" make-flags)))
966 (add-after 'install 'install-.drv-files
967 (lambda* (#:key make-flags #:allow-other-keys)
968 (apply invoke "make" "install" "DRV_ONLY=1" make-flags)))
969 (add-after 'install 'compress-PPDs
970 (lambda* (#:key outputs #:allow-other-keys)
971 (let ((ppd (assoc-ref outputs "ppd")))
972 (for-each (cut invoke "gzip" "-9" <>)
973 (find-files ppd "\\.ppd$"))))))
974 #:tests? #f)) ; no test suite
976 `(("cups" ,cups-minimal)
979 (synopsis "QPDL (SPL2) printer driver")
981 "SpliX is a set of CUPS drivers for printers that speak @acronym{QPDL,
982 Quick Page Description Language}, also called @acronym{SPL2, Samsung Printer
983 Language version 2}. These include many laser printers sold by Samsung,
984 Xerox, Lexmark, Toshiba, and Dell.
986 Colour printers need colour profile files to get better results. These
987 @file{cms} files are provided by the printer's manufacturer and must be
988 obtained and installed separately.")
989 (home-page "http://splix.ap2c.org/")
990 (license license:gpl2))))
992 (define-public python-pycups
994 (name "python-pycups")
999 (uri (pypi-uri "pycups" version ".tar.bz2"))
1002 "1ffp7sswhdsfpy88zg0cc8kl04wygkjs01rlm9f0spbwk8jhy2c6"))))
1003 (build-system python-build-system)
1005 '(;; Tests require CUPS to be running
1009 (home-page "https://github.com/zdohnal/pycups")
1010 (synopsis "Python bindings for libcups")
1012 "This package provides Python bindings for libcups, wrapping the CUPS
1014 (license license:gpl2+)))