gnu: Add wl-clipboard.
[jackhill/guix/guix.git] / gnu / packages / groff.scm
... / ...
CommitLineData
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
5;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
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 utils)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages ghostscript)
32 #:use-module (gnu packages netpbm)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages texinfo))
35
36(define-public groff
37 (package
38 (name "groff")
39 (version "1.22.3")
40 (source (origin
41 (method url-fetch)
42 (uri (string-append "mirror://gnu/groff/groff-" version
43 ".tar.gz"))
44 (sha256 (base32
45 "1998v2kcs288d3y7kfxpvl369nqi06zbbvjzafyvyl3pr7bajj1s"))
46 (patches (search-patches "groff-source-date-epoch.patch"))))
47 (build-system gnu-build-system)
48 (outputs '("out"
49 "doc")) ;12MiB of PS, PDF, HTML, and examples
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)))
57 (native-inputs `(("bison" ,bison)
58 ("perl" ,perl)
59 ("psutils" ,psutils)
60 ("texinfo" ,texinfo)))
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)))))
69 (synopsis "Typesetting from plain text mixed with formatting commands")
70 (description
71 "Groff is a typesetting package that reads plain text and produces
72formatted output based on formatting commands contained within the text. It
73is usually the formatter of \"man\" documentation pages.")
74 (license gpl3+)
75 (home-page "https://www.gnu.org/software/groff/")))
76
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
94 #:configure-flags '("--docdir=/tmp/trash/doc")
95
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"))
104 (kept '("eqn" "neqn" "pic" "tbl" "refer" "preconv"
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")))
110
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"))
115
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))))))))))
122
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.
159It is typically used to display man pages on a web site.")
160 (license expat))))