gnu: deutex: Update to 5.2.1.
[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 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
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.
13 ;;;
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.
18 ;;;
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/>.
21
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))
36
37 (define-public docbook-xml
38 (package
39 (name "docbook-xml")
40 (version "4.5")
41 (source (origin
42 (method url-fetch)
43 (uri (string-append "http://www.docbook.org/xml/" version
44 "/docbook-xml-" version ".zip"))
45 (sha256
46 (base32
47 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
48 (build-system trivial-build-system)
49 (arguments
50 '(#:builder (begin
51 (use-modules (guix build utils))
52
53 (let* ((unzip
54 (string-append (assoc-ref %build-inputs "unzip")
55 "/bin/unzip"))
56 (source (assoc-ref %build-inputs "source"))
57 (out (assoc-ref %outputs "out"))
58 (dtd (string-append out "/xml/dtd/docbook")))
59 (mkdir-p dtd)
60 (with-directory-excursion dtd
61 (invoke unzip source))
62 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
63 (("uri=\"")
64 (string-append
65 "uri=\"file://" dtd "/")))
66 #t))
67 #:modules ((guix build utils))))
68 (native-inputs `(("unzip" ,unzip)))
69 (home-page "http://docbook.org")
70 (synopsis "DocBook XML DTDs for document authoring")
71 (description
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."))))
76
77 (define-public docbook-xml-4.4
78 (package (inherit docbook-xml)
79 (version "4.4")
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "http://www.docbook.org/xml/" version
83 "/docbook-xml-" version ".zip"))
84 (sha256
85 (base32
86 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
87
88 (define-public docbook-xml-4.3
89 (package (inherit docbook-xml)
90 (version "4.3")
91 (source (origin
92 (method url-fetch)
93 (uri (string-append "http://www.docbook.org/xml/" version
94 "/docbook-xml-" version ".zip"))
95 (sha256
96 (base32
97 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
98
99 (define-public docbook-xml-4.2
100 (package (inherit docbook-xml)
101 (version "4.2")
102 (source (origin
103 (method url-fetch)
104 (uri (string-append "http://www.docbook.org/xml/" version
105 "/docbook-xml-" version ".zip"))
106 (sha256
107 (base32
108 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
109
110 (define-public docbook-xml-4.1.2
111 (package (inherit docbook-xml)
112 (version "4.1.2")
113 (source (origin
114 (method url-fetch)
115 (uri (string-append "http://www.docbook.org/xml/" version
116 "/docbkx412.zip"))
117 (sha256
118 (base32
119 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
120 (arguments
121 '(#:modules ((guix build utils))
122 #:builder
123 (begin
124 (use-modules (guix build utils))
125 (let ((source (assoc-ref %build-inputs "source"))
126 (unzip (string-append (assoc-ref %build-inputs "unzip")
127 "/bin/unzip"))
128 (dtd (string-append (assoc-ref %outputs "out")
129 "/xml/dtd/docbook")))
130 (mkdir-p dtd)
131 (invoke unzip source "-d" dtd)))))))
132
133 (define-public docbook-xsl
134 (package
135 (name "docbook-xsl")
136 (version "1.79.1")
137 (source (origin
138 (method url-fetch)
139 (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
140 version "/docbook-xsl-" version ".tar.bz2"))
141 (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
142 (sha256
143 (base32
144 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))
145 (modules '((guix build utils)))
146 (snippet
147 '(begin
148 (for-each delete-file (find-files "." "\\.jar$"))
149 #t))))
150 (build-system trivial-build-system)
151 (arguments
152 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
153 (use-modules (guix build utils))
154
155 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
156 (xz (assoc-ref %build-inputs "xz"))
157 (tar (assoc-ref %build-inputs "tar"))
158 (source (assoc-ref %build-inputs "source"))
159 (out (assoc-ref %outputs "out"))
160 (xsl (string-append out "/xml/xsl")))
161 (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
162 (invoke (string-append tar "/bin/tar") "xvf" source)
163
164 (mkdir-p xsl)
165 (copy-recursively name-version
166 (string-append xsl "/" name-version))
167
168 (substitute* (string-append xsl "/" name-version "/catalog.xml")
169 (("rewritePrefix=\"./")
170 (string-append "rewritePrefix=\"file://" xsl "/"
171 name-version "/")))
172 #t))
173 #:modules ((guix build utils))))
174 (native-inputs `(("bzip2" ,bzip2)
175 ("xz" ,xz) ;needed for repacked tarballs
176 ("tar" ,tar)))
177 (home-page "http://docbook.org")
178 (synopsis "DocBook XSL style sheets for document authoring")
179 (description
180 "This package provides XSL style sheets for DocBook.")
181 (license (x11-style "" "See 'COPYING' file."))))
182
183 (define-public dblatex
184 (package
185 (name "dblatex")
186 (version "0.3.10")
187 (source (origin
188 (method url-fetch)
189 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
190 "dblatex-" version "/dblatex-"
191 version ".tar.bz2"))
192 (sha256
193 (base32
194 "1yicd861rqz78i2khl35j7nvc0ccv4jx4hzqrbhll17082vrdmkg"))))
195 (build-system python-build-system)
196 ;; TODO: Add xfig/transfig for fig2dev utility
197 (inputs
198 `(("texlive" ,(texlive-union (list texlive-amsfonts
199 texlive-latex-anysize
200 texlive-latex-appendix
201 texlive-latex-changebar
202 texlive-latex-colortbl
203 texlive-latex-eepic
204 texlive-latex-eso-pic
205 texlive-latex-fancybox
206 texlive-latex-fancyhdr
207 texlive-latex-fancyvrb
208 texlive-latex-float
209 texlive-latex-footmisc
210 texlive-latex-hyperref
211 texlive-latex-jknapltx
212 texlive-latex-listings
213 texlive-latex-multirow
214 texlive-latex-oberdiek
215 texlive-latex-overpic
216 texlive-latex-pdfpages
217 texlive-latex-subfigure
218 texlive-latex-titlesec
219 texlive-latex-url
220 texlive-latex-wasysym
221
222 texlive-fonts-ec
223 texlive-fonts-rsfs
224 texlive-fonts-stmaryrd
225
226 texlive-generic-ifxetex)))
227 ("imagemagick" ,imagemagick) ;for convert
228 ("inkscape" ,inkscape) ;for svg conversion
229 ("docbook" ,docbook-xml)
230 ("libxslt" ,libxslt))) ;for xsltproc
231 (arguments
232 `(#:python ,python-2 ;'print' syntax
233 ;; Using setuptools causes an invalid "package_base" path in
234 ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
235 ;; by dblatex's setup.py stripping the root path when creating the
236 ;; script. (dblatex's setup.py still uses distutils and thus has to
237 ;; create the script by itself. The feature for creating scripts is one
238 ;; of setuptools' features.)
239 ;; See this thread for details:
240 ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
241 #:use-setuptools? #f
242 #:tests? #f ;no 'test' command
243 #:phases
244 (modify-phases %standard-phases
245 (add-after 'wrap 'set-path
246 (lambda* (#:key inputs outputs #:allow-other-keys)
247 (let ((out (assoc-ref outputs "out")))
248 ;; dblatex executes helper programs at runtime.
249 (wrap-program (string-append out "/bin/dblatex")
250 `("PATH" ":" prefix
251 ,(map (lambda (input)
252 (string-append (assoc-ref inputs input)
253 "/bin"))
254 '("libxslt" "texlive"
255 "imagemagick" "inkscape"))))
256 #t))))))
257 (home-page "http://dblatex.sourceforge.net")
258 (synopsis "DocBook to LaTeX Publishing")
259 (description
260 "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
261 to DVI, PostScript or PDF by translating them in pure LaTeX as a first
262 process. MathML 2.0 markups are supported too. It started as a clone of
263 DB2LaTeX.")
264 ;; lib/contrib/which is under an X11 license
265 (license gpl2+)))