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