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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
38 (define-public docbook-xml-5
44 (uri (string-append "https://www.docbook.org/xml/" version
45 "/docbook-" version ".zip"))
48 "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
49 (build-system trivial-build-system)
51 `(#:modules ((guix build utils))
54 (use-modules (guix build utils))
56 (string-append (assoc-ref %build-inputs "unzip")
58 (source (assoc-ref %build-inputs "source"))
59 (out (assoc-ref %outputs "out"))
60 (dtd (string-append out "/xml/dtd/docbook")))
63 (copy-recursively (string-append "docbook-" ,version) dtd)
64 (with-directory-excursion dtd
65 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
68 "uri=\"file://" dtd "/")))
70 (native-inputs `(("unzip" ,unzip)))
71 (home-page "https://docbook.org")
72 (synopsis "DocBook XML DTDs for document authoring")
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."))))
79 (define-public docbook-xml
81 (inherit docbook-xml-5)
86 (uri (string-append "https://www.docbook.org/xml/" version
87 "/docbook-xml-" version ".zip"))
90 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
93 (use-modules (guix build utils))
96 (string-append (assoc-ref %build-inputs "unzip")
98 (source (assoc-ref %build-inputs "source"))
99 (out (assoc-ref %outputs "out"))
100 (dtd (string-append out "/xml/dtd/docbook")))
102 (with-directory-excursion dtd
103 (invoke unzip source))
104 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
107 "uri=\"file://" dtd "/")))
109 #:modules ((guix build utils))))))
111 (define-public docbook-xml-4.4
112 (package (inherit docbook-xml)
116 (uri (string-append "https://www.docbook.org/xml/" version
117 "/docbook-xml-" version ".zip"))
120 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
122 (define-public docbook-xml-4.3
123 (package (inherit docbook-xml)
127 (uri (string-append "https://www.docbook.org/xml/" version
128 "/docbook-xml-" version ".zip"))
131 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
133 (define-public docbook-xml-4.2
134 (package (inherit docbook-xml)
138 (uri (string-append "https://www.docbook.org/xml/" version
139 "/docbook-xml-" version ".zip"))
142 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
144 (define-public docbook-xml-4.1.2
145 (package (inherit docbook-xml)
149 (uri (string-append "https://www.docbook.org/xml/" version
153 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
155 '(#:modules ((guix build utils))
158 (use-modules (guix build utils))
159 (let ((source (assoc-ref %build-inputs "source"))
160 (unzip (string-append (assoc-ref %build-inputs "unzip")
162 (dtd (string-append (assoc-ref %outputs "out")
163 "/xml/dtd/docbook")))
165 (invoke unzip source "-d" dtd)))))))
167 (define-public docbook-xsl
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"))
178 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))
179 (modules '((guix build utils)))
182 (for-each delete-file (find-files "." "\\.jar$"))
184 (build-system trivial-build-system)
186 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
187 (use-modules (guix build utils))
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)
199 (copy-recursively name-version
200 (string-append xsl "/" name-version))
202 (substitute* (string-append xsl "/" name-version "/catalog.xml")
203 (("rewritePrefix=\"./")
204 (string-append "rewritePrefix=\"file://" xsl "/"
207 #:modules ((guix build utils))))
208 (native-inputs `(("bzip2" ,bzip2)
209 ("xz" ,xz) ;needed for repacked tarballs
211 (home-page "https://docbook.org")
212 (synopsis "DocBook XSL style sheets for document authoring")
214 "This package provides XSL style sheets for DocBook.")
215 (license (x11-style "" "See 'COPYING' file."))))
217 (define-public dblatex
223 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
224 "dblatex-" version "/dblatex-"
228 "0rp1bc2lgisigscq1i7zxfd2qdaxxxld6khbcxss4pq7fpi9fzkv"))))
229 (build-system python-build-system)
230 ;; TODO: Add xfig/transfig for fig2dev utility
232 `(("texlive" ,(texlive-union (list texlive-amsfonts
233 texlive-latex-anysize
234 texlive-latex-appendix
235 texlive-latex-changebar
236 texlive-latex-colortbl
238 texlive-latex-eso-pic
239 texlive-latex-fancybox
240 texlive-latex-fancyhdr
241 texlive-latex-fancyvrb
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
254 texlive-latex-wasysym
258 texlive-fonts-stmaryrd
260 texlive-generic-ifxetex)))
261 ("imagemagick" ,imagemagick) ;for convert
262 ("inkscape" ,inkscape) ;for svg conversion
263 ("docbook" ,docbook-xml)
264 ("libxslt" ,libxslt))) ;for xsltproc
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
276 #:tests? #f ;no 'test' command
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")
285 ,(map (lambda (input)
286 (string-append (assoc-ref inputs input)
288 '("libxslt" "texlive"
289 "imagemagick" "inkscape"))))
291 (home-page "http://dblatex.sourceforge.net")
292 (synopsis "DocBook to LaTeX Publishing")
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
298 ;; lib/contrib/which is under an X11 license