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