gnu: libvpx: Add upstream security fix.
[jackhill/guix/guix.git] / gnu / packages / ghostscript.scm
CommitLineData
bf4018fb
AE
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
7020a6ab 3;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
01aae5fc 4;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
49d035ff 5;;; Copyright © 2013, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
e4f43bc5 6;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
a6d352cc 7;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
1c09eb99 8;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
c3800f0b 9;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
0084744b 10;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
bf4018fb
AE
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages ghostscript)
28 #:use-module (gnu packages)
01aae5fc 29 #:use-module (gnu packages autotools)
bf4018fb 30 #:use-module (gnu packages compression)
3e442f85 31 #:use-module (gnu packages cups)
a86177d6 32 #:use-module (gnu packages fontutils)
e55354b8 33 #:use-module (gnu packages image)
bf4018fb
AE
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages tcl)
7a75b02a 38 #:use-module (gnu packages xorg)
b5b73a82 39 #:use-module ((guix licenses) #:prefix license:)
bf4018fb
AE
40 #:use-module (guix packages)
41 #:use-module (guix download)
0084744b 42 #:use-module (guix utils)
71eba3eb 43 #:use-module (guix build-system gnu)
0084744b
MB
44 #:use-module (guix build-system trivial)
45 #:use-module (srfi srfi-1))
bf4018fb
AE
46
47(define-public lcms
48 (package
49 (name "lcms")
c3800f0b 50 (version "2.9")
bf4018fb
AE
51 (source (origin
52 (method url-fetch)
de67e922
LF
53 (uri (string-append "mirror://sourceforge/lcms/lcms/" version
54 "/lcms2-" version ".tar.gz"))
bf4018fb 55 (sha256 (base32
c3800f0b 56 "083xisy6z01zhm7p7rgk4bx9d6zlr8l20qkfv1g29ylnhgwzvij8"))))
bf4018fb
AE
57 (build-system gnu-build-system)
58 (inputs `(("libjpeg-8" ,libjpeg-8)
59 ("libtiff" ,libtiff)
60 ("zlib" ,zlib)))
61 (synopsis "Little CMS, a small-footprint colour management engine")
62 (description
63 "Little CMS is a small-footprint colour management engine, with special
35b9e423 64focus on accuracy and performance. It uses the International Color
bf4018fb
AE
65Consortium standard (ICC), approved as ISO 15076-1.")
66 (license license:x11)
f769c1d7
LF
67 (home-page "http://www.littlecms.com/")
68 (properties '((cpe-name . "little_cms_color_engine")))))
bf4018fb
AE
69
70(define-public libpaper
71 (package
72 (name "libpaper")
73 (version "1.1.24")
74 (source (origin
75 (method url-fetch)
76 (uri (string-append
48fa9312
EF
77 ;; Debian moved their libpaper-1.1.24 to archive.debian.net
78 ;; but in the move the hash of their tarball changed.
79 "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_"
80 version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
bf4018fb
AE
81 version ".tar.gz"))
82 (sha256 (base32
83 "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
84 (build-system gnu-build-system)
35b9e423 85 (synopsis "Library for handling paper sizes")
bf4018fb
AE
86 (description
87 "The paper library and accompanying files are intended to provide a simple
88way for applications to take actions based on a system- or user-specified
89paper size.")
90 (license license:gpl2)
48fa9312 91 (home-page "https://packages.qa.debian.org/libp/libpaper.html")))
bf4018fb 92
87ec7a7a
AE
93(define-public psutils
94 (package
95 (name "psutils")
96 (version "17")
97 (source (origin
98 (method url-fetch)
99 (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz")
100 (sha256 (base32
101 "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq"))))
102 (build-system gnu-build-system)
103 (inputs `(("perl" ,perl)))
104 (arguments
105 `(#:tests? #f ; none provided
106 #:phases
530d9e15
EF
107 (modify-phases %standard-phases
108 (replace 'configure
109 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
110 (let ((perl (assoc-ref inputs "perl"))
111 (out (assoc-ref outputs "out")))
112 (copy-file "Makefile.unix" "Makefile")
113 (substitute* "Makefile"
114 (("/usr/local/bin/perl") (string-append perl "/bin/perl")))
115 (substitute* "Makefile"
116 (("/usr/local") out))
117 ;; for the install phase
118 (substitute* "Makefile"
119 (("-mkdir") "mkdir -p"))
120 ;; drop installation of non-free files
121 (substitute* "Makefile"
122 ((" install.include") "")))
123 #t)))))
35b9e423 124 (synopsis "Collection of utilities for manipulating PostScript documents")
87ec7a7a
AE
125 (description
126 "PSUtils is a collection of utilities for manipulating PostScript
35b9e423 127documents. Programs included are psnup, for placing out several logical pages
87ec7a7a
AE
128on a single sheet of paper, psselect, for selecting pages from a document,
129pstops, for general imposition, psbook, for signature generation for booklet
130printing, and psresize, for adjusting page sizes.")
166191b3 131 (license (license:non-copyleft "file://LICENSE"
87ec7a7a
AE
132 "See LICENSE in the distribution."))
133 (home-page "http://knackered.org/angus/psutils/")))
134
bf4018fb
AE
135(define-public ghostscript
136 (package
d6158fe7 137 (name "ghostscript")
a1e3da63 138 (replacement ghostscript/fixed)
68ab0ad5 139 (version "9.23")
d6158fe7
LF
140 (source
141 (origin
142 (method url-fetch)
143 (uri (string-append "https://github.com/ArtifexSoftware/"
144 "ghostpdl-downloads/releases/download/gs"
145 (string-delete #\. version)
146 "/ghostscript-" version ".tar.xz"))
147 (sha256
148 (base32
68ab0ad5 149 "1ng8d9fm5lza7k1f7ybc791275c07z5hcmpkrl2i226nshkxrkhz"))
d6158fe7 150 (patches (search-patches "ghostscript-runpath.patch"
ad22c718 151 "ghostscript-no-header-creationdate.patch"
63eb4a2a
DM
152 "ghostscript-no-header-id.patch"
153 "ghostscript-no-header-uuid.patch"))
d6158fe7
LF
154 (modules '((guix build utils)))
155 (snippet
156 ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
157 ;; we leave it, at least for now.
158 ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
68ab0ad5 159 ;; Likewise for the thread-safe lcms2 fork called "lcms2art".
d6158fe7
LF
160 '(begin
161 (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
68ab0ad5 162 "libpng" "tiff" "zlib"))
6cbee49d 163 #t))))
d6158fe7
LF
164 (build-system gnu-build-system)
165 (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
166 (arguments
167 `(#:disallowed-references ("doc")
168 #:configure-flags
169 (list "--with-system-libtiff"
170 "LIBS=-lz"
171 (string-append "ZLIBDIR="
172 (assoc-ref %build-inputs "zlib") "/include")
49d035ff
LC
173 "--enable-dynamic"
174
175 ,@(if (%current-target-system)
176 '(;; Specify the native compiler, which is used to build 'echogs'
177 ;; and other intermediary tools when cross-compiling; see
178 ;; <https://ghostscript.com/FAQ.html>.
179 "CCAUX=gcc"
180
181 ;; Save 'config.log' etc. of the native build under
182 ;; auxtmp/, useful for debugging.
183 "--enable-save_confaux")
184 '()))
d6158fe7
LF
185 #:phases
186 (modify-phases %standard-phases
d6158fe7 187 (add-after 'configure 'remove-doc-reference
eb354bda 188 (lambda _
d6158fe7
LF
189 ;; Don't retain a reference to the 'doc' output in 'gs'.
190 ;; The only use of this definition is in the output of
191 ;; 'gs --help', so this change is fine.
192 (substitute* "base/gscdef.c"
193 (("GS_DOCDIR")
194 "\"~/.guix-profile/share/doc/ghostscript\""))
68ab0ad5
MB
195 ;; The docdir default changed in 9.23 and a compatibility
196 ;; symlink was added from datadir->docdir. Remove it.
197 (substitute* "base/unixinst.mak"
198 (("ln -s \\$\\(DESTDIR\\)\\$\\(docdir\\).*") ""))
d6158fe7
LF
199 #t))
200 (add-after 'configure 'patch-config-files
201 (lambda _
202 (substitute* "base/unixhead.mak"
203 (("/bin/sh") (which "sh")))
204 #t))
49d035ff
LC
205 ,@(if (%current-target-system)
206 `((add-after 'configure 'add-native-lz
207 (lambda _
208 ;; Add missing '-lz' for native tools such as 'mkromfs'.
209 (substitute* "Makefile"
210 (("^AUXEXTRALIBS=(.*)$" _ value)
211 (string-append "AUXEXTRALIBS = -lz " value "\n")))
212 #t)))
213 '())
d6158fe7
LF
214 (replace 'build
215 (lambda _
216 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
217 ;; binary (saves 22 MiB).
eb075edd
MW
218 (invoke "make" "so" "-j"
219 (number->string (parallel-job-count)))))
d6158fe7
LF
220 (replace 'install
221 (lambda _
eb075edd 222 (invoke "make" "soinstall")))
d6158fe7
LF
223 (add-after 'install 'create-gs-symlink
224 (lambda* (#:key outputs #:allow-other-keys)
225 (let ((out (assoc-ref outputs "out")))
226 ;; Some programs depend on having a 'gs' binary available.
227 (symlink "gsc" (string-append out "/bin/gs"))
228 #t))))))
229 (native-inputs
230 `(("perl" ,perl)
231 ("python" ,python-wrapper)
49d035ff
LC
232 ("tcl" ,tcl)
233
234 ;; When cross-compiling, some of the natively-built tools require all
235 ;; these libraries.
236 ,@(if (%current-target-system)
237 `(("zlib/native" ,zlib)
68ab0ad5 238 ("libjpeg/native" ,libjpeg))
49d035ff 239 '())))
d6158fe7
LF
240 (inputs
241 `(("freetype" ,freetype)
242 ("jbig2dec" ,jbig2dec)
d6158fe7
LF
243 ("libjpeg" ,libjpeg)
244 ("libpaper" ,libpaper)
245 ("libpng" ,libpng)
246 ("libtiff" ,libtiff)
247 ("zlib" ,zlib)))
248 (synopsis "PostScript and PDF interpreter")
249 (description
250 "Ghostscript is an interpreter for the PostScript language and the PDF
a22dc0c4
LC
251file format. It also includes a C library that implements the graphics
252capabilities of the PostScript language. It supports a wide variety of
253output file formats and printers.")
d6158fe7
LF
254 (home-page "https://www.ghostscript.com/")
255 (license license:agpl3+)))
1f7c6a1f 256
a1e3da63
LF
257(define-public ghostscript/fixed
258 (hidden-package
259 (package
260 (inherit ghostscript)
0084744b 261 (version "9.24")
a1e3da63
LF
262 (source
263 (origin
264 (inherit (package-source ghostscript))
0084744b
MB
265 (uri (string-append "https://github.com/ArtifexSoftware/"
266 "ghostpdl-downloads/releases/download/gs"
267 (string-delete #\. version)
268 "/ghostscript-" version ".tar.xz"))
269 (sha256
270 (base32
271 "1mk922rnml93w2g42yxiyn8xqanc50cm65irrgh0b6lp4kgifjfl"))
272 (patches (search-patches "ghostscript-CVE-2018-16509.patch"
273 "ghostscript-bug-699708.patch"
274 "ghostscript-no-header-creationdate.patch"
275 "ghostscript-no-header-id.patch"
276 "ghostscript-no-header-uuid.patch"))))
277 (arguments
278 (substitute-keyword-arguments (package-arguments ghostscript)
279 ((#:configure-flags flags)
280 ;; Notice that we removed the 'ghostscript-runpath' patch above.
281 ;; The reason is that it conflicts with an upstream change that
282 ;; takes LDFLAGS into account.
283 `(cons (string-append "LDFLAGS=-Wl,-rpath="
284 (assoc-ref %outputs "out") "/lib")
285 ,flags))
286 ((#:phases phases)
287 `(modify-phases ,phases
288 (add-before 'configure 'create-output-directory
289 (lambda* (#:key outputs #:allow-other-keys)
290 ;; Unfortunately the configure script refuses to function if
291 ;; the directory specified as -rpath does not already exist.
292 (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
293 #t)))))))))
a1e3da63 294
7a75b02a 295(define-public ghostscript/x
7020a6ab 296 (package/inherit ghostscript
7a75b02a
MW
297 (name (string-append (package-name ghostscript) "-with-x"))
298 (inputs `(("libxext" ,libxext)
299 ("libxt" ,libxt)
300 ,@(package-inputs ghostscript)))))
301
3e442f85
LC
302(define-public ghostscript/cups
303 (package/inherit ghostscript
304 (name "ghostscript-with-cups")
305 (inputs `(("cups" ,cups-minimal)
306 ,@(package-inputs ghostscript)))))
307
01aae5fc
RW
308(define-public ijs
309 (package
310 (name "ijs")
55af10fb
LF
311 (version (package-version ghostscript))
312 (source (package-source ghostscript))
01aae5fc
RW
313 (build-system gnu-build-system)
314 (native-inputs
315 `(("libtool" ,libtool)
316 ("automake" ,automake)
317 ("autoconf" ,autoconf)))
318 (arguments
319 `(#:phases
1c09eb99
LF
320 (modify-phases %standard-phases
321 (add-after 'unpack 'autogen
322 (lambda _
323 ;; need to regenerate macros
324 (system* "autoreconf" "-if")
325 ;; do not run configure
326 (substitute* "autogen.sh"
327 (("^.*\\$srcdir/configure.*") ""))
328 (system* "bash" "autogen.sh")
329 ;; create configure script in ./ijs/
330 (chdir "ijs")
331 ;; do not run configure
332 (substitute* "autogen.sh"
333 (("^.*\\$srcdir/configure.*") "")
334 (("^ + && echo Now type.*$") ""))
8f52d898 335 (invoke "bash" "autogen.sh"))))))
01aae5fc
RW
336 (synopsis "IJS driver framework for inkjet and other raster devices")
337 (description
338 "IJS is a protocol for transmission of raster page images. This package
339provides the reference implementation of the raster printer driver
340architecture.")
341 (license license:expat)
55af10fb 342 (home-page (package-home-page ghostscript))))
01aae5fc 343
1f7c6a1f
AE
344(define-public gs-fonts
345 (package
346 (name "gs-fonts")
347 (version "8.11")
348 (source (origin
349 (method url-fetch)
350 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
351 version
352 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
353 version
354 ".tar.gz"))
355 (sha256 (base32
356 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
357 (build-system gnu-build-system)
358 (arguments
359 `(#:tests? #f ; nothing to check, just files to copy
809bc394
ST
360
361 #:modules ((guix build gnu-build-system)
362 (guix build utils)
363 (srfi srfi-1))
1f7c6a1f 364 #:phases
a6d352cc
EF
365 (modify-phases %standard-phases
366 (delete 'configure)
367 (delete 'build)
368 (replace 'install
369 (lambda* (#:key outputs #:allow-other-keys)
370 (let* ((out (assoc-ref outputs "out"))
371 (dir (string-append out "/share/fonts/type1/ghostscript")))
372 (mkdir-p dir)
373 (for-each
374 (lambda (file)
375 (copy-file file (string-append dir "/" file)))
6449e68d
MW
376 (find-files "." "pfb|afm"))
377 #t))))))
35b9e423 378 (synopsis "Free replacements for the PostScript fonts")
1f7c6a1f 379 (description
35b9e423
EB
380 "Ghostscript fonts provides fonts and font metrics customarily distributed with
381Ghostscript. It currently includes the 35 standard PostScript fonts.")
1f7c6a1f 382 (license license:gpl2)
3b3b60d0 383 (home-page "https://sourceforge.net/projects/gs-fonts/")))
c5ea1201 384
7cf2a2a1
AE
385(define-public libspectre
386 (package
387 (name "libspectre")
94522776 388 (version "0.2.8")
7cf2a2a1
AE
389 (source (origin
390 (method url-fetch)
5cc3096c 391 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
7cf2a2a1
AE
392 version ".tar.gz"))
393 (sha256 (base32
94522776 394 "1a67iglsc3r05mzngyg9kb1gy8whq4fgsnyjwi7bqfw2i7rnl9b5"))))
7cf2a2a1 395 (build-system gnu-build-system)
c4c4cc05
JD
396 (inputs `(("ghostscript" ,ghostscript)))
397 (native-inputs `(("pkg-config" ,pkg-config)))
35b9e423 398 (synopsis "Postscript rendering library")
7cf2a2a1
AE
399 (description
400 "libspectre is a small library for rendering Postscript documents.
401It provides a convenient easy to use API for handling and rendering
402Postscript documents.")
403 (license license:gpl2+)
57e7d748 404 (home-page "https://www.freedesktop.org/wiki/Software/libspectre")))