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 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-8" ,libjpeg-8)
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-no-header-creationdate.patch"
148 "ghostscript-no-header-id.patch"
149 "ghostscript-no-header-uuid.patch"))
150 (modules '((guix build utils)))
152 ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
153 ;; we leave it, at least for now.
154 ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
155 ;; Likewise for the thread-safe lcms2 fork called "lcms2art".
157 (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
158 "libpng" "tiff" "zlib"))
160 (build-system gnu-build-system)
161 (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
163 `(#:disallowed-references ("doc")
165 (list "--with-system-libtiff"
167 (string-append "ZLIBDIR="
168 (assoc-ref %build-inputs "zlib") "/include")
171 ,@(if (%current-target-system)
172 '(;; Specify the native compiler, which is used to build 'echogs'
173 ;; and other intermediary tools when cross-compiling; see
174 ;; <https://ghostscript.com/FAQ.html>.
177 ;; Save 'config.log' etc. of the native build under
178 ;; auxtmp/, useful for debugging.
179 "--enable-save_confaux")
182 (modify-phases %standard-phases
183 (add-after 'configure 'remove-doc-reference
185 ;; Don't retain a reference to the 'doc' output in 'gs'.
186 ;; The only use of this definition is in the output of
187 ;; 'gs --help', so this change is fine.
188 (substitute* "base/gscdef.c"
190 "\"~/.guix-profile/share/doc/ghostscript\""))
191 ;; The docdir default changed in 9.23 and a compatibility
192 ;; symlink was added from datadir->docdir. Remove it.
193 (substitute* "base/unixinst.mak"
194 (("ln -s \\$\\(DESTDIR\\)\\$\\(docdir\\).*") ""))
196 (add-after 'configure 'patch-config-files
198 (substitute* "base/unixhead.mak"
199 (("/bin/sh") (which "sh")))
201 ,@(if (%current-target-system)
202 `((add-after 'configure 'add-native-lz
204 ;; Add missing '-lz' for native tools such as 'mkromfs'.
205 (substitute* "Makefile"
206 (("^AUXEXTRALIBS=(.*)$" _ value)
207 (string-append "AUXEXTRALIBS = -lz " value "\n")))
212 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
213 ;; binary (saves 22 MiB).
214 (invoke "make" "so" "-j"
215 (number->string (parallel-job-count)))))
218 (invoke "make" "soinstall")))
219 (add-after 'install 'create-gs-symlink
220 (lambda* (#:key outputs #:allow-other-keys)
221 (let ((out (assoc-ref outputs "out")))
222 ;; Some programs depend on having a 'gs' binary available.
223 (symlink "gsc" (string-append out "/bin/gs"))
227 ("python" ,python-wrapper)
230 ;; When cross-compiling, some of the natively-built tools require all
232 ,@(if (%current-target-system)
233 `(("zlib/native" ,zlib)
234 ("libjpeg/native" ,libjpeg))
237 `(("freetype" ,freetype)
238 ("jbig2dec" ,jbig2dec)
240 ("libpaper" ,libpaper)
244 (synopsis "PostScript and PDF interpreter")
246 "Ghostscript is an interpreter for the PostScript language and the PDF
247 file format. It also includes a C library that implements the graphics
248 capabilities of the PostScript language. It supports a wide variety of
249 output file formats and printers.")
250 (home-page "https://www.ghostscript.com/")
251 (license license:agpl3+)))
253 (define-public ghostscript/x
254 (package/inherit ghostscript
255 (name (string-append (package-name ghostscript) "-with-x"))
256 (inputs `(("libxext" ,libxext)
258 ,@(package-inputs ghostscript)))))
260 (define-public ghostscript/cups
261 (package/inherit ghostscript
262 (name "ghostscript-with-cups")
263 (inputs `(("cups" ,cups-minimal)
264 ,@(package-inputs ghostscript)))))
269 (version (package-version ghostscript))
270 (source (package-source ghostscript))
271 (build-system gnu-build-system)
273 `(("libtool" ,libtool)
274 ("automake" ,automake)
275 ("autoconf" ,autoconf)))
278 (modify-phases %standard-phases
279 (add-after 'unpack 'autogen
281 ;; need to regenerate macros
282 (system* "autoreconf" "-if")
283 ;; do not run configure
284 (substitute* "autogen.sh"
285 (("^.*\\$srcdir/configure.*") ""))
286 (system* "bash" "autogen.sh")
287 ;; create configure script in ./ijs/
289 ;; do not run configure
290 (substitute* "autogen.sh"
291 (("^.*\\$srcdir/configure.*") "")
292 (("^ + && echo Now type.*$") ""))
293 (invoke "bash" "autogen.sh"))))))
294 (synopsis "IJS driver framework for inkjet and other raster devices")
296 "IJS is a protocol for transmission of raster page images. This package
297 provides the reference implementation of the raster printer driver
299 (license license:expat)
300 (home-page (package-home-page ghostscript))))
302 (define-public gs-fonts
308 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
310 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
314 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
315 (build-system gnu-build-system)
317 `(#:tests? #f ; nothing to check, just files to copy
319 #:modules ((guix build gnu-build-system)
323 (modify-phases %standard-phases
327 (lambda* (#:key outputs #:allow-other-keys)
328 (let* ((out (assoc-ref outputs "out"))
329 (dir (string-append out "/share/fonts/type1/ghostscript")))
333 (copy-file file (string-append dir "/" file)))
334 (find-files "." "pfb|afm"))
336 (synopsis "Free replacements for the PostScript fonts")
338 "Ghostscript fonts provides fonts and font metrics customarily distributed with
339 Ghostscript. It currently includes the 35 standard PostScript fonts.")
340 (license license:gpl2)
341 (home-page "https://sourceforge.net/projects/gs-fonts/")))
343 (define-public libspectre
349 (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
352 "1a67iglsc3r05mzngyg9kb1gy8whq4fgsnyjwi7bqfw2i7rnl9b5"))))
353 (build-system gnu-build-system)
354 (inputs `(("ghostscript" ,ghostscript)))
355 (native-inputs `(("pkg-config" ,pkg-config)))
356 (synopsis "Postscript rendering library")
358 "libspectre is a small library for rendering Postscript documents.
359 It provides a convenient easy to use API for handling and rendering
360 Postscript documents.")
361 (license license:gpl2+)
362 (home-page "https://www.freedesktop.org/wiki/Software/libspectre")))