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, 2019 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
7 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
9 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
11 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages ghostscript)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages cups)
33 #:use-module (gnu packages fontutils)
34 #:use-module (gnu packages image)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages tcl)
39 #:use-module (gnu packages xorg)
40 #:use-module ((guix licenses) #:prefix license:)
41 #:use-module (guix packages)
42 #:use-module (guix download)
43 #:use-module (guix utils)
44 #:use-module (guix build-system gnu)
45 #:use-module (guix build-system trivial)
46 #:use-module (srfi srfi-1))
54 (uri (string-append "mirror://sourceforge/lcms/lcms/" version
55 "/lcms2-" version ".tar.gz"))
57 (patches (search-patches "lcms-CVE-2018-16435.patch"))
59 "083xisy6z01zhm7p7rgk4bx9d6zlr8l20qkfv1g29ylnhgwzvij8"))))
60 (build-system gnu-build-system)
61 (inputs `(("libjpeg" ,libjpeg)
64 (synopsis "Little CMS, a small-footprint colour management engine")
66 "Little CMS is a small-footprint colour management engine, with special
67 focus on accuracy and performance. It uses the International Color
68 Consortium standard (ICC), approved as ISO 15076-1.")
70 (home-page "http://www.littlecms.com/")
71 (properties '((cpe-name . "little_cms_color_engine")))))
73 (define-public libpaper
80 ;; Debian moved their libpaper-1.1.24 to archive.debian.net
81 ;; but in the move the hash of their tarball changed.
82 "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_"
83 version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
86 "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
87 (build-system gnu-build-system)
89 `(("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
92 (modify-phases %standard-phases
93 (add-after 'unpack 'fix-configure
94 (lambda* (#:key inputs native-inputs #:allow-other-keys)
95 ;; Replace outdated config.sub and config.guess:
96 (for-each (lambda (file)
98 (string-append (assoc-ref
99 (or native-inputs inputs) "automake")
101 ,(version-major+minor
102 (package-version automake))
104 '("config.sub" "config.guess"))
106 (synopsis "Library for handling paper sizes")
108 "The paper library and accompanying files are intended to provide a simple
109 way for applications to take actions based on a system- or user-specified
111 (license license:gpl2)
112 (home-page "https://packages.qa.debian.org/libp/libpaper.html")))
114 (define-public psutils
120 (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz")
122 "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq"))))
123 (build-system gnu-build-system)
124 (inputs `(("perl" ,perl)))
126 `(#:tests? #f ; none provided
128 (modify-phases %standard-phases
130 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
131 (let ((perl (assoc-ref inputs "perl"))
132 (out (assoc-ref outputs "out")))
133 (copy-file "Makefile.unix" "Makefile")
134 (substitute* "Makefile"
135 (("/usr/local/bin/perl") (string-append perl "/bin/perl")))
136 (substitute* "Makefile"
137 (("/usr/local") out))
138 ;; for the install phase
139 (substitute* "Makefile"
140 (("-mkdir") "mkdir -p"))
141 ;; drop installation of non-free files
142 (substitute* "Makefile"
143 ((" install.include") "")))
145 (synopsis "Collection of utilities for manipulating PostScript documents")
147 "PSUtils is a collection of utilities for manipulating PostScript
148 documents. Programs included are psnup, for placing out several logical pages
149 on a single sheet of paper, psselect, for selecting pages from a document,
150 pstops, for general imposition, psbook, for signature generation for booklet
151 printing, and psresize, for adjusting page sizes.")
152 (license (license:non-copyleft "file://LICENSE"
153 "See LICENSE in the distribution."))
154 (home-page "http://knackered.org/angus/psutils/")))
156 (define-public ghostscript
163 (uri (string-append "https://github.com/ArtifexSoftware/"
164 "ghostpdl-downloads/releases/download/gs"
165 (string-delete #\. version)
166 "/ghostscript-" version ".tar.xz"))
169 "06dnj0mxyaryfbwlsjwaqf847w91w2h8f108kxxcc41nrnx1y3zw"))
170 (patches (search-patches "ghostscript-no-header-creationdate.patch"
171 "ghostscript-no-header-id.patch"
172 "ghostscript-no-header-uuid.patch"))
173 (modules '((guix build utils)))
175 ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
176 ;; we leave it, at least for now.
177 ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
178 ;; Likewise for the thread-safe lcms2 fork called "lcms2art".
180 (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
181 "libpng" "tiff" "zlib"))
183 (build-system gnu-build-system)
184 (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
186 `(#:disallowed-references ("doc")
187 ;; XXX: Starting with version 9.27, building the tests in parallel
188 ;; occasionally fails like this:
189 ;; In file included from ./base/memory_.h:23:0,
190 ;; from ./obj/gsmd5.h:1,
191 ;; from ./obj/gsmd5.c:56:
192 ;; ./base/std.h:25:10: fatal error: arch.h: No such file or directory
195 (list (string-append "LDFLAGS=-Wl,-rpath="
196 (assoc-ref %outputs "out") "/lib")
197 "--with-system-libtiff"
199 (string-append "ZLIBDIR="
200 (assoc-ref %build-inputs "zlib") "/include")
202 "--disable-compile-inits"
203 (string-append "--with-fontpath="
204 (assoc-ref %build-inputs "gs-fonts")
205 "/share/fonts/type1/ghostscript")
207 ,@(if (%current-target-system)
208 '(;; Specify the native compiler, which is used to build 'echogs'
209 ;; and other intermediary tools when cross-compiling; see
210 ;; <https://ghostscript.com/FAQ.html>.
213 ;; Save 'config.log' etc. of the native build under
214 ;; auxtmp/, useful for debugging.
215 "--enable-save_confaux")
218 (modify-phases %standard-phases
219 (add-before 'configure 'create-output-directory
220 (lambda* (#:key outputs #:allow-other-keys)
221 ;; The configure script refuses to function if the directory
222 ;; specified as -rpath does not already exist.
223 (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
225 (add-after 'configure 'remove-doc-reference
227 ;; Don't retain a reference to the 'doc' output in 'gs'.
228 ;; The only use of this definition is in the output of
229 ;; 'gs --help', so this change is fine.
230 (substitute* "base/gscdef.c"
232 "\"~/.guix-profile/share/doc/ghostscript\""))
233 ;; The docdir default changed in 9.23 and a compatibility
234 ;; symlink was added from datadir->docdir. Remove it.
235 (substitute* "base/unixinst.mak"
236 (("ln -s \\$\\(DESTDIR\\)\\$\\(docdir\\).*") ""))
238 (add-after 'configure 'patch-config-files
240 (substitute* "base/unixhead.mak"
241 (("/bin/sh") (which "sh")))
243 ,@(if (%current-target-system)
244 `((add-after 'configure 'add-native-lz
246 ;; Add missing '-lz' for native tools such as 'mkromfs'.
247 (substitute* "Makefile"
248 (("^AUXEXTRALIBS=(.*)$" _ value)
249 (string-append "AUXEXTRALIBS = -lz " value "\n")))
254 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
255 ;; binary (saves 22 MiB).
256 (invoke "make" "so" "-j"
257 (number->string (parallel-job-count)))))
260 (invoke "make" "soinstall")))
261 (add-after 'install 'create-gs-symlink
262 (lambda* (#:key outputs #:allow-other-keys)
263 (let ((out (assoc-ref outputs "out")))
264 ;; Some programs depend on having a 'gs' binary available.
265 (symlink "gsc" (string-append out "/bin/gs"))
269 ("pkg-config" ,pkg-config) ;needed for freetype
270 ("python" ,python-wrapper)
273 ;; When cross-compiling, some of the natively-built tools require all
275 ,@(if (%current-target-system)
276 `(("zlib/native" ,zlib)
277 ("libjpeg/native" ,libjpeg))
280 `(("fontconfig" ,fontconfig)
281 ("freetype" ,freetype)
282 ("gs-fonts" ,gs-fonts)
283 ("jbig2dec" ,jbig2dec)
285 ("libpaper" ,libpaper)
289 (synopsis "PostScript and PDF interpreter")
291 "Ghostscript is an interpreter for the PostScript language and the PDF
292 file format. It also includes a C library that implements the graphics
293 capabilities of the PostScript language. It supports a wide variety of
294 output file formats and printers.")
295 (home-page "https://www.ghostscript.com/")
296 (license license:agpl3+)))
298 (define-public ghostscript/x
299 (package/inherit ghostscript
300 (name (string-append (package-name ghostscript) "-with-x"))
301 (inputs `(("libxext" ,libxext)
303 ,@(package-inputs ghostscript)))))
305 (define-public ghostscript/cups
306 (package/inherit ghostscript
307 (name "ghostscript-with-cups")
308 (inputs `(("cups" ,cups-minimal)
309 ,@(package-inputs ghostscript)))))
314 (version (package-version ghostscript))
315 (source (package-source ghostscript))
316 (build-system gnu-build-system)
318 `(("libtool" ,libtool)
319 ("automake" ,automake)
320 ("autoconf" ,autoconf)))
323 (modify-phases %standard-phases
324 (add-after 'unpack 'autogen
326 ;; need to regenerate macros
327 (system* "autoreconf" "-if")
328 ;; do not run configure
329 (substitute* "autogen.sh"
330 (("^.*\\$srcdir/configure.*") ""))
331 (system* "bash" "autogen.sh")
332 ;; create configure script in ./ijs/
334 ;; do not run configure
335 (substitute* "autogen.sh"
336 (("^.*\\$srcdir/configure.*") "")
337 (("^ + && echo Now type.*$") ""))
338 (invoke "bash" "autogen.sh"))))))
339 (synopsis "IJS driver framework for inkjet and other raster devices")
341 "IJS is a protocol for transmission of raster page images. This package
342 provides the reference implementation of the raster printer driver
344 (license license:expat)
345 (home-page (package-home-page ghostscript))))
347 (define-public gs-fonts
353 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
355 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
359 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
360 (build-system gnu-build-system)
362 `(#:tests? #f ; nothing to check, just files to copy
364 #:modules ((guix build gnu-build-system)
368 (modify-phases %standard-phases
372 (lambda* (#:key outputs #:allow-other-keys)
373 (let* ((out (assoc-ref outputs "out"))
374 (dir (string-append out "/share/fonts/type1/ghostscript")))
378 (copy-file file (string-append dir "/" file)))
379 (find-files "." "pfb|afm"))
381 (synopsis "Free replacements for the PostScript fonts")
383 "Ghostscript fonts provides fonts and font metrics customarily distributed with
384 Ghostscript. It currently includes the 35 standard PostScript fonts.")
385 (license license:gpl2)
386 (home-page "https://sourceforge.net/projects/gs-fonts/")))
388 (define-public libspectre
394 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
397 "1a67iglsc3r05mzngyg9kb1gy8whq4fgsnyjwi7bqfw2i7rnl9b5"))))
398 (build-system gnu-build-system)
399 (inputs `(("ghostscript" ,ghostscript)))
400 (native-inputs `(("pkg-config" ,pkg-config)))
401 (synopsis "Postscript rendering library")
403 "libspectre is a small library for rendering Postscript documents.
404 It provides a convenient easy to use API for handling and rendering
405 Postscript documents.")
406 (license license:gpl2+)
407 (home-page "https://www.freedesktop.org/wiki/Software/libspectre")))