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