gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[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 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages docbook)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages compression)
26 #:use-module (gnu packages imagemagick)
27 #:use-module (gnu packages inkscape)
28 #:use-module (gnu packages tex)
29 #:use-module (gnu packages python)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages xml)
32 #:use-module (guix licenses)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix build-system trivial)
36 #:use-module (guix build-system python))
37
38 (define-public docbook-xml-5
39 (package
40 (name "docbook-xml")
41 (version "5.0.1")
42 (source (origin
43 (method url-fetch)
44 (uri (string-append "https://www.docbook.org/xml/" version
45 "/docbook-" version ".zip"))
46 (sha256
47 (base32
48 "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
49 (build-system trivial-build-system)
50 (arguments
51 `(#:modules ((guix build utils))
52 #:builder
53 (begin
54 (use-modules (guix build utils))
55 (let* ((unzip
56 (string-append (assoc-ref %build-inputs "unzip")
57 "/bin/unzip"))
58 (source (assoc-ref %build-inputs "source"))
59 (out (assoc-ref %outputs "out"))
60 (dtd (string-append out "/xml/dtd/docbook")))
61 (invoke unzip source)
62 (mkdir-p dtd)
63 (copy-recursively (string-append "docbook-" ,version) dtd)
64 (with-directory-excursion dtd
65 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
66 (("uri=\"")
67 (string-append
68 "uri=\"file://" dtd "/")))
69 #t)))))
70 (native-inputs `(("unzip" ,unzip)))
71 (home-page "https://docbook.org")
72 (synopsis "DocBook XML DTDs for document authoring")
73 (description
74 "DocBook is general purpose XML and SGML document type particularly well
75 suited to books and papers about computer hardware and software (though it is
76 by no means limited to these applications.) This package provides XML DTDs.")
77 (license (x11-style "" "See file headers."))))
78
79 (define-public docbook-xml
80 (package
81 (inherit docbook-xml-5)
82 (name "docbook-xml")
83 (version "4.5")
84 (source (origin
85 (method url-fetch)
86 (uri (string-append "https://www.docbook.org/xml/" version
87 "/docbook-xml-" version ".zip"))
88 (sha256
89 (base32
90 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
91 (arguments
92 '(#:builder (begin
93 (use-modules (guix build utils))
94
95 (let* ((unzip
96 (string-append (assoc-ref %build-inputs "unzip")
97 "/bin/unzip"))
98 (source (assoc-ref %build-inputs "source"))
99 (out (assoc-ref %outputs "out"))
100 (dtd (string-append out "/xml/dtd/docbook")))
101 (mkdir-p dtd)
102 (with-directory-excursion dtd
103 (invoke unzip source))
104 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
105 (("uri=\"")
106 (string-append
107 "uri=\"file://" dtd "/")))
108 #t))
109 #:modules ((guix build utils))))))
110
111 (define-public docbook-xml-4.4
112 (package (inherit docbook-xml)
113 (version "4.4")
114 (source (origin
115 (method url-fetch)
116 (uri (string-append "https://www.docbook.org/xml/" version
117 "/docbook-xml-" version ".zip"))
118 (sha256
119 (base32
120 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
121
122 (define-public docbook-xml-4.3
123 (package (inherit docbook-xml)
124 (version "4.3")
125 (source (origin
126 (method url-fetch)
127 (uri (string-append "https://www.docbook.org/xml/" version
128 "/docbook-xml-" version ".zip"))
129 (sha256
130 (base32
131 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
132
133 (define-public docbook-xml-4.2
134 (package (inherit docbook-xml)
135 (version "4.2")
136 (source (origin
137 (method url-fetch)
138 (uri (string-append "https://www.docbook.org/xml/" version
139 "/docbook-xml-" version ".zip"))
140 (sha256
141 (base32
142 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
143
144 (define-public docbook-xml-4.1.2
145 (package (inherit docbook-xml)
146 (version "4.1.2")
147 (source (origin
148 (method url-fetch)
149 (uri (string-append "https://www.docbook.org/xml/" version
150 "/docbkx412.zip"))
151 (sha256
152 (base32
153 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
154 (arguments
155 '(#:modules ((guix build utils))
156 #:builder
157 (begin
158 (use-modules (guix build utils))
159 (let ((source (assoc-ref %build-inputs "source"))
160 (unzip (string-append (assoc-ref %build-inputs "unzip")
161 "/bin/unzip"))
162 (dtd (string-append (assoc-ref %outputs "out")
163 "/xml/dtd/docbook")))
164 (mkdir-p dtd)
165 (invoke unzip source "-d" dtd)))))))
166
167 (define-public docbook-xsl
168 (package
169 (name "docbook-xsl")
170 (version "1.79.1")
171 (source (origin
172 (method url-fetch)
173 (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
174 version "/docbook-xsl-" version ".tar.bz2"))
175 (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
176 (sha256
177 (base32
178 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))
179 (modules '((guix build utils)))
180 (snippet
181 '(begin
182 (for-each delete-file (find-files "." "\\.jar$"))
183 #t))))
184 (build-system trivial-build-system)
185 (arguments
186 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
187 (use-modules (guix build utils))
188
189 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
190 (xz (assoc-ref %build-inputs "xz"))
191 (tar (assoc-ref %build-inputs "tar"))
192 (source (assoc-ref %build-inputs "source"))
193 (out (assoc-ref %outputs "out"))
194 (xsl (string-append out "/xml/xsl")))
195 (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
196 (invoke (string-append tar "/bin/tar") "xvf" source)
197
198 (mkdir-p xsl)
199 (copy-recursively name-version
200 (string-append xsl "/" name-version))
201
202 (substitute* (string-append xsl "/" name-version "/catalog.xml")
203 (("rewritePrefix=\"./")
204 (string-append "rewritePrefix=\"file://" xsl "/"
205 name-version "/")))
206 #t))
207 #:modules ((guix build utils))))
208 (native-inputs `(("bzip2" ,bzip2)
209 ("xz" ,xz) ;needed for repacked tarballs
210 ("tar" ,tar)))
211 (home-page "https://docbook.org")
212 (synopsis "DocBook XSL style sheets for document authoring")
213 (description
214 "This package provides XSL style sheets for DocBook.")
215 (license (x11-style "" "See 'COPYING' file."))))
216
217 (define-public dblatex
218 (package
219 (name "dblatex")
220 (version "0.3.11")
221 (source (origin
222 (method url-fetch)
223 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
224 "dblatex-" version "/dblatex-"
225 version ".tar.bz2"))
226 (sha256
227 (base32
228 "0rp1bc2lgisigscq1i7zxfd2qdaxxxld6khbcxss4pq7fpi9fzkv"))))
229 (build-system python-build-system)
230 ;; TODO: Add xfig/transfig for fig2dev utility
231 (inputs
232 `(("texlive" ,(texlive-union (list texlive-amsfonts
233 texlive-latex-anysize
234 texlive-latex-appendix
235 texlive-latex-changebar
236 texlive-latex-colortbl
237 texlive-latex-eepic
238 texlive-latex-eso-pic
239 texlive-latex-fancybox
240 texlive-latex-fancyhdr
241 texlive-latex-fancyvrb
242 texlive-latex-float
243 texlive-latex-footmisc
244 texlive-latex-hyperref
245 texlive-latex-jknapltx
246 texlive-latex-listings
247 texlive-latex-multirow
248 texlive-latex-oberdiek
249 texlive-latex-overpic
250 texlive-latex-pdfpages
251 texlive-latex-subfigure
252 texlive-latex-titlesec
253 texlive-latex-url
254 texlive-latex-wasysym
255
256 texlive-fonts-ec
257 texlive-fonts-rsfs
258 texlive-fonts-stmaryrd
259
260 texlive-generic-ifxetex)))
261 ("imagemagick" ,imagemagick) ;for convert
262 ("inkscape" ,inkscape) ;for svg conversion
263 ("docbook" ,docbook-xml)
264 ("libxslt" ,libxslt))) ;for xsltproc
265 (arguments
266 `(#:python ,python-2 ;'print' syntax
267 ;; Using setuptools causes an invalid "package_base" path in
268 ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
269 ;; by dblatex's setup.py stripping the root path when creating the
270 ;; script. (dblatex's setup.py still uses distutils and thus has to
271 ;; create the script by itself. The feature for creating scripts is one
272 ;; of setuptools' features.)
273 ;; See this thread for details:
274 ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
275 #:use-setuptools? #f
276 #:tests? #f ;no 'test' command
277 #:phases
278 (modify-phases %standard-phases
279 (add-after 'wrap 'set-path
280 (lambda* (#:key inputs outputs #:allow-other-keys)
281 (let ((out (assoc-ref outputs "out")))
282 ;; dblatex executes helper programs at runtime.
283 (wrap-program (string-append out "/bin/dblatex")
284 `("PATH" ":" prefix
285 ,(map (lambda (input)
286 (string-append (assoc-ref inputs input)
287 "/bin"))
288 '("libxslt" "texlive"
289 "imagemagick" "inkscape"))))
290 #t))))))
291 (home-page "http://dblatex.sourceforge.net")
292 (synopsis "DocBook to LaTeX Publishing")
293 (description
294 "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
295 to DVI, PostScript or PDF by translating them in pure LaTeX as a first
296 process. MathML 2.0 markups are supported too. It started as a clone of
297 DB2LaTeX.")
298 ;; lib/contrib/which is under an X11 license
299 (license gpl2+)))