man.scm 16 KB

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