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