projects/guix·blob librewolf-updates · refs

434 lines · 17.5 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-2017, 2019, 2023 Ludovic Courtès <[email protected]>
6;;; Copyright © 2017 Alex Vong <[email protected]>
7;;; Copyright © 2017, 2018, 2019, 2021, 2023 Efraim Flashner <[email protected]>
8;;; Copyright © 2017 Leo Famulari <[email protected]>
9;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
10;;; Copyright © 2018, 2020, 2022 Marius Bakke <[email protected]>
11;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
12;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen <[email protected]>
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29(define-module (gnu packages ghostscript)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages cups)
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages image)
36 #:use-module (gnu packages man)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages tcl)
41 #:use-module (gnu packages xorg)
42 #:use-module ((guix licenses) #:prefix license:)
43 #:use-module (guix packages)
44 #:use-module (guix download)
45 #:use-module (guix gexp)
46 #:use-module (guix utils)
47 #:use-module (guix build-system gnu)
48 #:use-module (srfi srfi-1))
49
50(define-public lcms
51 (package
52 (name "lcms")
53 (version "2.13.1")
54 (source (origin
55 (method url-fetch)
56 (uri (string-append "mirror://sourceforge/lcms/lcms/"
57 (version-major+minor version)
58 "/lcms2-" version ".tar.gz"))
59 (sha256
60 (base32
61 "121v414bg2zk0fcwx0kigr2l6nxl88nmblfn3gq5lz5jwybffwyl"))))
62 (build-system gnu-build-system)
63 (arguments
64 '(#:configure-flags '("--disable-static")))
65 (inputs
66 (list libjpeg-turbo libtiff zlib))
67 (synopsis "Little CMS, a small-footprint colour management engine")
68 (description
69 "Little CMS is a small-footprint colour management engine, with special
70focus on accuracy and performance. It uses the International Color
71Consortium standard (ICC), approved as ISO 15076-1.")
72 (license license:x11)
73 (home-page "https://www.littlecms.com/")
74 (properties '((cpe-name . "little_cms_color_engine")))))
75
76(define-public lcms-next
77 (package
78 (inherit lcms)
79 (name "lcms-next")
80 (version "2.16.0")
81 (source
82 (origin
83 (method url-fetch)
84 (uri (string-append "mirror://sourceforge/lcms/lcms/"
85 (version-major+minor version)
86 "/lcms2-" (version-major+minor version) ".tar.gz"))
87 (sha256
88 (base32 "0lasskcj7k0sp0z7cpnwwisp826j51i1l7v322hcxd5rv15d6wyq"))))))
89
90(define-public libpaper
91 (package
92 (name "libpaper")
93 (version "2.0.0")
94 (source (origin
95 (method url-fetch)
96 (uri (string-append "https://github.com/rrthomas/libpaper/releases"
97 "/download/v" version "/libpaper-"
98 version ".tar.gz"))
99 (sha256
100 (base32
101 "0aipyaqp30cn919j7w5wvlgkw0v4aqsax82i2zw4wmgck8g6ax77"))))
102 (build-system gnu-build-system)
103 (native-inputs
104 (list help2man))
105 (arguments
106 (list #:configure-flags ''("--disable-static"
107 ;; Tests require a relocatable build.
108 "--enable-relocatable")
109 ;; --enable-relocate is broken on the Hurd
110 #:tests? (not (or (target-hurd?)
111 (%current-target-system)))))
112 (outputs '("out" "debug"))
113 (home-page "https://github.com/rrthomas/libpaper")
114 (synopsis "Library for handling paper sizes")
115 (description
116 "The paper library and accompanying files are intended to provide a simple
117way for applications to take actions based on a system- or user-specified
118paper size.")
119 ;; The library is LGPL3+, everything else GPL3+.
120 (license (list license:lgpl3+ license:gpl3+))))
121
122(define-public psutils
123 (package
124 (name "psutils")
125 (version "2.09")
126 (source (origin
127 (method url-fetch)
128 (uri (string-append "https://github.com/rrthomas/psutils/releases"
129 "/download/v" version "/psutils-"
130 version ".tar.gz"))
131 (sha256
132 (base32
133 "1nmp0hb7c4a315vv1mqw2cbckvca8bzh1cv3gdvwwy24w9qba6p3"))))
134 (build-system gnu-build-system)
135 (inputs (list perl perl-ipc-run3))
136 (native-inputs
137 (list libpaper))
138 (arguments
139 (list
140 #:tests? #f ; FIXME: requires files not present in tarball
141 #:configure-flags
142 ;; Help the build system locate Perl when cross-compiling.
143 (if (%current-target-system)
144 #~(list (string-append "ac_cv_path_PERL="
145 (search-input-file %build-inputs "bin/perl")))
146 #~'())
147 #:phases
148 #~(modify-phases %standard-phases
149 (add-after 'install 'wrap-scripts
150 (lambda _
151 (let ((perl5lib (getenv "PERL5LIB")))
152 (for-each
153 (lambda (file)
154 (wrap-program file
155 `("PERL5LIB" ":" prefix
156 (,(string-append perl5lib ":" #$output
157 "/lib/perl5/site_perl")))))
158 (find-files (string-append #$output "/bin") "."))))))))
159 (synopsis "Collection of utilities for manipulating PostScript documents")
160 (description
161 "PSUtils is a collection of utilities for manipulating PostScript
162documents. Programs included are psnup, for placing out several logical pages
163on a single sheet of paper, psselect, for selecting pages from a document,
164pstops, for general imposition, psbook, for signature generation for booklet
165printing, and psresize, for adjusting page sizes.")
166 (home-page "https://github.com/rrthomas/psutils")
167 (license (list license:gpl3+
168 ;; This file carries the "historical" psutils license (v1),
169 ;; which is "effectively BSD 3-clause" (a quote from the file).
170 (license:non-copyleft
171 "file://extractres.in.in"
172 "See extractres.in.in in the distribution.")))))
173
174(define-public ghostscript
175 (package
176 (name "ghostscript")
177 (version "9.56.1")
178 (source
179 (origin
180 (method url-fetch)
181 (uri (string-append "https://github.com/ArtifexSoftware/"
182 "ghostpdl-downloads/releases/download/gs"
183 (string-delete #\. version)
184 "/ghostscript-" version ".tar.xz"))
185 (sha256
186 (base32
187 "1r5qash65m6ignki6z72q4rlai9ka99xrxnmqd19n02has00cd6l"))
188 (patches (search-patches "ghostscript-no-header-creationdate.patch"
189 "ghostscript-no-header-id.patch"
190 "ghostscript-no-header-uuid.patch"
191 "ghostscript-CVE-2023-36664.patch"
192 "ghostscript-CVE-2023-36664-fixup.patch"))
193 (modules '((guix build utils)))
194 (snippet
195 ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
196 ;; we leave it, at least for now.
197 ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
198 ;; Likewise for the thread-safe lcms2 fork called "lcms2art".
199 '(begin
200 (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
201 "libpng" "tiff" "zlib"))))))
202 (build-system gnu-build-system)
203 (outputs '("out" "doc")) ;19 MiB of HTML/PS doc + examples
204 (arguments
205 (list
206 #:disallowed-references '("doc")
207 #:configure-flags
208 #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
209 "--with-system-libtiff"
210 "LIBS=-lz"
211 (string-append "ZLIBDIR="
212 (dirname (search-input-file %build-inputs
213 "include/zlib.h")))
214 "--enable-dynamic"
215 "--disable-compile-inits"
216 (string-append "--with-fontpath="
217 (search-input-directory
218 %build-inputs
219 "share/fonts/type1/ghostscript"))
220
221 #$@(if (%current-target-system)
222 '(;; Specify the native compiler, which is used to build 'echogs'
223 ;; and other intermediary tools when cross-compiling; see
224 ;; <https://ghostscript.com/FAQ.html>.
225 "CCAUX=gcc"
226
227 ;; Save 'config.log' etc. of the native build under
228 ;; auxtmp/, useful for debugging.
229 "--enable-save_confaux")
230 '()))
231 #:phases
232 #~(modify-phases %standard-phases
233 #$@(if (target-hurd?)
234 #~((add-after 'unpack 'patch-leptonica
235 (lambda _
236 (let ((patch-file
237 #$(local-file
238 (search-patch
239 "ghostscript-leptonica-hurd.patch"))))
240 (with-directory-excursion "leptonica"
241 (invoke "patch" "--force" "-p1" "-i" patch-file))))))
242 #~())
243 (add-before 'configure 'create-output-directory
244 (lambda _
245 ;; The configure script refuses to function if the directory
246 ;; specified as -rpath does not already exist.
247 (mkdir-p (string-append #$output "/lib"))))
248 (add-after 'configure 'remove-doc-reference
249 (lambda _
250 ;; Don't retain a reference to the 'doc' output in 'gs'.
251 ;; The only use of this definition is in the output of
252 ;; 'gs --help', so this change is fine.
253 (substitute* "base/gscdef.c"
254 (("GS_DOCDIR")
255 "\"~/.guix-profile/share/doc/ghostscript\""))))
256 (add-after 'configure 'patch-config-files
257 (lambda _
258 (substitute* "base/unixhead.mak"
259 (("/bin/sh") (which "sh")))))
260 #$@(if (%current-target-system)
261 '((add-after 'configure 'add-native-lz
262 (lambda _
263 ;; Add missing '-lz' for native tools such as 'mkromfs'.
264 (substitute* "Makefile"
265 (("^AUXEXTRALIBS=(.*)$" _ value)
266 (string-append "AUXEXTRALIBS = -lz " value "\n"))))))
267 '())
268 (replace 'build
269 (lambda _
270 ;; Build 'libgs.so', but don't build the statically-linked 'gs'
271 ;; binary (saves 22 MiB).
272 (invoke "make" "so" "-j"
273 (number->string (parallel-job-count)))))
274 (replace 'install
275 (lambda _
276 (invoke "make" "soinstall")))
277 (add-after 'install 'create-gs-symlink
278 (lambda _
279 ;; Some programs depend on having a 'gs' binary available.
280 (symlink "gsc" (string-append #$output "/bin/gs")))))))
281 (native-inputs
282 (append
283 (list perl
284 pkg-config ;needed for freetype
285 python-minimal-wrapper
286 tcl)
287 ;; When cross-compiling, some of the natively-built tools require all
288 ;; these libraries.
289 (if (%current-target-system)
290 (list zlib libjpeg-turbo)
291 '())))
292 (inputs
293 (list fontconfig
294 freetype
295 font-ghostscript
296 jbig2dec
297 libjpeg-turbo
298 libpaper
299 libpng
300 libtiff
301 zlib))
302 (synopsis "PostScript and PDF interpreter")
303 (description
304 "Ghostscript is an interpreter for the PostScript language and the PDF
305file format. It also includes a C library that implements the graphics
306capabilities of the PostScript language. It supports a wide variety of
307output file formats and printers.")
308 (home-page "https://www.ghostscript.com/")
309 (license license:agpl3+)))
310
311(define-public ghostscript/x
312 (package/inherit ghostscript
313 (name (string-append (package-name ghostscript) "-with-x"))
314 (inputs (modify-inputs (package-inputs ghostscript)
315 (prepend libxext libxt)))))
316
317(define-public ghostscript/cups
318 (package/inherit ghostscript
319 (name "ghostscript-with-cups")
320 (inputs (modify-inputs (package-inputs ghostscript)
321 (prepend cups-minimal)))))
322
323(define-public ijs
324 (package
325 (name "ijs")
326 (version (package-version ghostscript))
327 (source (package-source ghostscript))
328 (build-system gnu-build-system)
329 (native-inputs
330 (append (if (target-riscv64?)
331 (list config)
332 '())
333 (list libtool automake autoconf)))
334 (arguments
335 `(#:phases
336 (modify-phases %standard-phases
337 (add-after 'unpack 'autogen
338 (lambda _
339 ;; need to regenerate macros
340 (system* "autoreconf" "-if")
341 ;; do not run configure
342 (substitute* "autogen.sh"
343 (("^.*\\$srcdir/configure.*") ""))
344 (system* "bash" "autogen.sh")
345 ;; create configure script in ./ijs/
346 (chdir "ijs")
347 ;; do not run configure
348 (substitute* "autogen.sh"
349 (("^.*\\$srcdir/configure.*") "")
350 (("^ + && echo Now type.*$") ""))
351 (invoke "bash" "autogen.sh")))
352 ,@(if (target-riscv64?)
353 `((add-after 'unpack 'update-config-scripts
354 (lambda* (#:key native-inputs inputs #:allow-other-keys)
355 (for-each (lambda (file)
356 (install-file
357 (search-input-file
358 (or native-inputs inputs)
359 (string-append "/bin/" file)) "ijs"))
360 '("config.guess" "config.sub")))))
361 '()))))
362 (synopsis "IJS driver framework for inkjet and other raster devices")
363 (description
364 "IJS is a protocol for transmission of raster page images. This package
365provides the reference implementation of the raster printer driver
366architecture.")
367 (license license:expat)
368 (home-page (package-home-page ghostscript))))
369
370(define-public font-ghostscript
371 (package
372 (name "font-ghostscript")
373 (version "8.11")
374 (source (origin
375 (method url-fetch)
376 (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
377 version
378 "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
379 version
380 ".tar.gz"))
381 (sha256 (base32
382 "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
383 (build-system gnu-build-system)
384 (arguments
385 `(#:tests? #f ; nothing to check, just files to copy
386
387 #:modules ((guix build gnu-build-system)
388 (guix build utils)
389 (srfi srfi-1))
390 #:phases
391 (modify-phases %standard-phases
392 (delete 'configure)
393 (delete 'build)
394 (replace 'install
395 (lambda* (#:key outputs #:allow-other-keys)
396 (let* ((out (assoc-ref outputs "out"))
397 (dir (string-append out "/share/fonts/type1/ghostscript")))
398 (mkdir-p dir)
399 (for-each
400 (lambda (file)
401 (copy-file file (string-append dir "/" file)))
402 (find-files "." "pfb|afm"))
403 #t))))))
404 (synopsis "Free replacements for the PostScript fonts")
405 (description
406 "Ghostscript fonts provides fonts and font metrics customarily distributed with
407Ghostscript. It currently includes the 35 standard PostScript fonts.")
408 (license license:gpl2)
409 (home-page "https://sourceforge.net/projects/gs-fonts/")))
410
411(define-deprecated-package gs-fonts
412 font-ghostscript)
413
414(define-public libspectre
415 (package
416 (name "libspectre")
417 (version "0.2.10")
418 (source (origin
419 (method url-fetch)
420 (uri (string-append "https://libspectre.freedesktop.org/releases"
421 "/libspectre-" version ".tar.gz"))
422 (sha256
423 (base32
424 "01sdaakrv5js8r6gj2r1ankyl304161z060f25mrmz3b1ylb4q6g"))))
425 (build-system gnu-build-system)
426 (inputs (list ghostscript))
427 (native-inputs (list pkg-config))
428 (synopsis "Postscript rendering library")
429 (description
430 "libspectre is a small library for rendering Postscript documents.
431It provides a convenient easy to use API for handling and rendering
432Postscript documents.")
433 (license license:gpl2+)
434 (home-page "https://www.freedesktop.org/wiki/Software/libspectre")))