gnu: gnome: Depend on xdg-user-dirs.
[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 (replacement ghostscript/fixed)
134 (version "9.14.0")
135 ;; XXX Try removing the bundled copy of jbig2dec.
136 (source (origin
137 (method url-fetch)
138 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
139 version ".tar.xz"))
140 (sha256
141 (base32
142 "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))
143 (patches (search-patches "ghostscript-CVE-2013-5653.patch"
144 "ghostscript-CVE-2015-3228.patch"
145 "ghostscript-CVE-2016-7976.patch"
146 "ghostscript-CVE-2016-7978.patch"
147 "ghostscript-CVE-2016-7979.patch"
148 "ghostscript-CVE-2016-8602.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 ghostscript/fixed
220 (package
221 (inherit ghostscript)
222 (source
223 (origin
224 (inherit (package-source ghostscript))
225 (patches
226 (append
227 (origin-patches (package-source ghostscript))
228 (search-patches "ghostscript-CVE-2017-8291.patch")))))))
229
230 (define-public ijs
231 (package
232 (name "ijs")
233 (version "9.14.0")
234 (source (origin
235 (method url-fetch)
236 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
237 version ".tar.xz"))
238 (sha256 (base32
239 "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))))
240 (build-system gnu-build-system)
241 (native-inputs
242 `(("libtool" ,libtool)
243 ("automake" ,automake)
244 ("autoconf" ,autoconf)))
245 (arguments
246 `(#:phases
247 (alist-cons-after
248 'unpack 'autogen
249 (lambda _
250 ;; need to regenerate macros
251 (system* "autoreconf" "-if")
252 ;; do not run configure
253 (substitute* "autogen.sh"
254 (("^.*\\$srcdir/configure.*") ""))
255 (system* "bash" "autogen.sh")
256
257 ;; create configure script in ./ijs/
258 (chdir "ijs")
259 ;; do not run configure
260 (substitute* "autogen.sh"
261 (("^.*\\$srcdir/configure.*") "")
262 (("^ + && echo Now type.*$") ""))
263 (zero? (system* "bash" "autogen.sh")))
264 %standard-phases)))
265 (synopsis "IJS driver framework for inkjet and other raster devices")
266 (description
267 "IJS is a protocol for transmission of raster page images. This package
268 provides the reference implementation of the raster printer driver
269 architecture.")
270 (license license:expat)
271 (home-page "https://www.gnu.org/software/ghostscript/")))
272
273 (define-public gs-fonts
274 (package
275 (name "gs-fonts")
276 (version "8.11")
277 (source (origin
278 (method url-fetch)
279 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
280 version
281 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
282 version
283 ".tar.gz"))
284 (sha256 (base32
285 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
286 (build-system gnu-build-system)
287 (arguments
288 `(#:tests? #f ; nothing to check, just files to copy
289 #:phases
290 (modify-phases %standard-phases
291 (delete 'configure)
292 (delete 'build)
293 (replace 'install
294 (lambda* (#:key outputs #:allow-other-keys)
295 (let* ((out (assoc-ref outputs "out"))
296 (dir (string-append out "/share/fonts/type1/ghostscript")))
297 (mkdir-p dir)
298 (for-each
299 (lambda (file)
300 (copy-file file (string-append dir "/" file)))
301 (find-files "." "pfb|afm"))))))))
302 (synopsis "Free replacements for the PostScript fonts")
303 (description
304 "Ghostscript fonts provides fonts and font metrics customarily distributed with
305 Ghostscript. It currently includes the 35 standard PostScript fonts.")
306 (license license:gpl2)
307 (home-page "https://sourceforge.net/projects/gs-fonts/")))
308
309 (define-public libspectre
310 (package
311 (name "libspectre")
312 (version "0.2.7")
313 (source (origin
314 (method url-fetch)
315 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
316 version ".tar.gz"))
317 (sha256 (base32
318 "1v63lqc6bhhxwkpa43qmz8phqs8ci4dhzizyy16d3vkb20m846z8"))))
319 (build-system gnu-build-system)
320 (inputs `(("ghostscript" ,ghostscript)))
321 (native-inputs `(("pkg-config" ,pkg-config)))
322 (synopsis "Postscript rendering library")
323 (description
324 "libspectre is a small library for rendering Postscript documents.
325 It provides a convenient easy to use API for handling and rendering
326 Postscript documents.")
327 (license license:gpl2+)
328 (home-page "http://www.freedesktop.org/wiki/Software/libspectre")))