docbook.scm 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014, 2021 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
  4. ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
  5. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  6. ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
  7. ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  8. ;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
  9. ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
  10. ;;; Copyright © 2021 Andrew Whatson <whatson@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. (define-module (gnu packages docbook)
  27. #:use-module (gnu packages)
  28. #:use-module (gnu packages bash)
  29. #:use-module (gnu packages compression)
  30. #:use-module (gnu packages imagemagick)
  31. #:use-module (gnu packages inkscape)
  32. #:use-module (gnu packages tex)
  33. #:use-module (gnu packages texinfo)
  34. #:use-module (gnu packages perl)
  35. #:use-module (gnu packages python)
  36. #:use-module (gnu packages base)
  37. #:use-module (gnu packages web-browsers)
  38. #:use-module (gnu packages xml)
  39. #:use-module ((guix licenses) #:prefix license:)
  40. #:use-module (guix packages)
  41. #:use-module (guix download)
  42. #:use-module ((guix build utils) #:select (alist-replace))
  43. #:use-module (guix build-system gnu)
  44. #:use-module (guix build-system trivial)
  45. #:use-module (guix build-system python))
  46. (define-public docbook-xml-5
  47. (package
  48. (name "docbook-xml")
  49. (version "5.0.1")
  50. (source (origin
  51. (method url-fetch)
  52. (uri (string-append "https://docbook.org/xml/" version
  53. "/docbook-" version ".zip"))
  54. (sha256
  55. (base32
  56. "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
  57. (build-system trivial-build-system)
  58. (arguments
  59. `(#:modules ((guix build utils))
  60. #:builder
  61. (begin
  62. (use-modules (guix build utils))
  63. (let* ((unzip
  64. (string-append (assoc-ref %build-inputs "unzip")
  65. "/bin/unzip"))
  66. (source (assoc-ref %build-inputs "source"))
  67. (out (assoc-ref %outputs "out"))
  68. (dtd (string-append out "/xml/dtd/docbook")))
  69. (invoke unzip source)
  70. (mkdir-p dtd)
  71. (copy-recursively (string-append "docbook-" ,version) dtd)
  72. (with-directory-excursion dtd
  73. (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
  74. (("uri=\"")
  75. (string-append
  76. "uri=\"file://" dtd "/")))
  77. #t)))))
  78. (native-inputs `(("unzip" ,unzip)))
  79. (home-page "https://docbook.org")
  80. (synopsis "DocBook XML DTDs for document authoring")
  81. (description
  82. "DocBook is general purpose XML and SGML document type particularly well
  83. suited to books and papers about computer hardware and software (though it is
  84. by no means limited to these applications.) This package provides XML DTDs.")
  85. (license (license:x11-style "" "See file headers."))))
  86. (define-public docbook-xml
  87. (package
  88. (inherit docbook-xml-5)
  89. (name "docbook-xml")
  90. (version "4.5")
  91. (source (origin
  92. (method url-fetch)
  93. (uri (string-append "https://docbook.org/xml/" version
  94. "/docbook-xml-" version ".zip"))
  95. (sha256
  96. (base32
  97. "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
  98. (arguments
  99. '(#:builder (begin
  100. (use-modules (guix build utils))
  101. (let* ((unzip
  102. (string-append (assoc-ref %build-inputs "unzip")
  103. "/bin/unzip"))
  104. (source (assoc-ref %build-inputs "source"))
  105. (out (assoc-ref %outputs "out"))
  106. (dtd (string-append out "/xml/dtd/docbook")))
  107. (mkdir-p dtd)
  108. (with-directory-excursion dtd
  109. (invoke unzip source))
  110. (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
  111. (("uri=\"")
  112. (string-append
  113. "uri=\"file://" dtd "/")))
  114. #t))
  115. #:modules ((guix build utils))))))
  116. (define-public docbook-xml-4.4
  117. (package (inherit docbook-xml)
  118. (version "4.4")
  119. (source (origin
  120. (method url-fetch)
  121. (uri (string-append "https://docbook.org/xml/" version
  122. "/docbook-xml-" version ".zip"))
  123. (sha256
  124. (base32
  125. "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
  126. (define-public docbook-xml-4.3
  127. (package (inherit docbook-xml)
  128. (version "4.3")
  129. (source (origin
  130. (method url-fetch)
  131. (uri (string-append "https://docbook.org/xml/" version
  132. "/docbook-xml-" version ".zip"))
  133. (sha256
  134. (base32
  135. "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
  136. (define-public docbook-xml-4.2
  137. (package (inherit docbook-xml)
  138. (version "4.2")
  139. (source (origin
  140. (method url-fetch)
  141. (uri (string-append "https://docbook.org/xml/" version
  142. "/docbook-xml-" version ".zip"))
  143. (sha256
  144. (base32
  145. "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
  146. (define-public docbook-xml-4.1.2
  147. (package (inherit docbook-xml)
  148. (version "4.1.2")
  149. (source (origin
  150. (method url-fetch)
  151. (uri (string-append "https://docbook.org/xml/" version
  152. "/docbkx412.zip"))
  153. (sha256
  154. (base32
  155. "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
  156. (arguments
  157. '(#:modules ((guix build utils))
  158. #:builder
  159. (begin
  160. (use-modules (guix build utils))
  161. (let ((source (assoc-ref %build-inputs "source"))
  162. (unzip (string-append (assoc-ref %build-inputs "unzip")
  163. "/bin/unzip"))
  164. (dtd (string-append (assoc-ref %outputs "out")
  165. "/xml/dtd/docbook")))
  166. (mkdir-p dtd)
  167. (invoke unzip source "-d" dtd)))))))
  168. (define-public docbook-xsl
  169. (package
  170. (name "docbook-xsl")
  171. (version "1.79.2")
  172. (source (origin
  173. (method url-fetch)
  174. (uri (string-append "https://github.com/docbook/xslt10-stylesheets"
  175. "/releases/download/release%2F" version
  176. "/docbook-xsl-" version ".tar.bz2"))
  177. (patches (search-patches "docbook-xsl-support-old-url.patch"
  178. "docbook-xsl-nonrecursive-string-subst.patch"))
  179. (sha256
  180. (base32
  181. "0wd33z41kdsybyx3ay21w6bdlmgpd9kyn3mr5y520lsf8km28r9i"))
  182. (modules '((guix build utils)))
  183. (snippet
  184. '(begin
  185. (for-each delete-file (find-files "." "\\.jar$"))
  186. #t))))
  187. (build-system trivial-build-system)
  188. (arguments
  189. `(#:builder (begin
  190. (use-modules (guix build utils))
  191. (define name-version
  192. (string-append ,name "-" ,version))
  193. (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
  194. (xz (assoc-ref %build-inputs "xz"))
  195. (tar (assoc-ref %build-inputs "tar"))
  196. (source (assoc-ref %build-inputs "source"))
  197. (out (assoc-ref %outputs "out"))
  198. (xsl (string-append out "/xml/xsl")))
  199. (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
  200. (invoke (string-append tar "/bin/tar") "xvf" source)
  201. (mkdir-p xsl)
  202. (copy-recursively name-version
  203. (string-append xsl "/" name-version))
  204. (substitute* (string-append xsl "/" name-version "/catalog.xml")
  205. (("rewritePrefix=\"./")
  206. (string-append "rewritePrefix=\"file://" xsl "/"
  207. name-version "/")))
  208. #t))
  209. #:modules ((guix build utils))))
  210. (native-inputs `(("bzip2" ,bzip2)
  211. ("xz" ,xz) ;needed for repacked tarballs
  212. ("tar" ,tar)))
  213. (home-page "https://docbook.org")
  214. (synopsis "DocBook XSL style sheets for document authoring")
  215. (description
  216. "This package provides XSL style sheets for DocBook.")
  217. (license (license:x11-style "" "See 'COPYING' file."))))
  218. (define-public docbook-dsssl
  219. (package
  220. (name "docbook-dsssl")
  221. (version "1.79")
  222. (source (origin
  223. (method url-fetch)
  224. (uri (string-append "mirror://sourceforge/docbook/"
  225. name "/" version "/"
  226. name "-" version ".tar.bz2"))
  227. (sha256
  228. (base32
  229. "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
  230. (build-system trivial-build-system)
  231. (outputs '("out" "doc"))
  232. (arguments
  233. `(#:modules ((guix build utils))
  234. #:builder
  235. (begin
  236. (use-modules (guix build utils))
  237. (let ((source (assoc-ref %build-inputs "source"))
  238. (dtd (string-append (assoc-ref %outputs "out")
  239. "/sgml/dtd/docbook"))
  240. (docbook-dsssl-doc (assoc-ref %build-inputs "docbook-dsssl-doc"))
  241. (doc (assoc-ref %outputs "doc"))
  242. (tar (assoc-ref %build-inputs "tar"))
  243. (bzip2 (assoc-ref %build-inputs "bzip2")))
  244. (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
  245. (mkdir-p dtd)
  246. (invoke "tar" "-xf" source "-C" dtd)
  247. ;; The doc output contains 1.4 MiB of HTML documentation.
  248. (symlink docbook-dsssl-doc doc)))))
  249. (inputs
  250. `(("docbook-dsssl-doc" ,docbook-dsssl-doc)))
  251. (native-inputs
  252. `(("bzip2" ,bzip2)
  253. ("tar" ,tar)))
  254. (home-page "https://docbook.org/")
  255. (synopsis "DSSSL style sheets for DocBook")
  256. (description "This package provides DSSSL style sheets for DocBook.")
  257. (license (license:non-copyleft "file://README"))))
  258. ;;; Private variable, used as the 'doc' output of the docbook-dsssl package.
  259. (define docbook-dsssl-doc
  260. (package
  261. (name "docbook-dsssl-doc")
  262. (version "1.79")
  263. (source (origin
  264. (method url-fetch)
  265. (uri (string-append "mirror://sourceforge/docbook/"
  266. name "/" version "/"
  267. name "-" version ".tar.bz2"))
  268. (sha256
  269. (base32
  270. "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
  271. (build-system trivial-build-system)
  272. (arguments
  273. `(#:modules ((guix build utils))
  274. #:builder
  275. (begin
  276. (use-modules (guix build utils))
  277. (let ((source (assoc-ref %build-inputs "source"))
  278. (docdir (string-append (assoc-ref %outputs "out")
  279. "/share/doc/" "docbook-dsssl-" ,version))
  280. (tar (assoc-ref %build-inputs "tar"))
  281. (bzip2 (assoc-ref %build-inputs "bzip2")))
  282. (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
  283. (mkdir-p docdir)
  284. ;; Extract the "doc" subdirectory.
  285. (invoke "tar" "-xf" source "--strip-components=2"
  286. "--no-same-owner" "-C" docdir
  287. (string-append "docbook-dsssl-" ,version "/doc"))))))
  288. (native-inputs
  289. `(("bzip2" ,bzip2)
  290. ("tar" ,tar)))
  291. (home-page "https://docbook.org/")
  292. (synopsis "DocBook DSSSL style sheets documentation")
  293. (description "Documentation for the DocBook DSSSL style sheets.")
  294. (license (license:non-copyleft "file://doc/LEGALNOTICE.htm"))))
  295. (define-public docbook-sgml
  296. (package
  297. (name "docbook-sgml")
  298. (version "4.1")
  299. (source (origin
  300. (method url-fetch)
  301. (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
  302. version "/docbk41.zip"))
  303. (sha256
  304. (base32
  305. "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))
  306. (build-system trivial-build-system)
  307. (arguments
  308. '(#:modules ((guix build utils))
  309. #:builder
  310. (begin
  311. (use-modules (guix build utils))
  312. (let ((source (assoc-ref %build-inputs "source"))
  313. (iso-entities-dir (string-append
  314. (assoc-ref %build-inputs "iso-8879-entities")))
  315. (unzip (string-append (assoc-ref %build-inputs "unzip")
  316. "/bin/unzip"))
  317. (dtd (string-append (assoc-ref %outputs "out")
  318. "/sgml/dtd/docbook")))
  319. ;; Extract the sources.
  320. (mkdir-p dtd)
  321. (chdir dtd)
  322. (invoke unzip source)
  323. ;; Reference the ISO 8879 character entities.
  324. ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
  325. (substitute* "docbook.cat"
  326. (("(.*ISO 8879.*)\"iso-(.*)\\.gml\"" _ head name)
  327. (string-append head "\"" iso-entities-dir "/ISO" name "\"")))))))
  328. (native-inputs
  329. `(("unzip" ,unzip)))
  330. (inputs
  331. `(("iso-8879-entities" ,iso-8879-entities)))
  332. (home-page "https://docbook.org")
  333. (synopsis "DocBook SGML style sheets for document authoring")
  334. (description "This package provides SGML style sheets for DocBook.")
  335. (license (license:x11-style "" "See file headers."))))
  336. (define-public docbook-sgml-3.1
  337. (package
  338. (inherit docbook-sgml)
  339. (version "3.1")
  340. (source (origin
  341. (method url-fetch)
  342. (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
  343. version "/docbk31.zip"))
  344. (sha256
  345. (base32
  346. "0f25ch7bywwhdxb1qa0hl28mgq1blqdap3rxzamm585rf4kis9i0"))))))
  347. ;;; Private package referenced by docbook-sgml.
  348. (define iso-8879-entities
  349. (package
  350. (name "iso-8879-entities")
  351. (version "0.0") ;no proper version
  352. (source (origin
  353. (method url-fetch)
  354. (uri "http://www.oasis-open.org/cover/ISOEnts.zip")
  355. (sha256
  356. (base32
  357. "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
  358. (build-system trivial-build-system)
  359. (arguments
  360. '(#:modules ((guix build utils))
  361. #:builder
  362. (begin
  363. (use-modules (guix build utils))
  364. (let ((source (assoc-ref %build-inputs "source"))
  365. (unzip (string-append (assoc-ref %build-inputs "unzip")
  366. "/bin/unzip"))
  367. (out (string-append (assoc-ref %outputs "out"))))
  368. (invoke unzip source "-d" out)))))
  369. (native-inputs `(("unzip" ,unzip)))
  370. (home-page "https://www.oasis-open.org/")
  371. (synopsis "ISO 8879 character entities")
  372. (description "ISO 8879 character entities that are typically used in
  373. the in DocBook SGML DTDs.")
  374. (license (license:x11-style "" "See file headers."))))
  375. (define-public dblatex
  376. (package
  377. (name "dblatex")
  378. (version "0.3.12")
  379. (source (origin
  380. (method url-fetch)
  381. (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
  382. "dblatex-" version "/dblatex3-"
  383. version ".tar.bz2"))
  384. (sha256
  385. (base32
  386. "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))))
  387. (build-system python-build-system)
  388. ;; TODO: Add xfig/transfig for fig2dev utility
  389. (inputs
  390. `(("texlive" ,(texlive-updmap.cfg (list texlive-amsfonts
  391. texlive-latex-anysize
  392. texlive-latex-appendix
  393. texlive-latex-bookmark
  394. texlive-latex-changebar
  395. texlive-latex-colortbl
  396. texlive-latex-fancybox
  397. texlive-latex-fancyhdr
  398. texlive-latex-fancyvrb
  399. texlive-latex-float
  400. texlive-latex-footmisc
  401. texlive-hyperref
  402. texlive-latex-jknapltx
  403. texlive-latex-listings
  404. texlive-latex-multirow
  405. texlive-latex-overpic
  406. texlive-latex-pdfpages
  407. texlive-latex-refcount
  408. texlive-latex-subfigure
  409. texlive-latex-titlesec
  410. texlive-wasysym
  411. texlive-fonts-rsfs
  412. texlive-stmaryrd
  413. texlive-generic-iftex)))
  414. ("imagemagick" ,imagemagick) ;for convert
  415. ("inkscape" ,inkscape) ;for svg conversion
  416. ("docbook" ,docbook-xml)
  417. ("libxslt" ,libxslt))) ;for xsltproc
  418. (arguments
  419. `(;; Using setuptools causes an invalid "package_base" path in
  420. ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
  421. ;; by dblatex's setup.py stripping the root path when creating the
  422. ;; script. (dblatex's setup.py still uses distutils and thus has to
  423. ;; create the script by itself. The feature for creating scripts is one
  424. ;; of setuptools' features.)
  425. ;; See this thread for details:
  426. ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
  427. #:use-setuptools? #f
  428. #:tests? #f ;no 'test' command
  429. #:phases
  430. (modify-phases %standard-phases
  431. (add-after 'wrap 'set-path
  432. (lambda* (#:key inputs outputs #:allow-other-keys)
  433. (let ((out (assoc-ref outputs "out")))
  434. ;; dblatex executes helper programs at runtime.
  435. (wrap-program (string-append out "/bin/dblatex")
  436. `("PATH" ":" prefix
  437. ,(map (lambda (input)
  438. (string-append (assoc-ref inputs input)
  439. "/bin"))
  440. '("libxslt" "texlive"
  441. "imagemagick" "inkscape"))))
  442. #t))))))
  443. (home-page "http://dblatex.sourceforge.net")
  444. (synopsis "DocBook to LaTeX Publishing")
  445. (description
  446. "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
  447. to DVI, PostScript or PDF by translating them in pure LaTeX as a first
  448. process. MathML 2.0 markups are supported too. It started as a clone of
  449. DB2LaTeX.")
  450. ;; lib/contrib/which is under an X11 license
  451. (license license:gpl2+)))
  452. ;; This is a variant of the 'dblatex' package that is not updated often. It
  453. ;; is intended to be used as a native-input at build-time only, e.g. by
  454. ;; 'gtk-doc' for generating package documentation. This allows the main
  455. ;; 'dblatex' and 'imagemagick' packages to be freely updated on the 'master'
  456. ;; branch without triggering an excessive number of rebuilds.
  457. (define-public dblatex/stable
  458. (hidden-package
  459. (package/inherit dblatex
  460. (inputs (alist-replace "imagemagick" `(,imagemagick/stable)
  461. (package-inputs dblatex))))))
  462. (define-public docbook-utils
  463. (package
  464. (name "docbook-utils")
  465. (version "0.6.14")
  466. (source (origin
  467. (method url-fetch)
  468. ;; The original sources are not accessible anymore.
  469. (uri (string-append "http://deb.debian.org/debian/pool/main/"
  470. "d/docbook-utils/docbook-utils_"
  471. version ".orig.tar.gz"))
  472. (sha256
  473. (base32
  474. "1scj5vgw1xz872pq54a89blcxqqm11p90yzv8a9mqq57x27apyj8"))))
  475. (build-system gnu-build-system)
  476. (arguments
  477. `(#:phases (modify-phases %standard-phases
  478. (add-after 'unpack 'patch-build-system
  479. (lambda _
  480. (substitute* (find-files "." "\\.in$")
  481. ;; Do not hard-code SGML_CATALOG_FILES.
  482. ((".*SGML_CATALOG_FILES=/etc/sgml/catalog.*") "")
  483. ;; Use OpenSP and OpenJade.
  484. (("\\bjade\\b")
  485. "openjade")
  486. (("\\bnsgmls\\b")
  487. "onsgmls"))
  488. #t))
  489. (add-after 'unpack 'patch-jw.in
  490. ;; Do not override the SGML_CATALOG_FILES environment
  491. ;; variable.
  492. (lambda _
  493. (substitute* "bin/jw.in"
  494. ((".*SGML_CATALOG_FILES=`find.*")
  495. "")
  496. (("SGML_CATALOG_FILES=`echo.*")
  497. ":\n")
  498. (("SGML_CATALOG_FILES=\"\"")
  499. ":")
  500. (("\\bwhich\\b")
  501. "command -v"))
  502. #t))
  503. (add-after 'unpack 'patch-txt-backend
  504. (lambda _
  505. ;; Locate lynx, links or w3m from the PATH, not from
  506. ;; /usr/bin.
  507. (substitute* "backends/txt"
  508. (("CONVERT=/usr/bin/")
  509. "CONVERT=")
  510. (("\\[ -x /usr/bin/([^ ]+) \\]" dummy command)
  511. (string-append "command -v " command " > /dev/null")))
  512. #t)))))
  513. ;; Propagated for convenience. All these tools are used at run time to
  514. ;; provide the complete functionality of the docbook-utils commands.
  515. (propagated-inputs
  516. `(("texlive-jadetex" ,texlive-jadetex)
  517. ("docbook-sgml" ,docbook-sgml-3.1)
  518. ("docbook-dsssl" ,docbook-dsssl)
  519. ("openjade" ,openjade)
  520. ("opensp" ,opensp)
  521. ("lynx" ,lynx)
  522. ("perl-sgmls" ,perl-sgmls)))
  523. (home-page "https://packages.debian.org/sid/docbook-utils")
  524. (synopsis "DocBook converter to other formats")
  525. (description "The docbook-utils package is a collection of utilities
  526. intended to ease the use of SGML and XML.
  527. @table @command
  528. @item jw
  529. Convert a SGML DocBook file to other formats such as Hyper Text Markup
  530. Language (HTML), Rich Text Format (RTF), PostScript (PS), man, Portable
  531. Document Format (PDF), TeX, Texinfo or plain text (txt). It can be used
  532. more conveniently via the following wrappers:
  533. @itemx docbook2dvi Convert a SGML DocBook file to the DVI format.
  534. @itemx docbook2html Convert a SGML DocBook file to an HTML document.
  535. @itemx docbook2man Convert a SGML DocBook file a man page.
  536. @itemx docbook2pdf Convert a SGML DocBook file to a PDF document.
  537. @itemx docbook2ps Convert a SGML DocBook file to a PS document.
  538. @itemx docbook2rtf Convert a SGML DocBook file to a RTF document.
  539. @itemx docbook2tex Convert a SGML DocBook file to a TeX document.
  540. @itemx docbook2texi Convert a SGML DocBook file to a Texinfo document.
  541. @itemx docbook2txt Convert a SGML DocBook file to a plain text document.
  542. @item sgmldiff
  543. Detect the differences in markup between two SGML files.
  544. @end table")
  545. (license license:gpl2+)))
  546. (define-public docbook2x
  547. (package
  548. (name "docbook2x")
  549. (version "0.8.8")
  550. (source (origin
  551. (method url-fetch)
  552. (uri (string-append "mirror://sourceforge/docbook2x/docbook2x/"
  553. version "/docbook2X-" version ".tar.gz"))
  554. (sha256
  555. (base32
  556. "0ifwzk99rzjws0ixzimbvs83x6cxqk1xzmg84wa1p7bs6rypaxs0"))))
  557. (build-system gnu-build-system)
  558. (inputs
  559. `(("bash-minimal" ,bash-minimal)
  560. ("docbook-xml" ,docbook-xml)
  561. ("perl" ,perl)
  562. ("perl-xml-namespacesupport" ,perl-xml-namespacesupport)
  563. ("perl-xml-parser" ,perl-xml-parser)
  564. ("perl-xml-sax" ,perl-xml-sax)
  565. ("perl-xml-sax-base" ,perl-xml-sax-base)
  566. ("texinfo" ,texinfo)
  567. ("xsltproc" ,libxslt)))
  568. (arguments
  569. `(#:phases
  570. (modify-phases %standard-phases
  571. (add-after 'configure 'patch-sources
  572. (lambda* (#:key inputs outputs #:allow-other-keys)
  573. ;; Fix failed substitution in config.pl
  574. (substitute* "perl/config.pl"
  575. (("\\$\\{prefix\\}")
  576. (assoc-ref outputs "out")))
  577. ;; Fix a failing test (maybe it worked with old texinfo?)
  578. (substitute* "test/complete-manuals/at1.xml"
  579. (("<bridgehead>")
  580. "<bridgehead renderas=\"sect2\">"))
  581. ;; Patch all the tests use DocBook 4.5
  582. (substitute* (find-files "test" "\\.xml$")
  583. (("\"-//OASIS//DTD DocBook XML V4\\..+//EN\"")
  584. "\"-//OASIS//DTD DocBook XML V4.5//EN\"")
  585. (("\"http://www\\.oasis-open\\.org/docbook/xml/4\\..+/docbookx.dtd\"")
  586. "\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""))
  587. ;; Set XML catalogs for tests to pass
  588. (setenv "XML_CATALOG_FILES"
  589. (string-append (assoc-ref inputs "docbook-xml")
  590. "/xml/dtd/docbook/catalog.xml"))))
  591. (add-after 'install 'wrap-programs
  592. (lambda* (#:key inputs outputs #:allow-other-keys)
  593. (let* ((out (assoc-ref outputs "out"))
  594. (programs
  595. (map (lambda (p)
  596. (string-append out "/bin/" p))
  597. '("db2x_manxml" "db2x_texixml" "db2x_xsltproc"
  598. "docbook2man" "docbook2texi")))
  599. (perl5lib
  600. (map (lambda (i)
  601. (string-append (assoc-ref inputs i)
  602. "/lib/perl5/site_perl"))
  603. '("perl-xml-namespacesupport"
  604. "perl-xml-parser"
  605. "perl-xml-sax"
  606. "perl-xml-sax-base")))
  607. (xml-catalog-files
  608. (list (string-append (assoc-ref inputs "docbook-xml")
  609. "/xml/dtd/docbook/catalog.xml"))))
  610. (map (lambda (program)
  611. (wrap-program program
  612. `("PERL5LIB" ":" prefix
  613. ,perl5lib)
  614. `("XML_CATALOG_FILES" " " prefix
  615. ,xml-catalog-files)))
  616. programs))))
  617. (add-after 'install 'create-symlinks
  618. (lambda* (#:key outputs #:allow-other-keys)
  619. (let ((out (assoc-ref outputs "out")))
  620. ;; Create db2x_* symlinks to satisfy some configure scripts
  621. ;; which use these names to differentiate from an older
  622. ;; docbook2man script provided by docbook-utils.
  623. (map (lambda (prog)
  624. (symlink prog (string-append out "/bin/db2x_" prog)))
  625. '("docbook2man" "docbook2texi"))))))))
  626. (home-page "http://docbook2x.sourceforge.net")
  627. (synopsis "Convert DocBook to man page and Texinfo format")
  628. (description
  629. "docbook2X is a software package that converts DocBook documents into the
  630. traditional Unix man page format and the GNU Texinfo format. Notable features
  631. include table support for man pages, internationalization support, and easy
  632. customization of the output using XSLT.")
  633. (license license:expat)))