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