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 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 (source (origin
135 (method url-fetch)
136 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
137 version ".tar.xz"))
138 (sha256
139 (base32
140 "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))
141 (patches (search-patches "ghostscript-CVE-2013-5653.patch"
142 "ghostscript-CVE-2015-3228.patch"
143 "ghostscript-CVE-2016-7976.patch"
144 "ghostscript-CVE-2016-7978.patch"
145 "ghostscript-CVE-2016-7979.patch"
146 "ghostscript-CVE-2016-8602.patch"
147 "ghostscript-runpath.patch"))
148 (modules '((guix build utils)))
149 (snippet
150 ;; Honor --docdir.
151 '(substitute* "Makefile.in"
152 (("^docdir=.*$") "docdir = @docdir@\n")
153 (("^exdir=.*$") "exdir = $(docdir)/examples\n")))))
154 (build-system gnu-build-system)
155 (outputs '("out" "doc")) ;16 MiB of HTML/PS doc + examples
156 (inputs `(("freetype" ,freetype)
157 ("lcms" ,lcms)
158 ("libjpeg-8" ,libjpeg-8)
159 ("libpng" ,libpng)
160 ("libpaper" ,libpaper)
161 ("libtiff" ,libtiff)
162 ("zlib" ,zlib)))
163 (native-inputs
164 `(("perl" ,perl)
165 ("pkg-config" ,pkg-config) ; needed to find libtiff
166 ("python" ,python-wrapper)
167 ("tcl" ,tcl)))
168 (arguments
169 `(#:disallowed-references ("doc")
170 #:phases
171 (modify-phases %standard-phases
172 (add-after 'configure 'patch-config-files
173 (lambda _
174 (substitute* "base/all-arch.mak"
175 (("/bin/sh") (which "sh")))
176 (substitute* "base/unixhead.mak"
177 (("/bin/sh") (which "sh")))))
178 (add-after 'configure 'remove-doc-reference
179 (lambda _
180 ;; Don't retain a reference to the 'doc' output in 'gs'.
181 ;; The only use of this definition is in the output of
182 ;; 'gs --help', so this change is fine.
183 (substitute* "base/gscdef.c"
184 (("GS_DOCDIR")
185 "\"~/.guix-profile/share/doc/ghostscript\""))))
186 (replace 'build
187 (lambda _
188 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
189 ;; binary (saves 18 MiB).
190 (zero? (system* "make" "so" "-j"
191 (number->string (parallel-job-count))))))
192 (replace 'install
193 (lambda _
194 (zero? (system* "make" "soinstall"))))
195 (add-after 'install 'create-gs-symlink
196 (lambda* (#:key outputs #:allow-other-keys)
197 (let ((out (assoc-ref outputs "out")))
198 ;; some programs depend on having a 'gs' binary available
199 (symlink "gsc" (string-append out "/bin/gs"))))))))
200 (synopsis "PostScript and PDF interpreter")
201 (description
202 "Ghostscript is an interpreter for the PostScript language and the PDF
203 file format. It also includes a C library that implements the graphics
204 capabilities of the PostScript language. It supports a wide variety of
205 output file formats and printers.")
206 (license license:agpl3+)
207 (home-page "http://www.gnu.org/software/ghostscript/")
208 (properties '((upstream-name . "gnu-ghostscript")))))
209
210 (define-public ghostscript/x
211 (package (inherit ghostscript)
212 (name (string-append (package-name ghostscript) "-with-x"))
213 (inputs `(("libxext" ,libxext)
214 ("libxt" ,libxt)
215 ,@(package-inputs ghostscript)))))
216
217 (define-public ijs
218 (package
219 (name "ijs")
220 (version "9.14.0")
221 (source (origin
222 (method url-fetch)
223 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
224 version ".tar.xz"))
225 (sha256 (base32
226 "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))))
227 (build-system gnu-build-system)
228 (native-inputs
229 `(("libtool" ,libtool)
230 ("automake" ,automake)
231 ("autoconf" ,autoconf)))
232 (arguments
233 `(#:phases
234 (alist-cons-after
235 'unpack 'autogen
236 (lambda _
237 ;; need to regenerate macros
238 (system* "autoreconf" "-if")
239 ;; do not run configure
240 (substitute* "autogen.sh"
241 (("^.*\\$srcdir/configure.*") ""))
242 (system* "bash" "autogen.sh")
243
244 ;; create configure script in ./ijs/
245 (chdir "ijs")
246 ;; do not run configure
247 (substitute* "autogen.sh"
248 (("^.*\\$srcdir/configure.*") "")
249 (("^ + && echo Now type.*$") ""))
250 (zero? (system* "bash" "autogen.sh")))
251 %standard-phases)))
252 (synopsis "IJS driver framework for inkjet and other raster devices")
253 (description
254 "IJS is a protocol for transmission of raster page images. This package
255 provides the reference implementation of the raster printer driver
256 architecture.")
257 (license license:expat)
258 (home-page "http://www.gnu.org/software/ghostscript/")))
259
260 (define-public gs-fonts
261 (package
262 (name "gs-fonts")
263 (version "8.11")
264 (source (origin
265 (method url-fetch)
266 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
267 version
268 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
269 version
270 ".tar.gz"))
271 (sha256 (base32
272 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
273 (build-system gnu-build-system)
274 (arguments
275 `(#:tests? #f ; nothing to check, just files to copy
276 #:phases
277 (modify-phases %standard-phases
278 (delete 'configure)
279 (delete 'build)
280 (replace 'install
281 (lambda* (#:key outputs #:allow-other-keys)
282 (let* ((out (assoc-ref outputs "out"))
283 (dir (string-append out "/share/fonts/type1/ghostscript")))
284 (mkdir-p dir)
285 (for-each
286 (lambda (file)
287 (copy-file file (string-append dir "/" file)))
288 (find-files "." "pfb|afm"))))))))
289 (synopsis "Free replacements for the PostScript fonts")
290 (description
291 "Ghostscript fonts provides fonts and font metrics customarily distributed with
292 Ghostscript. It currently includes the 35 standard PostScript fonts.")
293 (license license:gpl2)
294 (home-page "https://sourceforge.net/projects/gs-fonts/")))
295
296 (define-public libspectre
297 (package
298 (name "libspectre")
299 (version "0.2.7")
300 (source (origin
301 (method url-fetch)
302 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
303 version ".tar.gz"))
304 (sha256 (base32
305 "1v63lqc6bhhxwkpa43qmz8phqs8ci4dhzizyy16d3vkb20m846z8"))))
306 (build-system gnu-build-system)
307 (inputs `(("ghostscript" ,ghostscript)))
308 (native-inputs `(("pkg-config" ,pkg-config)))
309 (synopsis "Postscript rendering library")
310 (description
311 "libspectre is a small library for rendering Postscript documents.
312 It provides a convenient easy to use API for handling and rendering
313 Postscript documents.")
314 (license license:gpl2+)
315 (home-page "http://www.freedesktop.org/wiki/Software/libspectre")))