gnu: hidapi: Fix 'license'.
[jackhill/guix/guix.git] / gnu / packages / ghostscript.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2013, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages ghostscript)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages autotools)
25 #:use-module (gnu packages compression)
26 #:use-module (gnu packages fontutils)
27 #:use-module (gnu packages image)
28 #:use-module (gnu packages perl)
29 #:use-module (gnu packages pkg-config)
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages tcl)
32 #:use-module (gnu packages xorg)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system trivial))
38
39 (define-public lcms
40 (package
41 (name "lcms")
42 (version "2.6")
43 (source (origin
44 (method url-fetch)
45 (uri (string-append "mirror://sourceforge/lcms/lcms/" version
46 "/lcms2-" version ".tar.gz"))
47 (sha256 (base32
48 "1c8lgq8gfs3nyplvbx9k8wzfj6r2bqi3f611vb1m8z3476454wji"))))
49 (build-system gnu-build-system)
50 (inputs `(("libjpeg-8" ,libjpeg-8)
51 ("libtiff" ,libtiff)
52 ("zlib" ,zlib)))
53 (synopsis "Little CMS, a small-footprint colour management engine")
54 (description
55 "Little CMS is a small-footprint colour management engine, with special
56 focus on accuracy and performance. It uses the International Color
57 Consortium standard (ICC), approved as ISO 15076-1.")
58 (license license:x11)
59 (home-page "http://www.littlecms.com/")))
60
61 (define-public libpaper
62 (package
63 (name "libpaper")
64 (version "1.1.24")
65 (source (origin
66 (method url-fetch)
67 (uri (string-append
68 ;; Debian moved their libpaper-1.1.24 to archive.debian.net
69 ;; but in the move the hash of their tarball changed.
70 "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_"
71 version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
72 version ".tar.gz"))
73 (sha256 (base32
74 "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
75 (build-system gnu-build-system)
76 (synopsis "Library for handling paper sizes")
77 (description
78 "The paper library and accompanying files are intended to provide a simple
79 way for applications to take actions based on a system- or user-specified
80 paper size.")
81 (license license:gpl2)
82 (home-page "https://packages.qa.debian.org/libp/libpaper.html")))
83
84 (define-public psutils
85 (package
86 (name "psutils")
87 (version "17")
88 (source (origin
89 (method url-fetch)
90 (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz")
91 (sha256 (base32
92 "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq"))))
93 (build-system gnu-build-system)
94 (inputs `(("perl" ,perl)))
95 (arguments
96 `(#:tests? #f ; none provided
97 #:phases
98 (alist-replace
99 'configure
100 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
101 (let ((perl (assoc-ref inputs "perl"))
102 (out (assoc-ref outputs "out")))
103 (copy-file "Makefile.unix" "Makefile")
104 (substitute* "Makefile"
105 (("/usr/local/bin/perl") (string-append perl "/bin/perl")))
106 (substitute* "Makefile"
107 (("/usr/local") out))
108 ;; for the install phase
109 (substitute* "Makefile"
110 (("-mkdir") "mkdir -p"))
111 ;; drop installation of non-free files
112 (substitute* "Makefile"
113 ((" install.include") ""))))
114 %standard-phases)))
115 (synopsis "Collection of utilities for manipulating PostScript documents")
116 (description
117 "PSUtils is a collection of utilities for manipulating PostScript
118 documents. Programs included are psnup, for placing out several logical pages
119 on a single sheet of paper, psselect, for selecting pages from a document,
120 pstops, for general imposition, psbook, for signature generation for booklet
121 printing, and psresize, for adjusting page sizes.")
122 (license (license:non-copyleft "file://LICENSE"
123 "See LICENSE in the distribution."))
124 (home-page "http://knackered.org/angus/psutils/")))
125
126 (define-public ghostscript
127 (package
128 (name "ghostscript")
129 (version "9.14.0")
130 (replacement ghostscript/fixed)
131 (source (origin
132 (method url-fetch)
133 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
134 version ".tar.xz"))
135 (sha256
136 (base32
137 "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))
138 (patches (search-patches "ghostscript-CVE-2015-3228.patch"
139 "ghostscript-runpath.patch"))
140 (modules '((guix build utils)))
141 (snippet
142 ;; Honor --docdir.
143 '(substitute* "Makefile.in"
144 (("^docdir=.*$") "docdir = @docdir@\n")
145 (("^exdir=.*$") "exdir = $(docdir)/examples\n")))))
146 (build-system gnu-build-system)
147 (outputs '("out" "doc")) ;16 MiB of HTML/PS doc + examples
148 (inputs `(("freetype" ,freetype)
149 ("lcms" ,lcms)
150 ("libjpeg-8" ,libjpeg-8)
151 ("libpng" ,libpng)
152 ("libpaper" ,libpaper)
153 ("libtiff" ,libtiff)
154 ("zlib" ,zlib)))
155 (native-inputs
156 `(("perl" ,perl)
157 ("pkg-config" ,pkg-config) ; needed to find libtiff
158 ("python" ,python-wrapper)
159 ("tcl" ,tcl)))
160 (arguments
161 `(#:disallowed-references ("doc")
162 #:phases
163 (modify-phases %standard-phases
164 (add-after 'configure 'patch-config-files
165 (lambda _
166 (substitute* "base/all-arch.mak"
167 (("/bin/sh") (which "bash")))
168 (substitute* "base/unixhead.mak"
169 (("/bin/sh") (which "bash")))))
170 (add-after 'configure 'remove-doc-reference
171 (lambda _
172 ;; Don't retain a reference to the 'doc' output in 'gs'.
173 ;; The only use of this definition is in the output of
174 ;; 'gs --help', so this change is fine.
175 (substitute* "base/gscdef.c"
176 (("GS_DOCDIR")
177 "\"~/.guix-profile/share/doc/ghostscript\""))))
178 (replace 'build
179 (lambda _
180 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
181 ;; binary (saves 18 MiB).
182 (zero? (system* "make" "so" "-j"
183 (number->string (parallel-job-count))))))
184 (replace 'install
185 (lambda _
186 (zero? (system* "make" "soinstall")))))))
187 (synopsis "PostScript and PDF interpreter")
188 (description
189 "Ghostscript is an interpreter for the PostScript language and the PDF
190 file format. It also includes a C library that implements the graphics
191 capabilities of the PostScript language. It supports a wide variety of
192 output file formats and printers.")
193 (license license:agpl3+)
194 (home-page "http://www.gnu.org/software/ghostscript/")
195 (properties '((upstream-name . "gnu-ghostscript")))))
196
197 (define ghostscript/fixed
198 (package
199 (inherit ghostscript)
200 (replacement #f) ; Prevent ghostscript/x from inheriting the replacement
201 (source (origin
202 (inherit (package-source ghostscript))
203 (patches (search-patches "ghostscript-CVE-2013-5653.patch"
204 "ghostscript-CVE-2015-3228.patch"
205 "ghostscript-CVE-2016-7976.patch"
206 "ghostscript-CVE-2016-7978.patch"
207 "ghostscript-CVE-2016-7979.patch"
208 "ghostscript-CVE-2016-8602.patch"
209 "ghostscript-runpath.patch"))))))
210
211 (define-public ghostscript/x
212 (package (inherit ghostscript/fixed)
213 (name (string-append (package-name ghostscript) "-with-x"))
214 (inputs `(("libxext" ,libxext)
215 ("libxt" ,libxt)
216 ,@(package-inputs ghostscript)))))
217
218 (define (ghostscript-wrapper name ghostscript)
219 ;; Return a GHOSTSCRIPT wrapper that provides the 'gs' command.
220 ;; See <https://lists.gnu.org/archive/html/guix-devel/2016-07/msg00987.html>.
221 (package
222 (name name)
223 (version (package-version ghostscript))
224 (source #f)
225 (build-system trivial-build-system)
226 (inputs `(("ghostscript" ,ghostscript)))
227 (arguments
228 `(#:modules ((guix build utils))
229 #:builder (begin
230 (use-modules (guix build utils))
231
232 (let* ((out (assoc-ref %outputs "out"))
233 (bin (string-append out "/bin"))
234 (gs (assoc-ref %build-inputs "ghostscript")))
235 (mkdir-p bin)
236 (with-directory-excursion bin
237 (symlink (string-append gs "/bin/gsc") "gs")
238 #t)))))
239 (synopsis "Wrapper providing Ghostscript's 'gs' command")
240 (description
241 "This package provides the @command{gs} command, which used to be
242 provided by Ghostscript itself and no longer is.")
243 (license (package-license ghostscript))
244 (home-page (package-home-page ghostscript))))
245
246 (define-public ghostscript-gs
247 (ghostscript-wrapper "ghostscript-gs" ghostscript))
248
249 (define-public ghostscript-gs/x
250 (ghostscript-wrapper "ghostscript-gs-with-x" ghostscript/x))
251
252 (define-public ijs
253 (package
254 (name "ijs")
255 (version "9.14.0")
256 (source (origin
257 (method url-fetch)
258 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
259 version ".tar.xz"))
260 (sha256 (base32
261 "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))))
262 (build-system gnu-build-system)
263 (native-inputs
264 `(("libtool" ,libtool)
265 ("automake" ,automake)
266 ("autoconf" ,autoconf)))
267 (arguments
268 `(#:phases
269 (alist-cons-after
270 'unpack 'autogen
271 (lambda _
272 ;; need to regenerate macros
273 (system* "autoreconf" "-if")
274 ;; do not run configure
275 (substitute* "autogen.sh"
276 (("^.*\\$srcdir/configure.*") ""))
277 (system* "bash" "autogen.sh")
278
279 ;; create configure script in ./ijs/
280 (chdir "ijs")
281 ;; do not run configure
282 (substitute* "autogen.sh"
283 (("^.*\\$srcdir/configure.*") "")
284 (("^ + && echo Now type.*$") ""))
285 (zero? (system* "bash" "autogen.sh")))
286 %standard-phases)))
287 (synopsis "IJS driver framework for inkjet and other raster devices")
288 (description
289 "IJS is a protocol for transmission of raster page images. This package
290 provides the reference implementation of the raster printer driver
291 architecture.")
292 (license license:expat)
293 (home-page "http://www.gnu.org/software/ghostscript/")))
294
295 (define-public gs-fonts
296 (package
297 (name "gs-fonts")
298 (version "8.11")
299 (source (origin
300 (method url-fetch)
301 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
302 version
303 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
304 version
305 ".tar.gz"))
306 (sha256 (base32
307 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
308 (build-system gnu-build-system)
309 (arguments
310 `(#:tests? #f ; nothing to check, just files to copy
311 #:modules ((guix build gnu-build-system)
312 (guix build utils)
313 (srfi srfi-1)) ; for alist-delete
314 #:phases
315 (alist-delete
316 'configure
317 (alist-delete
318 'build
319 (alist-replace
320 'install
321 (lambda* (#:key outputs #:allow-other-keys)
322 (let* ((out (assoc-ref outputs "out"))
323 (dir (string-append out "/share/fonts/type1/ghostscript")))
324 (mkdir-p dir)
325 (for-each
326 (lambda (file)
327 (copy-file file (string-append dir "/" file)))
328 (find-files "." "pfb|afm"))))
329 %standard-phases)))))
330 (synopsis "Free replacements for the PostScript fonts")
331 (description
332 "Ghostscript fonts provides fonts and font metrics customarily distributed with
333 Ghostscript. It currently includes the 35 standard PostScript fonts.")
334 (license license:gpl2)
335 (home-page "http://sourceforge.net/projects/gs-fonts/")))
336
337 (define-public libspectre
338 (package
339 (name "libspectre")
340 (version "0.2.7")
341 (source (origin
342 (method url-fetch)
343 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
344 version ".tar.gz"))
345 (sha256 (base32
346 "1v63lqc6bhhxwkpa43qmz8phqs8ci4dhzizyy16d3vkb20m846z8"))))
347 (build-system gnu-build-system)
348 (inputs `(("ghostscript" ,ghostscript)))
349 (native-inputs `(("pkg-config" ,pkg-config)))
350 (synopsis "Postscript rendering library")
351 (description
352 "libspectre is a small library for rendering Postscript documents.
353 It provides a convenient easy to use API for handling and rendering
354 Postscript documents.")
355 (license license:gpl2+)
356 (home-page "http://www.freedesktop.org/wiki/Software/libspectre")))