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 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
23 (define-module (gnu packages groff)
24 #:use-module (guix licenses)
25 #:use-module (guix packages)
26 #:use-module (guix utils)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
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))
43 (uri (string-append "mirror://gnu/groff/groff-" version
46 "14q2mldnr1vx0l9lqp9v2f6iww24gj28iyh4j2211hyynx67p3p7"))))
47 (build-system gnu-build-system)
49 "doc")) ;12MiB of PS, PDF, HTML, and examples
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
56 (inputs `(("ghostscript" ,ghostscript)))
57 (native-inputs `(("bison" ,bison)
60 ("texinfo" ,texinfo)))
62 `(#:parallel-build? #f ; parallel build fails
64 (modify-phases %standard-phases
65 (add-after 'unpack 'setenv
67 (setenv "GS_GENERATE_UUIDS" "0")
69 (synopsis "Typesetting from plain text mixed with formatting commands")
71 "Groff is a typesetting package that reads plain text and produces
72 formatted output based on formatting commands contained within the text. It
73 is usually the formatter of \"man\" documentation pages.")
75 (home-page "https://www.gnu.org/software/groff/")))
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.
82 (name "groff-minimal")
83 (synopsis "Minimalist variant of Groff for use by man-db")
86 ;; Omit the DVI, PS, PDF, and HTML backends.
88 (native-inputs `(("bison" ,bison)
92 `(#:disallowed-references (,perl)
94 #:configure-flags '("--with-doc=no")
96 ,@(substitute-keyword-arguments (package-arguments groff)
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)
109 (find-files (string-append out "/bin")))
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"))
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)$"
123 ;; There are no releases, so we take the latest commit.
124 (define-public roffit
125 (let ((commit "e5228388e3faf2b7f1ae5bd048ad46ed565304c6")
129 (version (string-append "0.11-" revision "." (string-take commit 9)))
133 (url "https://github.com/bagder/roffit.git")
135 (file-name (string-append "roffit-" commit "-checkout"))
138 "1y7ndbqciy7h0khlpi1bv4v1614vhybnmm4jysj6fwxkw9cwv1nc"))))
139 (build-system gnu-build-system)
141 `(#:test-target "test"
143 (list (string-append "INSTALLDIR="
144 (assoc-ref %outputs "out") "/bin"))
146 (modify-phases %standard-phases
148 (add-before 'install 'pre-install
149 (lambda* (#:key outputs #:allow-other-keys)
150 (mkdir-p (string-append (assoc-ref outputs "out")
155 (home-page "https://daniel.haxx.se/projects/roffit/")
156 (synopsis "Convert nroff files to HTML")
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.")