| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2014, 2015, 2017, 2018, 2021 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, 2020 Efraim Flashner <efraim@flashner.co.il> |
| 7 | ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr> |
| 8 | ;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com> |
| 9 | ;;; Copyright © 2018, 2019 Marius Bakke <mbakke@fastmail.com> |
| 10 | ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com> |
| 11 | ;;; |
| 12 | ;;; This file is part of GNU Guix. |
| 13 | ;;; |
| 14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 15 | ;;; under the terms of the GNU General Public License as published by |
| 16 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 17 | ;;; your option) any later version. |
| 18 | ;;; |
| 19 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | ;;; GNU General Public License for more details. |
| 23 | ;;; |
| 24 | ;;; You should have received a copy of the GNU General Public License |
| 25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 26 | |
| 27 | (define-module (gnu packages man) |
| 28 | #:use-module ((guix licenses) #:prefix license:) |
| 29 | #:use-module (guix git-download) |
| 30 | #:use-module (guix download) |
| 31 | #:use-module (guix packages) |
| 32 | #:use-module (guix build-system gnu) |
| 33 | #:use-module (guix build-system ruby) |
| 34 | #:use-module (guix utils) |
| 35 | #:use-module (gnu packages compression) |
| 36 | #:use-module (gnu packages dbm) |
| 37 | #:use-module (gnu packages flex) |
| 38 | #:use-module (gnu packages gawk) |
| 39 | #:use-module (gnu packages groff) |
| 40 | #:use-module (gnu packages less) |
| 41 | #:use-module (gnu packages perl) |
| 42 | #:use-module (gnu packages pkg-config) |
| 43 | #:use-module (gnu packages linux) |
| 44 | #:use-module (gnu packages xml)) |
| 45 | |
| 46 | (define-public xmltoman |
| 47 | (package |
| 48 | (name "xmltoman") |
| 49 | (version "0.4") |
| 50 | (source |
| 51 | (origin |
| 52 | (method url-fetch) |
| 53 | (uri |
| 54 | (string-append "https://sourceforge.net/projects/xmltoman/files/" |
| 55 | "xmltoman/xmltoman-" version ".tar.gz/xmltoman-" |
| 56 | version ".tar.gz/download")) |
| 57 | (sha256 |
| 58 | (base32 "1c0lvzr7kdy63wbn1jv6s126ds7add3pxqb0vlxd3v5a2sir91wl")))) |
| 59 | (build-system gnu-build-system) |
| 60 | (arguments |
| 61 | `(#:tests? #f ; No tests |
| 62 | #:make-flags |
| 63 | (list |
| 64 | (string-append "PREFIX=" |
| 65 | (assoc-ref %outputs "out"))) |
| 66 | #:phases |
| 67 | (modify-phases %standard-phases |
| 68 | (delete 'configure)))) |
| 69 | (propagated-inputs |
| 70 | `(("perl" ,perl) |
| 71 | ("perl-xml-parser" ,perl-xml-parser))) |
| 72 | (synopsis "XML to Man converter") |
| 73 | (description "XMLtoMan and XMLMantoHTML are two small scripts to convert xml |
| 74 | to man pages in groff format or html. It features the usual man page items such |
| 75 | as description, options, see also, etc.") |
| 76 | (home-page "http://xmltoman.sourceforge.net/") |
| 77 | (license license:gpl2+))) |
| 78 | |
| 79 | (define-public ronn |
| 80 | (package |
| 81 | (name "ronn") |
| 82 | (version "0.7.3") |
| 83 | (source |
| 84 | (origin |
| 85 | (method git-fetch) |
| 86 | (uri |
| 87 | (git-reference |
| 88 | (url "https://github.com/rtomayko/ronn") |
| 89 | (commit version))) |
| 90 | (file-name |
| 91 | (git-file-name name version)) |
| 92 | (sha256 |
| 93 | (base32 "0fkniz7j1jp8v3i05m6hks3nsh6rzvjfi0ichpi7h4gwk5byxb94")))) |
| 94 | (build-system ruby-build-system) |
| 95 | (arguments |
| 96 | `(#:tests? #f)) ; Library hpricot not available |
| 97 | (synopsis "Manual authoring tool") |
| 98 | (description "Ronn builds manuals. It converts simple, human readable |
| 99 | textfiles to roff for terminal display, and also to HTML for the web.") |
| 100 | (home-page "https://rtomayko.github.io/ronn/") |
| 101 | (license license:expat))) |
| 102 | |
| 103 | (define-public libpipeline |
| 104 | (package |
| 105 | (name "libpipeline") |
| 106 | (version "1.5.3") |
| 107 | (source (origin |
| 108 | (method url-fetch) |
| 109 | (uri (string-append |
| 110 | "mirror://savannah/libpipeline/libpipeline-" |
| 111 | version ".tar.gz")) |
| 112 | (sha256 |
| 113 | (base32 |
| 114 | "1c5dl017xil2ssb6a5vg927bnsbc9vymfgi9ahvqbb8gypx0igsx")))) |
| 115 | (build-system gnu-build-system) |
| 116 | (home-page "http://libpipeline.nongnu.org/") |
| 117 | (synopsis "C library for manipulating pipelines of subprocesses") |
| 118 | (description |
| 119 | "libpipeline is a C library for manipulating pipelines of subprocesses in |
| 120 | a flexible and convenient way.") |
| 121 | (license license:gpl3+))) |
| 122 | |
| 123 | (define-public man-db |
| 124 | (package |
| 125 | (name "man-db") |
| 126 | (version "2.9.4") |
| 127 | (source (origin |
| 128 | (method url-fetch) |
| 129 | (uri (string-append "mirror://savannah/man-db/man-db-" |
| 130 | version ".tar.xz")) |
| 131 | (sha256 |
| 132 | (base32 |
| 133 | "0mk7n7yn6scy785jhg1j14b3q9l0cgvpry49r0ldjsnizbnrjv5n")))) |
| 134 | (build-system gnu-build-system) |
| 135 | (arguments |
| 136 | `(#:phases |
| 137 | (modify-phases %standard-phases |
| 138 | (add-after 'patch-source-shebangs 'patch-test-shebangs |
| 139 | (lambda* (#:key outputs #:allow-other-keys) |
| 140 | ;; Patch shebangs in test scripts. |
| 141 | (let ((out (assoc-ref outputs "out"))) |
| 142 | (for-each (lambda (file) |
| 143 | (substitute* file |
| 144 | (("#! /bin/sh") |
| 145 | (string-append "#!" (which "sh"))))) |
| 146 | (remove file-is-directory? |
| 147 | (find-files "src/tests" ".*"))) |
| 148 | #t))) |
| 149 | (add-after 'unpack 'patch-absolute-paths |
| 150 | (lambda* (#:key inputs #:allow-other-keys) |
| 151 | (substitute* "src/man.c" |
| 152 | (("\"iconv\"") |
| 153 | (string-append "\"" (which "iconv") "\""))) |
| 154 | ;; Embed an absolute reference to "preconv", otherwise it |
| 155 | ;; falls back to searching in PATH and ultimately fails |
| 156 | ;; to render unicode data (see <https://bugs.gnu.org/30785>). |
| 157 | (substitute* "lib/encodings.c" |
| 158 | (("groff_preconv = NULL") |
| 159 | (string-append "groff_preconv = \"" |
| 160 | (assoc-ref inputs "groff-minimal") |
| 161 | "/bin/preconv\""))) |
| 162 | #t))) |
| 163 | #:configure-flags |
| 164 | (let ((groff (assoc-ref %build-inputs "groff")) |
| 165 | (groff-minimal (assoc-ref %build-inputs "groff-minimal")) |
| 166 | (less (assoc-ref %build-inputs "less")) |
| 167 | (gzip (assoc-ref %build-inputs "gzip")) |
| 168 | (bzip2 (assoc-ref %build-inputs "bzip2")) |
| 169 | (xz (assoc-ref %build-inputs "xz")) |
| 170 | (util (assoc-ref %build-inputs "util-linux"))) |
| 171 | ;; Invoke groff, less, gzip, bzip2, and xz directly from the store. |
| 172 | (append (list ;; Disable setuid man user. |
| 173 | "--disable-setuid" |
| 174 | ;; Don't constrain ownership of system-wide cache files. |
| 175 | ;; Otherwise creating the manpage database fails with |
| 176 | ;; man-db > 2.7.5. |
| 177 | "--disable-cache-owner" |
| 178 | (string-append "--with-pager=" less "/bin/less") |
| 179 | (string-append "--with-gzip=" gzip "/bin/gzip") |
| 180 | (string-append "--with-bzip2=" bzip2 "/bin/gzip") |
| 181 | (string-append "--with-xz=" xz "/bin/xz") |
| 182 | (string-append "--with-col=" util "/bin/col") |
| 183 | ;; The default systemd directories ignore --prefix. |
| 184 | (string-append "--with-systemdsystemunitdir=" |
| 185 | %output "/lib/systemd/system") |
| 186 | (string-append "--with-systemdtmpfilesdir=" |
| 187 | %output "/lib/tmpfiles.d")) |
| 188 | (map (lambda (prog) |
| 189 | (string-append "--with-" prog "=" groff-minimal |
| 190 | "/bin/" prog)) |
| 191 | '("nroff" "eqn" "neqn" "tbl" "refer" "pic")))) |
| 192 | |
| 193 | ;; At run time we should refer to GROFF-MINIMAL, not GROFF (the latter |
| 194 | ;; pulls in Perl.) |
| 195 | #:disallowed-references (,groff) |
| 196 | |
| 197 | #:modules ((guix build gnu-build-system) |
| 198 | (guix build utils) |
| 199 | (srfi srfi-1)))) |
| 200 | (native-inputs |
| 201 | `(("pkg-config" ,pkg-config) |
| 202 | ("flex" ,flex) |
| 203 | ("groff" ,groff))) ;needed at build time (troff, grops, soelim, etc.) |
| 204 | (inputs |
| 205 | `(("gdbm" ,gdbm) |
| 206 | ("groff-minimal" ,groff-minimal) |
| 207 | ("less" ,less) |
| 208 | ("libpipeline" ,libpipeline) |
| 209 | ;; FIXME: 4.8 and later can use libseccomp, but it causes test |
| 210 | ;; failures in the build chroot. |
| 211 | ;;("libseccomp" ,libseccomp) |
| 212 | ("util-linux" ,util-linux))) |
| 213 | (native-search-paths |
| 214 | (list (search-path-specification |
| 215 | (variable "MANPATH") |
| 216 | (files '("share/man"))))) |
| 217 | (home-page "http://man-db.nongnu.org/") |
| 218 | (synopsis "Standard Unix documentation system") |
| 219 | (description |
| 220 | "Man-db is an implementation of the standard Unix documentation system |
| 221 | accessed using the man command. It uses a Berkeley DB database in place of |
| 222 | the traditional flat-text whatis databases.") |
| 223 | (license license:gpl2+))) |
| 224 | |
| 225 | (define-public mandoc |
| 226 | (package |
| 227 | (name "mandoc") |
| 228 | (version "1.14.5") |
| 229 | (source (origin |
| 230 | (method url-fetch) |
| 231 | (uri (string-append "https://mandoc.bsd.lv/snapshots/mandoc-" |
| 232 | version ".tar.gz")) |
| 233 | (sha256 |
| 234 | (base32 |
| 235 | "1xyqllxpjj1kimlipx11pzyywf5c25i4wmv0lqm7ph3gnlnb86c2")))) |
| 236 | (build-system gnu-build-system) |
| 237 | (arguments |
| 238 | `(#:test-target "regress" |
| 239 | #:phases (modify-phases %standard-phases |
| 240 | (add-before 'configure 'set-prefix |
| 241 | (lambda* (#:key outputs #:allow-other-keys) |
| 242 | (substitute* "configure" |
| 243 | (("^CC=.*") |
| 244 | (string-append "CC=" ,(cc-for-target) "\n")) |
| 245 | (("^DEFCFLAGS=\\\\\"") |
| 246 | "DEFCFLAGS=\"-O2 ") |
| 247 | (("^UTF8_LOCALE=.*") ;used for tests |
| 248 | "UTF8_LOCALE=en_US.UTF-8\n") |
| 249 | (("^MANPATH_(BASE|DEFAULT)=.*" _ which) |
| 250 | (string-append "MANPATH_" which "=" |
| 251 | "/run/current-system/profile/share/man\n")) |
| 252 | (("^PREFIX=.*") |
| 253 | (string-append "PREFIX=" (assoc-ref outputs "out") |
| 254 | "\n")))))))) |
| 255 | (native-inputs `(("perl" ,perl))) ;used to run tests |
| 256 | (inputs `(("zlib" ,zlib))) |
| 257 | (synopsis "Tools for BSD mdoc and man pages") |
| 258 | (description |
| 259 | "mandoc is a suite of tools compiling mdoc, the roff macro language of |
| 260 | choice for BSD manual pages, and man, the predominant historical language for |
| 261 | UNIX manuals. It is small and quite fast. The main component of the toolset |
| 262 | is the @command{mandoc} utility program, based on the libmandoc validating |
| 263 | compiler, to format output for UTF-8 and ASCII UNIX terminals, HTML 5, |
| 264 | PostScript, and PDF. Additional tools include the @command{man} viewer, and |
| 265 | @command{apropos} and @command{whatis}.") |
| 266 | (home-page "https://mandoc.bsd.lv/") |
| 267 | (license license:isc))) |
| 268 | |
| 269 | (define-public man-pages |
| 270 | (package |
| 271 | (name "man-pages") |
| 272 | (version "5.11") |
| 273 | (source |
| 274 | (origin |
| 275 | (method url-fetch) |
| 276 | (uri |
| 277 | (list (string-append "mirror://kernel.org/linux/docs/man-pages/" |
| 278 | "man-pages-" version ".tar.xz") |
| 279 | (string-append "mirror://kernel.org/linux/docs/man-pages/Archive/" |
| 280 | "man-pages-" version ".tar.xz"))) |
| 281 | (sha256 |
| 282 | (base32 "1aiwn6yi19idg4jbf7x4x5i06macjv7r8d5fgp1rwnc4a775vniy")))) |
| 283 | (build-system gnu-build-system) |
| 284 | (arguments |
| 285 | '(#:phases (modify-phases %standard-phases (delete 'configure)) |
| 286 | |
| 287 | ;; The 'all' target depends on three targets that directly populate |
| 288 | ;; $(MANDIR) based on its current contents. Doing that in parallel |
| 289 | ;; leads to undefined behavior (see <http://bugs.gnu.org/18701>.) |
| 290 | #:parallel-build? #f |
| 291 | |
| 292 | #:tests? #f |
| 293 | #:make-flags (list (string-append "MANDIR=" |
| 294 | (assoc-ref %outputs "out") |
| 295 | "/share/man")))) |
| 296 | (home-page "https://www.kernel.org/doc/man-pages/") |
| 297 | (synopsis "Development manual pages from the Linux project") |
| 298 | (description |
| 299 | "This package provides traditional Unix \"man pages\" documenting the |
| 300 | Linux kernel and C library interfaces employed by user-space programs.") |
| 301 | |
| 302 | ;; Each man page has its own license; some are GPLv2+, some are MIT/X11. |
| 303 | (license license:gpl2+))) |
| 304 | |
| 305 | (define-public help2man |
| 306 | (package |
| 307 | (name "help2man") |
| 308 | (version "1.47.13") |
| 309 | (source |
| 310 | (origin |
| 311 | (method url-fetch) |
| 312 | (uri (string-append "mirror://gnu/help2man/help2man-" |
| 313 | version ".tar.xz")) |
| 314 | (sha256 |
| 315 | (base32 |
| 316 | "08q5arxz4j4pyx5q4712c2rn7p7dw7as9xg38yvmsh1c3ynvpy5p")))) |
| 317 | (build-system gnu-build-system) |
| 318 | (arguments `(;; There's no `check' target. |
| 319 | #:tests? #f)) |
| 320 | (inputs |
| 321 | `(("perl" ,perl) |
| 322 | ;; TODO: Add these optional dependencies. |
| 323 | ;; ("perl-LocaleGettext" ,perl-LocaleGettext) |
| 324 | ;; ("gettext" ,gettext-minimal) |
| 325 | )) |
| 326 | (native-inputs |
| 327 | `(("perl" ,perl))) |
| 328 | (home-page "https://www.gnu.org/software/help2man/") |
| 329 | (synopsis "Automatically generate man pages from program --help") |
| 330 | (description |
| 331 | "GNU help2man is a program that converts the output of standard |
| 332 | \"--help\" and \"--version\" command-line arguments into a manual page |
| 333 | automatically.") |
| 334 | (license license:gpl3+))) |
| 335 | |
| 336 | (define-public scdoc |
| 337 | (package |
| 338 | (name "scdoc") |
| 339 | (version "1.10.1") |
| 340 | (source |
| 341 | (origin |
| 342 | (method git-fetch) |
| 343 | (uri (git-reference |
| 344 | (url "https://git.sr.ht/~sircmpwn/scdoc") |
| 345 | (commit version))) |
| 346 | (file-name (git-file-name name version)) |
| 347 | (sha256 |
| 348 | (base32 "1xmh6fnp378xmiycslg4migs1vx7yly4i1cf2vbbnwim9c9g0aw7")))) |
| 349 | (build-system gnu-build-system) |
| 350 | (arguments |
| 351 | `(#:make-flags |
| 352 | (list (string-append "CC=" ,(cc-for-target)) |
| 353 | (string-append "PREFIX=" (assoc-ref %outputs "out"))) |
| 354 | #:phases |
| 355 | (modify-phases %standard-phases |
| 356 | (delete 'configure)))) |
| 357 | (home-page "https://git.sr.ht/~sircmpwn/scdoc") |
| 358 | (synopsis "Simple man page generator") |
| 359 | (description "scdoc is a simple man page generator written for POSIX systems |
| 360 | in C99.") |
| 361 | ;; MIT license, see /share/doc/scdoc-1.6.0/COPYING. |
| 362 | (license license:expat))) |
| 363 | |
| 364 | (define-public txt2man |
| 365 | (package |
| 366 | (name "txt2man") |
| 367 | (version "1.6.0") |
| 368 | (source |
| 369 | (origin |
| 370 | (method git-fetch) |
| 371 | (uri (git-reference |
| 372 | (url "https://github.com/mvertes/txt2man") |
| 373 | (commit (string-append "txt2man-" version)))) |
| 374 | (file-name (git-file-name name version)) |
| 375 | (sha256 |
| 376 | (base32 |
| 377 | "1razjpvlcp85hqli77mwr9nmn5jnv3lm1fxbbqjpx1brv3h1lvm5")))) |
| 378 | (build-system gnu-build-system) |
| 379 | (arguments |
| 380 | `(#:tests? #f ; no "check" target |
| 381 | #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out"))) |
| 382 | #:phases (modify-phases %standard-phases (delete 'configure)))) |
| 383 | (inputs |
| 384 | `(("gawk" ,gawk))) |
| 385 | (home-page "https://github.com/mvertes/txt2man") |
| 386 | (synopsis "Convert text to man page") |
| 387 | (description "Txt2man converts flat ASCII text to man page format.") |
| 388 | (license license:gpl2+))) |