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) |
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 | |
161 | core CUPS distribution but is no longer maintained by Apple Inc. In addition | |
162 | it contains additional filters developed independently of Apple, especially | |
163 | filters 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 |
232 | as a Web interface and a C programming interface to manage printers and print |
233 | jobs. It supports printing to both local (parallel, serial, USB) and | |
234 | networked printers, and printers can be shared from one computer to another. | |
9ced1033 TGR |
235 | Internally, CUPS uses PostScript Printer Description (@dfn{PPD}) files to |
236 | describe printer capabilities and features, and a wide variety of generic and | |
51002318 RW |
237 | device-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") | |
b17004f9 | 399 | (version "3.18.9") |
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 | |
b17004f9 | 406 | "0g3q5mm2crjyc1z4z6gv4lam6sc5d3diz704djrnpqadk4q3h290")) |
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") | |
b17004f9 TGR |
431 | ,(string-append "LDFLAGS=-Wl,-rpath=" |
432 | (assoc-ref %outputs "out") "/lib") | |
2b56dc01 DM |
433 | ;; Disable until mime.types merging works (FIXME). |
434 | "--disable-fax-build" | |
435 | "--enable-hpcups-install" | |
436 | "--enable-new-hpcups" | |
437 | "--enable-cups_ppd_install" | |
438 | "--enable-cups_drv_install" | |
439 | ;; TODO add foomatic drv install eventually. | |
440 | ;; TODO --enable-policykit eventually. | |
441 | ,(string-append "--with-cupsfilterdir=" | |
442 | (assoc-ref %outputs "out") "/lib/cups/filter") | |
443 | ,(string-append "--with-cupsbackenddir=" | |
444 | (assoc-ref %outputs "out") "/lib/cups/backend") | |
445 | ,(string-append "--with-icondir=" | |
446 | (assoc-ref %outputs "out") "/share/applications") | |
447 | ,(string-append "--with-systraydir=" | |
407ef4b3 TGR |
448 | (assoc-ref %outputs "out") "/etc/xdg") |
449 | "--enable-qt5" "--disable-qt4") | |
2b56dc01 DM |
450 | |
451 | #:imported-modules ((guix build python-build-system) | |
452 | ,@%gnu-build-system-modules) | |
453 | #:modules ((guix build gnu-build-system) | |
454 | (guix build utils) | |
455 | ((guix build python-build-system) #:prefix python:)) | |
456 | ||
457 | #:phases (modify-phases %standard-phases | |
458 | (add-after 'unpack 'fix-hard-coded-file-names | |
459 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
460 | (let ((out (assoc-ref outputs "out")) | |
461 | ;; FIXME: use merged ppds (I think actually only | |
462 | ;; drvs need to be merged). | |
463 | (cupsdir (assoc-ref inputs "cups-minimal"))) | |
464 | (substitute* "base/g.py" | |
465 | (("'/usr/share;[^']*'") | |
466 | (string-append "'" cupsdir "/share'")) | |
467 | (("'/etc/hp/hplip.conf'") | |
468 | (string-append "'" out | |
469 | "/etc/hp/hplip.conf" "'"))) | |
470 | ||
471 | (substitute* "Makefile.in" | |
472 | (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ") | |
473 | ;; FIXME Use beginning-of-word in regexp. | |
474 | (("[[:blank:]]plugin\\.py[[:blank:]]") " ") | |
475 | (("/usr/include/libusb-1.0") | |
476 | (string-append (assoc-ref inputs "libusb") | |
477 | "/include/libusb-1.0")) | |
86c979b7 LC |
478 | (("hplip_statedir =.*$") |
479 | ;; Don't bail out while trying to create | |
480 | ;; /var/lib/hplip. We can safely change its value | |
481 | ;; here because it's hard-coded in the code anyway. | |
482 | "hplip_statedir = $(prefix)\n") | |
2b56dc01 DM |
483 | (("hplip_confdir = /etc/hp") |
484 | ;; This is only used for installing the default config. | |
485 | (string-append "hplip_confdir = " out | |
486 | "/etc/hp")) | |
487 | (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor") | |
407ef4b3 | 488 | ;; We don't use hal. |
2b56dc01 DM |
489 | (string-append "halpredir = " out |
490 | "/share/hal/fdi/preprobe/10osvendor")) | |
491 | (("rulesdir = /etc/udev/rules.d") | |
492 | ;; udev rules will be merged by base service. | |
493 | (string-append "rulesdir = " out | |
494 | "/lib/udev/rules.d")) | |
495 | (("rulessystemdir = /usr/lib/systemd/system") | |
496 | ;; We don't use systemd. | |
497 | (string-append "rulessystemdir = " out | |
498 | "/lib/systemd/system")) | |
499 | (("/etc/sane.d") | |
500 | (string-append out "/etc/sane.d")))))) | |
501 | ||
407ef4b3 | 502 | ;; Wrap bin/* so that the Python libraries are found. |
2b56dc01 DM |
503 | (add-after 'install 'wrap-binaries |
504 | (assoc-ref python:%standard-phases 'wrap))))) | |
505 | ||
407ef4b3 TGR |
506 | ;; Note that the error messages printed by the tools in the case of |
507 | ;; missing dependencies are often downright misleading. | |
508 | ;; TODO: hp-toolbox still fails to start with: | |
509 | ;; from dbus.mainloop.pyqt5 import DBusQtMainLoop | |
510 | ;; ModuleNotFoundError: No module named 'dbus.mainloop.pyqt5' | |
511 | (inputs | |
512 | `(("cups-minimal" ,cups-minimal) | |
513 | ("dbus" ,dbus) | |
514 | ("libjpeg" ,libjpeg) | |
515 | ("libusb" ,libusb) | |
516 | ("python" ,python) | |
517 | ("python-dbus" ,python-dbus) | |
518 | ("python-pygobject" ,python-pygobject) | |
519 | ("python-pyqt" ,python-pyqt) | |
520 | ("python-wrapper" ,python-wrapper) | |
521 | ("sane-backends" ,sane-backends-minimal) | |
522 | ("zlib" ,zlib))) | |
523 | (native-inputs | |
524 | `(("perl" ,perl) | |
525 | ("pkg-config" ,pkg-config))))) | |
d02aabaf | 526 | |
8e189596 EF |
527 | (define-public hplip-minimal |
528 | (package | |
529 | (inherit hplip) | |
530 | (name "hplip-minimal") | |
531 | (arguments | |
532 | (substitute-keyword-arguments (package-arguments hplip) | |
533 | ((#:configure-flags cf) | |
9a1356f7 | 534 | `(delete "--enable-qt5" ,cf)))) |
8e189596 | 535 | (inputs |
9a1356f7 MB |
536 | (fold alist-delete (package-inputs hplip) |
537 | '("python-pygobject" "python-pyqt"))) | |
8e189596 EF |
538 | (synopsis "GUI-less version of hplip"))) |
539 | ||
d02aabaf LC |
540 | (define-public foomatic-filters |
541 | (package | |
542 | (name "foomatic-filters") | |
4bd05a21 | 543 | (version "4.0.17") |
d02aabaf LC |
544 | (source (origin |
545 | (method url-fetch) | |
546 | (uri (string-append | |
547 | "http://www.openprinting.org/download/foomatic/" | |
548 | name "-" version ".tar.gz")) | |
549 | (sha256 | |
550 | (base32 | |
4bd05a21 | 551 | "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2")) |
d02aabaf LC |
552 | (patches |
553 | (search-patches "foomatic-filters-CVE-2015-8327.patch" | |
554 | "foomatic-filters-CVE-2015-8560.patch")))) | |
555 | (build-system gnu-build-system) | |
556 | (home-page | |
557 | "https://wiki.linuxfoundation.org/openprinting/database/foomatic") | |
558 | (native-inputs | |
559 | `(("perl" ,perl) | |
560 | ("pkg-config" ,pkg-config))) | |
561 | (inputs | |
562 | `(("dbus" ,dbus) | |
563 | ("a2ps" ,a2ps))) | |
564 | (arguments | |
565 | '( ;; Specify the installation directories. | |
566 | #:configure-flags (list (string-append "ac_cv_path_CUPS_BACKENDS=" | |
567 | (assoc-ref %outputs "out") | |
568 | "/lib/cups/backend") | |
569 | (string-append "ac_cv_path_CUPS_FILTERS=" | |
570 | (assoc-ref %outputs "out") | |
571 | "/lib/cups/filter") | |
572 | (string-append "ac_cv_path_PPR_INTERFACES=" | |
573 | (assoc-ref %outputs "out") | |
574 | "/lib/ppr/interfaces") | |
575 | (string-append "ac_cv_path_PPR_LIB=" | |
576 | (assoc-ref %outputs "out") | |
577 | "/lib/ppr/lib") | |
578 | ||
579 | ;; For some reason these are misdiagnosed. | |
580 | "ac_cv_func_malloc_0_nonnull=yes" | |
581 | "ac_cv_func_realloc_0_nonnull=yes") | |
582 | #:test-target "tests")) | |
583 | (synopsis "Convert PostScript to the printer's native format") | |
584 | (description | |
585 | "This package contains filter scripts used by the printer spoolers to | |
586 | convert the incoming PostScript data into the printer's native format using a | |
587 | printer/driver specific, but spooler-independent PPD file.") | |
588 | (license license:gpl2+))) | |
5db0a1cd LC |
589 | |
590 | (define-public foo2zjs | |
591 | (package | |
5db0a1cd | 592 | (name "foo2zjs") |
f6a4d57e | 593 | (version "20180910") |
5db0a1cd LC |
594 | (source (origin |
595 | (method url-fetch) | |
596 | ;; XXX: This is an unversioned URL! | |
597 | (uri "http://foo2zjs.rkkda.com/foo2zjs.tar.gz") | |
598 | (sha256 | |
599 | (base32 | |
f6a4d57e | 600 | "1clddqy4y4vvws0lllv1v90dfiihihdc23bn93c544yb3fvmwmr6")))) |
5db0a1cd LC |
601 | (build-system gnu-build-system) |
602 | (arguments | |
603 | '(#:phases (modify-phases %standard-phases | |
604 | (replace 'configure | |
605 | (lambda* (#:key outputs #:allow-other-keys) | |
606 | (substitute* (find-files "." "^Makefile$") | |
607 | ;; Set the installation directory. | |
608 | (("^PREFIX[[:blank:]]*=.*$") | |
609 | (string-append "PREFIX = " | |
610 | (assoc-ref outputs "out") | |
611 | "\n")) | |
612 | (("^UDEVBIN[[:blank:]]*=.*$") | |
613 | "UDEVBIN = $(PREFIX)/bin\n") | |
614 | ;; Don't try to chown/chgrp the installed files. | |
615 | (("-oroot") | |
616 | "") | |
617 | (("-glp") | |
618 | "") | |
619 | ;; Placate the dependency checks. | |
620 | (("/usr/include/stdio.h") | |
621 | "/etc/passwd") | |
622 | (("/usr/") | |
623 | "$(PREFIX)/") | |
624 | ;; Ensure fixed timestamps in man pages. | |
625 | (("^MODTIME[[:blank:]]*=.*$") | |
626 | "MODTIME = echo Thu Jan 01 01:00:00 1970\n")) | |
627 | #t)) | |
628 | (add-after 'install 'remove-pdf | |
629 | (lambda* (#:key outputs #:allow-other-keys) | |
630 | ;; Remove 'manual.pdf' which is (1) useless (it's a | |
631 | ;; concatenation of man pages), and (2) not | |
632 | ;; bit-reproducible due to <https://bugs.gnu.org/27593>. | |
633 | (let ((out (assoc-ref outputs "out"))) | |
634 | (for-each delete-file | |
635 | (find-files out "^manual\\.pdf$")) | |
636 | #t)))) | |
637 | #:parallel-build? #f ;broken makefile | |
638 | #:tests? #f ;no tests | |
639 | #:make-flags '("CC=gcc"))) | |
640 | (inputs | |
641 | `(("ghostscript" ,ghostscript) | |
642 | ("foomatic-filters" ,foomatic-filters))) ;for 'foomatic-rip' | |
643 | (native-inputs | |
644 | `(("bc" ,bc) | |
645 | ("groff" ,groff))) | |
0a7d3e1e TGR |
646 | (home-page "http://foo2zjs.rkkda.com/") |
647 | (synopsis "Printer driver for ZjStream-based printers") | |
5db0a1cd | 648 | (description |
0a7d3e1e TGR |
649 | "foo2zjs is a printer driver for printers that use the Zenographics |
650 | ZjStream wire protocol for their print data, often erroneously referred to as | |
651 | winprinters or GDI printers. | |
652 | ||
653 | It supports Minolta/QMS@tie{}Magicolor, Minolta@tie{}Color@tie{}PageWorks/Pro, | |
654 | HP@tie{}LaserJet, and possibly other printers. See @file{README} for details.") | |
655 | (license (list license:expat ; icc2ps/*.[ch] | |
656 | license:gpl2+)))) ; everything else | |
011f5769 DNB |
657 | |
658 | (define-public escpr | |
659 | (package | |
660 | (name "escpr") | |
ff30bb01 | 661 | (version "1.6.30") |
011f5769 DNB |
662 | ;; XXX: This currently works. But it will break as soon as a newer |
663 | ;; version is available since the URLs for older versions are not | |
664 | ;; preserved. An alternative source will be added as soon as | |
665 | ;; available. | |
666 | (source (origin | |
667 | (method url-fetch) | |
668 | ;; The uri has to be chopped up in order to satisfy guix lint. | |
ff30bb01 DNB |
669 | (uri (string-append "https://download3.ebz.epson.net/dsc/f/03/00/08/18/20/" |
670 | "e94de600e28e510c1cfa158929d8b2c0aadc8aa0/" | |
671 | "epson-inkjet-printer-escpr-1.6.30-1lsb3.2.tar.gz")) | |
011f5769 DNB |
672 | (sha256 |
673 | (base32 | |
ff30bb01 | 674 | "0m8pyfkixisp0vclwxj340isn15zzisal0v2xvv66kxfd68dzf12")))) |
011f5769 DNB |
675 | (build-system gnu-build-system) |
676 | (arguments | |
677 | `(#:configure-flags | |
678 | `(,(string-append "--prefix=" | |
679 | (assoc-ref %outputs "out")) | |
680 | ,(string-append "--with-cupsfilterdir=" | |
681 | (assoc-ref %outputs "out") "/lib/cups/filter") | |
682 | ,(string-append "--with-cupsppddir=" | |
683 | (assoc-ref %outputs "out") "/share/ppd")))) | |
684 | (inputs `(("cups" ,cups-minimal))) | |
685 | (synopsis "ESC/P-R printer driver") | |
686 | (description | |
687 | "This package provides a filter for the Common UNIX Printing | |
688 | System (CUPS). It offers high-quality printing with Seiko Epson color ink jet | |
689 | printers. It can only be used with printers that support the Epson ESC/P-R | |
690 | language.") | |
691 | (home-page "http://download.ebz.epson.net/dsc/search/01/search") | |
692 | (license license:gpl2+))) |