1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages cups)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages avahi)
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages image)
28 #:use-module (gnu packages fonts) ;font-dejavu
29 #:use-module (gnu packages fontutils)
30 #:use-module (gnu packages ghostscript)
31 #:use-module (gnu packages glib)
32 #:use-module (gnu packages gnutls)
33 #:use-module (gnu packages pdf)
34 #:use-module (gnu packages pkg-config))
36 (define-public cups-filters
43 (string-append "http://openprinting.org/download/cups-filters/"
44 "cups-filters-" version ".tar.xz"))
47 "1bq48nnrarlbf6qc93bz1n5wlh6j420gppbck3r45sinwhz5wa7m"))
48 (modules '((guix build utils)))
50 ;; install backends, banners and filters to cups-filters output
51 ;; directory, not the cups server directory
52 '(substitute* "Makefile.in"
53 (("CUPS_DATADIR = @CUPS_DATADIR@")
54 "CUPS_DATADIR = $(PREFIX)/share/cups")
55 (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)")
56 "pkgcupsserverrootdir = $(PREFIX)")
57 (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend")
58 "pkgbackenddir = $(PREFIX)/backend")
59 (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter")
60 "pkgfilterdir = $(PREFIX)/filter")))))
61 (build-system gnu-build-system)
63 `(#:make-flags (list (string-append "PREFIX=" %output))
65 `(,(string-append "--with-test-font-path="
66 (assoc-ref %build-inputs "font-dejavu")
67 "/share/fonts/truetype/DejaVuSans.ttf")
68 ,(string-append "--with-rcdir="
69 (assoc-ref %outputs "out") "/etc/rc.d"))))
71 `(("pkg-config" ,pkg-config)))
73 `(("fontconfig" ,fontconfig)
74 ("freetype" ,freetype)
75 ("font-dejavu" ,font-dejavu) ;needed by test suite
76 ("ghostscript" ,ghostscript)
80 ("libjpeg-8" ,libjpeg-8)
86 ("cups-minimal" ,cups-minimal)))
87 (home-page "http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups-filters")
88 (synopsis "OpenPrinting CUPS filters and backends")
90 "Contains backends, filters, and other software that was once part of the
91 core CUPS distribution but is no longer maintained by Apple Inc. In addition
92 it contains additional filters developed independently of Apple, especially
93 filters for the PDF-centric printing workflow introduced by OpenPrinting.")
94 ;; Different filters and backends have different licenses; see COPYING for
96 (license (list license:gpl2
103 ;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also
104 ;; depends on CUPS libraries and binaries, cups-minimal has been added to
105 ;; satisfy this dependency.
106 (define-public cups-minimal
108 (name "cups-minimal")
112 (uri (string-append "http://www.cups.org/software/"
113 version "/cups-" version "-source.tar.gz"))
116 "1kbc85kwhm1vyzahblrg3qih9yypggs91d13gdrbnaac8q7jd9jr"))))
117 (build-system gnu-build-system)
120 '("--disable-launchd"
124 ;; Seven tests fail, mostly because of files that are provided by the
125 ;; cups-filters package.
132 (substitute* "Makedefs.in"
133 (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
134 (("/bin/sh") (which "sh"))))
139 (substitute* "test/ippserver.c"
140 (("# else /\\* HAVE_AVAHI \\*/") "#elif defined(HAVE_AVAHI)")))
143 `(("pkg-config" ,pkg-config)))
147 (home-page "http://www.cups.org")
148 (synopsis "The Common Unix Printing System")
150 "CUPS is a printing system that uses the Internet Printing
151 Protocol (IPP). It provides System V and BSD command-line interfaces, as well
152 as a Web interface and a C programming interface to manage printers and print
153 jobs. It supports printing to both local (parallel, serial, USB) and
154 networked printers, and printers can be shared from one computer to another.
155 Internally, CUPS uses PostScript Printer Description (PPD) files to describe
156 printer capabilities and features and a wide variety of generic and
157 device-specific programs to convert and print many types of files.")
158 (license license:gpl2)))
161 (package (inherit cups-minimal)
164 `(;; Three tests fail:
165 ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
166 ;; Get-Jobs Operation"
167 ;; * test of number of error/warning messages, probably related to a
171 '("--disable-launchd"
178 (substitute* "Makedefs.in"
179 (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
180 (("/bin/sh") (which "sh"))))
185 (let ((filters (assoc-ref %build-inputs "cups-filters"))
186 (catpath (string-append
187 (assoc-ref %build-inputs "coreutils") "/bin/"))
188 (testdir (string-append (getcwd) "/tmp/")))
190 (substitute* "test/run-stp-tests.sh"
191 ((" *BASE=/tmp/") (string-append "BASE=" testdir))
193 ;; allow installation of filters from output dir and from
195 (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
198 (assoc-ref %outputs "out") "/lib/cups/filter "
201 ;; check for charsets in cups-filters output
202 (("/usr/share/cups/charsets")
203 (string-append filters "/share/cups/charsets"))
205 ;; install additional required filters
206 (("instfilter texttopdf texttopdf pdf")
208 "instfilter texttopdf texttopdf pdf;"
209 "instfilter imagetoraster imagetoraster raster;"
210 "instfilter gstoraster gstoraster raster;"
211 "instfilter urftopdf urftopdf pdf;"
212 "instfilter rastertopdf rastertopdf pdf;"
213 "instfilter pstopdf pstopdf pdf"))
215 ;; specify location of lpstat binary
216 (("description=\"`lpstat -l")
217 "description=\"`../systemv/lpstat -l")
219 ;; patch shebangs of embedded scripts
220 (("#!/bin/sh") (string-append "#!" (which "sh")))
222 ;; also link mime definitions from cups-filters
223 ;; to enable the additional filters for the test suite
224 (("ln -s \\$root/conf/mime\\.types")
227 "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
228 "ln -s $root/conf/mime.types"))
229 (("ln -s \\$root/conf/mime\\.convs")
232 "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
233 "ln -s $root/conf/mime.convs")))
235 ;; fix search path for "cat"
236 (substitute* "cups/testfile.c"
237 (("cupsFileFind\\(\"cat\", \"/bin\"")
238 (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
239 (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
240 (string-append "cupsFileFind(\"cat\", \"" catpath "\"")))))
243 'install-cups-filters-symlinks
244 (lambda* (#:key inputs outputs #:allow-other-keys)
245 (let ((out (assoc-ref outputs "out"))
246 (cups-filters (assoc-ref inputs "cups-filters")))
249 (string-append cups-filters "/share/cups/charsets")
250 (string-append out "/share/charsets"))
252 ;; mime types, driver file, ppds
255 (symlink (string-append cups-filters f)
256 (string-append out f)))
257 '("/share/cups/mime/cupsfilters.types"
258 "/share/cups/mime/cupsfilters.convs"
259 "/share/cups/drv/cupsfilters.drv"
266 (string-append out "/lib/cups/filter" (basename f))))
267 (find-files (string-append cups-filters "/filter") ".*"))
272 (symlink (string-append cups-filters f)
273 (string-append out "/lib/cups" f)))
274 '("/backend/parallel"
278 (let ((banners "/share/cups/banners"))
279 (delete-file-recursively (string-append out banners))
280 (symlink (string-append cups-filters banners)
281 (string-append out banners)))
284 (let ((data "/share/cups/data"))
285 (delete-file-recursively (string-append out data))
286 (symlink (string-append cups-filters data)
287 (string-append out data)))))
288 %standard-phases)))))
292 ("cups-filters" ,cups-filters)