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