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