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, 2017 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
7 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
9 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages ghostscript)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages cups)
31 #:use-module (gnu packages fontutils)
32 #:use-module (gnu packages image)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages tcl)
37 #:use-module (gnu packages xorg)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system trivial))
50 (uri (string-append "mirror://sourceforge/lcms/lcms/" version
51 "/lcms2-" version ".tar.gz"))
53 "083xisy6z01zhm7p7rgk4bx9d6zlr8l20qkfv1g29ylnhgwzvij8"))))
54 (build-system gnu-build-system)
55 (inputs `(("libjpeg" ,libjpeg)
58 (synopsis "Little CMS, a small-footprint colour management engine")
60 "Little CMS is a small-footprint colour management engine, with special
61 focus on accuracy and performance. It uses the International Color
62 Consortium standard (ICC), approved as ISO 15076-1.")
64 (home-page "http://www.littlecms.com/")
65 (properties '((cpe-name . "little_cms_color_engine")))))
67 (define-public libpaper
74 ;; Debian moved their libpaper-1.1.24 to archive.debian.net
75 ;; but in the move the hash of their tarball changed.
76 "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_"
77 version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
80 "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
81 (build-system gnu-build-system)
82 (synopsis "Library for handling paper sizes")
84 "The paper library and accompanying files are intended to provide a simple
85 way for applications to take actions based on a system- or user-specified
87 (license license:gpl2)
88 (home-page "https://packages.qa.debian.org/libp/libpaper.html")))
90 (define-public psutils
96 (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz")
98 "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq"))))
99 (build-system gnu-build-system)
100 (inputs `(("perl" ,perl)))
102 `(#:tests? #f ; none provided
104 (modify-phases %standard-phases
106 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
107 (let ((perl (assoc-ref inputs "perl"))
108 (out (assoc-ref outputs "out")))
109 (copy-file "Makefile.unix" "Makefile")
110 (substitute* "Makefile"
111 (("/usr/local/bin/perl") (string-append perl "/bin/perl")))
112 (substitute* "Makefile"
113 (("/usr/local") out))
114 ;; for the install phase
115 (substitute* "Makefile"
116 (("-mkdir") "mkdir -p"))
117 ;; drop installation of non-free files
118 (substitute* "Makefile"
119 ((" install.include") "")))
121 (synopsis "Collection of utilities for manipulating PostScript documents")
123 "PSUtils is a collection of utilities for manipulating PostScript
124 documents. Programs included are psnup, for placing out several logical pages
125 on a single sheet of paper, psselect, for selecting pages from a document,
126 pstops, for general imposition, psbook, for signature generation for booklet
127 printing, and psresize, for adjusting page sizes.")
128 (license (license:non-copyleft "file://LICENSE"
129 "See LICENSE in the distribution."))
130 (home-page "http://knackered.org/angus/psutils/")))
132 (define-public ghostscript
139 (uri (string-append "https://github.com/ArtifexSoftware/"
140 "ghostpdl-downloads/releases/download/gs"
141 (string-delete #\. version)
142 "/ghostscript-" version ".tar.xz"))
145 "1ng8d9fm5lza7k1f7ybc791275c07z5hcmpkrl2i226nshkxrkhz"))
146 (patches (search-patches "ghostscript-runpath.patch"
147 "ghostscript-CVE-2018-10194.patch"
148 "ghostscript-no-header-creationdate.patch"
149 "ghostscript-no-header-id.patch"
150 "ghostscript-no-header-uuid.patch"))
151 (modules '((guix build utils)))
153 ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
154 ;; we leave it, at least for now.
155 ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
156 ;; Likewise for the thread-safe lcms2 fork called "lcms2art".
158 (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
159 "libpng" "tiff" "zlib"))
161 (build-system gnu-build-system)
162 (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
164 `(#:disallowed-references ("doc")
166 (list "--with-system-libtiff"
168 (string-append "ZLIBDIR="
169 (assoc-ref %build-inputs "zlib") "/include")
172 ,@(if (%current-target-system)
173 '(;; Specify the native compiler, which is used to build 'echogs'
174 ;; and other intermediary tools when cross-compiling; see
175 ;; <https://ghostscript.com/FAQ.html>.
178 ;; Save 'config.log' etc. of the native build under
179 ;; auxtmp/, useful for debugging.
180 "--enable-save_confaux")
183 (modify-phases %standard-phases
184 (add-after 'configure 'remove-doc-reference
186 ;; Don't retain a reference to the 'doc' output in 'gs'.
187 ;; The only use of this definition is in the output of
188 ;; 'gs --help', so this change is fine.
189 (substitute* "base/gscdef.c"
191 "\"~/.guix-profile/share/doc/ghostscript\""))
192 ;; The docdir default changed in 9.23 and a compatibility
193 ;; symlink was added from datadir->docdir. Remove it.
194 (substitute* "base/unixinst.mak"
195 (("ln -s \\$\\(DESTDIR\\)\\$\\(docdir\\).*") ""))
197 (add-after 'configure 'patch-config-files
199 (substitute* "base/unixhead.mak"
200 (("/bin/sh") (which "sh")))
202 ,@(if (%current-target-system)
203 `((add-after 'configure 'add-native-lz
205 ;; Add missing '-lz' for native tools such as 'mkromfs'.
206 (substitute* "Makefile"
207 (("^AUXEXTRALIBS=(.*)$" _ value)
208 (string-append "AUXEXTRALIBS = -lz " value "\n")))
213 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
214 ;; binary (saves 22 MiB).
215 (invoke "make" "so" "-j"
216 (number->string (parallel-job-count)))))
219 (invoke "make" "soinstall")))
220 (add-after 'install 'create-gs-symlink
221 (lambda* (#:key outputs #:allow-other-keys)
222 (let ((out (assoc-ref outputs "out")))
223 ;; Some programs depend on having a 'gs' binary available.
224 (symlink "gsc" (string-append out "/bin/gs"))
228 ("python" ,python-wrapper)
231 ;; When cross-compiling, some of the natively-built tools require all
233 ,@(if (%current-target-system)
234 `(("zlib/native" ,zlib)
235 ("libjpeg/native" ,libjpeg))
238 `(("freetype" ,freetype)
239 ("jbig2dec" ,jbig2dec)
241 ("libpaper" ,libpaper)
245 (synopsis "PostScript and PDF interpreter")
247 "Ghostscript is an interpreter for the PostScript language and the PDF
248 file format. It also includes a C library that implements the graphics
249 capabilities of the PostScript language. It supports a wide variety of
250 output file formats and printers.")
251 (home-page "https://www.ghostscript.com/")
252 (license license:agpl3+)))
254 (define-public ghostscript/x
255 (package/inherit ghostscript
256 (name (string-append (package-name ghostscript) "-with-x"))
257 (inputs `(("libxext" ,libxext)
259 ,@(package-inputs ghostscript)))))
261 (define-public ghostscript/cups
262 (package/inherit ghostscript
263 (name "ghostscript-with-cups")
264 (inputs `(("cups" ,cups-minimal)
265 ,@(package-inputs ghostscript)))))
270 (version (package-version ghostscript))
271 (source (package-source ghostscript))
272 (build-system gnu-build-system)
274 `(("libtool" ,libtool)
275 ("automake" ,automake)
276 ("autoconf" ,autoconf)))
279 (modify-phases %standard-phases
280 (add-after 'unpack 'autogen
282 ;; need to regenerate macros
283 (system* "autoreconf" "-if")
284 ;; do not run configure
285 (substitute* "autogen.sh"
286 (("^.*\\$srcdir/configure.*") ""))
287 (system* "bash" "autogen.sh")
288 ;; create configure script in ./ijs/
290 ;; do not run configure
291 (substitute* "autogen.sh"
292 (("^.*\\$srcdir/configure.*") "")
293 (("^ + && echo Now type.*$") ""))
294 (invoke "bash" "autogen.sh"))))))
295 (synopsis "IJS driver framework for inkjet and other raster devices")
297 "IJS is a protocol for transmission of raster page images. This package
298 provides the reference implementation of the raster printer driver
300 (license license:expat)
301 (home-page (package-home-page ghostscript))))
303 (define-public gs-fonts
309 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
311 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
315 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
316 (build-system gnu-build-system)
318 `(#:tests? #f ; nothing to check, just files to copy
320 #:modules ((guix build gnu-build-system)
324 (modify-phases %standard-phases
328 (lambda* (#:key outputs #:allow-other-keys)
329 (let* ((out (assoc-ref outputs "out"))
330 (dir (string-append out "/share/fonts/type1/ghostscript")))
334 (copy-file file (string-append dir "/" file)))
335 (find-files "." "pfb|afm"))
337 (synopsis "Free replacements for the PostScript fonts")
339 "Ghostscript fonts provides fonts and font metrics customarily distributed with
340 Ghostscript. It currently includes the 35 standard PostScript fonts.")
341 (license license:gpl2)
342 (home-page "https://sourceforge.net/projects/gs-fonts/")))
344 (define-public libspectre
350 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
353 "1a67iglsc3r05mzngyg9kb1gy8whq4fgsnyjwi7bqfw2i7rnl9b5"))))
354 (build-system gnu-build-system)
355 (inputs `(("ghostscript" ,ghostscript)))
356 (native-inputs `(("pkg-config" ,pkg-config)))
357 (synopsis "Postscript rendering library")
359 "libspectre is a small library for rendering Postscript documents.
360 It provides a convenient easy to use API for handling and rendering
361 Postscript documents.")
362 (license license:gpl2+)
363 (home-page "https://www.freedesktop.org/wiki/Software/libspectre")))