gnu: Rename module gnutls to tls.
[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>
ef2f51a4 3;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
51002318
RW
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages cups)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages avahi)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages image)
29 #:use-module (gnu packages fonts) ;font-dejavu
30 #:use-module (gnu packages fontutils)
31 #:use-module (gnu packages ghostscript)
32 #:use-module (gnu packages glib)
51002318 33 #:use-module (gnu packages pdf)
a7fd7b68
AE
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages tls))
51002318
RW
36
37(define-public cups-filters
38 (package
39 (name "cups-filters")
e4c9d9bb 40 (version "1.0.68")
51002318
RW
41 (source (origin
42 (method url-fetch)
43 (uri
44 (string-append "http://openprinting.org/download/cups-filters/"
45 "cups-filters-" version ".tar.xz"))
46 (sha256
47 (base32
e4c9d9bb 48 "0dx4assqzqdi0q4j7z5s7xzzvzxnd5c1njd9139a1h353qrcr5fi"))
51002318
RW
49 (modules '((guix build utils)))
50 (snippet
51 ;; install backends, banners and filters to cups-filters output
52 ;; directory, not the cups server directory
53 '(substitute* "Makefile.in"
54 (("CUPS_DATADIR = @CUPS_DATADIR@")
55 "CUPS_DATADIR = $(PREFIX)/share/cups")
56 (("pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\)")
57 "pkgcupsserverrootdir = $(PREFIX)")
ef2f51a4
LC
58 ;; Choose standard directories notably so that binaries are
59 ;; stripped.
51002318 60 (("pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend")
ef2f51a4 61 "pkgbackenddir = $(PREFIX)/lib/cups/backend")
51002318 62 (("pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter")
ef2f51a4 63 "pkgfilterdir = $(PREFIX)/lib/cups/filter")))))
51002318
RW
64 (build-system gnu-build-system)
65 (arguments
66 `(#:make-flags (list (string-append "PREFIX=" %output))
67 #:configure-flags
68 `(,(string-append "--with-test-font-path="
69 (assoc-ref %build-inputs "font-dejavu")
70 "/share/fonts/truetype/DejaVuSans.ttf")
71 ,(string-append "--with-rcdir="
72 (assoc-ref %outputs "out") "/etc/rc.d"))))
73 (native-inputs
74 `(("pkg-config" ,pkg-config)))
75 (inputs
76 `(("fontconfig" ,fontconfig)
77 ("freetype" ,freetype)
78 ("font-dejavu" ,font-dejavu) ;needed by test suite
79 ("ghostscript" ,ghostscript)
80 ("ijs" ,ijs)
81 ("dbus" ,dbus)
82 ("lcms" ,lcms)
83 ("libjpeg-8" ,libjpeg-8)
84 ("libpng" ,libpng)
85 ("libtiff" ,libtiff)
86 ("glib" ,glib)
87 ("qpdf" ,qpdf)
88 ("poppler" ,poppler)
89 ("cups-minimal" ,cups-minimal)))
90 (home-page "http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups-filters")
91 (synopsis "OpenPrinting CUPS filters and backends")
92 (description
93 "Contains backends, filters, and other software that was once part of the
94core CUPS distribution but is no longer maintained by Apple Inc. In addition
95it contains additional filters developed independently of Apple, especially
96filters for the PDF-centric printing workflow introduced by OpenPrinting.")
97 ;; Different filters and backends have different licenses; see COPYING for
98 ;; details
99 (license (list license:gpl2
100 license:gpl2+
101 license:gpl3
102 license:gpl3+
103 license:lgpl2.0+
104 license:expat))))
105
106;; CUPS on non-MacOS systems requires cups-filters. Since cups-filters also
107;; depends on CUPS libraries and binaries, cups-minimal has been added to
108;; satisfy this dependency.
109(define-public cups-minimal
110 (package
111 (name "cups-minimal")
e51943f8 112 (version "2.0.3")
51002318
RW
113 (source (origin
114 (method url-fetch)
115 (uri (string-append "http://www.cups.org/software/"
116 version "/cups-" version "-source.tar.gz"))
117 (sha256
118 (base32
e51943f8 119 "1kq1kpny0hghqgbjvashlv6qw1xn0c1p3d4r3cx8qxdzd2ifk4lf"))))
51002318
RW
120 (build-system gnu-build-system)
121 (arguments
122 `(#:configure-flags
123 '("--disable-launchd"
124 "--disable-systemd"
125 "--disable-avahi"
126 "--disable-dnssd")
127 ;; Seven tests fail, mostly because of files that are provided by the
128 ;; cups-filters package.
129 #:tests? #f
130 #:phases
131 (alist-cons-before
132 'configure
133 'patch-makedefs
134 (lambda _
135 (substitute* "Makedefs.in"
136 (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
137 (("/bin/sh") (which "sh"))))
138 (alist-cons-before
139 'build
140 'patch-tests
141 (lambda _
142 (substitute* "test/ippserver.c"
143 (("# else /\\* HAVE_AVAHI \\*/") "#elif defined(HAVE_AVAHI)")))
144 %standard-phases))))
145 (native-inputs
146 `(("pkg-config" ,pkg-config)))
147 (inputs
148 `(("zlib" ,zlib)
149 ("gnutls" ,gnutls)))
150 (home-page "http://www.cups.org")
151 (synopsis "The Common Unix Printing System")
152 (description
153 "CUPS is a printing system that uses the Internet Printing
154Protocol (IPP). It provides System V and BSD command-line interfaces, as well
155as a Web interface and a C programming interface to manage printers and print
156jobs. It supports printing to both local (parallel, serial, USB) and
157networked printers, and printers can be shared from one computer to another.
158Internally, CUPS uses PostScript Printer Description (PPD) files to describe
159printer capabilities and features and a wide variety of generic and
160device-specific programs to convert and print many types of files.")
161 (license license:gpl2)))
162
163(define-public cups
164 (package (inherit cups-minimal)
165 (name "cups")
166 (arguments
167 `(;; Three tests fail:
168 ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
169 ;; Get-Jobs Operation"
170 ;; * test of number of error/warning messages, probably related to a
171 ;; missing font.
172 #:tests? #f
173 #:configure-flags
174 '("--disable-launchd"
175 "--disable-systemd")
176 #:phases
177 (alist-cons-before
178 'configure
179 'patch-makedefs
180 (lambda _
181 (substitute* "Makedefs.in"
182 (("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@")
183 (("/bin/sh") (which "sh"))))
184 (alist-cons-before
185 'check
186 'patch-tests
187 (lambda _
188 (let ((filters (assoc-ref %build-inputs "cups-filters"))
189 (catpath (string-append
190 (assoc-ref %build-inputs "coreutils") "/bin/"))
191 (testdir (string-append (getcwd) "/tmp/")))
192 (mkdir testdir)
193 (substitute* "test/run-stp-tests.sh"
194 ((" *BASE=/tmp/") (string-append "BASE=" testdir))
195
196 ;; allow installation of filters from output dir and from
197 ;; cups-filters
198 (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
199 (string-append
200 "for dir in "
201 (assoc-ref %outputs "out") "/lib/cups/filter "
ef2f51a4 202 filters "/lib/cups/filter"))
51002318
RW
203
204 ;; check for charsets in cups-filters output
205 (("/usr/share/cups/charsets")
206 (string-append filters "/share/cups/charsets"))
207
208 ;; install additional required filters
209 (("instfilter texttopdf texttopdf pdf")
210 (string-append
211 "instfilter texttopdf texttopdf pdf;"
212 "instfilter imagetoraster imagetoraster raster;"
213 "instfilter gstoraster gstoraster raster;"
214 "instfilter urftopdf urftopdf pdf;"
215 "instfilter rastertopdf rastertopdf pdf;"
216 "instfilter pstopdf pstopdf pdf"))
217
218 ;; specify location of lpstat binary
219 (("description=\"`lpstat -l")
220 "description=\"`../systemv/lpstat -l")
221
222 ;; patch shebangs of embedded scripts
223 (("#!/bin/sh") (string-append "#!" (which "sh")))
224
225 ;; also link mime definitions from cups-filters
226 ;; to enable the additional filters for the test suite
227 (("ln -s \\$root/conf/mime\\.types")
228 (string-append
229 "ln -s " filters
230 "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
231 "ln -s $root/conf/mime.types"))
232 (("ln -s \\$root/conf/mime\\.convs")
233 (string-append
234 "ln -s " filters
235 "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
236 "ln -s $root/conf/mime.convs")))
237
238 ;; fix search path for "cat"
239 (substitute* "cups/testfile.c"
240 (("cupsFileFind\\(\"cat\", \"/bin\"")
241 (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
242 (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
243 (string-append "cupsFileFind(\"cat\", \"" catpath "\"")))))
244 (alist-cons-after
245 'install
246 'install-cups-filters-symlinks
247 (lambda* (#:key inputs outputs #:allow-other-keys)
248 (let ((out (assoc-ref outputs "out"))
249 (cups-filters (assoc-ref inputs "cups-filters")))
250 ;; charsets
251 (symlink
252 (string-append cups-filters "/share/cups/charsets")
253 (string-append out "/share/charsets"))
254
255 ;; mime types, driver file, ppds
256 (for-each
257 (lambda (f)
258 (symlink (string-append cups-filters f)
259 (string-append out f)))
260 '("/share/cups/mime/cupsfilters.types"
261 "/share/cups/mime/cupsfilters.convs"
262 "/share/cups/drv/cupsfilters.drv"
263 "/share/ppd"))
264
265 ;; filters
266 (for-each
267 (lambda (f)
268 (symlink f
269 (string-append out "/lib/cups/filter" (basename f))))
ef2f51a4 270 (find-files (string-append cups-filters "/lib/cups/filter")))
51002318
RW
271
272 ;; backends
273 (for-each
274 (lambda (f)
275 (symlink (string-append cups-filters f)
ef2f51a4
LC
276 (string-append out "/lib/cups/backend/"
277 (basename f))))
278 '("/lib/cups/backend/parallel"
279 "/lib/cups/backend/serial"))
51002318
RW
280
281 ;; banners
282 (let ((banners "/share/cups/banners"))
283 (delete-file-recursively (string-append out banners))
284 (symlink (string-append cups-filters banners)
285 (string-append out banners)))
286
287 ;; assorted data
288 (let ((data "/share/cups/data"))
289 (delete-file-recursively (string-append out data))
290 (symlink (string-append cups-filters data)
291 (string-append out data)))))
292 %standard-phases)))))
293 (inputs
294 `(("avahi" ,avahi)
295 ("gnutls" ,gnutls)
296 ("cups-filters" ,cups-filters)
297 ("zlib" ,zlib)))))