projects/guix·blob java-team · refs

289 lines · 12.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <[email protected]>
3;;; Copyright © 2014 Mark H Weaver <[email protected]>
4;;; Copyright © 2016 Ricardo Wurmus <[email protected]>
5;;; Copyright © 2017, 2025 Ludovic Courtès <[email protected]>
6;;; Copyright © 2019, 2020 Efraim Flashner <[email protected]>
7;;; Copyright © 2019 Eric Bavier <[email protected]>
8;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
9;;; Copyright © 2020 Michael Rohleder <[email protected]>
10;;; Copyright © 2020 Prafulla Giri <[email protected]>
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 groff)
28 #:use-module (guix licenses)
29 #:use-module (guix packages)
30 #:use-module (guix utils)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system ruby)
35 #:use-module (guix gexp)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages bash)
38 #:use-module (gnu packages ruby-xyz)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages compiler-tools)
41 #:use-module (gnu packages ghostscript)
42 #:use-module (gnu packages netpbm)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages web))
46
47(define-public groff
48 (package
49 (name "groff")
50 (version "1.24.0")
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "mirror://gnu/groff/groff-" version
54 ".tar.gz"))
55 (sha256 (base32
56 "0w3mf9jb5j1gbw1160lr5498q4ayl5i3jpf5g8721l1yzzcbr6z7"))))
57 (build-system gnu-build-system)
58 (outputs '("out"
59 "doc")) ;12MiB of PS, PDF, HTML, and examples
60
61 ;; Note: groff's HTML backend uses executables from netpbm when they are in
62 ;; $PATH. In practice, not having them doesn't prevent it from install its
63 ;; own HTML doc, nor does it change its capabilities, so we removed netpbm
64 ;; from 'inputs'.
65
66 (inputs (list ghostscript))
67
68 ;; When cross-compiling, this package depends upon a native install of
69 ;; itself.
70 (native-inputs `(,@(if (%current-target-system)
71 `(("self" ,this-package))
72 '())
73 ("bison" ,bison)
74 ("perl" ,perl)
75 ("psutils" ,psutils)
76 ("texinfo" ,texinfo)))
77 (arguments
78 `(#:parallel-build? #f ; parallel build fails
79 ,@(if (%current-target-system)
80 `(#:make-flags
81 ;; In groff-minimal package, that inherits from this package,
82 ;; we'll need to locate "groff" instead of "self".
83 (let ((groff (or (assoc-ref %build-host-inputs "groff")
84 (assoc-ref %build-host-inputs "self"))))
85 (list
86 (string-append "GROFF_BIN_PATH=" groff)
87 (string-append "GROFFBIN=" groff "/bin/groff"))))
88 '())
89 #:phases
90 (modify-phases %standard-phases
91 (add-after 'unpack 'disable-relocatability
92 (lambda _
93 ;; Groff contains a Rube Goldberg-esque relocator for the file
94 ;; "charset.alias". It tries to find the current executable
95 ;; using realpath, a do-it-yourself search in $PATH and so on.
96 ;; Furthermore, the routine that does the search is buggy
97 ;; in that it doesn't handle error cases when they arise.
98 ;; This causes preconv to segfault when trying to look up
99 ;; the file "charset.alias" in the NULL location.
100 ;; The "charset.alias" parser is a copy of gnulib's, and a
101 ;; non-broken version of gnulib's "charset.alias" parser is
102 ;; part of glibc's libcharset.
103 ;; However, groff unconditionally uses their own
104 ;; "charset.alias" parser, but then DOES NOT INSTALL the
105 ;; file "charset.alias" when glibc is too new.
106 ;; In Guix, our file "charset.alias" only contains an obscure
107 ;; alias for ASCII and nothing else. So just disable relocation
108 ;; and make the entire "charset.alias" lookup fail.
109 ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30785> for
110 ;; details.
111 (substitute* "Makefile.in"
112 (("-DENABLE_RELOCATABLE=1") ""))
113 #t))
114 (add-after 'unpack 'setenv
115 (lambda _
116 (setenv "GS_GENERATE_UUIDS" "0")
117 #t))
118 (add-after 'unpack 'fix-docdir
119 (lambda _ ;see https://savannah.gnu.org/bugs/index.php?55461
120 (substitute* "Makefile.in"
121 (("^docdir =.*") "docdir = @docdir@\n"))
122 #t)))))
123 (synopsis "Typesetting from plain text mixed with formatting commands")
124 (description
125 "Groff is a typesetting package that reads plain text and produces
126formatted output based on formatting commands contained within the text. It
127is usually the formatter of \"man\" documentation pages.")
128 (license gpl3+)
129 (home-page "https://www.gnu.org/software/groff/")))
130
131(define-public groff-minimal
132 ;; Minimialist groff for use by man-db. Its closure size is less than half
133 ;; that of the full-blown groff.
134 (package/inherit groff
135 (name "groff-minimal")
136 (synopsis "Minimalist variant of Groff for use by man-db")
137 (outputs '("out"))
138
139 ;; Omit the DVI, PS, PDF, and HTML backends.
140 (inputs '())
141 (native-inputs `(("bison" ,bison)
142 ("perl" ,perl)
143 ("groff" ,groff)))
144
145 (arguments
146 `(#:disallowed-references ,(list (this-package-native-input "perl"))
147
148 #:configure-flags '("--with-doc=no")
149
150 ,@(substitute-keyword-arguments arguments
151 ((#:phases phases)
152 `(modify-phases ,phases
153 (add-after 'install 'remove-non-essential-programs
154 (lambda* (#:key outputs #:allow-other-keys)
155 ;; Keep only the programs that man-db needs at run time,
156 ;; and make sure we don't pull in Perl.
157 (let ((out (assoc-ref outputs "out"))
158 (kept '("eqn" "neqn" "pic" "tbl" "refer" "preconv"
159 "nroff" "groff" "troff" "grotty")))
160 (for-each (lambda (file)
161 (unless (member (basename file) kept)
162 (delete-file file)))
163 (find-files (string-append out "/bin")))
164
165 ;; Remove a bunch of unneeded Perl scripts.
166 (for-each delete-file (find-files out "\\.pl$"))
167 (for-each delete-file
168 (find-files out "BuildFoundries"))
169
170 ;; Remove ~3 MiB from share/groff/X.Y/font/devBACKEND
171 ;; corresponding to the unused backends.
172 (for-each delete-file-recursively
173 (find-files out "^dev(dvi|ps|pdf|html|lj4)$"
174 #:directories? #t))
175 #t))))))))))
176
177;; There are no releases, so we take the latest commit.
178(define-public roffit
179 (let ((commit "b59e6c855ebea03daf76e996b5c0f8343f11be3d")
180 (revision "1"))
181 (package
182 (name "roffit")
183 (version (string-append "0.12-" revision "." (string-take commit 9)))
184 (source (origin
185 (method git-fetch)
186 (uri (git-reference
187 (url "https://github.com/bagder/roffit")
188 (commit commit)))
189 (file-name (string-append "roffit-" commit "-checkout"))
190 (sha256
191 (base32
192 "0z4cs92yqh22sykfgbjlyxfaifdvsd47cf1yhr0f2rgcc6l0fj1r"))))
193 (build-system gnu-build-system)
194 (arguments
195 `(#:test-target "test"
196 #:phases
197 (modify-phases %standard-phases
198 (delete 'configure)
199 (replace 'install
200 (lambda* (#:key outputs #:allow-other-keys)
201 (let ((out (assoc-ref outputs "out")))
202 (install-file "roffit" (string-append out "/bin"))
203 (install-file "roffit.1"
204 (string-append out "/share/man/man1")))))
205 (add-after 'install 'wrap-program
206 (lambda* (#:key outputs #:allow-other-keys)
207 (let ((out (assoc-ref outputs "out")))
208 (wrap-program (string-append out "/bin/roffit")
209 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB"))))))))))
210 (native-inputs (list perl-html-tree)) ; for test
211 (inputs (list bash-minimal perl))
212 (home-page "https://daniel.haxx.se/projects/roffit/")
213 (synopsis "Convert nroff files to HTML")
214 (description
215 "Roffit is a program that reads an nroff file and outputs an HTML file.
216It is typically used to display man pages on a web site.")
217 (license expat))))
218
219(define-public ronn-ng
220 (package
221 (name "ronn-ng")
222 (version "0.10.1")
223 (source
224 (origin
225 (method url-fetch)
226 (uri (rubygems-uri "ronn-ng" version))
227 (sha256
228 (base32
229 "1h2y2v3wkl5c710wfanqwxlxi74l1ssva8yrzsg8iypvq22h3ssf"))))
230 (build-system ruby-build-system)
231 (arguments
232 (list
233 #:phases
234 #~(modify-phases %standard-phases
235 (add-after 'extract-gemspec 'fix-gemspec-mustache
236 (lambda _
237 (substitute* "ronn-ng.gemspec"
238 (("(<mustache>.freeze.*~>).*(\".*$)" all start end)
239 (string-append start " 1.0" end)))))
240 (add-after 'wrap 'wrap-program
241 (lambda* (#:key outputs #:allow-other-keys)
242 (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn")))
243 (wrap-program prog
244 `("PATH" ":" suffix ,(map
245 (lambda (exp_inpt)
246 (string-append
247 (assoc-ref %build-inputs exp_inpt)
248 "/bin"))
249 '("ruby-kramdown"
250 "ruby-mustache"
251 "ruby-nokogiri"))))))))))
252 (inputs
253 (list bash-minimal
254 ruby-kramdown
255 ruby-kramdown-parser-gfm
256 ruby-mustache
257 ruby-nokogiri))
258 (synopsis
259 "Build manuals in HTML and Unix man page format from Markdown")
260 (description
261 "Ronn-NG is an updated fork of ronn. It builds manuals in HTML and Unix
262man page format from Markdown.")
263 (home-page "https://github.com/apjanke/ronn-ng")
264 (license expat)))
265
266(define-public grap
267 (package
268 (name "grap")
269 (version "1.46")
270 (source (origin
271 (method url-fetch)
272 (uri (string-append
273 "https://www.lunabase.org/~faber/Vault/software/grap/grap-"
274 version ".tar.gz"))
275 (sha256
276 (base32
277 "1d4bhhgi64x4cjww7fj0lqgr20w7lqnl2aizj6cndsgyxkywx3ks"))))
278 (build-system gnu-build-system)
279 (native-inputs (list flex bison))
280 (synopsis "Tool for creating graphs with troff")
281 (description
282 "Grap is a language for typesetting graphs specified and
283first implemented by Brian Kernighan and Jon Bentley at Bell Labs. It is an
284expressive language for describing graphs and incorporating them in typeset
285documents. It is implemented as a preprocessor to Kernigan's pic language for
286describing languages, so any system that can use pic can use grap. For sure,
287TeX and groff can use it.")
288 (home-page "https://github.com/snorerot13/grap")
289 (license bsd-3)))