projects/guix·blob version-0.14.0 · refs

386 lines · 15.3 KiB

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