projects/guix·blob javascript-team · refs

372 lines · 16.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2013, 2015-2017, 2019, 2022-2023, 2025 Ludovic Courtès <[email protected]>
3;;; Copyright © 2014, 2016 Eric Bavier <[email protected]>
4;;; Copyright © 2015 Mark H Weaver <[email protected]>
5;;; Copyright © 2017, 2019, 2022 Efraim Flashner <[email protected]>
6;;; Copyright © 2019 Ricardo Wurmus <[email protected]>
7;;; Copyright © 2019 Pierre-Moana Levesque <[email protected]>
8;;; Copyright © 2019, 2020 Mathieu Othacehe <[email protected]>
9;;; Copyright © 2020 Nicolas Goaziou <[email protected]>
10;;; Copyright © 2020, 2023, 2024, 2026 Janneke Nieuwenhuizen <[email protected]>
11;;; Copyright © 2021 Maxime Devos <[email protected]>
12;;; Copyright © 2022 ( <[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 texinfo)
30 #:use-module (gnu packages autotools)
31 #:use-module (guix gexp)
32 #:use-module (guix licenses)
33 #:use-module (guix packages)
34 #:use-module (guix utils)
35 #:use-module (guix download)
36 #:use-module (guix utils)
37 #:use-module (guix git-download)
38 #:use-module (guix build-system gnu)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages bash)
42 #:use-module (gnu packages base)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages gawk)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages gperf)
47 #:use-module (gnu packages man)
48 #:use-module (gnu packages ncurses)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages perl-compression)
51 #:use-module (gnu packages readline))
52
53(define-public texinfo
54 (package
55 (name "texinfo")
56 (version "6.8")
57 (source (origin
58 (method url-fetch)
59 (uri (string-append "mirror://gnu/texinfo/texinfo-"
60 version ".tar.xz"))
61 (patches (search-patches "texinfo-headings-single.patch"))
62 (sha256
63 (base32
64 "1i7yb7mrp3inz25zbzv2pllr4y7d58v818f1as7iz8mw53nm7dwf"))))
65 (build-system gnu-build-system)
66 (arguments
67 ;; When cross-compiling, the package is configured twice: once with the
68 ;; native compiler and once with the cross-compiler. During the configure
69 ;; with the native compiler, the environment is reset. This leads to
70 ;; multiple environment variables missing. Do not reset the environment
71 ;; to prevent that.
72 `(#:phases
73 (if ,(%current-target-system)
74 (modify-phases %standard-phases
75 (add-before 'configure 'fix-cross-configure
76 (lambda _
77 (substitute* "configure"
78 (("env -i")
79 "env "))
80 #t)))
81 %standard-phases)
82
83 ,@(if (%current-target-system)
84 (list #:configure-flags #~'("texinfo_cv_sys_iconv_converts_euc_cn=yes"))
85 '())
86
87 ;; XXX: Work around <https://issues.guix.gnu.org/59616>.
88 #:tests? ,(and (not (target-hurd?))
89 (not (%current-target-system)))))
90 (inputs (list ncurses perl))
91
92 ;; When cross-compiling, texinfo will build some of its own binaries with
93 ;; the native compiler. This means ncurses is needed both in both inputs
94 ;; and native-inputs. Some of its tests require extra locales such as
95 ;; fr_FR.UTF-8.
96 (native-inputs (list perl ncurses (libc-utf8-locales-for-target)))
97
98 (native-search-paths
99 ;; This is the variable used by the standalone Info reader.
100 (list (search-path-specification
101 (variable "INFOPATH")
102 (files '("share/info")))))
103
104 (home-page "https://www.gnu.org/software/texinfo/")
105 (synopsis "The GNU documentation format")
106 (description
107 "Texinfo is the official documentation format of the GNU project. It
108uses a single source file using explicit commands to produce a final document
109in any of several supported output formats, such as HTML or PDF. This
110package includes both the tools necessary to produce Info documents from
111their source and the command-line Info reader. The emphasis of the language
112is on expressing the content semantically, avoiding physical markup commands.")
113 (license gpl3+)))
114
115(define-public texinfo-7
116 (package
117 (inherit texinfo)
118 (version "7.3")
119 (source (origin
120 (method git-fetch)
121 (uri (git-reference
122 (url "https://git.savannah.gnu.org/git/texinfo.git")
123 (commit (string-append "texinfo-" version))))
124 (file-name (git-file-name "texinfo" version))
125 (sha256
126 (base32
127 "1ln3rr34b9k9m8mhg01ygifj945610cn5qk11mfvgzpavyy5rghg"))))
128 (native-inputs (list autoconf
129 automake
130 bash-minimal
131 coreutils-minimal
132 gawk
133 gettext-minimal
134 gperf
135 help2man
136 (libc-utf8-locales-for-target)
137 libtool
138 ncurses
139 perl
140 perl-text-unidecode
141 perl-unicode-eastasianwidth))
142 (inputs (modify-inputs inputs
143 (append perl-archive-zip ;needed for 'tex2any --epub3'
144 perl-unicode-eastasianwidth perl-text-unidecode
145 perl-libintl-perl)))
146 (arguments
147 (substitute-keyword-arguments arguments
148 ((#:modules modules `((guix build utils)
149 (guix build gnu-build-system)))
150 `((srfi srfi-26)
151 ,@modules))
152 ((#:configure-flags flags
153 ''())
154 #~(cons* "--with-external-Unicode-EastAsianWidth"
155 "--with-external-Text-Unidecode"
156 "--with-external-libintl-perl"
157 #$@(if (%current-target-system)
158 ;; tries to build for the native perl
159 '("--disable-perl-xs")
160 '())
161 #$flags))
162 ((#:phases phases #~%standard-phases)
163 #~(modify-phases #$phases
164 (add-after 'unpack 'patch-bootstrap-shebangs
165 (lambda* (#:key native-inputs inputs #:allow-other-keys)
166 (let ((sh (search-input-file (or native-inputs inputs)
167 "/bin/sh"))
168 (perl (search-input-file (or native-inputs inputs)
169 "/bin/perl")))
170 (for-each
171 (cute patch-shebang <> (list (dirname sh)))
172 (find-files "." ".*[.]sh"))
173 (for-each
174 (cute patch-shebang <> (list (dirname perl)))
175 (find-files "." ".*[.]pl")))))
176 #$@(if (%current-target-system)
177 ;; for help2man
178 #~((add-after 'configure 'fixup-texindex-building-from-git
179 (lambda _
180 (symlink "../../texindex/texindex"
181 "tools/texindex/texindex"))))
182 #~())
183 (add-after 'configure 'patch-jrtangle
184 (lambda* (#:key native-inputs inputs #:allow-other-keys)
185 (let ((mv (search-input-file (or native-inputs inputs)
186 "/bin/mv")))
187 (substitute* "texindex/jrtangle"
188 (("mv") mv)))))
189 (add-after 'install 'wrap-program
190 (lambda* (#:key inputs outputs #:allow-other-keys)
191 (let* ((out (assoc-ref outputs "out"))
192 (bin (string-append out "/bin"))
193 (program (string-append bin "/texi2any"))
194 (zip (car (find-files
195 (assoc-ref inputs "perl-archive-zip")
196 (lambda (file stat)
197 (and (eq? 'directory (stat:type stat))
198 (string=? (basename file)
199 "Archive")))
200 #:directories? #t)))
201 (mods (map (lambda (mod)
202 (string-append (assoc-ref inputs mod)
203 "/lib/perl5/site_perl"))
204 '("perl-unicode-eastasianwidth"
205 "perl-text-unidecode" "perl-libintl-perl"))))
206 (wrap-program program
207 `("PERL5LIB" prefix
208 ,(cons* (dirname zip) mods))))))))))))
209
210(define-public texinfo-5
211 (package (inherit texinfo)
212 (version "5.2")
213 (source (origin
214 (method url-fetch)
215 (uri (string-append "mirror://gnu/texinfo/texinfo-"
216 version ".tar.xz"))
217 (patches (search-patches "texinfo-5-perl-compat.patch"))
218 (sha256
219 (base32
220 "1njfwh2z34r2c4r0iqa7v24wmjzvsfyz4vplzry8ln3479lfywal"))))))
221
222(define-public info-reader
223 ;; The idea of this package is to have the standalone Info reader without
224 ;; the dependency on Perl that 'makeinfo' drags.
225 ;; Texinfo version must be at least 7.0, which fixed crashes in a pt_BR
226 ;; locale; see <https://git.savannah.gnu.org/cgit/texinfo.git/plain/NEWS>.
227 (package/inherit texinfo-7
228 (name "info-reader")
229 (arguments
230 (append
231 (substitute-keyword-arguments arguments
232 ((#:modules modules `((guix build utils)
233 (guix build gnu-build-system)))
234 `((srfi srfi-1)
235 (ice-9 ftw)
236 ,@modules))
237 ((#:phases phases)
238 #~(modify-phases #$phases
239 ;; Make sure 'info-reader' can read compressed info files
240 ;; in a pure environment. There are also a few other
241 ;; uncompressors listed in this file (lzip, unxz, bunzip2, ...)
242 ;; but let's not include them because info manuals in Guix
243 ;; are always compressed with 'gzip'.
244 ;; TODO(core-updates): maybe move to the 'texinfo' package.
245 (add-after 'unpack 'absolute-binary-path
246 (lambda* (#:key inputs #:allow-other-keys)
247 (substitute* "info/filesys.c"
248 (("gunzip") (search-input-file inputs "/bin/gunzip"))
249 (("gzip") (search-input-file inputs "/bin/gzip")))))
250 (add-after 'install 'keep-only-info-reader
251 (lambda* (#:key outputs #:allow-other-keys)
252 ;; Remove everything but 'bin/info' and associated
253 ;; files.
254 (define (files)
255 (scandir "." (lambda (file)
256 (not (member file '("." ".."))))))
257
258 (let ((out (assoc-ref outputs "out")))
259 (with-directory-excursion out
260 (for-each delete-file-recursively
261 (fold delete (files) '("bin" "share"))))
262 (with-directory-excursion (string-append out "/bin")
263 (for-each delete-file (delete "info" (files))))
264 (with-directory-excursion (string-append out "/share")
265 (for-each delete-file-recursively
266 (fold delete (files)
267 '("info" "locale")))))))
268 (delete 'wrap-program))))
269 (list
270 #:disallowed-references (list (this-package-input "perl")))))
271 (synopsis "Standalone Info documentation reader")
272 (inputs (modify-inputs inputs
273 (prepend gzip)))))
274
275(define-public texi2html
276 (package
277 (name "texi2html")
278 (version "5.0")
279 (source (origin
280 (method url-fetch)
281 (uri (string-append "mirror://savannah/" name "/" name "-"
282 version ".tar.bz2"))
283 (sha256
284 (base32
285 "1yprv64vrlcbksqv25asplnjg07mbq38lfclp1m5lj8cw878pag8"))
286 (patches
287 (search-patches "texi2html-document-encoding.patch"
288 "texi2html-i18n.patch"))
289 (snippet
290 ;; This file is modified by the patch above, but reset its
291 ;; timestamp so we don't trigger the rule to update PO files,
292 ;; which would require Gettext.
293 ;; See <http://bugs.gnu.org/18247>.
294 '(begin
295 (utime "texi2html.pl" 0 0 0 0)
296 #t))))
297 (build-system gnu-build-system)
298 (inputs (list perl))
299 (arguments
300 ;; Tests fail because of warnings on stderr from Perl 5.22. Adjusting
301 ;; texi2html.pl to avoid the warnings seems non-trivial, so we simply
302 ;; disable the tests.
303 '(#:tests? #f))
304 (home-page "https://www.nongnu.org/texi2html/")
305 (synopsis "Convert Texinfo to HTML")
306 (description
307 "Texi2HTML is a Perl script which converts Texinfo source files to HTML
308output. It now supports many advanced features, such as internationalization
309and extremely configurable output formats.
310
311Development of Texi2HTML moved to the GNU Texinfo repository in 2010, since it
312was meant to replace the makeinfo implementation in GNU Texinfo. The route
313forward for authors is, in most cases, to alter manuals and build processes as
314necessary to use the new features of the makeinfo/texi2any implementation of
315GNU Texinfo. The Texi2HTML maintainers (one of whom is the principal author
316of the GNU Texinfo implementation) do not intend to make further releases of
317Texi2HTML.")
318 ;; Files in /lib under lgpl2.1+ and x11
319 (license gpl2+)))
320
321(define-public texi2html-1.82
322 (package
323 (inherit texi2html)
324 (version "1.82")
325 (source
326 (origin
327 (method url-fetch)
328 (uri (string-append "mirror://savannah/texi2html/"
329 "texi2html-" version ".tar.bz2"))
330 (sha256
331 (base32 "1wdli2szkgm3l0vx8rf6lylw0b0m47dlz9iy004n928nqkzix76n"))))))
332
333(define-public pinfo
334 (let ((commit "3d76eecde211e41ccc28b04e229f159b3f924399")
335 (revision "0"))
336 (package
337 (name "pinfo")
338 ;; Latest tag is completely broken and does not build.
339 (version (git-version "0.6.13" revision commit))
340 (source (origin
341 (method git-fetch)
342 (uri (git-reference
343 (url "https://github.com/baszoetekouw/pinfo")
344 (commit commit)))
345 (file-name (git-file-name name version))
346 (sha256
347 (base32 "0qym323d9my5l4bhw9vry453hhlxhjjvy8mcdi38sk0bqqid0vd1"))))
348 (build-system gnu-build-system)
349 (arguments
350 (list #:phases
351 #~(modify-phases %standard-phases
352 (add-after 'unpack 'embed-reference-to-clear
353 (lambda* (#:key inputs #:allow-other-keys)
354 (let ((ncurses (assoc-ref inputs "ncurses")))
355 (substitute* (list "src/manual.c"
356 "src/mainfunction.c"
357 "src/utils.c")
358 (("\"clear\"")
359 (string-append "\"" ncurses "/bin/clear\"")))))))))
360 (inputs
361 (list ncurses readline))
362 (native-inputs
363 (list autoconf automake gettext-minimal libtool texinfo))
364 (home-page "https://github.com/baszoetekouw/pinfo")
365 (synopsis "Lynx-style Info file and man page reader")
366 (description
367 "Pinfo is an Info file viewer. Pinfo is similar in use to the Lynx web
368browser. You just move across info nodes, and select links, follow them, etc.
369It supports many colors. Pinfo also supports viewing of manual pages -- they
370are colorized like in the midnight commander's viewer, and additionally they
371are hypertextualized.")
372 (license gpl2+))))