projects/guix·blob java-team · refs

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