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>
10 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
41 (define-public docbook-xml-5
47 (uri (string-append "https://docbook.org/xml/" version
48 "/docbook-" version ".zip"))
51 "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
52 (build-system trivial-build-system)
54 `(#:modules ((guix build utils))
57 (use-modules (guix build utils))
59 (string-append (assoc-ref %build-inputs "unzip")
61 (source (assoc-ref %build-inputs "source"))
62 (out (assoc-ref %outputs "out"))
63 (dtd (string-append out "/xml/dtd/docbook")))
66 (copy-recursively (string-append "docbook-" ,version) dtd)
67 (with-directory-excursion dtd
68 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
71 "uri=\"file://" dtd "/")))
73 (native-inputs `(("unzip" ,unzip)))
74 (home-page "https://docbook.org")
75 (synopsis "DocBook XML DTDs for document authoring")
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."))))
82 (define-public docbook-xml
84 (inherit docbook-xml-5)
89 (uri (string-append "https://docbook.org/xml/" version
90 "/docbook-xml-" version ".zip"))
93 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
96 (use-modules (guix build utils))
99 (string-append (assoc-ref %build-inputs "unzip")
101 (source (assoc-ref %build-inputs "source"))
102 (out (assoc-ref %outputs "out"))
103 (dtd (string-append out "/xml/dtd/docbook")))
105 (with-directory-excursion dtd
106 (invoke unzip source))
107 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
110 "uri=\"file://" dtd "/")))
112 #:modules ((guix build utils))))))
114 (define-public docbook-xml-4.4
115 (package (inherit docbook-xml)
119 (uri (string-append "https://docbook.org/xml/" version
120 "/docbook-xml-" version ".zip"))
123 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
125 (define-public docbook-xml-4.3
126 (package (inherit docbook-xml)
130 (uri (string-append "https://docbook.org/xml/" version
131 "/docbook-xml-" version ".zip"))
134 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
136 (define-public docbook-xml-4.2
137 (package (inherit docbook-xml)
141 (uri (string-append "https://docbook.org/xml/" version
142 "/docbook-xml-" version ".zip"))
145 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
147 (define-public docbook-xml-4.1.2
148 (package (inherit docbook-xml)
152 (uri (string-append "https://docbook.org/xml/" version
156 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
158 '(#:modules ((guix build utils))
161 (use-modules (guix build utils))
162 (let ((source (assoc-ref %build-inputs "source"))
163 (unzip (string-append (assoc-ref %build-inputs "unzip")
165 (dtd (string-append (assoc-ref %outputs "out")
166 "/xml/dtd/docbook")))
168 (invoke unzip source "-d" dtd)))))))
170 (define-public docbook-xsl
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"))
181 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))
182 (modules '((guix build utils)))
185 (for-each delete-file (find-files "." "\\.jar$"))
187 (build-system trivial-build-system)
189 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
190 (use-modules (guix build utils))
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)
202 (copy-recursively name-version
203 (string-append xsl "/" name-version))
205 (substitute* (string-append xsl "/" name-version "/catalog.xml")
206 (("rewritePrefix=\"./")
207 (string-append "rewritePrefix=\"file://" xsl "/"
210 #:modules ((guix build utils))))
211 (native-inputs `(("bzip2" ,bzip2)
212 ("xz" ,xz) ;needed for repacked tarballs
214 (home-page "https://docbook.org")
215 (synopsis "DocBook XSL style sheets for document authoring")
217 "This package provides XSL style sheets for DocBook.")
218 (license (x11-style "" "See 'COPYING' file."))))
220 (define-public docbook-dsssl
222 (name "docbook-dsssl")
226 (uri (string-append "mirror://sourceforge/docbook/"
228 name "-" version ".tar.bz2"))
231 "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
232 (build-system trivial-build-system)
233 (outputs '("out" "doc"))
235 `(#:modules ((guix build utils))
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"))
248 (invoke "tar" "-xf" source "-C" dtd)
249 ;; The doc output contains 1.4 MiB of HTML documentation.
250 (symlink docbook-dsssl-doc doc)))))
252 `(("docbook-dsssl-doc" ,docbook-dsssl-doc)))
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"))))
261 ;;; Private variable, used as the 'doc' output of the docbook-dsssl package.
262 (define docbook-dsssl-doc
264 (name "docbook-dsssl-doc")
268 (uri (string-append "mirror://sourceforge/docbook/"
270 name "-" version ".tar.bz2"))
273 "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
274 (build-system trivial-build-system)
276 `(#:modules ((guix build utils))
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"))
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"))))))
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"))))
299 (define-public docbook-sgml
301 (name "docbook-sgml")
305 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
306 version "/docbk41.zip"))
309 "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))
310 (build-system trivial-build-system)
312 '(#:modules ((guix build utils))
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")
321 (dtd (string-append (assoc-ref %outputs "out")
322 "/sgml/dtd/docbook")))
323 ;; Extract the sources.
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 "\"")))))))
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."))))
341 (define-public docbook-sgml-3.1
343 (inherit docbook-sgml)
347 (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
348 version "/docbk31.zip"))
351 "0f25ch7bywwhdxb1qa0hl28mgq1blqdap3rxzamm585rf4kis9i0"))))))
353 ;;; Private package referenced by docbook-sgml.
354 (define iso-8879-entities
356 (name "iso-8879-entities")
357 (version "0.0") ;no proper version
360 (uri "http://www.oasis-open.org/cover/ISOEnts.zip")
363 "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
364 (build-system trivial-build-system)
366 '(#:modules ((guix build utils))
369 (use-modules (guix build utils))
370 (let ((source (assoc-ref %build-inputs "source"))
371 (unzip (string-append (assoc-ref %build-inputs "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."))))
382 (define-public dblatex
388 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
389 "dblatex-" version "/dblatex-"
393 "0rp1bc2lgisigscq1i7zxfd2qdaxxxld6khbcxss4pq7fpi9fzkv"))))
394 (build-system python-build-system)
395 ;; TODO: Add xfig/transfig for fig2dev utility
397 `(("texlive" ,(texlive-union (list texlive-amsfonts/patched
398 texlive-latex-anysize
399 texlive-latex-appendix
400 texlive-latex-changebar
401 texlive-latex-colortbl
403 texlive-latex-eso-pic
404 texlive-latex-fancybox
405 texlive-latex-fancyhdr
406 texlive-latex-fancyvrb
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
419 texlive-latex-wasysym
423 texlive-fonts-stmaryrd
425 texlive-generic-ifxetex)))
426 ("imagemagick" ,imagemagick) ;for convert
427 ("inkscape" ,inkscape) ;for svg conversion
428 ("docbook" ,docbook-xml)
429 ("libxslt" ,libxslt))) ;for xsltproc
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
441 #:tests? #f ;no 'test' command
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")
450 ,(map (lambda (input)
451 (string-append (assoc-ref inputs input)
453 '("libxslt" "texlive"
454 "imagemagick" "inkscape"))))
456 (home-page "http://dblatex.sourceforge.net")
457 (synopsis "DocBook to LaTeX Publishing")
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
463 ;; lib/contrib/which is under an X11 license
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
473 (package/inherit dblatex
474 (inputs (alist-replace "imagemagick" `(,imagemagick/stable)
475 (package-inputs dblatex))))))