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