gnu: varnish-modules: Update to 0.19.0.
[jackhill/guix/guix.git] / gnu / packages / docbook.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 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 Andrew Whatson <whatson@gmail.com>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
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.
17 ;;;
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.
22 ;;;
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/>.
25
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 xml)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module ((guix build utils) #:select (alist-replace))
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system trivial)
44 #:use-module (guix build-system python))
45
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
87 (define-public docbook-xml
88 (package
89 (inherit docbook-xml-5)
90 (name "docbook-xml")
91 (version "4.5")
92 (source (origin
93 (method url-fetch)
94 (uri (string-append "https://docbook.org/xml/" version
95 "/docbook-xml-" version ".zip"))
96 (sha256
97 (base32
98 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
99 (arguments
100 '(#:builder (begin
101 (use-modules (guix build utils))
102
103 (let* ((unzip
104 (string-append (assoc-ref %build-inputs "unzip")
105 "/bin/unzip"))
106 (source (assoc-ref %build-inputs "source"))
107 (out (assoc-ref %outputs "out"))
108 (dtd (string-append out "/xml/dtd/docbook")))
109 (mkdir-p dtd)
110 (with-directory-excursion dtd
111 (invoke unzip source))
112 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
113 (("uri=\"")
114 (string-append
115 "uri=\"file://" dtd "/")))
116 #t))
117 #:modules ((guix build utils))))))
118
119 (define-public docbook-xml-4.4
120 (package (inherit docbook-xml)
121 (version "4.4")
122 (source (origin
123 (method url-fetch)
124 (uri (string-append "https://docbook.org/xml/" version
125 "/docbook-xml-" version ".zip"))
126 (sha256
127 (base32
128 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
129
130 (define-public docbook-xml-4.3
131 (package (inherit docbook-xml)
132 (version "4.3")
133 (source (origin
134 (method url-fetch)
135 (uri (string-append "https://docbook.org/xml/" version
136 "/docbook-xml-" version ".zip"))
137 (sha256
138 (base32
139 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
140
141 (define-public docbook-xml-4.2
142 (package (inherit docbook-xml)
143 (version "4.2")
144 (source (origin
145 (method url-fetch)
146 (uri (string-append "https://docbook.org/xml/" version
147 "/docbook-xml-" version ".zip"))
148 (sha256
149 (base32
150 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
151
152 (define-public docbook-xml-4.1.2
153 (package (inherit docbook-xml)
154 (version "4.1.2")
155 (source (origin
156 (method url-fetch)
157 (uri (string-append "https://docbook.org/xml/" version
158 "/docbkx412.zip"))
159 (sha256
160 (base32
161 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
162 (arguments
163 '(#:modules ((guix build utils))
164 #:builder
165 (begin
166 (use-modules (guix build utils))
167 (let ((source (assoc-ref %build-inputs "source"))
168 (unzip (string-append (assoc-ref %build-inputs "unzip")
169 "/bin/unzip"))
170 (dtd (string-append (assoc-ref %outputs "out")
171 "/xml/dtd/docbook")))
172 (mkdir-p dtd)
173 (invoke unzip source "-d" dtd)))))))
174
175 (define-public docbook-xsl
176 (package
177 (name "docbook-xsl")
178 (version "1.79.1")
179 (source (origin
180 (method url-fetch)
181 (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
182 version "/docbook-xsl-" version ".tar.bz2"))
183 (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
184 (sha256
185 (base32
186 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))
187 (modules '((guix build utils)))
188 (snippet
189 '(begin
190 (for-each delete-file (find-files "." "\\.jar$"))
191 #t))))
192 (build-system trivial-build-system)
193 (arguments
194 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
195 (use-modules (guix build utils))
196
197 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
198 (xz (assoc-ref %build-inputs "xz"))
199 (tar (assoc-ref %build-inputs "tar"))
200 (source (assoc-ref %build-inputs "source"))
201 (out (assoc-ref %outputs "out"))
202 (xsl (string-append out "/xml/xsl")))
203 (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
204 (invoke (string-append tar "/bin/tar") "xvf" source)
205
206 (mkdir-p xsl)
207 (copy-recursively name-version
208 (string-append xsl "/" name-version))
209
210 (substitute* (string-append xsl "/" name-version "/catalog.xml")
211 (("rewritePrefix=\"./")
212 (string-append "rewritePrefix=\"file://" xsl "/"
213 name-version "/")))
214 #t))
215 #:modules ((guix build utils))))
216 (native-inputs `(("bzip2" ,bzip2)
217 ("xz" ,xz) ;needed for repacked tarballs
218 ("tar" ,tar)))
219 (home-page "https://docbook.org")
220 (synopsis "DocBook XSL style sheets for document authoring")
221 (description
222 "This package provides XSL style sheets for DocBook.")
223 (license (license:x11-style "" "See 'COPYING' file."))))
224
225 (define-public docbook-dsssl
226 (package
227 (name "docbook-dsssl")
228 (version "1.79")
229 (source (origin
230 (method url-fetch)
231 (uri (string-append "mirror://sourceforge/docbook/"
232 name "/" version "/"
233 name "-" version ".tar.bz2"))
234 (sha256
235 (base32
236 "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
237 (build-system trivial-build-system)
238 (outputs '("out" "doc"))
239 (arguments
240 `(#:modules ((guix build utils))
241 #:builder
242 (begin
243 (use-modules (guix build utils))
244 (let ((source (assoc-ref %build-inputs "source"))
245 (dtd (string-append (assoc-ref %outputs "out")
246 "/sgml/dtd/docbook"))
247 (docbook-dsssl-doc (assoc-ref %build-inputs "docbook-dsssl-doc"))
248 (doc (assoc-ref %outputs "doc"))
249 (tar (assoc-ref %build-inputs "tar"))
250 (bzip2 (assoc-ref %build-inputs "bzip2")))
251 (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
252 (mkdir-p dtd)
253 (invoke "tar" "-xf" source "-C" dtd)
254 ;; The doc output contains 1.4 MiB of HTML documentation.
255 (symlink docbook-dsssl-doc doc)))))
256 (inputs
257 `(("docbook-dsssl-doc" ,docbook-dsssl-doc)))
258 (native-inputs
259 `(("bzip2" ,bzip2)
260 ("tar" ,tar)))
261 (home-page "https://docbook.org/")
262 (synopsis "DSSSL style sheets for DocBook")
263 (description "This package provides DSSSL style sheets for DocBook.")
264 (license (license:non-copyleft "file://README"))))
265
266 ;;; Private variable, used as the 'doc' output of the docbook-dsssl package.
267 (define docbook-dsssl-doc
268 (package
269 (name "docbook-dsssl-doc")
270 (version "1.79")
271 (source (origin
272 (method url-fetch)
273 (uri (string-append "mirror://sourceforge/docbook/"
274 name "/" version "/"
275 name "-" version ".tar.bz2"))
276 (sha256
277 (base32
278 "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
279 (build-system trivial-build-system)
280 (arguments
281 `(#:modules ((guix build utils))
282 #:builder
283 (begin
284 (use-modules (guix build utils))
285 (let ((source (assoc-ref %build-inputs "source"))
286 (docdir (string-append (assoc-ref %outputs "out")
287 "/share/doc/" "docbook-dsssl-" ,version))
288 (tar (assoc-ref %build-inputs "tar"))
289 (bzip2 (assoc-ref %build-inputs "bzip2")))
290 (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
291 (mkdir-p docdir)
292 ;; Extract the "doc" subdirectory.
293 (invoke "tar" "-xf" source "--strip-components=2"
294 "--no-same-owner" "-C" docdir
295 (string-append "docbook-dsssl-" ,version "/doc"))))))
296 (native-inputs
297 `(("bzip2" ,bzip2)
298 ("tar" ,tar)))
299 (home-page "https://docbook.org/")
300 (synopsis "DocBook DSSSL style sheets documentation")
301 (description "Documentation for the DocBook DSSSL style sheets.")
302 (license (license:non-copyleft "file://doc/LEGALNOTICE.htm"))))
303
304 (define-public docbook-sgml
305 (package
306 (name "docbook-sgml")
307 (version "4.1")
308 (source (origin
309 (method url-fetch)
310 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
311 version "/docbk41.zip"))
312 (sha256
313 (base32
314 "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))
315 (build-system trivial-build-system)
316 (arguments
317 '(#:modules ((guix build utils))
318 #:builder
319 (begin
320 (use-modules (guix build utils))
321 (let ((source (assoc-ref %build-inputs "source"))
322 (iso-entities-dir (string-append
323 (assoc-ref %build-inputs "iso-8879-entities")))
324 (unzip (string-append (assoc-ref %build-inputs "unzip")
325 "/bin/unzip"))
326 (dtd (string-append (assoc-ref %outputs "out")
327 "/sgml/dtd/docbook")))
328 ;; Extract the sources.
329 (mkdir-p dtd)
330 (chdir dtd)
331 (invoke unzip source)
332 ;; Reference the ISO 8879 character entities.
333 ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
334 (substitute* "docbook.cat"
335 (("(.*ISO 8879.*)\"iso-(.*)\\.gml\"" _ head name)
336 (string-append head "\"" iso-entities-dir "/ISO" name "\"")))))))
337 (native-inputs
338 `(("unzip" ,unzip)))
339 (inputs
340 `(("iso-8879-entities" ,iso-8879-entities)))
341 (home-page "https://docbook.org")
342 (synopsis "DocBook SGML style sheets for document authoring")
343 (description "This package provides SGML style sheets for DocBook.")
344 (license (license:x11-style "" "See file headers."))))
345
346 (define-public docbook-sgml-3.1
347 (package
348 (inherit docbook-sgml)
349 (version "3.1")
350 (source (origin
351 (method url-fetch)
352 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
353 version "/docbk31.zip"))
354 (sha256
355 (base32
356 "0f25ch7bywwhdxb1qa0hl28mgq1blqdap3rxzamm585rf4kis9i0"))))))
357
358 ;;; Private package referenced by docbook-sgml.
359 (define iso-8879-entities
360 (package
361 (name "iso-8879-entities")
362 (version "0.0") ;no proper version
363 (source (origin
364 (method url-fetch)
365 (uri "http://www.oasis-open.org/cover/ISOEnts.zip")
366 (sha256
367 (base32
368 "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
369 (build-system trivial-build-system)
370 (arguments
371 '(#:modules ((guix build utils))
372 #:builder
373 (begin
374 (use-modules (guix build utils))
375 (let ((source (assoc-ref %build-inputs "source"))
376 (unzip (string-append (assoc-ref %build-inputs "unzip")
377 "/bin/unzip"))
378 (out (string-append (assoc-ref %outputs "out"))))
379 (invoke unzip source "-d" out)))))
380 (native-inputs `(("unzip" ,unzip)))
381 (home-page "https://www.oasis-open.org/")
382 (synopsis "ISO 8879 character entities")
383 (description "ISO 8879 character entities that are typically used in
384 the in DocBook SGML DTDs.")
385 (license (license:x11-style "" "See file headers."))))
386
387 (define-public dblatex
388 (package
389 (name "dblatex")
390 (version "0.3.11")
391 (source (origin
392 (method url-fetch)
393 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
394 "dblatex-" version "/dblatex-"
395 version ".tar.bz2"))
396 (sha256
397 (base32
398 "0rp1bc2lgisigscq1i7zxfd2qdaxxxld6khbcxss4pq7fpi9fzkv"))))
399 (build-system python-build-system)
400 ;; TODO: Add xfig/transfig for fig2dev utility
401 (inputs
402 `(("texlive" ,(texlive-union (list texlive-amsfonts/patched
403 texlive-latex-anysize
404 texlive-latex-appendix
405 texlive-latex-changebar
406 texlive-latex-colortbl
407 texlive-latex-eepic
408 texlive-latex-eso-pic
409 texlive-latex-fancybox
410 texlive-latex-fancyhdr
411 texlive-latex-fancyvrb
412 texlive-latex-float
413 texlive-latex-footmisc
414 texlive-latex-hyperref
415 texlive-latex-jknapltx
416 texlive-latex-listings
417 texlive-latex-multirow
418 texlive-latex-oberdiek
419 texlive-latex-overpic
420 texlive-latex-pdfpages
421 texlive-latex-subfigure
422 texlive-latex-titlesec
423 texlive-latex-url
424 texlive-latex-wasysym
425
426 texlive-fonts-ec
427 texlive-fonts-rsfs
428 texlive-fonts-stmaryrd
429
430 texlive-generic-ifxetex)))
431 ("imagemagick" ,imagemagick) ;for convert
432 ("inkscape" ,inkscape) ;for svg conversion
433 ("docbook" ,docbook-xml)
434 ("libxslt" ,libxslt))) ;for xsltproc
435 (arguments
436 `(#:python ,python-2 ;'print' syntax
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
445 #:use-setuptools? #f
446 #:tests? #f ;no 'test' command
447 #:phases
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")
454 `("PATH" ":" prefix
455 ,(map (lambda (input)
456 (string-append (assoc-ref inputs input)
457 "/bin"))
458 '("libxslt" "texlive"
459 "imagemagick" "inkscape"))))
460 #t))))))
461 (home-page "http://dblatex.sourceforge.net")
462 (synopsis "DocBook to LaTeX Publishing")
463 (description
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
467 DB2LaTeX.")
468 ;; lib/contrib/which is under an X11 license
469 (license license:gpl2+)))
470
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
477 (hidden-package
478 (package/inherit dblatex
479 (inputs (alist-replace "imagemagick" `(,imagemagick/stable)
480 (package-inputs dblatex))))))
481
482 (define-public docbook2x
483 (package
484 (name "docbook2x")
485 (version "0.8.8")
486 (source (origin
487 (method url-fetch)
488 (uri (string-append "mirror://sourceforge/docbook2x/docbook2x/"
489 version "/docbook2X-" version ".tar.gz"))
490 (sha256
491 (base32
492 "0ifwzk99rzjws0ixzimbvs83x6cxqk1xzmg84wa1p7bs6rypaxs0"))))
493 (build-system gnu-build-system)
494 (inputs
495 `(("bash-minimal" ,bash-minimal)
496 ("docbook-xml" ,docbook-xml)
497 ("perl" ,perl)
498 ("perl-xml-namespacesupport" ,perl-xml-namespacesupport)
499 ("perl-xml-parser" ,perl-xml-parser)
500 ("perl-xml-sax" ,perl-xml-sax)
501 ("perl-xml-sax-base" ,perl-xml-sax-base)
502 ("texinfo" ,texinfo)
503 ("xsltproc" ,libxslt)))
504 (arguments
505 `(#:phases
506 (modify-phases %standard-phases
507 (add-after 'configure 'patch-sources
508 (lambda* (#:key inputs outputs #:allow-other-keys)
509 ;; Fix failed substitution in config.pl
510 (substitute* "perl/config.pl"
511 (("\\$\\{prefix\\}")
512 (assoc-ref outputs "out")))
513 ;; Fix a failing test (maybe it worked with old texinfo?)
514 (substitute* "test/complete-manuals/at1.xml"
515 (("<bridgehead>")
516 "<bridgehead renderas=\"sect2\">"))
517 ;; Patch all the tests use DocBook 4.5
518 (substitute* (find-files "test" "\\.xml$")
519 (("\"-//OASIS//DTD DocBook XML V4\\..+//EN\"")
520 "\"-//OASIS//DTD DocBook XML V4.5//EN\"")
521 (("\"http://www\\.oasis-open\\.org/docbook/xml/4\\..+/docbookx.dtd\"")
522 "\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""))
523 ;; Set XML catalogs for tests to pass
524 (setenv "XML_CATALOG_FILES"
525 (string-append (assoc-ref inputs "docbook-xml")
526 "/xml/dtd/docbook/catalog.xml"))))
527 (add-after 'install 'wrap-programs
528 (lambda* (#:key inputs outputs #:allow-other-keys)
529 (let* ((out (assoc-ref outputs "out"))
530 (programs
531 (map (lambda (p)
532 (string-append out "/bin/" p))
533 '("db2x_manxml" "db2x_texixml" "db2x_xsltproc"
534 "docbook2man" "docbook2texi")))
535 (perl5lib
536 (map (lambda (i)
537 (string-append (assoc-ref inputs i)
538 "/lib/perl5/site_perl"))
539 '("perl-xml-namespacesupport"
540 "perl-xml-parser"
541 "perl-xml-sax"
542 "perl-xml-sax-base")))
543 (xml-catalog-files
544 (list (string-append (assoc-ref inputs "docbook-xml")
545 "/xml/dtd/docbook/catalog.xml"))))
546 (map (lambda (program)
547 (wrap-program program
548 `("PERL5LIB" ":" prefix
549 ,perl5lib)
550 `("XML_CATALOG_FILES" " " prefix
551 ,xml-catalog-files)))
552 programs))))
553 (add-after 'install 'create-symlinks
554 (lambda* (#:key outputs #:allow-other-keys)
555 (let ((out (assoc-ref outputs "out")))
556 ;; Create db2x_* symlinks to satisfy some configure scripts
557 ;; which use these names to differentiate from an older
558 ;; docbook2man script provided by docbook-utils.
559 (map (lambda (prog)
560 (symlink prog (string-append out "/bin/db2x_" prog)))
561 '("docbook2man" "docbook2texi"))))))))
562 (home-page "http://docbook2x.sourceforge.net")
563 (synopsis "Convert DocBook to man page and Texinfo format")
564 (description
565 "docbook2X is a software package that converts DocBook documents into the
566 traditional Unix man page format and the GNU Texinfo format. Notable features
567 include table support for man pages, internationalization support, and easy
568 customization of the output using XSLT.")
569 (license license:expat)))