Commit | Line | Data |
---|---|---|
bf4018fb AE |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr> | |
7020a6ab | 3 | ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org> |
01aae5fc | 4 | ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> |
49d035ff | 5 | ;;; Copyright © 2013, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> |
e4f43bc5 | 6 | ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com> |
8a3bb34c | 7 | ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il> |
1c09eb99 | 8 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> |
c3800f0b | 9 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
0084744b | 10 | ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com> |
bf4018fb AE |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu packages ghostscript) | |
28 | #:use-module (gnu packages) | |
01aae5fc | 29 | #:use-module (gnu packages autotools) |
bf4018fb | 30 | #:use-module (gnu packages compression) |
3e442f85 | 31 | #:use-module (gnu packages cups) |
a86177d6 | 32 | #:use-module (gnu packages fontutils) |
e55354b8 | 33 | #:use-module (gnu packages image) |
bf4018fb AE |
34 | #:use-module (gnu packages perl) |
35 | #:use-module (gnu packages pkg-config) | |
36 | #:use-module (gnu packages python) | |
37 | #:use-module (gnu packages tcl) | |
7a75b02a | 38 | #:use-module (gnu packages xorg) |
b5b73a82 | 39 | #:use-module ((guix licenses) #:prefix license:) |
bf4018fb AE |
40 | #:use-module (guix packages) |
41 | #:use-module (guix download) | |
0084744b | 42 | #:use-module (guix utils) |
71eba3eb | 43 | #:use-module (guix build-system gnu) |
0084744b MB |
44 | #:use-module (guix build-system trivial) |
45 | #:use-module (srfi srfi-1)) | |
bf4018fb AE |
46 | |
47 | (define-public lcms | |
48 | (package | |
49 | (name "lcms") | |
8a3bb34c | 50 | (replacement lcms/fixed) |
c3800f0b | 51 | (version "2.9") |
bf4018fb AE |
52 | (source (origin |
53 | (method url-fetch) | |
de67e922 LF |
54 | (uri (string-append "mirror://sourceforge/lcms/lcms/" version |
55 | "/lcms2-" version ".tar.gz")) | |
bf4018fb | 56 | (sha256 (base32 |
c3800f0b | 57 | "083xisy6z01zhm7p7rgk4bx9d6zlr8l20qkfv1g29ylnhgwzvij8")))) |
bf4018fb | 58 | (build-system gnu-build-system) |
9bb98f64 | 59 | (inputs `(("libjpeg" ,libjpeg) |
bf4018fb AE |
60 | ("libtiff" ,libtiff) |
61 | ("zlib" ,zlib))) | |
62 | (synopsis "Little CMS, a small-footprint colour management engine") | |
63 | (description | |
64 | "Little CMS is a small-footprint colour management engine, with special | |
35b9e423 | 65 | focus on accuracy and performance. It uses the International Color |
bf4018fb AE |
66 | Consortium standard (ICC), approved as ISO 15076-1.") |
67 | (license license:x11) | |
f769c1d7 LF |
68 | (home-page "http://www.littlecms.com/") |
69 | (properties '((cpe-name . "little_cms_color_engine"))))) | |
bf4018fb | 70 | |
8a3bb34c EF |
71 | (define lcms/fixed |
72 | (package | |
73 | (inherit lcms) | |
74 | (source | |
75 | (origin | |
76 | (inherit (package-source lcms)) | |
77 | (patches (search-patches "lcms-CVE-2018-16435.patch")))))) | |
78 | ||
bf4018fb AE |
79 | (define-public libpaper |
80 | (package | |
81 | (name "libpaper") | |
82 | (version "1.1.24") | |
83 | (source (origin | |
84 | (method url-fetch) | |
85 | (uri (string-append | |
48fa9312 EF |
86 | ;; Debian moved their libpaper-1.1.24 to archive.debian.net |
87 | ;; but in the move the hash of their tarball changed. | |
88 | "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_" | |
89 | version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_" | |
bf4018fb AE |
90 | version ".tar.gz")) |
91 | (sha256 (base32 | |
92 | "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q")))) | |
93 | (build-system gnu-build-system) | |
35b9e423 | 94 | (synopsis "Library for handling paper sizes") |
bf4018fb AE |
95 | (description |
96 | "The paper library and accompanying files are intended to provide a simple | |
97 | way for applications to take actions based on a system- or user-specified | |
98 | paper size.") | |
99 | (license license:gpl2) | |
48fa9312 | 100 | (home-page "https://packages.qa.debian.org/libp/libpaper.html"))) |
bf4018fb | 101 | |
87ec7a7a AE |
102 | (define-public psutils |
103 | (package | |
104 | (name "psutils") | |
105 | (version "17") | |
106 | (source (origin | |
107 | (method url-fetch) | |
108 | (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz") | |
109 | (sha256 (base32 | |
110 | "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq")))) | |
111 | (build-system gnu-build-system) | |
112 | (inputs `(("perl" ,perl))) | |
113 | (arguments | |
114 | `(#:tests? #f ; none provided | |
115 | #:phases | |
530d9e15 EF |
116 | (modify-phases %standard-phases |
117 | (replace 'configure | |
118 | (lambda* (#:key inputs outputs #:allow-other-keys #:rest args) | |
119 | (let ((perl (assoc-ref inputs "perl")) | |
120 | (out (assoc-ref outputs "out"))) | |
121 | (copy-file "Makefile.unix" "Makefile") | |
122 | (substitute* "Makefile" | |
123 | (("/usr/local/bin/perl") (string-append perl "/bin/perl"))) | |
124 | (substitute* "Makefile" | |
125 | (("/usr/local") out)) | |
126 | ;; for the install phase | |
127 | (substitute* "Makefile" | |
128 | (("-mkdir") "mkdir -p")) | |
129 | ;; drop installation of non-free files | |
130 | (substitute* "Makefile" | |
131 | ((" install.include") ""))) | |
132 | #t))))) | |
35b9e423 | 133 | (synopsis "Collection of utilities for manipulating PostScript documents") |
87ec7a7a AE |
134 | (description |
135 | "PSUtils is a collection of utilities for manipulating PostScript | |
35b9e423 | 136 | documents. Programs included are psnup, for placing out several logical pages |
87ec7a7a AE |
137 | on a single sheet of paper, psselect, for selecting pages from a document, |
138 | pstops, for general imposition, psbook, for signature generation for booklet | |
139 | printing, and psresize, for adjusting page sizes.") | |
166191b3 | 140 | (license (license:non-copyleft "file://LICENSE" |
87ec7a7a AE |
141 | "See LICENSE in the distribution.")) |
142 | (home-page "http://knackered.org/angus/psutils/"))) | |
143 | ||
bf4018fb AE |
144 | (define-public ghostscript |
145 | (package | |
d6158fe7 | 146 | (name "ghostscript") |
87f29c1e | 147 | (version "9.26") |
d6158fe7 LF |
148 | (source |
149 | (origin | |
150 | (method url-fetch) | |
151 | (uri (string-append "https://github.com/ArtifexSoftware/" | |
152 | "ghostpdl-downloads/releases/download/gs" | |
153 | (string-delete #\. version) | |
154 | "/ghostscript-" version ".tar.xz")) | |
155 | (sha256 | |
156 | (base32 | |
87f29c1e MB |
157 | "1645f47all5w27bfhiq15vycdm954lmr6agqkrp68ksq6xglgvch")) |
158 | (patches (search-patches "ghostscript-no-header-creationdate.patch" | |
63eb4a2a DM |
159 | "ghostscript-no-header-id.patch" |
160 | "ghostscript-no-header-uuid.patch")) | |
d6158fe7 LF |
161 | (modules '((guix build utils))) |
162 | (snippet | |
163 | ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so | |
164 | ;; we leave it, at least for now. | |
165 | ;; TODO Try unbundling ijs, which is developed alongside Ghostscript. | |
68ab0ad5 | 166 | ;; Likewise for the thread-safe lcms2 fork called "lcms2art". |
d6158fe7 LF |
167 | '(begin |
168 | (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg" | |
68ab0ad5 | 169 | "libpng" "tiff" "zlib")) |
6cbee49d | 170 | #t)))) |
d6158fe7 LF |
171 | (build-system gnu-build-system) |
172 | (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples | |
173 | (arguments | |
174 | `(#:disallowed-references ("doc") | |
175 | #:configure-flags | |
842c44c9 MB |
176 | (list (string-append "LDFLAGS=-Wl,-rpath=" |
177 | (assoc-ref %outputs "out") "/lib") | |
178 | "--with-system-libtiff" | |
d6158fe7 LF |
179 | "LIBS=-lz" |
180 | (string-append "ZLIBDIR=" | |
181 | (assoc-ref %build-inputs "zlib") "/include") | |
49d035ff LC |
182 | "--enable-dynamic" |
183 | ||
184 | ,@(if (%current-target-system) | |
185 | '(;; Specify the native compiler, which is used to build 'echogs' | |
186 | ;; and other intermediary tools when cross-compiling; see | |
187 | ;; <https://ghostscript.com/FAQ.html>. | |
188 | "CCAUX=gcc" | |
189 | ||
190 | ;; Save 'config.log' etc. of the native build under | |
191 | ;; auxtmp/, useful for debugging. | |
192 | "--enable-save_confaux") | |
193 | '())) | |
d6158fe7 LF |
194 | #:phases |
195 | (modify-phases %standard-phases | |
842c44c9 MB |
196 | (add-before 'configure 'create-output-directory |
197 | (lambda* (#:key outputs #:allow-other-keys) | |
198 | ;; The configure script refuses to function if the directory | |
199 | ;; specified as -rpath does not already exist. | |
200 | (mkdir-p (string-append (assoc-ref outputs "out") "/lib")) | |
201 | #t)) | |
d6158fe7 | 202 | (add-after 'configure 'remove-doc-reference |
eb354bda | 203 | (lambda _ |
d6158fe7 LF |
204 | ;; Don't retain a reference to the 'doc' output in 'gs'. |
205 | ;; The only use of this definition is in the output of | |
206 | ;; 'gs --help', so this change is fine. | |
207 | (substitute* "base/gscdef.c" | |
208 | (("GS_DOCDIR") | |
209 | "\"~/.guix-profile/share/doc/ghostscript\"")) | |
68ab0ad5 MB |
210 | ;; The docdir default changed in 9.23 and a compatibility |
211 | ;; symlink was added from datadir->docdir. Remove it. | |
212 | (substitute* "base/unixinst.mak" | |
213 | (("ln -s \\$\\(DESTDIR\\)\\$\\(docdir\\).*") "")) | |
d6158fe7 LF |
214 | #t)) |
215 | (add-after 'configure 'patch-config-files | |
216 | (lambda _ | |
217 | (substitute* "base/unixhead.mak" | |
218 | (("/bin/sh") (which "sh"))) | |
219 | #t)) | |
49d035ff LC |
220 | ,@(if (%current-target-system) |
221 | `((add-after 'configure 'add-native-lz | |
222 | (lambda _ | |
223 | ;; Add missing '-lz' for native tools such as 'mkromfs'. | |
224 | (substitute* "Makefile" | |
225 | (("^AUXEXTRALIBS=(.*)$" _ value) | |
226 | (string-append "AUXEXTRALIBS = -lz " value "\n"))) | |
227 | #t))) | |
228 | '()) | |
d6158fe7 LF |
229 | (replace 'build |
230 | (lambda _ | |
231 | ;; Build 'libgs.so', but don't build the statically-linked 'gs' | |
232 | ;; binary (saves 22 MiB). | |
eb075edd MW |
233 | (invoke "make" "so" "-j" |
234 | (number->string (parallel-job-count))))) | |
d6158fe7 LF |
235 | (replace 'install |
236 | (lambda _ | |
eb075edd | 237 | (invoke "make" "soinstall"))) |
d6158fe7 LF |
238 | (add-after 'install 'create-gs-symlink |
239 | (lambda* (#:key outputs #:allow-other-keys) | |
240 | (let ((out (assoc-ref outputs "out"))) | |
241 | ;; Some programs depend on having a 'gs' binary available. | |
242 | (symlink "gsc" (string-append out "/bin/gs")) | |
243 | #t)))))) | |
244 | (native-inputs | |
245 | `(("perl" ,perl) | |
246 | ("python" ,python-wrapper) | |
49d035ff LC |
247 | ("tcl" ,tcl) |
248 | ||
249 | ;; When cross-compiling, some of the natively-built tools require all | |
250 | ;; these libraries. | |
251 | ,@(if (%current-target-system) | |
252 | `(("zlib/native" ,zlib) | |
68ab0ad5 | 253 | ("libjpeg/native" ,libjpeg)) |
49d035ff | 254 | '()))) |
d6158fe7 LF |
255 | (inputs |
256 | `(("freetype" ,freetype) | |
257 | ("jbig2dec" ,jbig2dec) | |
d6158fe7 LF |
258 | ("libjpeg" ,libjpeg) |
259 | ("libpaper" ,libpaper) | |
260 | ("libpng" ,libpng) | |
261 | ("libtiff" ,libtiff) | |
262 | ("zlib" ,zlib))) | |
263 | (synopsis "PostScript and PDF interpreter") | |
264 | (description | |
265 | "Ghostscript is an interpreter for the PostScript language and the PDF | |
a22dc0c4 LC |
266 | file format. It also includes a C library that implements the graphics |
267 | capabilities of the PostScript language. It supports a wide variety of | |
268 | output file formats and printers.") | |
d6158fe7 LF |
269 | (home-page "https://www.ghostscript.com/") |
270 | (license license:agpl3+))) | |
1f7c6a1f | 271 | |
7a75b02a | 272 | (define-public ghostscript/x |
7020a6ab | 273 | (package/inherit ghostscript |
7a75b02a MW |
274 | (name (string-append (package-name ghostscript) "-with-x")) |
275 | (inputs `(("libxext" ,libxext) | |
276 | ("libxt" ,libxt) | |
277 | ,@(package-inputs ghostscript))))) | |
278 | ||
3e442f85 LC |
279 | (define-public ghostscript/cups |
280 | (package/inherit ghostscript | |
281 | (name "ghostscript-with-cups") | |
282 | (inputs `(("cups" ,cups-minimal) | |
283 | ,@(package-inputs ghostscript))))) | |
284 | ||
01aae5fc RW |
285 | (define-public ijs |
286 | (package | |
287 | (name "ijs") | |
55af10fb LF |
288 | (version (package-version ghostscript)) |
289 | (source (package-source ghostscript)) | |
01aae5fc RW |
290 | (build-system gnu-build-system) |
291 | (native-inputs | |
292 | `(("libtool" ,libtool) | |
293 | ("automake" ,automake) | |
294 | ("autoconf" ,autoconf))) | |
295 | (arguments | |
296 | `(#:phases | |
1c09eb99 LF |
297 | (modify-phases %standard-phases |
298 | (add-after 'unpack 'autogen | |
299 | (lambda _ | |
300 | ;; need to regenerate macros | |
301 | (system* "autoreconf" "-if") | |
302 | ;; do not run configure | |
303 | (substitute* "autogen.sh" | |
304 | (("^.*\\$srcdir/configure.*") "")) | |
305 | (system* "bash" "autogen.sh") | |
306 | ;; create configure script in ./ijs/ | |
307 | (chdir "ijs") | |
308 | ;; do not run configure | |
309 | (substitute* "autogen.sh" | |
310 | (("^.*\\$srcdir/configure.*") "") | |
311 | (("^ + && echo Now type.*$") "")) | |
8f52d898 | 312 | (invoke "bash" "autogen.sh")))))) |
01aae5fc RW |
313 | (synopsis "IJS driver framework for inkjet and other raster devices") |
314 | (description | |
315 | "IJS is a protocol for transmission of raster page images. This package | |
316 | provides the reference implementation of the raster printer driver | |
317 | architecture.") | |
318 | (license license:expat) | |
55af10fb | 319 | (home-page (package-home-page ghostscript)))) |
01aae5fc | 320 | |
1f7c6a1f AE |
321 | (define-public gs-fonts |
322 | (package | |
323 | (name "gs-fonts") | |
324 | (version "8.11") | |
325 | (source (origin | |
326 | (method url-fetch) | |
327 | (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/" | |
328 | version | |
329 | "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-" | |
330 | version | |
331 | ".tar.gz")) | |
332 | (sha256 (base32 | |
333 | "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf")))) | |
334 | (build-system gnu-build-system) | |
335 | (arguments | |
336 | `(#:tests? #f ; nothing to check, just files to copy | |
809bc394 ST |
337 | |
338 | #:modules ((guix build gnu-build-system) | |
339 | (guix build utils) | |
340 | (srfi srfi-1)) | |
1f7c6a1f | 341 | #:phases |
a6d352cc EF |
342 | (modify-phases %standard-phases |
343 | (delete 'configure) | |
344 | (delete 'build) | |
345 | (replace 'install | |
346 | (lambda* (#:key outputs #:allow-other-keys) | |
347 | (let* ((out (assoc-ref outputs "out")) | |
348 | (dir (string-append out "/share/fonts/type1/ghostscript"))) | |
349 | (mkdir-p dir) | |
350 | (for-each | |
351 | (lambda (file) | |
352 | (copy-file file (string-append dir "/" file))) | |
6449e68d MW |
353 | (find-files "." "pfb|afm")) |
354 | #t)))))) | |
35b9e423 | 355 | (synopsis "Free replacements for the PostScript fonts") |
1f7c6a1f | 356 | (description |
35b9e423 EB |
357 | "Ghostscript fonts provides fonts and font metrics customarily distributed with |
358 | Ghostscript. It currently includes the 35 standard PostScript fonts.") | |
1f7c6a1f | 359 | (license license:gpl2) |
3b3b60d0 | 360 | (home-page "https://sourceforge.net/projects/gs-fonts/"))) |
c5ea1201 | 361 | |
7cf2a2a1 AE |
362 | (define-public libspectre |
363 | (package | |
364 | (name "libspectre") | |
94522776 | 365 | (version "0.2.8") |
7cf2a2a1 AE |
366 | (source (origin |
367 | (method url-fetch) | |
5cc3096c | 368 | (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-" |
7cf2a2a1 AE |
369 | version ".tar.gz")) |
370 | (sha256 (base32 | |
94522776 | 371 | "1a67iglsc3r05mzngyg9kb1gy8whq4fgsnyjwi7bqfw2i7rnl9b5")))) |
7cf2a2a1 | 372 | (build-system gnu-build-system) |
c4c4cc05 JD |
373 | (inputs `(("ghostscript" ,ghostscript))) |
374 | (native-inputs `(("pkg-config" ,pkg-config))) | |
35b9e423 | 375 | (synopsis "Postscript rendering library") |
7cf2a2a1 AE |
376 | (description |
377 | "libspectre is a small library for rendering Postscript documents. | |
378 | It provides a convenient easy to use API for handling and rendering | |
379 | Postscript documents.") | |
380 | (license license:gpl2+) | |
57e7d748 | 381 | (home-page "https://www.freedesktop.org/wiki/Software/libspectre"))) |