Commit | Line | Data |
---|---|---|
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> |
0559a4c2 | 6 | ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il> |
2df4f702 | 7 | ;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org> |
23180beb AE |
8 | ;;; |
9 | ;;; This file is part of GNU Guix. | |
10 | ;;; | |
11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
12 | ;;; under the terms of the GNU General Public License as published by | |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
16 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | (define-module (gnu packages groff) | |
25 | #:use-module (guix licenses) | |
26 | #:use-module (guix packages) | |
2ced84fb | 27 | #:use-module (guix utils) |
23180beb | 28 | #:use-module (guix download) |
33ca5517 | 29 | #:use-module (guix git-download) |
23180beb AE |
30 | #:use-module (guix build-system gnu) |
31 | #:use-module (gnu packages) | |
32 | #:use-module (gnu packages bison) | |
33 | #:use-module (gnu packages ghostscript) | |
34 | #:use-module (gnu packages netpbm) | |
35 | #:use-module (gnu packages perl) | |
36 | #:use-module (gnu packages texinfo)) | |
37 | ||
38 | (define-public groff | |
39 | (package | |
40 | (name "groff") | |
0559a4c2 | 41 | (version "1.22.4") |
23180beb AE |
42 | (source (origin |
43 | (method url-fetch) | |
44 | (uri (string-append "mirror://gnu/groff/groff-" version | |
45 | ".tar.gz")) | |
46 | (sha256 (base32 | |
0559a4c2 | 47 | "14q2mldnr1vx0l9lqp9v2f6iww24gj28iyh4j2211hyynx67p3p7")))) |
23180beb | 48 | (build-system gnu-build-system) |
7d157c65 LC |
49 | (outputs '("out" |
50 | "doc")) ;12MiB of PS, PDF, HTML, and examples | |
0b6e4f82 LC |
51 | |
52 | ;; Note: groff's HTML backend uses executables from netpbm when they are in | |
53 | ;; $PATH. In practice, not having them doesn't prevent it from install its | |
54 | ;; own HTML doc, nor does it change its capabilities, so we removed netpbm | |
55 | ;; from 'inputs'. | |
56 | ||
57 | (inputs `(("ghostscript" ,ghostscript))) | |
c4c4cc05 | 58 | (native-inputs `(("bison" ,bison) |
dec7ab59 MW |
59 | ("perl" ,perl) |
60 | ("psutils" ,psutils) | |
61 | ("texinfo" ,texinfo))) | |
e9e6d40b DM |
62 | (arguments |
63 | `(#:parallel-build? #f ; parallel build fails | |
64 | #:phases | |
65 | (modify-phases %standard-phases | |
5466e82a MB |
66 | (add-after 'unpack 'disable-relocatability |
67 | (lambda _ | |
68 | ;; Groff contains a Rube Goldberg-esque relocator for the file | |
69 | ;; "charset.alias". It tries to find the current executable | |
70 | ;; using realpath, a do-it-yourself search in $PATH and so on. | |
71 | ;; Furthermore, the routine that does the search is buggy | |
72 | ;; in that it doesn't handle error cases when they arise. | |
73 | ;; This causes preconv to segfault when trying to look up | |
74 | ;; the file "charset.alias" in the NULL location. | |
75 | ;; The "charset.alias" parser is a copy of gnulib's, and a | |
76 | ;; non-broken version of gnulib's "charset.alias" parser is | |
77 | ;; part of glibc's libcharset. | |
78 | ;; However, groff unconditionally uses their own | |
79 | ;; "charset.alias" parser, but then DOES NOT INSTALL the | |
80 | ;; file "charset.alias" when glibc is too new. | |
81 | ;; In Guix, our file "charset.alias" only contains an obscure | |
82 | ;; alias for ASCII and nothing else. So just disable relocation | |
83 | ;; and make the entire "charset.alias" lookup fail. | |
84 | ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30785> for | |
85 | ;; details. | |
86 | (substitute* "Makefile.in" | |
87 | (("-DENABLE_RELOCATABLE=1") "")) | |
88 | #t)) | |
e9e6d40b DM |
89 | (add-after 'unpack 'setenv |
90 | (lambda _ | |
91 | (setenv "GS_GENERATE_UUIDS" "0") | |
2df4f702 EB |
92 | #t)) |
93 | (add-after 'unpack 'fix-docdir | |
94 | (lambda _ ;see https://savannah.gnu.org/bugs/index.php?55461 | |
95 | (substitute* "Makefile.in" | |
96 | (("^docdir =.*") "docdir = @docdir@\n"))))))) | |
f50d2669 | 97 | (synopsis "Typesetting from plain text mixed with formatting commands") |
23180beb | 98 | (description |
79c311b8 | 99 | "Groff is a typesetting package that reads plain text and produces |
a22dc0c4 | 100 | formatted output based on formatting commands contained within the text. It |
79c311b8 | 101 | is usually the formatter of \"man\" documentation pages.") |
23180beb | 102 | (license gpl3+) |
6fd52309 | 103 | (home-page "https://www.gnu.org/software/groff/"))) |
33ca5517 | 104 | |
3c97322a LC |
105 | (define-public groff-minimal |
106 | ;; Minimialist groff for use by man-db. Its closure size is less than half | |
107 | ;; that of the full-blown groff. | |
108 | (package | |
109 | (inherit groff) | |
110 | (name "groff-minimal") | |
111 | (synopsis "Minimalist variant of Groff for use by man-db") | |
112 | (outputs '("out")) | |
113 | ||
114 | ;; Omit the DVI, PS, PDF, and HTML backends. | |
115 | (inputs '()) | |
116 | (native-inputs `(("bison" ,bison) | |
117 | ("perl" ,perl))) | |
118 | ||
119 | (arguments | |
120 | `(#:disallowed-references (,perl) | |
121 | ||
0559a4c2 | 122 | #:configure-flags '("--with-doc=no") |
3c97322a | 123 | |
2ced84fb MB |
124 | ,@(substitute-keyword-arguments (package-arguments groff) |
125 | ((#:phases phases) | |
126 | `(modify-phases ,phases | |
127 | (add-after 'install 'remove-non-essential-programs | |
128 | (lambda* (#:key outputs #:allow-other-keys) | |
129 | ;; Keep only the programs that man-db needs at run time, | |
130 | ;; and make sure we don't pull in Perl. | |
131 | (let ((out (assoc-ref outputs "out")) | |
06fc895f | 132 | (kept '("eqn" "neqn" "pic" "tbl" "refer" "preconv" |
2ced84fb MB |
133 | "nroff" "groff" "troff" "grotty"))) |
134 | (for-each (lambda (file) | |
135 | (unless (member (basename file) kept) | |
136 | (delete-file file))) | |
137 | (find-files (string-append out "/bin"))) | |
3c97322a | 138 | |
2ced84fb MB |
139 | ;; Remove a bunch of unneeded Perl scripts. |
140 | (for-each delete-file (find-files out "\\.pl$")) | |
141 | (for-each delete-file | |
142 | (find-files out "BuildFoundries")) | |
3c97322a | 143 | |
2ced84fb MB |
144 | ;; Remove ~3 MiB from share/groff/X.Y/font/devBACKEND |
145 | ;; corresponding to the unused backends. | |
146 | (for-each delete-file-recursively | |
147 | (find-files out "^dev(dvi|ps|pdf|html|lj4)$" | |
148 | #:directories? #t)) | |
149 | #t)))))))))) | |
3c97322a | 150 | |
33ca5517 RW |
151 | ;; There are no releases, so we take the latest commit. |
152 | (define-public roffit | |
153 | (let ((commit "e5228388e3faf2b7f1ae5bd048ad46ed565304c6") | |
154 | (revision "1")) | |
155 | (package | |
156 | (name "roffit") | |
157 | (version (string-append "0.11-" revision "." (string-take commit 9))) | |
158 | (source (origin | |
159 | (method git-fetch) | |
160 | (uri (git-reference | |
161 | (url "https://github.com/bagder/roffit.git") | |
162 | (commit commit))) | |
163 | (file-name (string-append "roffit-" commit "-checkout")) | |
164 | (sha256 | |
165 | (base32 | |
166 | "1y7ndbqciy7h0khlpi1bv4v1614vhybnmm4jysj6fwxkw9cwv1nc")))) | |
167 | (build-system gnu-build-system) | |
168 | (arguments | |
169 | `(#:test-target "test" | |
170 | #:make-flags | |
171 | (list (string-append "INSTALLDIR=" | |
172 | (assoc-ref %outputs "out") "/bin")) | |
173 | #:phases | |
174 | (modify-phases %standard-phases | |
175 | (delete 'configure) | |
176 | (add-before 'install 'pre-install | |
177 | (lambda* (#:key outputs #:allow-other-keys) | |
178 | (mkdir-p (string-append (assoc-ref outputs "out") | |
179 | "/bin")) | |
180 | #t))))) | |
181 | (inputs | |
182 | `(("perl" ,perl))) | |
183 | (home-page "https://daniel.haxx.se/projects/roffit/") | |
184 | (synopsis "Convert nroff files to HTML") | |
185 | (description | |
186 | "Roffit is a program that reads an nroff file and outputs an HTML file. | |
187 | It is typically used to display man pages on a web site.") | |
188 | (license expat)))) |