1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2015, 2016, 2017, 2019, 2021 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–2022 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages cups)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages algebra)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages avahi)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages fonts) ; font-dejavu
35 #:use-module (gnu packages fontutils)
36 #:use-module (gnu packages ghostscript)
37 #:use-module (gnu packages glib)
38 #:use-module (gnu packages groff)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages libusb)
41 #:use-module (gnu packages pdf)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages polkit)
45 #:use-module (gnu packages pretty-print)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages qt)
49 #:use-module (gnu packages scanner)
50 #:use-module (gnu packages tls)
51 #:use-module (guix build-system cmake)
52 #:use-module (guix build-system gnu)
53 #:use-module (guix build-system meson)
54 #:use-module (guix build-system python)
55 #:use-module (guix download)
56 #:use-module (guix git-download)
57 #:use-module (guix gexp)
58 #:use-module ((guix licenses) #:prefix license:)
59 #:use-module (guix packages)
60 #:use-module (guix utils)
61 #:use-module (srfi srfi-1)
62 #:use-module (ice-9 match))
64 (define-public brlaser
65 (let ((commit "9d7ddda8383bfc4d205b5e1b49de2b8bcd9137f1")
69 (version (git-version "6" revision commit))
73 (url "https://github.com/pdewacht/brlaser")
75 (file-name (git-file-name name version))
78 "1drh0nk7amn9a8wykki4l9maqa4vy7vwminypfy1712alwj31nd4"))))
79 (build-system cmake-build-system)
82 (list (string-append "-DCUPS_DATA_DIR="
83 (assoc-ref %outputs "out")
85 (string-append "-DCUPS_SERVER_BIN="
86 (assoc-ref %outputs "out")
89 (list ghostscript cups zlib))
90 (home-page "https://github.com/pdewacht/brlaser")
91 (synopsis "Brother laser printer driver")
92 (description "Brlaser is a CUPS driver for Brother laser printers. This
93 driver is known to work with these printers:
96 @item Brother DCP-1510 series
97 @item Brother DCP-1600 series
98 @item Brother DCP-7030
99 @item Brother DCP-7040
100 @item Brother DCP-7055
101 @item Brother DCP-7055W
102 @item Brother DCP-7060D
103 @item Brother DCP-7065DN
104 @item Brother DCP-7080
105 @item Brother DCP-L2500D series
106 @item Brother DCP-L2520D series
107 @item Brother DCP-L2540DW series
108 @item Brother HL-1110 series
109 @item Brother HL-1200 series
110 @item Brother HL-2030 series
111 @item Brother HL-2140 series
112 @item Brother HL-2220 series
113 @item Brother HL-2270DW series
114 @item Brother HL-5030 series
115 @item Brother HL-L2300D series
116 @item Brother HL-L2320D series
117 @item Brother HL-L2340D series
118 @item Brother HL-L2360D series
119 @item Brother MFC-1910W
120 @item Brother MFC-7240
121 @item Brother MFC-7360N
122 @item Brother MFC-7365DN
123 @item Brother MFC-7840W
124 @item Brother MFC-L2710DW series
127 (license license:gpl2+))))
129 (define-public cups-filters
131 (name "cups-filters")
136 (string-append "https://openprinting.org/download/cups-filters/"
137 "cups-filters-" version ".tar.xz"))
140 "1bk0x1rrb8wqbhh5c979ppgy6s2kqss8mjdlahgcjvd79wm3fs9g"))
141 (modules '((guix build utils)))
143 ;; install backends, banners and filters to cups-filters output
144 ;; directory, not the cups server directory
146 (substitute* "Makefile.in"
147 (("CUPS_DATADIR = @CUPS_DATADIR@")
148 "CUPS_DATADIR = $(PREFIX)/share/cups")
149 (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)")
150 "pkgcupsserverrootdir = $(PREFIX)")
151 ;; Choose standard directories notably so that binaries are
153 (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend")
154 "pkgbackenddir = $(PREFIX)/lib/cups/backend")
155 (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter")
156 "pkgfilterdir = $(PREFIX)/lib/cups/filter"))
157 ;; Find bannertopdf data such as the print test page in our
158 ;; output directory, not CUPS's prefix.
159 (substitute* "configure"
160 (("\\{CUPS_DATADIR\\}/data")
161 "{prefix}/share/cups/data"))
163 (build-system gnu-build-system)
165 `(#:make-flags (list (string-append "PREFIX=" %output))
167 `("--disable-driverless" ; TODO: enable this
168 "--disable-mutool" ; depends on yet another PDF library (mupdf)
170 ;; Look for the "domain socket of CUPS" in /var/run/cups.
171 "--localstatedir=/var"
173 ;; Free software for the win.
174 "--with-acroread-path=evince"
176 ,(string-append "--with-test-font-path="
177 (assoc-ref %build-inputs "font-dejavu")
178 "/share/fonts/truetype/DejaVuSans.ttf")
179 ,(string-append "--with-gs-path="
180 (assoc-ref %build-inputs "ghostscript")
182 ,(string-append "--with-shell="
183 (assoc-ref %build-inputs "bash")
185 ,(string-append "--with-rcdir="
186 (assoc-ref %outputs "out") "/etc/rc.d"))
188 #:phases (modify-phases %standard-phases
189 (add-after 'unpack 'patch-foomatic-hardcoded-file-names
190 (lambda* (#:key inputs outputs #:allow-other-keys)
191 ;; Foomatic has hardcoded file names we need to fix.
192 (let ((out (assoc-ref outputs "out"))
193 (gs (assoc-ref inputs "ghostscript")))
194 (substitute* "filter/foomatic-rip/foomaticrip.c"
195 (("/usr/local/lib/cups/filter")
196 (string-append out "/lib/cups/filter")))
198 (add-after 'install 'wrap-filters
199 (lambda* (#:key inputs outputs #:allow-other-keys)
200 ;; Some filters expect to find things in $PATH. We cannot
201 ;; just hard-code all absolute file names in the source
202 ;; because foomatic-rip, for example, has tests like
203 ;; 'startswith(cmd, "gs")'.
204 (let ((out (assoc-ref outputs "out"))
205 (ghostscript (assoc-ref inputs "ghostscript"))
206 (grep (assoc-ref inputs "grep")))
207 (for-each (lambda (file)
210 (,(string-append ghostscript "/bin:"
212 (find-files (string-append
213 out "/lib/cups/filter")))
216 (list `(,glib "bin") ; for gdbus-codegen
220 ("fontconfig" ,fontconfig)
221 ("freetype" ,freetype)
222 ("font-dejavu" ,font-dejavu) ; also needed by test suite
223 ("ghostscript" ,ghostscript/cups)
228 ("libjpeg" ,libjpeg-turbo)
234 ("cups-minimal" ,cups-minimal)))
235 (home-page "https://wiki.linuxfoundation.org/openprinting/cups-filters")
236 (synopsis "OpenPrinting CUPS filters and backends")
238 "Contains backends, filters, and other software that was once part of the
239 core CUPS distribution but is no longer maintained by Apple Inc. In addition
240 it contains additional filters developed independently of Apple, especially
241 filters for the PDF-centric printing workflow introduced by OpenPrinting.")
242 ;; Different filters and backends have different licenses; see COPYING for
244 (license (list license:gpl2
251 ;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also
252 ;; depends on CUPS libraries and binaries, cups-minimal has been added to
253 ;; satisfy this dependency.
254 (define-public cups-minimal
256 (name "cups-minimal")
261 ;; Version maintained by the OpenPrinting organization, NOT a fork. The
262 ;; CUPS author tracks the current Apple CUPS sources and includes common
263 ;; changes and bug fixes for GNU/Linux. See its README and for example
264 ;; <https://github.com/apple/cups/issues/5917#issuecomment-819465891>.
266 (url "https://github.com/OpenPrinting/cups")
267 (commit (string-append "v" version))))
268 (file-name (git-file-name name version))
270 (base32 "126d6kd3pkhmsvbcflkcpk3y30iqlkdqyvrk9aqq88vbxzjd5ia6"))))
271 (build-system gnu-build-system)
274 '("--disable-launchd"
278 ;; Seven tests fail, mostly because of files that are provided by the
279 ;; cups-filters package.
282 (modify-phases %standard-phases
283 (add-after 'unpack 'never-cupsAdminGetServerSettings
284 ;; Instead of querying the daemon directly, this part of CUPS assumes
285 ;; that (1) it has access to a cupsd.conf under CUPS_SERVERROOT, and
286 ;; (2) the file's contents apply to the running daemon. (1) is false
287 ;; at least on Guix Systems resulting in extremely long delays when
288 ;; loading the Web interface's /admin page. (2) isn't valid anywhere
289 ;; because it ignores, e.g., -c FILE.
290 ;; Upstream considers this code on ‘life support’ so just neuter it.
292 (substitute* "cgi-bin/admin.c"
293 (("!cupsAdminGetServerSettings" match)
294 (string-append "0 && " match)))))
295 (add-after 'unpack 'remove-Web-UI-server-settings
296 ;; The /admin page's server configuration form is questionable for
297 ;; the same reason as cupsAdminGetServerSettings, and won't work at
298 ;; all on Guix Systems. Remove it entirely.
300 ;; SUBSTITUTE* and a patch both have (dis)advantages. This is
301 ;; shorter & should ensure that no translation is forgotten.
302 (substitute* (find-files "templates" "^admin\\.tmpl$")
303 ((" class=\"halves\"") "")
304 (("<FORM.* ACTION=\"/jobs.*</FORM>" match)
305 (string-append match "</P>{BROKEN? "))
307 (string-append match "}")))))
308 (add-before 'configure 'patch-makedefs
310 (substitute* "Makedefs.in"
311 (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
312 (("/bin/sh") (which "sh")))
314 (add-before 'build 'patch-tests
316 (substitute* "tools/ippeveprinter.c"
317 (("# else /\\* HAVE_AVAHI \\*/")
318 "#elif defined(HAVE_AVAHI)"))
324 (home-page "https://openprinting.github.io/")
325 (synopsis "The Common Unix Printing System")
327 "CUPS is a printing system that uses the Internet Printing Protocol
328 (@dfn{IPP}). It provides System V and BSD command-line interfaces, as well
329 as a Web interface and a C programming interface to manage printers and print
330 jobs. It supports printing to both local (parallel, serial, USB) and
331 networked printers, and printers can be shared from one computer to another.
332 Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to
333 describe printer capabilities and features, and a wide variety of generic and
334 device-specific programs to convert and print many types of files.")
335 ;; CUPS is Apache 2.0 with exceptions, see the NOTICE file.
336 (license license:asl2.0)))
339 (package/inherit cups-minimal
342 (substitute-keyword-arguments (package-arguments cups-minimal)
345 ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
346 ;; Get-Jobs Operation"
347 ;; * test of number of error/warning messages, probably related to a
350 ((#:configure-flags _ '())
351 `(list "--disable-launchd"
352 "--disable-systemd"))
353 ((#:phases phases '%standard-phases)
354 `(modify-phases ,phases
355 (add-before 'check 'patch-tests
357 (let ((filters (assoc-ref %build-inputs "cups-filters"))
358 (catpath (string-append
359 (assoc-ref %build-inputs "coreutils") "/bin/"))
360 (testdir (string-append (getcwd) "/tmp/")))
362 (substitute* "test/run-stp-tests.sh"
363 ((" *BASE=/tmp/") (string-append "BASE=" testdir))
365 ;; Allow installation of filters from the output directory
366 ;; and from cups-filters.
367 (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
370 (assoc-ref %outputs "out") "/lib/cups/filter "
371 filters "/lib/cups/filter"))
373 ;; Check for charsets in the default cups-filters output.
374 (("/usr/share/cups/charsets")
375 (string-append filters "/share/cups/charsets"))
377 ;; Install additional required filters.
378 (("instfilter texttopdf texttopdf pdf")
380 "instfilter texttopdf texttopdf pdf;"
381 "instfilter imagetoraster imagetoraster raster;"
382 "instfilter gstoraster gstoraster raster;"
383 "instfilter urftopdf urftopdf pdf;"
384 "instfilter rastertopdf rastertopdf pdf;"
385 "instfilter pstopdf pstopdf pdf"))
387 ;; Specify the location of the lpstat binary.
388 (("description=\"`lpstat -l")
389 "description=\"`../systemv/lpstat -l")
391 ;; Patch the shebangs of embedded scripts.
392 (("#!/bin/sh") (string-append "#!" (which "sh")))
394 ;; Also link MIME definitions from cups-filters
395 ;; to enable the additional filters for the test suite.
396 (("ln -s \\$root/conf/mime\\.types")
399 "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
400 "ln -s $root/conf/mime.types"))
401 (("ln -s \\$root/conf/mime\\.convs")
404 "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
405 "ln -s $root/conf/mime.convs")))
407 ;; Fix the search path for the "cat" command.
408 (substitute* "cups/testfile.c"
409 (("cupsFileFind\\(\"cat\", \"/bin\"")
410 (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
411 (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
412 (string-append "cupsFileFind(\"cat\", \"" catpath "\""))))))
413 (add-after 'install 'install-cups-filters-symlinks
414 (lambda* (#:key inputs outputs #:allow-other-keys)
415 (let ((out (assoc-ref outputs "out"))
416 (cups-filters (assoc-ref inputs "cups-filters")))
419 (string-append cups-filters "/share/cups/charsets")
420 (string-append out "/share/charsets"))
422 ;; MIME types, driver files, and PPDs.
425 (symlink (string-append cups-filters f)
426 (string-append out f)))
427 '("/share/cups/mime/cupsfilters.types"
428 "/share/cups/mime/cupsfilters.convs"
429 "/share/cups/drv/cupsfilters.drv"
436 (string-append out "/lib/cups/filter"
438 (find-files (string-append cups-filters "/lib/cups/filter")))
443 (symlink (string-append cups-filters f)
444 (string-append out "/lib/cups/backend/"
446 '("/lib/cups/backend/parallel"
447 "/lib/cups/backend/serial"))
450 (let ((banners "/share/cups/banners"))
451 (delete-file-recursively (string-append out banners))
452 (symlink (string-append cups-filters banners)
453 (string-append out banners)))
456 (let ((data "/share/cups/data"))
457 (delete-file-recursively (string-append out data))
458 (symlink (string-append cups-filters data)
459 (string-append out data))))))))))
463 ("cups-filters" ,cups-filters)
466 (define-public cups-pk-helper
468 (name "cups-pk-helper")
472 (uri (string-append "https://freedesktop.org/software/"
473 name "/releases/" name "-" version ".tar.xz"))
476 "0cg8wbxpkz9bkpasz973cdazi02svqpbw9mafvpgrscg8kdhs1v6"))))
477 (build-system meson-build-system)
479 ;; XXX The tests require a running D-Bus and CUPS daemon, of course.
482 #~(modify-phases %standard-phases
483 (add-after 'install 'install-compatibility-symlink
484 ;; XXX Upstream (and, presumably, the world) has moved to
485 ;; /share/dbus-1 over /etc/dbus-1, but Guix System's
486 ;; dbus-configuration-directory has yet to catch up.
487 ;; TODO It should be properly fixed and this phase removed.
488 (lambda* (#:key outputs #:allow-other-keys)
489 (with-directory-excursion (assoc-ref outputs "out")
491 (symlink "../share/dbus-1" "etc/dbus-1")))))))
493 (list intltool pkg-config `(,glib "bin")))
495 (list glib polkit-duktape cups-minimal))
496 (home-page "https://www.freedesktop.org/wiki/Software/cups-pk-helper/")
497 (synopsis "PolicyKit helper to configure CUPS with fine-grained privileges")
499 "This package provides the org.opensuse.CupsPkHelper.Mechanism DBus
500 system service which uses @file{cups-pk-helper-mechanism}. This package
501 should only be used as part of the Guix cups-pk-helper service.")
502 (license license:gpl2+)))
510 (uri (string-append "mirror://sourceforge/hplip/hplip/" version
511 "/hplip-" version ".tar.gz"))
514 "0q3adcp8iygravp4bq4gw14jk20c5rhnawj1333qyw8yvlghw8yy"))
515 (modules '((guix build utils)))
518 ;; Delete non-free blobs: .so files, pre-compiled
519 ;; 'locatedriver' executable, etc.
520 (for-each delete-file
525 ;; Now remove some broken references to them.
526 (delete-file "prnt/hpcups/ImageProcessor.h")
527 (substitute* "Makefile.in"
528 ((" -lImageProcessor ") " ")
529 ;; Turn shell commands inside an if…fi into harmless no-ops.
530 (("^(\\@HPLIP_BUILD_TRUE\\@[[:blank:]]*).*libImageProcessor.*"
532 (string-append prefix ": ; \\\n"))
533 ;; Remove the lines adding file targets altogether.
534 (("^\\@FULL_BUILD_TRUE\\@.*libImageProcessor.*")
537 ;; Install binaries under libexec/hplip instead of
538 ;; share/hplip; that'll at least ensure they get stripped.
539 ;; It's not even clear that they're of any use though...
540 (substitute* "Makefile.in"
542 "dat2drvdir = $(pkglibexecdir)\n")
543 (("^locatedriverdir =.*")
544 "locatedriverdir = $(pkglibexecdir)\n"))))))
545 (build-system gnu-build-system)
546 (outputs (list "out" "ppd"))
547 (home-page "https://developers.hp.com/hp-linux-imaging-and-printing")
548 (synopsis "HP printer drivers")
550 "Hewlett-Packard printer drivers and PostScript Printer Descriptions
553 ;; The 'COPYING' file lists directories where each of these 3 licenses
555 (license (list license:gpl2+ license:bsd-3 license:expat))
557 ;; TODO install apparmor profile files eventually.
560 `("--disable-imageProcessor-build"
561 "--disable-network-build"
562 ,(string-append "--prefix=" (assoc-ref %outputs "out"))
563 ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
564 ,(string-append "LDFLAGS=-Wl,-rpath="
565 (assoc-ref %outputs "out") "/lib")
566 ;; Disable until mime.types merging works (FIXME).
567 "--disable-fax-build"
568 "--enable-new-hpcups"
569 ;; TODO add foomatic drv install eventually.
570 ;; TODO --enable-policykit eventually.
571 ,(string-append "--with-cupsfilterdir="
572 (assoc-ref %outputs "out") "/lib/cups/filter")
573 ,(string-append "--with-cupsbackenddir="
574 (assoc-ref %outputs "out") "/lib/cups/backend")
575 ,(string-append "--with-hpppddir="
576 (assoc-ref %outputs "ppd") "/share/ppd/HP")
577 ,(string-append "--with-icondir="
578 (assoc-ref %outputs "out") "/share/applications")
579 ,(string-append "--with-systraydir="
580 (assoc-ref %outputs "out") "/etc/xdg")
581 "--enable-qt5" "--disable-qt4")
583 #:imported-modules ((guix build python-build-system)
584 ,@%gnu-build-system-modules)
585 #:modules ((guix build gnu-build-system)
587 ((guix build python-build-system) #:prefix python:))
590 (modify-phases %standard-phases
591 (add-after 'unpack 'fix-hard-coded-file-names
592 (lambda* (#:key inputs outputs #:allow-other-keys)
593 (let ((out (assoc-ref outputs "out"))
594 ;; FIXME: use merged ppds (I think actually only
595 ;; drvs need to be merged).
596 (cupsdir (assoc-ref inputs "cups-minimal")))
597 (substitute* "base/g.py"
598 (("'/usr/share;[^']*'")
599 (string-append "'" cupsdir "/share'"))
600 (("'/etc/hp/hplip.conf'")
601 (string-append "'" out
602 "/etc/hp/hplip.conf" "'")))
604 (substitute* "Makefile.in"
605 (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
606 ;; FIXME Use beginning-of-word in regexp.
607 (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
608 (("/usr/include/libusb-1.0")
609 (search-input-directory inputs "/include/libusb-1.0"))
610 (("hplip_statedir =.*$")
611 ;; Don't bail out while trying to create
612 ;; /var/lib/hplip. We can safely change its value
613 ;; here because it's hard-coded in the code anyway.
614 "hplip_statedir = $(prefix)\n")
615 (("hplip_confdir = /etc/hp")
616 ;; This is only used for installing the default config.
617 (string-append "hplip_confdir = " out
619 (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
621 (string-append "halpredir = " out
622 "/share/hal/fdi/preprobe/10osvendor"))
623 (("rulesdir = /etc/udev/rules.d")
624 ;; udev rules will be merged by base service.
625 (string-append "rulesdir = " out
626 "/lib/udev/rules.d"))
627 (("rulessystemdir = /usr/lib/systemd/system")
628 ;; We don't use systemd.
629 (string-append "rulessystemdir = " out
630 "/lib/systemd/system"))
632 (string-append out "/etc/sane.d"))))))
633 (add-before 'configure 'fix-build-with-python-3.8
634 (lambda* (#:key inputs #:allow-other-keys)
635 (let ((python (assoc-ref inputs "python")))
636 ;; XXX: The configure script looks for Python headers in the
637 ;; wrong places as of version 3.20.3. Help it by adding the
638 ;; include directory on C_INCLUDE_PATH.
640 (setenv "C_INCLUDE_PATH"
641 (string-append python "/include/python"
642 (python:python-version python)
643 ":" (getenv "C_INCLUDE_PATH")))))))
644 (add-after 'install 'install-models-dat
645 (lambda* (#:key outputs #:allow-other-keys)
646 (let* ((out (assoc-ref outputs "out"))
647 (models-dir (string-append out
648 "/share/hplip/data/models")))
649 (install-file "data/models/models.dat" models-dir))))
650 (add-after 'install 'wrap-binaries
651 ;; Scripts in /bin are all symlinks to .py files in /share/hplip.
652 ;; Symlinks are immune to the Python build system's 'WRAP phase,
653 ;; and the .py files can't be wrapped because they are reused as
654 ;; modules. Replacing the symlinks in /bin with copies and
655 ;; wrapping them also doesn't work (“ModuleNotFoundError:
656 ;; No module named 'base'”). Behold: a custom WRAP-PROGRAM.
657 (lambda* (#:key inputs outputs #:allow-other-keys)
658 (let* ((out (assoc-ref outputs "out"))
659 (bin (string-append out "/bin"))
660 (site (python:site-packages inputs outputs)))
661 (with-directory-excursion bin
662 (for-each (lambda (file)
663 (let ((target (readlink file)))
665 (with-output-to-file file
669 export GUIX_PYTHONPATH=\"~a:~a\"~@
670 exec -a \"$0\" \"~a/~a\" \"$@\"~%"
673 (getenv "GUIX_PYTHONPATH")
676 (find-files "." (lambda (file stat)
677 (eq? 'symlink (stat:type stat))))))))))))
679 ;; Note that the error messages printed by the tools in the case of
680 ;; missing dependencies are often downright misleading.
681 ;; TODO: hp-toolbox still fails to start with:
682 ;; from dbus.mainloop.pyqt5 import DBusQtMainLoop
683 ;; ModuleNotFoundError: No module named 'dbus.mainloop.pyqt5'
685 `(("cups-minimal" ,cups-minimal)
687 ("libjpeg" ,libjpeg-turbo)
690 ("python-dbus" ,python-dbus)
691 ("python-pygobject" ,python-pygobject)
692 ("python-pyqt" ,python-pyqt)
693 ("python-wrapper" ,python-wrapper)
694 ("sane-backends" ,sane-backends-minimal)
697 (list perl pkg-config))))
699 (define-public hplip-minimal
700 (package/inherit hplip
701 (name "hplip-minimal")
703 (substitute-keyword-arguments (package-arguments hplip)
704 ((#:configure-flags cf)
705 ;; Produce a "light build", meaning that only the printer (CUPS) and
706 ;; scanner (SANE) support gets built, without all the 'hp-*'
707 ;; command-line tools.
708 `(cons "--enable-lite-build"
709 (delete "--enable-qt5" ,cf)))
711 ;; The 'wrap-binaries' is not needed here since the 'hp-*' programs
712 ;; are not installed.
713 `(alist-delete 'wrap-binaries ,phases))))
714 (inputs (remove (match-lambda
716 (string-prefix? "python" label)))
717 (package-inputs hplip)))
718 (synopsis "GUI-less version of hplip")))
720 (define-public foomatic-filters
722 (name "foomatic-filters")
727 "http://www.openprinting.org/download/foomatic/"
728 "foomatic-filters-" version ".tar.gz"))
731 "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2"))
733 (search-patches "foomatic-filters-CVE-2015-8327.patch"
734 "foomatic-filters-CVE-2015-8560.patch"))))
735 (build-system gnu-build-system)
736 (home-page "https://openprinting.github.io/projects/02-foomatic/")
738 (list perl pkg-config))
742 '( ;; Specify the installation directories.
743 #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS="
744 (assoc-ref %outputs "out")
746 (string-append "ac_cv_path_CUPS_FILTERS="
747 (assoc-ref %outputs "out")
749 (string-append "ac_cv_path_PPR_INTERFACES="
750 (assoc-ref %outputs "out")
751 "/lib/ppr/interfaces")
752 (string-append "ac_cv_path_PPR_LIB="
753 (assoc-ref %outputs "out")
756 ;; For some reason these are misdiagnosed.
757 "ac_cv_func_malloc_0_nonnull=yes"
758 "ac_cv_func_realloc_0_nonnull=yes")
759 #:test-target "tests"))
760 (synopsis "Convert PostScript to the printer's native format")
762 "This package contains filter scripts used by the printer spoolers to
763 convert the incoming PostScript data into the printer's native format using a
764 printer/driver specific, but spooler-independent PPD file.")
765 (license license:gpl2+)))
767 (define-public foo2zjs
770 (version "20200610.1")
774 ;; The upstream tarball is unversioned: use a stable snapshot.
775 (uri (string-append "https://web.archive.org/web/20210224094943if_/"
776 "http://foo2zjs.rkkda.com/foo2zjs.tar.gz"))
778 (base32 "03ncif50n7ck7drggqxbc7w0kgzdb90ha0dbvqk98ky8lw3k76xd"))))
779 (build-system gnu-build-system)
781 '(#:phases (modify-phases %standard-phases
783 (lambda* (#:key outputs #:allow-other-keys)
784 (substitute* (find-files "." "^Makefile$")
785 ;; Set the installation directory.
786 (("^PREFIX[[:blank:]]*=.*$")
787 (string-append "PREFIX = "
788 (assoc-ref outputs "out")
790 (("^UDEVBIN[[:blank:]]*=.*$")
791 "UDEVBIN = $(PREFIX)/bin\n")
792 ;; Don't try to chown/chgrp the installed files.
797 ;; Placate the dependency checks.
798 (("/usr/include/stdio.h")
802 ;; Ensure fixed timestamps in man pages.
803 (("^MODTIME[[:blank:]]*=.*$")
804 "MODTIME = echo Thu Jan 01 01:00:00 1970\n"))
806 (add-before 'install 'make-install-dirs
807 (lambda* (#:key outputs #:allow-other-keys)
808 ;; Make missing install dirs
809 (let ((out (assoc-ref outputs "out"))
810 (dirs '("/share/cups/model"
811 "/share/foomatic/db/source/opt"
812 "/share/foomatic/db/source/printer"
813 "/share/foomatic/db/source/driver"
814 "/lib/cups/filter")))
815 (for-each (lambda (dir)
816 (mkdir-p (string-append out dir)))
818 (add-after 'install 'wrap-wrappers
819 (lambda* (#:key inputs outputs #:allow-other-keys)
820 (let ((out (assoc-ref outputs "out"))
821 (ghostscript (assoc-ref inputs "ghostscript"))
822 (coreutils (assoc-ref inputs "coreutils"))
823 (sed (assoc-ref inputs "sed")))
824 (for-each (lambda (file)
827 (,(string-append ghostscript "/bin:"
830 (find-files (string-append
831 out "/bin") "wrapper$")))))
832 (add-after 'install 'install-cups-filters-symlinks
833 (lambda* (#:key inputs outputs #:allow-other-keys)
834 (let ((out (assoc-ref outputs "out")))
838 (string-append out "/lib/cups/filter/"
840 (find-files (string-append out "/bin"))))))
841 (add-after 'install 'remove-pdf
842 (lambda* (#:key outputs #:allow-other-keys)
843 ;; Remove 'manual.pdf' which is (1) useless (it's a
844 ;; concatenation of man pages), and (2) not
845 ;; bit-reproducible due to <https://bugs.gnu.org/27593>.
846 (let ((out (assoc-ref outputs "out")))
847 (for-each delete-file
848 (find-files out "^manual\\.pdf$"))
850 #:parallel-build? #f ;broken makefile
851 #:tests? #f ;no tests
852 #:make-flags '("CC=gcc")))
854 (list coreutils sed ghostscript foomatic-filters)) ;for 'foomatic-rip'
857 ;; The domain has expired and no one has meaningfully taken up the torch.
858 (home-page (string-append "https://web.archive.org/web/20210129024712/"
859 "http://foo2zjs.rkkda.com/"))
860 (synopsis "Printer driver for ZjStream-based printers")
862 "foo2zjs is a printer driver for printers that use the Zenographics
863 ZjStream wire protocol for their print data, often erroneously referred to as
864 winprinters or GDI printers.
866 It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro,
867 HP@tie{}LaserJet, and possibly other printers. See @file{README} for details.")
868 (license (list license:expat ; icc2ps/*.[ch]
869 license:gpl2+)))) ; everything else
871 (define-public epson-inkjet-printer-escpr
873 (name "epson-inkjet-printer-escpr")
875 ;; XXX: This currently works. But it will break as soon as a newer
876 ;; version is available since the URLs for older versions are not
877 ;; preserved. An alternative source will be added as soon as
882 (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/13/77/"
883 "93/e85dc2dc266e96fdc242bd95758bd88d1a51963e/"
884 "epson-inkjet-printer-escpr-1.7.21-1lsb3.2.tar.gz"))
886 (base32 "0z1x9p58321plf2swfxgl72wn7ls8bfbyjwd9l9c8jxfr1v2skkz"))))
887 (build-system gnu-build-system)
891 ,@%gnu-build-system-modules)
893 #~(list "--disable-static"
894 (string-append "--prefix=" #$output)
895 (string-append "--with-cupsfilterdir=" #$output "/lib/cups/filter")
896 (string-append "--with-cupsppddir=" #$output "/share/cups/model"))
898 #~(modify-phases %standard-phases
899 (add-after 'unpack 'patch-autotools-version-requirement
901 (substitute* "aclocal.m4"
903 #$(package-version automake)))
904 (substitute* "configure"
905 (("^(ACLOCAL=).*" _ match)
906 (string-append match "aclocal"))
907 (("^(AUTOMAKE=).*" _ match)
908 (string-append match "automake")))))
909 (add-after 'install 'compress-PPDs
911 (with-directory-excursion #$output
912 (for-each (cut invoke "gzip" "-9" <>)
913 (find-files "share/cups" "\\.ppd$"))))))))
915 (list autoconf automake))
918 (synopsis "ESC/P-R printer driver")
920 "This package provides a filter for @acronym{CUPS, the Common UNIX Printing
921 System} that offers high-quality printing with Seiko@tie{}Epson color ink jet
922 printers. It can be used only with printers that support the Epson@tie{}ESC/P-R
924 (home-page "https://download.ebz.epson.net/dsc/search/01/search/?OSC=LX")
925 (license license:gpl2+)))
928 ;; Last released in 2009 <https://sourceforge.net/projects/splix/files/>.
929 ;; Last SVN commit was 2013 <https://svn.code.sf.net/p/splix/code/splix/>.
930 ;; Use a more maintained fork with several bug fixes and support for newer
932 (let ((commit "76268c4dd7dbc8218ea7426401104c3b40cc707a")
936 (version (git-version "2.0.0" revision commit))
941 (url "https://gitlab.com/ScumCoder/splix")
943 (file-name (git-file-name name version))
945 (base32 "1mxsvllwwr1v8sgrax0b7gkajjhnm0l06s67spmaxz47lyll1qab"))))
946 (build-system gnu-build-system)
947 ;; PPDs have been obsolete since CUPS 1.2 and make up 90% of total size.
948 (outputs (list "out" "ppd"))
952 ,@%gnu-build-system-modules)
954 (list (string-append "CUPSDRV="
955 (assoc-ref %outputs "out") "/share/cups/drv")
956 (string-append "CUPSFILTER="
957 (assoc-ref %outputs "out") "/lib/cups/filter")
958 (string-append "CUPSPPD="
959 (assoc-ref %outputs "ppd") "/share/cups/model")
960 "CACHESIZE=100" ; pages in RAM, ±300 KiB each
961 "THREADS=4") ; compress and print faster
963 (modify-phases %standard-phases
964 (add-after 'unpack 'enter-subdirectory
965 ;; The git repository replicates the top-level SVN layout.
969 (delete 'configure) ; no configure script
970 (add-before 'build 'build-.drv-files
971 (lambda* (#:key make-flags #:allow-other-keys)
972 (apply invoke "make" "drv" make-flags)))
973 (add-after 'install 'install-.drv-files
974 (lambda* (#:key make-flags #:allow-other-keys)
975 (apply invoke "make" "install" "DRV_ONLY=1" make-flags)))
976 (add-after 'install 'compress-PPDs
977 (lambda* (#:key outputs #:allow-other-keys)
978 (let ((ppd (assoc-ref outputs "ppd")))
979 (for-each (cut invoke "gzip" "-9" <>)
980 (find-files ppd "\\.ppd$"))))))
981 #:tests? #f)) ; no test suite
983 `(("cups" ,cups-minimal)
986 (synopsis "QPDL (SPL2) printer driver")
988 "SpliX is a set of CUPS drivers for printers that speak @acronym{QPDL,
989 Quick Page Description Language}, also called @acronym{SPL2, Samsung Printer
990 Language version 2}. These include many laser printers sold by Samsung,
991 Xerox, Lexmark, Toshiba, and Dell.
993 Colour printers need colour profile files to get better results. These
994 @file{cms} files are provided by the printer's manufacturer and must be
995 obtained and installed separately.")
996 (home-page "http://splix.ap2c.org/")
997 (license license:gpl2))))
999 (define-public python-pycups
1001 (name "python-pycups")
1006 (uri (pypi-uri "pycups" version ".tar.bz2"))
1009 "1ffp7sswhdsfpy88zg0cc8kl04wygkjs01rlm9f0spbwk8jhy2c6"))))
1010 (build-system python-build-system)
1012 '(;; Tests require CUPS to be running
1016 (home-page "https://github.com/zdohnal/pycups")
1017 (synopsis "Python bindings for libcups")
1019 "This package provides Python bindings for libcups, wrapping the CUPS
1021 (license license:gpl2+)))