projects/guix·blob javascript-team · refs

291 lines · 12.4 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.2")
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "mirror://gnu/groff/groff-" version
54 ".tar.gz"))
55 (sha256 (base32
56 "1naxkizfbz04rr1hzzz41cz1xpz87i3vfg86w737zqxvpvayzhgr"))))
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 ;; This is to fix tests and should not be needed from groff 1.25:
118 ;; https://lists.gnu.org/archive/html/groff/2026-03/msg00077.html
119 (setenv "GROFF_BIN_PATH" ".")))
120 (add-after 'unpack 'fix-docdir
121 (lambda _ ;see https://savannah.gnu.org/bugs/index.php?55461
122 (substitute* "Makefile.in"
123 (("^docdir =.*") "docdir = @docdir@\n"))
124 #t)))))
125 (synopsis "Typesetting from plain text mixed with formatting commands")
126 (description
127 "Groff is a typesetting package that reads plain text and produces
128formatted output based on formatting commands contained within the text. It
129is usually the formatter of \"man\" documentation pages.")
130 (license gpl3+)
131 (home-page "https://www.gnu.org/software/groff/")))
132
133(define-public groff-minimal
134 ;; Minimialist groff for use by man-db. Its closure size is less than half
135 ;; that of the full-blown groff.
136 (package/inherit groff
137 (name "groff-minimal")
138 (synopsis "Minimalist variant of Groff for use by man-db")
139 (outputs '("out"))
140
141 ;; Omit the DVI, PS, PDF, and HTML backends.
142 (inputs '())
143 (native-inputs `(("bison" ,bison)
144 ("perl" ,perl)
145 ("groff" ,groff)))
146
147 (arguments
148 `(#:disallowed-references ,(list (this-package-native-input "perl"))
149
150 #:configure-flags '("--with-doc=no")
151
152 ,@(substitute-keyword-arguments arguments
153 ((#:phases phases)
154 `(modify-phases ,phases
155 (add-after 'install 'remove-non-essential-programs
156 (lambda* (#:key outputs #:allow-other-keys)
157 ;; Keep only the programs that man-db needs at run time,
158 ;; and make sure we don't pull in Perl.
159 (let ((out (assoc-ref outputs "out"))
160 (kept '("eqn" "neqn" "pic" "tbl" "refer" "preconv"
161 "nroff" "groff" "troff" "grotty")))
162 (for-each (lambda (file)
163 (unless (member (basename file) kept)
164 (delete-file file)))
165 (find-files (string-append out "/bin")))
166
167 ;; Remove a bunch of unneeded Perl scripts.
168 (for-each delete-file (find-files out "\\.pl$"))
169 (for-each delete-file
170 (find-files out "BuildFoundries"))
171
172 ;; Remove ~3 MiB from share/groff/X.Y/font/devBACKEND
173 ;; corresponding to the unused backends.
174 (for-each delete-file-recursively
175 (find-files out "^dev(dvi|ps|pdf|html|lj4)$"
176 #:directories? #t))
177 #t))))))))))
178
179;; There are no releases, so we take the latest commit.
180(define-public roffit
181 (let ((commit "b59e6c855ebea03daf76e996b5c0f8343f11be3d")
182 (revision "1"))
183 (package
184 (name "roffit")
185 (version (string-append "0.12-" revision "." (string-take commit 9)))
186 (source (origin
187 (method git-fetch)
188 (uri (git-reference
189 (url "https://github.com/bagder/roffit")
190 (commit commit)))
191 (file-name (string-append "roffit-" commit "-checkout"))
192 (sha256
193 (base32
194 "0z4cs92yqh22sykfgbjlyxfaifdvsd47cf1yhr0f2rgcc6l0fj1r"))))
195 (build-system gnu-build-system)
196 (arguments
197 `(#:test-target "test"
198 #:phases
199 (modify-phases %standard-phases
200 (delete 'configure)
201 (replace 'install
202 (lambda* (#:key outputs #:allow-other-keys)
203 (let ((out (assoc-ref outputs "out")))
204 (install-file "roffit" (string-append out "/bin"))
205 (install-file "roffit.1"
206 (string-append out "/share/man/man1")))))
207 (add-after 'install 'wrap-program
208 (lambda* (#:key outputs #:allow-other-keys)
209 (let ((out (assoc-ref outputs "out")))
210 (wrap-program (string-append out "/bin/roffit")
211 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB"))))))))))
212 (native-inputs (list perl-html-tree)) ; for test
213 (inputs (list bash-minimal perl))
214 (home-page "https://daniel.haxx.se/projects/roffit/")
215 (synopsis "Convert nroff files to HTML")
216 (description
217 "Roffit is a program that reads an nroff file and outputs an HTML file.
218It is typically used to display man pages on a web site.")
219 (license expat))))
220
221(define-public ronn-ng
222 (package
223 (name "ronn-ng")
224 (version "0.10.1")
225 (source
226 (origin
227 (method url-fetch)
228 (uri (rubygems-uri "ronn-ng" version))
229 (sha256
230 (base32
231 "1h2y2v3wkl5c710wfanqwxlxi74l1ssva8yrzsg8iypvq22h3ssf"))))
232 (build-system ruby-build-system)
233 (arguments
234 (list
235 #:phases
236 #~(modify-phases %standard-phases
237 (add-after 'extract-gemspec 'fix-gemspec-mustache
238 (lambda _
239 (substitute* "ronn-ng.gemspec"
240 (("(<mustache>.freeze.*~>).*(\".*$)" all start end)
241 (string-append start " 1.0" end)))))
242 (add-after 'wrap 'wrap-program
243 (lambda* (#:key outputs #:allow-other-keys)
244 (let ((prog (string-append (assoc-ref %outputs "out") "/bin/ronn")))
245 (wrap-program prog
246 `("PATH" ":" suffix ,(map
247 (lambda (exp_inpt)
248 (string-append
249 (assoc-ref %build-inputs exp_inpt)
250 "/bin"))
251 '("ruby-kramdown"
252 "ruby-mustache"
253 "ruby-nokogiri"))))))))))
254 (inputs
255 (list bash-minimal
256 ruby-kramdown
257 ruby-kramdown-parser-gfm
258 ruby-mustache
259 ruby-nokogiri))
260 (synopsis
261 "Build manuals in HTML and Unix man page format from Markdown")
262 (description
263 "Ronn-NG is an updated fork of ronn. It builds manuals in HTML and Unix
264man page format from Markdown.")
265 (home-page "https://github.com/apjanke/ronn-ng")
266 (license expat)))
267
268(define-public grap
269 (package
270 (name "grap")
271 (version "1.46")
272 (source (origin
273 (method url-fetch)
274 (uri (string-append
275 "https://www.lunabase.org/~faber/Vault/software/grap/grap-"
276 version ".tar.gz"))
277 (sha256
278 (base32
279 "1d4bhhgi64x4cjww7fj0lqgr20w7lqnl2aizj6cndsgyxkywx3ks"))))
280 (build-system gnu-build-system)
281 (native-inputs (list flex bison))
282 (synopsis "Tool for creating graphs with troff")
283 (description
284 "Grap is a language for typesetting graphs specified and
285first implemented by Brian Kernighan and Jon Bentley at Bell Labs. It is an
286expressive language for describing graphs and incorporating them in typeset
287documents. It is implemented as a preprocessor to Kernigan's pic language for
288describing languages, so any system that can use pic can use grap. For sure,
289TeX and groff can use it.")
290 (home-page "https://github.com/snorerot13/grap")
291 (license bsd-3)))