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