gnu: cvs-fast-export: Update to 1.56.
[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 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages docbook)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages imagemagick)
29 #:use-module (gnu packages inkscape)
30 #:use-module (gnu packages tex)
31 #:use-module (gnu packages python)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages xml)
34 #:use-module (guix licenses)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module ((guix build utils) #:select (alist-replace))
38 #:use-module (guix build-system trivial)
39 #:use-module (guix build-system python))
40
41 (define-public docbook-xml-5
42 (package
43 (name "docbook-xml")
44 (version "5.0.1")
45 (source (origin
46 (method url-fetch)
47 (uri (string-append "https://docbook.org/xml/" version
48 "/docbook-" version ".zip"))
49 (sha256
50 (base32
51 "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
52 (build-system trivial-build-system)
53 (arguments
54 `(#:modules ((guix build utils))
55 #:builder
56 (begin
57 (use-modules (guix build utils))
58 (let* ((unzip
59 (string-append (assoc-ref %build-inputs "unzip")
60 "/bin/unzip"))
61 (source (assoc-ref %build-inputs "source"))
62 (out (assoc-ref %outputs "out"))
63 (dtd (string-append out "/xml/dtd/docbook")))
64 (invoke unzip source)
65 (mkdir-p dtd)
66 (copy-recursively (string-append "docbook-" ,version) dtd)
67 (with-directory-excursion dtd
68 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
69 (("uri=\"")
70 (string-append
71 "uri=\"file://" dtd "/")))
72 #t)))))
73 (native-inputs `(("unzip" ,unzip)))
74 (home-page "https://docbook.org")
75 (synopsis "DocBook XML DTDs for document authoring")
76 (description
77 "DocBook is general purpose XML and SGML document type particularly well
78 suited to books and papers about computer hardware and software (though it is
79 by no means limited to these applications.) This package provides XML DTDs.")
80 (license (x11-style "" "See file headers."))))
81
82 (define-public docbook-xml
83 (package
84 (inherit docbook-xml-5)
85 (name "docbook-xml")
86 (version "4.5")
87 (source (origin
88 (method url-fetch)
89 (uri (string-append "https://docbook.org/xml/" version
90 "/docbook-xml-" version ".zip"))
91 (sha256
92 (base32
93 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
94 (arguments
95 '(#:builder (begin
96 (use-modules (guix build utils))
97
98 (let* ((unzip
99 (string-append (assoc-ref %build-inputs "unzip")
100 "/bin/unzip"))
101 (source (assoc-ref %build-inputs "source"))
102 (out (assoc-ref %outputs "out"))
103 (dtd (string-append out "/xml/dtd/docbook")))
104 (mkdir-p dtd)
105 (with-directory-excursion dtd
106 (invoke unzip source))
107 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
108 (("uri=\"")
109 (string-append
110 "uri=\"file://" dtd "/")))
111 #t))
112 #:modules ((guix build utils))))))
113
114 (define-public docbook-xml-4.4
115 (package (inherit docbook-xml)
116 (version "4.4")
117 (source (origin
118 (method url-fetch)
119 (uri (string-append "https://docbook.org/xml/" version
120 "/docbook-xml-" version ".zip"))
121 (sha256
122 (base32
123 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
124
125 (define-public docbook-xml-4.3
126 (package (inherit docbook-xml)
127 (version "4.3")
128 (source (origin
129 (method url-fetch)
130 (uri (string-append "https://docbook.org/xml/" version
131 "/docbook-xml-" version ".zip"))
132 (sha256
133 (base32
134 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
135
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
147 (define-public docbook-xml-4.1.2
148 (package (inherit docbook-xml)
149 (version "4.1.2")
150 (source (origin
151 (method url-fetch)
152 (uri (string-append "https://docbook.org/xml/" version
153 "/docbkx412.zip"))
154 (sha256
155 (base32
156 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
157 (arguments
158 '(#:modules ((guix build utils))
159 #:builder
160 (begin
161 (use-modules (guix build utils))
162 (let ((source (assoc-ref %build-inputs "source"))
163 (unzip (string-append (assoc-ref %build-inputs "unzip")
164 "/bin/unzip"))
165 (dtd (string-append (assoc-ref %outputs "out")
166 "/xml/dtd/docbook")))
167 (mkdir-p dtd)
168 (invoke unzip source "-d" dtd)))))))
169
170 (define-public docbook-xsl
171 (package
172 (name "docbook-xsl")
173 (version "1.79.1")
174 (source (origin
175 (method url-fetch)
176 (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
177 version "/docbook-xsl-" version ".tar.bz2"))
178 (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
179 (sha256
180 (base32
181 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))
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 (let ((name-version (string-append ,name "-" ,version)))
190 (use-modules (guix build utils))
191
192 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
193 (xz (assoc-ref %build-inputs "xz"))
194 (tar (assoc-ref %build-inputs "tar"))
195 (source (assoc-ref %build-inputs "source"))
196 (out (assoc-ref %outputs "out"))
197 (xsl (string-append out "/xml/xsl")))
198 (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
199 (invoke (string-append tar "/bin/tar") "xvf" source)
200
201 (mkdir-p xsl)
202 (copy-recursively name-version
203 (string-append xsl "/" name-version))
204
205 (substitute* (string-append xsl "/" name-version "/catalog.xml")
206 (("rewritePrefix=\"./")
207 (string-append "rewritePrefix=\"file://" xsl "/"
208 name-version "/")))
209 #t))
210 #:modules ((guix build utils))))
211 (native-inputs `(("bzip2" ,bzip2)
212 ("xz" ,xz) ;needed for repacked tarballs
213 ("tar" ,tar)))
214 (home-page "https://docbook.org")
215 (synopsis "DocBook XSL style sheets for document authoring")
216 (description
217 "This package provides XSL style sheets for DocBook.")
218 (license (x11-style "" "See 'COPYING' file."))))
219
220 (define-public docbook-dsssl
221 (package
222 (name "docbook-dsssl")
223 (version "1.79")
224 (source (origin
225 (method url-fetch)
226 (uri (string-append "mirror://sourceforge/docbook/"
227 name "/" version "/"
228 name "-" version ".tar.bz2"))
229 (sha256
230 (base32
231 "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
232 (build-system trivial-build-system)
233 (outputs '("out" "doc"))
234 (arguments
235 `(#:modules ((guix build utils))
236 #:builder
237 (begin
238 (use-modules (guix build utils))
239 (let ((source (assoc-ref %build-inputs "source"))
240 (dtd (string-append (assoc-ref %outputs "out")
241 "/sgml/dtd/docbook"))
242 (docbook-dsssl-doc (assoc-ref %build-inputs "docbook-dsssl-doc"))
243 (doc (assoc-ref %outputs "doc"))
244 (tar (assoc-ref %build-inputs "tar"))
245 (bzip2 (assoc-ref %build-inputs "bzip2")))
246 (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
247 (mkdir-p dtd)
248 (invoke "tar" "-xf" source "-C" dtd)
249 ;; The doc output contains 1.4 MiB of HTML documentation.
250 (symlink docbook-dsssl-doc doc)))))
251 (inputs
252 `(("docbook-dsssl-doc" ,docbook-dsssl-doc)))
253 (native-inputs
254 `(("bzip2" ,bzip2)
255 ("tar" ,tar)))
256 (home-page "https://docbook.org/")
257 (synopsis "DSSSL style sheets for DocBook")
258 (description "This package provides DSSSL style sheets for DocBook.")
259 (license (non-copyleft "file://README"))))
260
261 ;;; Private variable, used as the 'doc' output of the docbook-dsssl package.
262 (define docbook-dsssl-doc
263 (package
264 (name "docbook-dsssl-doc")
265 (version "1.79")
266 (source (origin
267 (method url-fetch)
268 (uri (string-append "mirror://sourceforge/docbook/"
269 name "/" version "/"
270 name "-" version ".tar.bz2"))
271 (sha256
272 (base32
273 "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
274 (build-system trivial-build-system)
275 (arguments
276 `(#:modules ((guix build utils))
277 #:builder
278 (begin
279 (use-modules (guix build utils))
280 (let ((source (assoc-ref %build-inputs "source"))
281 (docdir (string-append (assoc-ref %outputs "out")
282 "/share/doc/" "docbook-dsssl-" ,version))
283 (tar (assoc-ref %build-inputs "tar"))
284 (bzip2 (assoc-ref %build-inputs "bzip2")))
285 (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
286 (mkdir-p docdir)
287 ;; Extract the "doc" subdirectory.
288 (invoke "tar" "-xf" source "--strip-components=2"
289 "--no-same-owner" "-C" docdir
290 (string-append "docbook-dsssl-" ,version "/doc"))))))
291 (native-inputs
292 `(("bzip2" ,bzip2)
293 ("tar" ,tar)))
294 (home-page "https://docbook.org/")
295 (synopsis "DocBook DSSSL style sheets documentation")
296 (description "Documentation for the DocBook DSSSL style sheets.")
297 (license (non-copyleft "file://doc/LEGALNOTICE.htm"))))
298
299 (define-public docbook-sgml
300 (package
301 (name "docbook-sgml")
302 (version "4.1")
303 (source (origin
304 (method url-fetch)
305 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
306 version "/docbk41.zip"))
307 (sha256
308 (base32
309 "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))
310 (build-system trivial-build-system)
311 (arguments
312 '(#:modules ((guix build utils))
313 #:builder
314 (begin
315 (use-modules (guix build utils))
316 (let ((source (assoc-ref %build-inputs "source"))
317 (iso-entities-dir (string-append
318 (assoc-ref %build-inputs "iso-8879-entities")))
319 (unzip (string-append (assoc-ref %build-inputs "unzip")
320 "/bin/unzip"))
321 (dtd (string-append (assoc-ref %outputs "out")
322 "/sgml/dtd/docbook")))
323 ;; Extract the sources.
324 (mkdir-p dtd)
325 (chdir dtd)
326 (invoke unzip source)
327 ;; Reference the ISO 8879 character entities.
328 ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
329 (substitute* "docbook.cat"
330 (("(.*ISO 8879.*)\"iso-(.*)\\.gml\"" _ head name)
331 (string-append head "\"" iso-entities-dir "/ISO" name "\"")))))))
332 (native-inputs
333 `(("unzip" ,unzip)))
334 (inputs
335 `(("iso-8879-entities" ,iso-8879-entities)))
336 (home-page "https://docbook.org")
337 (synopsis "DocBook SGML style sheets for document authoring")
338 (description "This package provides SGML style sheets for DocBook.")
339 (license (x11-style "" "See file headers."))))
340
341 (define-public docbook-sgml-3.1
342 (package
343 (inherit docbook-sgml)
344 (version "3.1")
345 (source (origin
346 (method url-fetch)
347 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
348 version "/docbk31.zip"))
349 (sha256
350 (base32
351 "0f25ch7bywwhdxb1qa0hl28mgq1blqdap3rxzamm585rf4kis9i0"))))))
352
353 ;;; Private package referenced by docbook-sgml.
354 (define iso-8879-entities
355 (package
356 (name "iso-8879-entities")
357 (version "0.0") ;no proper version
358 (source (origin
359 (method url-fetch)
360 (uri "http://www.oasis-open.org/cover/ISOEnts.zip")
361 (sha256
362 (base32
363 "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
364 (build-system trivial-build-system)
365 (arguments
366 '(#:modules ((guix build utils))
367 #:builder
368 (begin
369 (use-modules (guix build utils))
370 (let ((source (assoc-ref %build-inputs "source"))
371 (unzip (string-append (assoc-ref %build-inputs "unzip")
372 "/bin/unzip"))
373 (out (string-append (assoc-ref %outputs "out"))))
374 (invoke unzip source "-d" out)))))
375 (native-inputs `(("unzip" ,unzip)))
376 (home-page "https://www.oasis-open.org/")
377 (synopsis "ISO 8879 character entities")
378 (description "ISO 8879 character entities that are typically used in
379 the in DocBook SGML DTDs.")
380 (license (x11-style "" "See file headers."))))
381
382 (define-public dblatex
383 (package
384 (name "dblatex")
385 (version "0.3.11")
386 (source (origin
387 (method url-fetch)
388 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
389 "dblatex-" version "/dblatex-"
390 version ".tar.bz2"))
391 (sha256
392 (base32
393 "0rp1bc2lgisigscq1i7zxfd2qdaxxxld6khbcxss4pq7fpi9fzkv"))))
394 (build-system python-build-system)
395 ;; TODO: Add xfig/transfig for fig2dev utility
396 (inputs
397 `(("texlive" ,(texlive-union (list texlive-amsfonts
398 texlive-latex-anysize
399 texlive-latex-appendix
400 texlive-latex-changebar
401 texlive-latex-colortbl
402 texlive-latex-eepic
403 texlive-latex-eso-pic
404 texlive-latex-fancybox
405 texlive-latex-fancyhdr
406 texlive-latex-fancyvrb
407 texlive-latex-float
408 texlive-latex-footmisc
409 texlive-latex-hyperref
410 texlive-latex-jknapltx
411 texlive-latex-listings
412 texlive-latex-multirow
413 texlive-latex-oberdiek
414 texlive-latex-overpic
415 texlive-latex-pdfpages
416 texlive-latex-subfigure
417 texlive-latex-titlesec
418 texlive-latex-url
419 texlive-latex-wasysym
420
421 texlive-fonts-ec
422 texlive-fonts-rsfs
423 texlive-fonts-stmaryrd
424
425 texlive-generic-ifxetex)))
426 ("imagemagick" ,imagemagick) ;for convert
427 ("inkscape" ,inkscape) ;for svg conversion
428 ("docbook" ,docbook-xml)
429 ("libxslt" ,libxslt))) ;for xsltproc
430 (arguments
431 `(#:python ,python-2 ;'print' syntax
432 ;; Using setuptools causes an invalid "package_base" path in
433 ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
434 ;; by dblatex's setup.py stripping the root path when creating the
435 ;; script. (dblatex's setup.py still uses distutils and thus has to
436 ;; create the script by itself. The feature for creating scripts is one
437 ;; of setuptools' features.)
438 ;; See this thread for details:
439 ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
440 #:use-setuptools? #f
441 #:tests? #f ;no 'test' command
442 #:phases
443 (modify-phases %standard-phases
444 (add-after 'wrap 'set-path
445 (lambda* (#:key inputs outputs #:allow-other-keys)
446 (let ((out (assoc-ref outputs "out")))
447 ;; dblatex executes helper programs at runtime.
448 (wrap-program (string-append out "/bin/dblatex")
449 `("PATH" ":" prefix
450 ,(map (lambda (input)
451 (string-append (assoc-ref inputs input)
452 "/bin"))
453 '("libxslt" "texlive"
454 "imagemagick" "inkscape"))))
455 #t))))))
456 (home-page "http://dblatex.sourceforge.net")
457 (synopsis "DocBook to LaTeX Publishing")
458 (description
459 "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
460 to DVI, PostScript or PDF by translating them in pure LaTeX as a first
461 process. MathML 2.0 markups are supported too. It started as a clone of
462 DB2LaTeX.")
463 ;; lib/contrib/which is under an X11 license
464 (license gpl2+)))
465
466 ;; This is a variant of the 'dblatex' package that is not updated often. It
467 ;; is intended to be used as a native-input at build-time only, e.g. by
468 ;; 'gtk-doc' for generating package documentation. This allows the main
469 ;; 'dblatex' and 'imagemagick' packages to be freely updated on the 'master'
470 ;; branch without triggering an excessive number of rebuilds.
471 (define-public dblatex/stable
472 (hidden-package
473 (package/inherit dblatex
474 (inputs (alist-replace "imagemagick" `(,imagemagick/stable)
475 (package-inputs dblatex))))))