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>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages docbook)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages compression)
25 #:use-module (gnu packages imagemagick)
26 #:use-module (gnu packages inkscape)
27 #:use-module (gnu packages tex)
28 #:use-module (gnu packages python)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages xml)
31 #:use-module (guix licenses)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system trivial)
35 #:use-module (guix build-system python))
37 (define-public docbook-xml
43 (uri (string-append "http://www.docbook.org/xml/" version
44 "/docbook-xml-" version ".zip"))
47 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
48 (build-system trivial-build-system)
51 (use-modules (guix build utils))
54 (string-append (assoc-ref %build-inputs "unzip")
56 (source (assoc-ref %build-inputs "source"))
57 (out (assoc-ref %outputs "out"))
58 (dtd (string-append out "/xml/dtd/docbook")))
60 (with-directory-excursion dtd
61 (invoke unzip source))
62 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
65 "uri=\"file://" dtd "/")))
67 #:modules ((guix build utils))))
68 (native-inputs `(("unzip" ,unzip)))
69 (home-page "http://docbook.org")
70 (synopsis "DocBook XML DTDs for document authoring")
72 "DocBook is general purpose XML and SGML document type particularly well
73 suited to books and papers about computer hardware and software (though it is
74 by no means limited to these applications.) This package provides XML DTDs.")
75 (license (x11-style "" "See file headers."))))
77 (define-public docbook-xml-4.4
78 (package (inherit docbook-xml)
82 (uri (string-append "http://www.docbook.org/xml/" version
83 "/docbook-xml-" version ".zip"))
86 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
88 (define-public docbook-xml-4.3
89 (package (inherit docbook-xml)
93 (uri (string-append "http://www.docbook.org/xml/" version
94 "/docbook-xml-" version ".zip"))
97 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
99 (define-public docbook-xml-4.2
100 (package (inherit docbook-xml)
104 (uri (string-append "http://www.docbook.org/xml/" version
105 "/docbook-xml-" version ".zip"))
108 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
110 (define-public docbook-xml-4.1.2
111 (package (inherit docbook-xml)
115 (uri (string-append "http://www.docbook.org/xml/" version
119 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
121 '(#:modules ((guix build utils))
124 (use-modules (guix build utils))
125 (let ((source (assoc-ref %build-inputs "source"))
126 (unzip (string-append (assoc-ref %build-inputs "unzip")
128 (dtd (string-append (assoc-ref %outputs "out")
129 "/xml/dtd/docbook")))
131 (invoke unzip source "-d" dtd)))))))
133 (define-public docbook-xsl
139 (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
140 version "/docbook-xsl-" version ".tar.bz2"))
141 ;; Note: If removing all patches, the XZ dependency is no longer needed.
142 (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
145 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))))
146 (build-system trivial-build-system)
148 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
149 (use-modules (guix build utils))
151 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
152 (xz (assoc-ref %build-inputs "xz"))
153 (tar (assoc-ref %build-inputs "tar"))
154 (source (assoc-ref %build-inputs "source"))
155 (out (assoc-ref %outputs "out"))
156 (xsl (string-append out "/xml/xsl")))
157 (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
158 (invoke (string-append tar "/bin/tar") "xvf" source)
161 (copy-recursively name-version
162 (string-append xsl "/" name-version))
164 (substitute* (string-append xsl "/" name-version "/catalog.xml")
165 (("rewritePrefix=\"./")
166 (string-append "rewritePrefix=\"file://" xsl "/"
169 #:modules ((guix build utils))))
170 (native-inputs `(("bzip2" ,bzip2)
173 (home-page "http://docbook.org")
174 (synopsis "DocBook XSL style sheets for document authoring")
176 "This package provides XSL style sheets for DocBook.")
177 (license (x11-style "" "See 'COPYING' file."))))
179 (define-public dblatex
185 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
186 "dblatex-" version "/dblatex-"
190 "1yicd861rqz78i2khl35j7nvc0ccv4jx4hzqrbhll17082vrdmkg"))))
191 (build-system python-build-system)
192 ;; TODO: Add xfig/transfig for fig2dev utility
194 `(("texlive" ,(texlive-union (list texlive-latex-amsfonts
195 texlive-latex-anysize
196 texlive-latex-appendix
197 texlive-latex-changebar
198 texlive-latex-colortbl
200 texlive-latex-eso-pic
201 texlive-latex-fancybox
202 texlive-latex-fancyhdr
203 texlive-latex-fancyvrb
205 texlive-latex-footmisc
206 texlive-latex-hyperref
207 texlive-latex-jknapltx
208 texlive-latex-listings
209 texlive-latex-multirow
210 texlive-latex-oberdiek
211 texlive-latex-overpic
212 texlive-latex-pdfpages
213 texlive-latex-subfigure
214 texlive-latex-titlesec
216 texlive-latex-wasysym
218 texlive-fonts-amsfonts
221 texlive-fonts-stmaryrd
223 texlive-generic-ifxetex)))
224 ("imagemagick" ,imagemagick) ;for convert
225 ("inkscape" ,inkscape) ;for svg conversion
226 ("docbook" ,docbook-xml)
227 ("libxslt" ,libxslt))) ;for xsltproc
229 `(#:python ,python-2 ;'print' syntax
230 ;; Using setuptools causes an invalid "package_base" path in
231 ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
232 ;; by dblatex's setup.py stripping the root path when creating the
233 ;; script. (dblatex's setup.py still uses distutils and thus has to
234 ;; create the script by itself. The feature for creating scripts is one
235 ;; of setuptools' features.)
236 ;; See this thread for details:
237 ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
239 #:tests? #f ;no 'test' command
241 (modify-phases %standard-phases
242 (add-after 'wrap 'set-path
243 (lambda* (#:key inputs outputs #:allow-other-keys)
244 (let ((out (assoc-ref outputs "out")))
245 ;; dblatex executes helper programs at runtime.
246 (wrap-program (string-append out "/bin/dblatex")
248 ,(map (lambda (input)
249 (string-append (assoc-ref inputs input)
251 '("libxslt" "texlive"
252 "imagemagick" "inkscape"))))
254 (home-page "http://dblatex.sourceforge.net")
255 (synopsis "DocBook to LaTeX Publishing")
257 "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
258 to DVI, PostScript or PDF by translating them in pure LaTeX as a first
259 process. MathML 2.0 markups are supported too. It started as a clone of
261 ;; lib/contrib/which is under an X11 license