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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; 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 compression)
29 #:use-module (gnu packages imagemagick)
30 #:use-module (gnu packages inkscape)
31 #:use-module (gnu packages tex)
32 #:use-module (gnu packages perl)
33 #:use-module (gnu packages python)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages web-browsers)
36 #:use-module (gnu packages xml)
37 #:use-module (guix licenses)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module ((guix build utils) #:select (alist-replace))
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system trivial)
43 #:use-module (guix build-system python))
45 (define-public docbook-xml-5
51 (uri (string-append "https://docbook.org/xml/" version
52 "/docbook-" version ".zip"))
55 "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
56 (build-system trivial-build-system)
58 `(#:modules ((guix build utils))
61 (use-modules (guix build utils))
63 (string-append (assoc-ref %build-inputs "unzip")
65 (source (assoc-ref %build-inputs "source"))
66 (out (assoc-ref %outputs "out"))
67 (dtd (string-append out "/xml/dtd/docbook")))
70 (copy-recursively (string-append "docbook-" ,version) dtd)
71 (with-directory-excursion dtd
72 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
75 "uri=\"file://" dtd "/")))
77 (native-inputs `(("unzip" ,unzip)))
78 (home-page "https://docbook.org")
79 (synopsis "DocBook XML DTDs for document authoring")
81 "DocBook is general purpose XML and SGML document type particularly well
82 suited to books and papers about computer hardware and software (though it is
83 by no means limited to these applications.) This package provides XML DTDs.")
84 (license (x11-style "" "See file headers."))))
86 (define-public docbook-xml
88 (inherit docbook-xml-5)
93 (uri (string-append "https://docbook.org/xml/" version
94 "/docbook-xml-" version ".zip"))
97 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
100 (use-modules (guix build utils))
103 (string-append (assoc-ref %build-inputs "unzip")
105 (source (assoc-ref %build-inputs "source"))
106 (out (assoc-ref %outputs "out"))
107 (dtd (string-append out "/xml/dtd/docbook")))
109 (with-directory-excursion dtd
110 (invoke unzip source))
111 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
114 "uri=\"file://" dtd "/")))
116 #:modules ((guix build utils))))))
118 (define-public docbook-xml-4.4
119 (package (inherit docbook-xml)
123 (uri (string-append "https://docbook.org/xml/" version
124 "/docbook-xml-" version ".zip"))
127 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
129 (define-public docbook-xml-4.3
130 (package (inherit docbook-xml)
134 (uri (string-append "https://docbook.org/xml/" version
135 "/docbook-xml-" version ".zip"))
138 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
140 (define-public docbook-xml-4.2
141 (package (inherit docbook-xml)
145 (uri (string-append "https://docbook.org/xml/" version
146 "/docbook-xml-" version ".zip"))
149 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
151 (define-public docbook-xml-4.1.2
152 (package (inherit docbook-xml)
156 (uri (string-append "https://docbook.org/xml/" version
160 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
162 '(#:modules ((guix build utils))
165 (use-modules (guix build utils))
166 (let ((source (assoc-ref %build-inputs "source"))
167 (unzip (string-append (assoc-ref %build-inputs "unzip")
169 (dtd (string-append (assoc-ref %outputs "out")
170 "/xml/dtd/docbook")))
172 (invoke unzip source "-d" dtd)))))))
174 (define-public docbook-xsl
180 (uri (string-append "https://github.com/docbook/xslt10-stylesheets"
181 "/releases/download/release%2F" version
182 "/docbook-xsl-" version ".tar.bz2"))
183 (patches (search-patches "docbook-xsl-support-old-url.patch"
184 "docbook-xsl-nonrecursive-string-subst.patch"))
187 "0wd33z41kdsybyx3ay21w6bdlmgpd9kyn3mr5y520lsf8km28r9i"))
188 (modules '((guix build utils)))
191 (for-each delete-file (find-files "." "\\.jar$"))
193 (build-system trivial-build-system)
196 (use-modules (guix build utils))
199 (string-append ,name "-" ,version))
201 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
202 (xz (assoc-ref %build-inputs "xz"))
203 (tar (assoc-ref %build-inputs "tar"))
204 (source (assoc-ref %build-inputs "source"))
205 (out (assoc-ref %outputs "out"))
206 (xsl (string-append out "/xml/xsl")))
207 (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
208 (invoke (string-append tar "/bin/tar") "xvf" source)
211 (copy-recursively name-version
212 (string-append xsl "/" name-version))
214 (substitute* (string-append xsl "/" name-version "/catalog.xml")
215 (("rewritePrefix=\"./")
216 (string-append "rewritePrefix=\"file://" xsl "/"
219 #:modules ((guix build utils))))
220 (native-inputs `(("bzip2" ,bzip2)
221 ("xz" ,xz) ;needed for repacked tarballs
223 (home-page "https://docbook.org")
224 (synopsis "DocBook XSL style sheets for document authoring")
226 "This package provides XSL style sheets for DocBook.")
227 (license (x11-style "" "See 'COPYING' file."))))
229 (define-public docbook-dsssl
231 (name "docbook-dsssl")
235 (uri (string-append "mirror://sourceforge/docbook/"
237 name "-" version ".tar.bz2"))
240 "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
241 (build-system trivial-build-system)
242 (outputs '("out" "doc"))
244 `(#:modules ((guix build utils))
247 (use-modules (guix build utils))
248 (let ((source (assoc-ref %build-inputs "source"))
249 (dtd (string-append (assoc-ref %outputs "out")
250 "/sgml/dtd/docbook"))
251 (docbook-dsssl-doc (assoc-ref %build-inputs "docbook-dsssl-doc"))
252 (doc (assoc-ref %outputs "doc"))
253 (tar (assoc-ref %build-inputs "tar"))
254 (bzip2 (assoc-ref %build-inputs "bzip2")))
255 (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
257 (invoke "tar" "-xf" source "-C" dtd)
258 ;; The doc output contains 1.4 MiB of HTML documentation.
259 (symlink docbook-dsssl-doc doc)))))
261 `(("docbook-dsssl-doc" ,docbook-dsssl-doc)))
265 (home-page "https://docbook.org/")
266 (synopsis "DSSSL style sheets for DocBook")
267 (description "This package provides DSSSL style sheets for DocBook.")
268 (license (non-copyleft "file://README"))))
270 ;;; Private variable, used as the 'doc' output of the docbook-dsssl package.
271 (define docbook-dsssl-doc
273 (name "docbook-dsssl-doc")
277 (uri (string-append "mirror://sourceforge/docbook/"
279 name "-" version ".tar.bz2"))
282 "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
283 (build-system trivial-build-system)
285 `(#:modules ((guix build utils))
288 (use-modules (guix build utils))
289 (let ((source (assoc-ref %build-inputs "source"))
290 (docdir (string-append (assoc-ref %outputs "out")
291 "/share/doc/" "docbook-dsssl-" ,version))
292 (tar (assoc-ref %build-inputs "tar"))
293 (bzip2 (assoc-ref %build-inputs "bzip2")))
294 (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
296 ;; Extract the "doc" subdirectory.
297 (invoke "tar" "-xf" source "--strip-components=2"
298 "--no-same-owner" "-C" docdir
299 (string-append "docbook-dsssl-" ,version "/doc"))))))
303 (home-page "https://docbook.org/")
304 (synopsis "DocBook DSSSL style sheets documentation")
305 (description "Documentation for the DocBook DSSSL style sheets.")
306 (license (non-copyleft "file://doc/LEGALNOTICE.htm"))))
308 (define-public docbook-sgml
310 (name "docbook-sgml")
314 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
315 version "/docbk41.zip"))
318 "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))
319 (build-system trivial-build-system)
321 '(#:modules ((guix build utils))
324 (use-modules (guix build utils))
325 (let ((source (assoc-ref %build-inputs "source"))
326 (iso-entities-dir (string-append
327 (assoc-ref %build-inputs "iso-8879-entities")))
328 (unzip (string-append (assoc-ref %build-inputs "unzip")
330 (dtd (string-append (assoc-ref %outputs "out")
331 "/sgml/dtd/docbook")))
332 ;; Extract the sources.
335 (invoke unzip source)
336 ;; Reference the ISO 8879 character entities.
337 ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
338 (substitute* "docbook.cat"
339 (("(.*ISO 8879.*)\"iso-(.*)\\.gml\"" _ head name)
340 (string-append head "\"" iso-entities-dir "/ISO" name "\"")))))))
344 `(("iso-8879-entities" ,iso-8879-entities)))
345 (home-page "https://docbook.org")
346 (synopsis "DocBook SGML style sheets for document authoring")
347 (description "This package provides SGML style sheets for DocBook.")
348 (license (x11-style "" "See file headers."))))
350 (define-public docbook-sgml-3.1
352 (inherit docbook-sgml)
356 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
357 version "/docbk31.zip"))
360 "0f25ch7bywwhdxb1qa0hl28mgq1blqdap3rxzamm585rf4kis9i0"))))))
362 ;;; Private package referenced by docbook-sgml.
363 (define iso-8879-entities
365 (name "iso-8879-entities")
366 (version "0.0") ;no proper version
369 (uri "http://www.oasis-open.org/cover/ISOEnts.zip")
372 "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
373 (build-system trivial-build-system)
375 '(#:modules ((guix build utils))
378 (use-modules (guix build utils))
379 (let ((source (assoc-ref %build-inputs "source"))
380 (unzip (string-append (assoc-ref %build-inputs "unzip")
382 (out (string-append (assoc-ref %outputs "out"))))
383 (invoke unzip source "-d" out)))))
384 (native-inputs `(("unzip" ,unzip)))
385 (home-page "https://www.oasis-open.org/")
386 (synopsis "ISO 8879 character entities")
387 (description "ISO 8879 character entities that are typically used in
388 the in DocBook SGML DTDs.")
389 (license (x11-style "" "See file headers."))))
391 (define-public dblatex
397 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
398 "dblatex-" version "/dblatex3-"
402 "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))))
403 (build-system python-build-system)
404 ;; TODO: Add xfig/transfig for fig2dev utility
406 `(("texlive" ,(texlive-updmap.cfg (list texlive-amsfonts
407 texlive-latex-anysize
408 texlive-latex-appendix
409 texlive-latex-bookmark
410 texlive-latex-changebar
411 texlive-latex-colortbl
412 texlive-latex-fancybox
413 texlive-latex-fancyhdr
414 texlive-latex-fancyvrb
416 texlive-latex-footmisc
418 texlive-latex-jknapltx
419 texlive-latex-listings
420 texlive-latex-multirow
421 texlive-latex-overpic
422 texlive-latex-pdfpages
423 texlive-latex-refcount
424 texlive-latex-subfigure
425 texlive-latex-titlesec
431 texlive-generic-iftex)))
432 ("imagemagick" ,imagemagick) ;for convert
433 ("inkscape" ,inkscape) ;for svg conversion
434 ("docbook" ,docbook-xml)
435 ("libxslt" ,libxslt))) ;for xsltproc
437 `(;; Using setuptools causes an invalid "package_base" path in
438 ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
439 ;; by dblatex's setup.py stripping the root path when creating the
440 ;; script. (dblatex's setup.py still uses distutils and thus has to
441 ;; create the script by itself. The feature for creating scripts is one
442 ;; of setuptools' features.)
443 ;; See this thread for details:
444 ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
446 #:tests? #f ;no 'test' command
448 (modify-phases %standard-phases
449 (add-after 'wrap 'set-path
450 (lambda* (#:key inputs outputs #:allow-other-keys)
451 (let ((out (assoc-ref outputs "out")))
452 ;; dblatex executes helper programs at runtime.
453 (wrap-program (string-append out "/bin/dblatex")
455 ,(map (lambda (input)
456 (string-append (assoc-ref inputs input)
458 '("libxslt" "texlive"
459 "imagemagick" "inkscape"))))
461 (home-page "http://dblatex.sourceforge.net")
462 (synopsis "DocBook to LaTeX Publishing")
464 "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
465 to DVI, PostScript or PDF by translating them in pure LaTeX as a first
466 process. MathML 2.0 markups are supported too. It started as a clone of
468 ;; lib/contrib/which is under an X11 license
471 ;; This is a variant of the 'dblatex' package that is not updated often. It
472 ;; is intended to be used as a native-input at build-time only, e.g. by
473 ;; 'gtk-doc' for generating package documentation. This allows the main
474 ;; 'dblatex' and 'imagemagick' packages to be freely updated on the 'master'
475 ;; branch without triggering an excessive number of rebuilds.
476 (define-public dblatex/stable
478 (package/inherit dblatex
479 (inputs (alist-replace "imagemagick" `(,imagemagick/stable)
480 (package-inputs dblatex))))))
482 (define-public docbook-utils
484 (name "docbook-utils")
488 ;; The original sources are not accessible anymore.
489 (uri (string-append "http://deb.debian.org/debian/pool/main/"
490 "d/docbook-utils/docbook-utils_"
491 version ".orig.tar.gz"))
494 "1scj5vgw1xz872pq54a89blcxqqm11p90yzv8a9mqq57x27apyj8"))))
495 (build-system gnu-build-system)
497 `(#:phases (modify-phases %standard-phases
498 (add-after 'unpack 'patch-build-system
500 (substitute* (find-files "." "\\.in$")
501 ;; Do not hard-code SGML_CATALOG_FILES.
502 ((".*SGML_CATALOG_FILES=/etc/sgml/catalog.*") "")
503 ;; Use OpenSP and OpenJade.
509 (add-after 'unpack 'patch-jw.in
510 ;; Do not override the SGML_CATALOG_FILES environment
513 (substitute* "bin/jw.in"
514 ((".*SGML_CATALOG_FILES=`find.*")
516 (("SGML_CATALOG_FILES=`echo.*")
518 (("SGML_CATALOG_FILES=\"\"")
523 (add-after 'unpack 'patch-txt-backend
525 ;; Locate lynx, links or w3m from the PATH, not from
527 (substitute* "backends/txt"
528 (("CONVERT=/usr/bin/")
530 (("\\[ -x /usr/bin/([^ ]+) \\]" dummy command)
531 (string-append "command -v " command " > /dev/null")))
533 ;; Propagated for convenience. All these tools are used at run time to
534 ;; provide the complete functionality of the docbook-utils commands.
536 `(("texlive-jadetex" ,texlive-jadetex)
537 ("docbook-sgml" ,docbook-sgml-3.1)
538 ("docbook-dsssl" ,docbook-dsssl)
539 ("openjade" ,openjade)
542 ("perl-sgmls" ,perl-sgmls)))
543 (home-page "https://packages.debian.org/sid/docbook-utils")
544 (synopsis "DocBook converter to other formats")
545 (description "The docbook-utils package is a collection of utilities
546 intended to ease the use of SGML and XML.
549 Convert a SGML DocBook file to other formats such as Hyper Text Markup
550 Language (HTML), Rich Text Format (RTF), PostScript (PS), man, Portable
551 Document Format (PDF), TeX, Texinfo or plain text (txt). It can be used
552 more conveniently via the following wrappers:
553 @itemx docbook2dvi Convert a SGML DocBook file to the DVI format.
554 @itemx docbook2html Convert a SGML DocBook file to an HTML document.
555 @itemx docbook2man Convert a SGML DocBook file a man page.
556 @itemx docbook2pdf Convert a SGML DocBook file to a PDF document.
557 @itemx docbook2ps Convert a SGML DocBook file to a PS document.
558 @itemx docbook2rtf Convert a SGML DocBook file to a RTF document.
559 @itemx docbook2tex Convert a SGML DocBook file to a TeX document.
560 @itemx docbook2texi Convert a SGML DocBook file to a Texinfo document.
561 @itemx docbook2txt Convert a SGML DocBook file to a plain text document.
563 Detect the differences in markup between two SGML files.