Merge remote-tracking branch 'origin/master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / man.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2014, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 David Thompson <dthompson2@worcester.edu>
4 ;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
6 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
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 man)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
27 #:use-module (guix packages)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages databases)
30 #:use-module (gnu packages flex)
31 #:use-module (gnu packages gawk)
32 #:use-module (gnu packages groff)
33 #:use-module (gnu packages less)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages linux))
37
38 (define-public libpipeline
39 (package
40 (name "libpipeline")
41 (version "1.5.0")
42 (source (origin
43 (method url-fetch)
44 (uri (string-append
45 "mirror://savannah/libpipeline/libpipeline-"
46 version ".tar.gz"))
47 (sha256
48 (base32
49 "0avg525wvifcvjrwa6i1r6kvahmsswj0mpxrsxzzdzra9wpf2whd"))))
50 (build-system gnu-build-system)
51 (home-page "http://libpipeline.nongnu.org/")
52 (synopsis "C library for manipulating pipelines of subprocesses")
53 (description
54 "libpipeline is a C library for manipulating pipelines of subprocesses in
55 a flexible and convenient way.")
56 (license gpl3+)))
57
58 (define-public man-db
59 (package
60 (name "man-db")
61 (version "2.7.6.1")
62 (source (origin
63 (method url-fetch)
64 (uri (string-append "mirror://savannah/man-db/man-db-"
65 version ".tar.xz"))
66 (sha256
67 (base32
68 "0gqgs4zc3r87apns0k5qp689p2ylxx2596s2mkmkxjjay99brv88"))))
69 (build-system gnu-build-system)
70 (arguments
71 `(#:phases
72 (modify-phases %standard-phases
73 (add-after 'patch-source-shebangs 'patch-test-shebangs
74 (lambda* (#:key outputs #:allow-other-keys)
75 ;; Patch shebangs in test scripts.
76 (let ((out (assoc-ref outputs "out")))
77 (for-each (lambda (file)
78 (substitute* file
79 (("#! /bin/sh")
80 (string-append "#!" (which "sh")))))
81 (remove file-is-directory?
82 (find-files "src/tests" ".*"))))))
83 (add-after 'unpack 'patch-iconv-path
84 (lambda* (#:key inputs #:allow-other-keys)
85 (substitute* "src/man.c"
86 (("\"iconv\"")
87 (string-append "\"" (which "iconv") "\"")))
88 #t)))
89 #:configure-flags
90 (let ((groff (assoc-ref %build-inputs "groff"))
91 (groff-minimal (assoc-ref %build-inputs "groff-minimal"))
92 (less (assoc-ref %build-inputs "less"))
93 (gzip (assoc-ref %build-inputs "gzip"))
94 (bzip2 (assoc-ref %build-inputs "bzip2"))
95 (xz (assoc-ref %build-inputs "xz"))
96 (util (assoc-ref %build-inputs "util-linux")))
97 ;; Invoke groff, less, gzip, bzip2, and xz directly from the store.
98 (append (list ;; Disable setuid man user.
99 "--disable-setuid"
100 ;; Don't constrain ownership of system-wide cache files.
101 ;; Otherwise creating the manpage database fails with
102 ;; man-db > 2.7.5.
103 "--disable-cache-owner"
104 (string-append "--with-pager=" less "/bin/less")
105 (string-append "--with-gzip=" gzip "/bin/gzip")
106 (string-append "--with-bzip2=" bzip2 "/bin/gzip")
107 (string-append "--with-xz=" xz "/bin/xz")
108 (string-append "--with-col=" util "/bin/col")
109 ;; Default value is "/usr/lib/tmpfiles.d" (not
110 ;; prefix-sensitive).
111 (string-append "--with-systemdtmpfilesdir="
112 %output "/lib/tmpfiles.d"))
113 (map (lambda (prog)
114 (string-append "--with-" prog "=" groff-minimal
115 "/bin/" prog))
116 '("nroff" "eqn" "neqn" "tbl" "refer" "pic"))))
117
118 ;; At run time we should refer to GROFF-MINIMAL, not GROFF (the latter
119 ;; pulls in Perl.)
120 #:disallowed-references (,groff)
121
122 #:modules ((guix build gnu-build-system)
123 (guix build utils)
124 (srfi srfi-1))))
125 (native-inputs
126 `(("pkg-config" ,pkg-config)
127 ("groff" ,groff))) ;needed at build time (troff, grops, soelim, etc.)
128 (inputs
129 `(("flex" ,flex)
130 ("gdbm" ,gdbm)
131 ("groff-minimal" ,groff-minimal)
132 ("less" ,less)
133 ("libpipeline" ,libpipeline)
134 ("util-linux" ,util-linux)))
135 (native-search-paths
136 (list (search-path-specification
137 (variable "MANPATH")
138 (files '("share/man")))))
139 (home-page "http://man-db.nongnu.org/")
140 (synopsis "Standard Unix documentation system")
141 (description
142 "Man-db is an implementation of the standard Unix documentation system
143 accessed using the man command. It uses a Berkeley DB database in place of
144 the traditional flat-text whatis databases.")
145 (license gpl2+)))
146
147 (define-public man-pages
148 (package
149 (name "man-pages")
150 (version "4.14")
151 (source (origin
152 (method url-fetch)
153 (uri
154 (list
155 (string-append
156 "mirror://kernel.org/linux/docs/man-pages/man-pages-"
157 version ".tar.xz")
158 (string-append
159 "mirror://kernel.org/linux/docs/man-pages/Archive/"
160 "man-pages-" version ".tar.xz")))
161 (sha256
162 (base32
163 "0wf9ymqxk1k5xwcl3n919p66a1aayif3x4cahj4w04y3k1wbhlih"))))
164 (build-system gnu-build-system)
165 (arguments
166 '(#:phases (modify-phases %standard-phases (delete 'configure))
167
168 ;; The 'all' target depends on three targets that directly populate
169 ;; $(MANDIR) based on its current contents. Doing that in parallel
170 ;; leads to undefined behavior (see <http://bugs.gnu.org/18701>.)
171 #:parallel-build? #f
172
173 #:tests? #f
174 #:make-flags (list (string-append "MANDIR="
175 (assoc-ref %outputs "out")
176 "/share/man"))))
177 (home-page "https://www.kernel.org/doc/man-pages/")
178 (synopsis "Development manual pages from the Linux project")
179 (description
180 "This package provides traditional Unix \"man pages\" documenting the
181 Linux kernel and C library interfaces employed by user-space programs.")
182
183 ;; Each man page has its own license; some are GPLv2+, some are MIT/X11.
184 (license gpl2+)))
185
186 (define-public help2man
187 (package
188 (name "help2man")
189 (version "1.47.5")
190 (source
191 (origin
192 (method url-fetch)
193 (uri (string-append "mirror://gnu/help2man/help2man-"
194 version ".tar.xz"))
195 (sha256
196 (base32
197 "1cb14kp380jzk1yi4i7x9d8qplc8c5mgcbgycgs9ggpx34jhp9kw"))))
198 (build-system gnu-build-system)
199 (arguments `(;; There's no `check' target.
200 #:tests? #f))
201 (inputs
202 `(("perl" ,perl)
203 ;; TODO: Add these optional dependencies.
204 ;; ("perl-LocaleGettext" ,perl-LocaleGettext)
205 ;; ("gettext" ,gettext-minimal)
206 ))
207 (home-page "https://www.gnu.org/software/help2man/")
208 (synopsis "Automatically generate man pages from program --help")
209 (description
210 "GNU help2man is a program that converts the output of standard
211 \"--help\" and \"--version\" command-line arguments into a manual page
212 automatically.")
213 (license gpl3+)))
214
215 (define-public txt2man
216 (package
217 (name "txt2man")
218 (version "1.6.0")
219 (source
220 (origin
221 (method url-fetch)
222 (uri (string-append
223 "https://github.com/mvertes/txt2man/archive/txt2man-"
224 version ".tar.gz"))
225 (sha256
226 (base32
227 "168cj96974n2z0igin6j1ic1m45zyic7nm5ark7frq8j78rrx4zn"))))
228 (build-system gnu-build-system)
229 (arguments
230 `(#:tests? #f ; no "check" target
231 #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
232 #:phases (modify-phases %standard-phases (delete 'configure))))
233 (inputs
234 `(("gawk" ,gawk)))
235 (home-page "https://github.com/mvertes/txt2man")
236 (synopsis "Convert text to man page")
237 (description "Txt2man converts flat ASCII text to man page format.")
238 (license gpl2+)))