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>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
47 (uri (string-append "mirror://sourceforge/lcms/lcms/" version
48 "/lcms2-" version ".tar.gz"))
49 (patches (search-patches "lcms-CVE-2016-10165.patch"))
51 "08pvl289g0mbznzx5l6ibhaldsgx41kwvdn2c974ga9fkli2pl36"))))
52 (build-system gnu-build-system)
53 (inputs `(("libjpeg-8" ,libjpeg-8)
56 (synopsis "Little CMS, a small-footprint colour management engine")
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.")
62 (home-page "http://www.littlecms.com/")
63 (properties '((cpe-name . "little_cms_color_engine")))))
65 (define-public libpaper
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_"
78 "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
79 (build-system gnu-build-system)
80 (synopsis "Library for handling paper sizes")
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
85 (license license:gpl2)
86 (home-page "https://packages.qa.debian.org/libp/libpaper.html")))
88 (define-public psutils
94 (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz")
96 "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq"))))
97 (build-system gnu-build-system)
98 (inputs `(("perl" ,perl)))
100 `(#:tests? #f ; none provided
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") ""))))
119 (synopsis "Collection of utilities for manipulating PostScript documents")
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/")))
130 (define-public ghostscript
133 (replacement ghostscript/fixed)
135 ;; XXX Try removing the bundled copy of jbig2dec.
138 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
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)))
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)
160 ("libjpeg-8" ,libjpeg-8)
162 ("libpaper" ,libpaper)
167 ("pkg-config" ,pkg-config) ; needed to find libtiff
168 ("python" ,python-wrapper)
171 `(#:disallowed-references ("doc")
173 (modify-phases %standard-phases
174 (add-after 'configure 'patch-config-files
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
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"
187 "\"~/.guix-profile/share/doc/ghostscript\""))))
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))))))
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")
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")))))
212 (define-public ghostscript/x
213 (package/inherit ghostscript
214 (name (string-append (package-name ghostscript) "-with-x"))
215 (inputs `(("libxext" ,libxext)
217 ,@(package-inputs ghostscript)))))
219 (define ghostscript/fixed
221 (inherit ghostscript)
224 (inherit (package-source ghostscript))
227 (origin-patches (package-source ghostscript))
228 (search-patches "ghostscript-CVE-2017-8291.patch")))))))
236 (uri (string-append "mirror://gnu/ghostscript/gnu-ghostscript-"
239 "0q4jj41p0qbr4mgcc9q78f5zs8cm1g57wgryhsm2yq4lfslm3ib1"))))
240 (build-system gnu-build-system)
242 `(("libtool" ,libtool)
243 ("automake" ,automake)
244 ("autoconf" ,autoconf)))
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")
257 ;; create configure script in ./ijs/
259 ;; do not run configure
260 (substitute* "autogen.sh"
261 (("^.*\\$srcdir/configure.*") "")
262 (("^ + && echo Now type.*$") ""))
263 (zero? (system* "bash" "autogen.sh")))
265 (synopsis "IJS driver framework for inkjet and other raster devices")
267 "IJS is a protocol for transmission of raster page images. This package
268 provides the reference implementation of the raster printer driver
270 (license license:expat)
271 (home-page "https://www.gnu.org/software/ghostscript/")))
273 (define-public gs-fonts
279 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
281 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
285 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
286 (build-system gnu-build-system)
288 `(#:tests? #f ; nothing to check, just files to copy
290 (modify-phases %standard-phases
294 (lambda* (#:key outputs #:allow-other-keys)
295 (let* ((out (assoc-ref outputs "out"))
296 (dir (string-append out "/share/fonts/type1/ghostscript")))
300 (copy-file file (string-append dir "/" file)))
301 (find-files "." "pfb|afm"))))))))
302 (synopsis "Free replacements for the PostScript fonts")
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/")))
309 (define-public libspectre
315 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
318 "1v63lqc6bhhxwkpa43qmz8phqs8ci4dhzizyy16d3vkb20m846z8"))))
319 (build-system gnu-build-system)
320 (inputs `(("ghostscript" ,ghostscript)))
321 (native-inputs `(("pkg-config" ,pkg-config)))
322 (synopsis "Postscript rendering library")
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")))