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 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages ghostscript)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages autotools)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages fontutils)
30 #:use-module (gnu packages image)
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages pkg-config)
33 #:use-module (gnu packages python)
34 #:use-module (gnu packages tcl)
35 #:use-module (gnu packages xorg)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix download)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system trivial))
48 (uri (string-append "mirror://sourceforge/lcms/lcms/" version
49 "/lcms2-" version ".tar.gz"))
50 (patches (search-patches "lcms-CVE-2016-10165.patch"))
52 "08pvl289g0mbznzx5l6ibhaldsgx41kwvdn2c974ga9fkli2pl36"))))
53 (build-system gnu-build-system)
54 (inputs `(("libjpeg-8" ,libjpeg-8)
57 (synopsis "Little CMS, a small-footprint colour management engine")
59 "Little CMS is a small-footprint colour management engine, with special
60 focus on accuracy and performance. It uses the International Color
61 Consortium standard (ICC), approved as ISO 15076-1.")
63 (home-page "http://www.littlecms.com/")
64 (properties '((cpe-name . "little_cms_color_engine")))))
66 (define-public libpaper
73 ;; Debian moved their libpaper-1.1.24 to archive.debian.net
74 ;; but in the move the hash of their tarball changed.
75 "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_"
76 version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
79 "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
80 (build-system gnu-build-system)
81 (synopsis "Library for handling paper sizes")
83 "The paper library and accompanying files are intended to provide a simple
84 way for applications to take actions based on a system- or user-specified
86 (license license:gpl2)
87 (home-page "https://packages.qa.debian.org/libp/libpaper.html")))
89 (define-public psutils
95 (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz")
97 "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq"))))
98 (build-system gnu-build-system)
99 (inputs `(("perl" ,perl)))
101 `(#:tests? #f ; none provided
105 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
106 (let ((perl (assoc-ref inputs "perl"))
107 (out (assoc-ref outputs "out")))
108 (copy-file "Makefile.unix" "Makefile")
109 (substitute* "Makefile"
110 (("/usr/local/bin/perl") (string-append perl "/bin/perl")))
111 (substitute* "Makefile"
112 (("/usr/local") out))
113 ;; for the install phase
114 (substitute* "Makefile"
115 (("-mkdir") "mkdir -p"))
116 ;; drop installation of non-free files
117 (substitute* "Makefile"
118 ((" install.include") ""))))
120 (synopsis "Collection of utilities for manipulating PostScript documents")
122 "PSUtils is a collection of utilities for manipulating PostScript
123 documents. Programs included are psnup, for placing out several logical pages
124 on a single sheet of paper, psselect, for selecting pages from a document,
125 pstops, for general imposition, psbook, for signature generation for booklet
126 printing, and psresize, for adjusting page sizes.")
127 (license (license:non-copyleft "file://LICENSE"
128 "See LICENSE in the distribution."))
129 (home-page "http://knackered.org/angus/psutils/")))
131 (define-public ghostscript
138 (uri (string-append "https://github.com/ArtifexSoftware/"
139 "ghostpdl-downloads/releases/download/gs"
140 (string-delete #\. version)
141 "/ghostscript-" version ".tar.xz"))
144 "0lyhjcrkmd5fcmh8h56bs4xr9k4jasmikv5vsix1hd4ai0ad1q9b"))
145 (patches (search-patches "ghostscript-runpath.patch"
146 "ghostscript-CVE-2017-8291.patch"))
147 (modules '((guix build utils)))
149 ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
150 ;; we leave it, at least for now.
151 ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
153 (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
156 (build-system gnu-build-system)
157 (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
159 `(#:disallowed-references ("doc")
161 (list "--with-system-libtiff"
163 (string-append "ZLIBDIR="
164 (assoc-ref %build-inputs "zlib") "/include")
167 (modify-phases %standard-phases
168 (add-after 'unpack 'fix-doc-dir
171 (substitute* "Makefile.in"
172 (("^docdir=.*$") "docdir = @docdir@\n")
173 (("^exdir=.*$") "exdir = $(docdir)/examples\n"))
175 (add-after 'configure 'remove-doc-reference
177 ;; Don't retain a reference to the 'doc' output in 'gs'.
178 ;; The only use of this definition is in the output of
179 ;; 'gs --help', so this change is fine.
180 (substitute* "base/gscdef.c"
182 "\"~/.guix-profile/share/doc/ghostscript\""))
184 (add-after 'configure 'patch-config-files
186 (substitute* "base/unixhead.mak"
187 (("/bin/sh") (which "sh")))
191 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
192 ;; binary (saves 22 MiB).
193 (zero? (system* "make" "so" "-j"
194 (number->string (parallel-job-count))))))
197 (zero? (system* "make" "soinstall"))))
198 (add-after 'install 'create-gs-symlink
199 (lambda* (#:key outputs #:allow-other-keys)
200 (let ((out (assoc-ref outputs "out")))
201 ;; Some programs depend on having a 'gs' binary available.
202 (symlink "gsc" (string-append out "/bin/gs"))
206 ("python" ,python-wrapper)
209 `(("freetype" ,freetype)
210 ("jbig2dec" ,jbig2dec)
213 ("libpaper" ,libpaper)
217 (synopsis "PostScript and PDF interpreter")
219 "Ghostscript is an interpreter for the PostScript language and the PDF
220 file format. It also includes a C library that implements the graphics
221 capabilities of the PostScript language. It supports a wide variety of
222 output file formats and printers.")
223 (home-page "https://www.ghostscript.com/")
224 (license license:agpl3+)))
226 (define-public ghostscript/x
227 (package/inherit ghostscript
228 (name (string-append (package-name ghostscript) "-with-x"))
229 (inputs `(("libxext" ,libxext)
231 ,@(package-inputs ghostscript)))))
236 (version (package-version ghostscript))
237 (source (package-source ghostscript))
238 (build-system gnu-build-system)
240 `(("libtool" ,libtool)
241 ("automake" ,automake)
242 ("autoconf" ,autoconf)))
245 (modify-phases %standard-phases
246 (add-after 'unpack 'autogen
248 ;; need to regenerate macros
249 (system* "autoreconf" "-if")
250 ;; do not run configure
251 (substitute* "autogen.sh"
252 (("^.*\\$srcdir/configure.*") ""))
253 (system* "bash" "autogen.sh")
254 ;; create configure script in ./ijs/
256 ;; do not run configure
257 (substitute* "autogen.sh"
258 (("^.*\\$srcdir/configure.*") "")
259 (("^ + && echo Now type.*$") ""))
260 (zero? (system* "bash" "autogen.sh")))))))
261 (synopsis "IJS driver framework for inkjet and other raster devices")
263 "IJS is a protocol for transmission of raster page images. This package
264 provides the reference implementation of the raster printer driver
266 (license license:expat)
267 (home-page (package-home-page ghostscript))))
269 (define-public gs-fonts
275 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
277 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
281 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
282 (build-system gnu-build-system)
284 `(#:tests? #f ; nothing to check, just files to copy
286 #:modules ((guix build gnu-build-system)
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")))