Merge branch 'master' into core-updates
[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 ;; Note: If removing all patches, the XZ dependency is no longer needed.
142 (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
143 (sha256
144 (base32
145 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))))
146 (build-system trivial-build-system)
147 (arguments
148 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
149 (use-modules (guix build utils))
150
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)
159
160 (mkdir-p xsl)
161 (copy-recursively name-version
162 (string-append xsl "/" name-version))
163
164 (substitute* (string-append xsl "/" name-version "/catalog.xml")
165 (("rewritePrefix=\"./")
166 (string-append "rewritePrefix=\"file://" xsl "/"
167 name-version "/")))
168 #t))
169 #:modules ((guix build utils))))
170 (native-inputs `(("bzip2" ,bzip2)
171 ("xz" ,xz)
172 ("tar" ,tar)))
173 (home-page "http://docbook.org")
174 (synopsis "DocBook XSL style sheets for document authoring")
175 (description
176 "This package provides XSL style sheets for DocBook.")
177 (license (x11-style "" "See 'COPYING' file."))))
178
179 (define-public dblatex
180 (package
181 (name "dblatex")
182 (version "0.3.10")
183 (source (origin
184 (method url-fetch)
185 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
186 "dblatex-" version "/dblatex-"
187 version ".tar.bz2"))
188 (sha256
189 (base32
190 "1yicd861rqz78i2khl35j7nvc0ccv4jx4hzqrbhll17082vrdmkg"))))
191 (build-system python-build-system)
192 ;; TODO: Add xfig/transfig for fig2dev utility
193 (inputs
194 `(("texlive" ,(texlive-union (list texlive-latex-amsfonts
195 texlive-latex-anysize
196 texlive-latex-appendix
197 texlive-latex-changebar
198 texlive-latex-colortbl
199 texlive-latex-eepic
200 texlive-latex-eso-pic
201 texlive-latex-fancybox
202 texlive-latex-fancyhdr
203 texlive-latex-fancyvrb
204 texlive-latex-float
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
215 texlive-latex-url
216 texlive-latex-wasysym
217
218 texlive-fonts-amsfonts
219 texlive-fonts-ec
220 texlive-fonts-rsfs
221 texlive-fonts-stmaryrd
222
223 texlive-generic-ifxetex)))
224 ("imagemagick" ,imagemagick) ;for convert
225 ("inkscape" ,inkscape) ;for svg conversion
226 ("docbook" ,docbook-xml)
227 ("libxslt" ,libxslt))) ;for xsltproc
228 (arguments
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
238 #:use-setuptools? #f
239 #:tests? #f ;no 'test' command
240 #:phases
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")
247 `("PATH" ":" prefix
248 ,(map (lambda (input)
249 (string-append (assoc-ref inputs input)
250 "/bin"))
251 '("libxslt" "texlive"
252 "imagemagick" "inkscape"))))
253 #t))))))
254 (home-page "http://dblatex.sourceforge.net")
255 (synopsis "DocBook to LaTeX Publishing")
256 (description
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
260 DB2LaTeX.")
261 ;; lib/contrib/which is under an X11 license
262 (license gpl2+)))