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>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages docbook)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages compression)
24 #:use-module (gnu packages imagemagick)
25 #:use-module (gnu packages inkscape)
26 #:use-module (gnu packages tex)
27 #:use-module (gnu packages python)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages xml)
30 #:use-module (guix licenses)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix build-system trivial)
34 #:use-module (guix build-system python))
36 (define-public docbook-xml
42 (uri (string-append "http://www.docbook.org/xml/" version
43 "/docbook-xml-" version ".zip"))
46 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
47 (build-system trivial-build-system)
50 (use-modules (guix build utils))
53 (string-append (assoc-ref %build-inputs "unzip")
55 (source (assoc-ref %build-inputs "source"))
56 (out (assoc-ref %outputs "out"))
57 (dtd (string-append out "/xml/dtd/docbook")))
59 (with-directory-excursion dtd
60 (system* unzip source))
61 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
64 "uri=\"file://" dtd "/")))))
65 #:modules ((guix build utils))))
66 (native-inputs `(("unzip" ,unzip)))
67 (home-page "http://docbook.org")
68 (synopsis "DocBook XML DTDs for document authoring")
70 "DocBook is general purpose XML and SGML document type particularly well
71 suited to books and papers about computer hardware and software (though it is
72 by no means limited to these applications.) This package provides XML DTDs.")
73 (license (x11-style "" "See file headers."))))
75 (define-public docbook-xml-4.4
76 (package (inherit docbook-xml)
80 (uri (string-append "http://www.docbook.org/xml/" version
81 "/docbook-xml-" version ".zip"))
84 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
86 (define-public docbook-xml-4.3
87 (package (inherit docbook-xml)
91 (uri (string-append "http://www.docbook.org/xml/" version
92 "/docbook-xml-" version ".zip"))
95 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
97 (define-public docbook-xml-4.2
98 (package (inherit docbook-xml)
102 (uri (string-append "http://www.docbook.org/xml/" version
103 "/docbook-xml-" version ".zip"))
106 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
108 (define-public docbook-xml-4.1.2
109 (package (inherit docbook-xml)
113 (uri (string-append "http://www.docbook.org/xml/" version
117 "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
119 '(#:modules ((guix build utils))
122 (use-modules (guix build utils))
123 (let ((source (assoc-ref %build-inputs "source"))
124 (unzip (string-append (assoc-ref %build-inputs "unzip")
126 (dtd (string-append (assoc-ref %outputs "out")
127 "/xml/dtd/docbook")))
129 (zero? (system* unzip source "-d" dtd))))))))
131 (define-public docbook-xsl
137 (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
138 version "/docbook-xsl-" version ".tar.bz2"))
139 ;; Note: If removing all patches, the XZ dependency is no longer needed.
140 (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
143 "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))))
144 (build-system trivial-build-system)
146 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
147 (use-modules (guix build utils))
149 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
150 (xz (assoc-ref %build-inputs "xz"))
151 (tar (assoc-ref %build-inputs "tar"))
152 (source (assoc-ref %build-inputs "source"))
153 (out (assoc-ref %outputs "out"))
154 (xsl (string-append out "/xml/xsl")))
155 (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
156 (system* (string-append tar "/bin/tar") "xvf" source)
159 (copy-recursively name-version
160 (string-append xsl "/" name-version))
162 (substitute* (string-append xsl "/" name-version "/catalog.xml")
163 (("rewritePrefix=\"./")
164 (string-append "rewritePrefix=\"file://" xsl "/"
165 name-version "/")))))
166 #:modules ((guix build utils))))
167 (native-inputs `(("bzip2" ,bzip2)
170 (home-page "http://docbook.org")
171 (synopsis "DocBook XSL style sheets for document authoring")
173 "This package provides XSL style sheets for DocBook.")
174 (license (x11-style "" "See 'COPYING' file."))))
176 (define-public dblatex
182 (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
183 "dblatex-" version "/dblatex-"
187 "0pdizc5rjywwzxa1qqhdmba5zr35pbmdwbysalsid7xw87w3kq06"))
188 (patches (search-patches "dblatex-remove-multirow.patch"))))
189 (build-system python-build-system)
190 ;; TODO: Add xfig/transfig for fig2dev utility
192 `(("texlive" ,(texlive-union (list texlive-latex-amsfonts
193 texlive-latex-anysize
194 texlive-latex-appendix
195 texlive-latex-changebar
196 texlive-latex-colortbl
198 texlive-latex-eso-pic
199 texlive-latex-fancybox
200 texlive-latex-fancyhdr
201 texlive-latex-fancyvrb
203 texlive-latex-footmisc
204 texlive-latex-hyperref
205 texlive-latex-jknapltx
206 texlive-latex-listings
207 texlive-latex-multirow
208 texlive-latex-oberdiek
209 texlive-latex-overpic
210 texlive-latex-pdfpages
211 texlive-latex-subfigure
212 texlive-latex-titlesec
214 texlive-latex-wasysym
216 texlive-fonts-amsfonts
219 texlive-fonts-stmaryrd
221 texlive-generic-ifxetex)))
222 ("imagemagick" ,imagemagick) ;for convert
223 ("inkscape" ,inkscape) ;for svg conversion
224 ("docbook" ,docbook-xml)
225 ("libxslt" ,libxslt))) ;for xsltproc
227 `(#:python ,python-2 ;'print' syntax
228 ;; Using setuptools causes an invalid "package_base" path in
229 ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
230 ;; by dblatex's setup.py stripping the root path when creating the
231 ;; script. (dblatex's setup.py still uses distutils and thus has to
232 ;; create the script by itself. The feature for creating scripts is one
233 ;; of setuptools' features.)
234 ;; See this thread for details:
235 ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
237 #:tests? #f ;no 'test' command
241 (lambda* (#:key inputs outputs #:allow-other-keys)
242 (let ((out (assoc-ref outputs "out")))
243 ;; dblatex executes helper programs at runtime.
244 (wrap-program (string-append out "/bin/dblatex")
246 ,(map (lambda (input)
247 (string-append (assoc-ref inputs input)
249 '("libxslt" "texlive"
250 "imagemagick" "inkscape"))))))
252 (home-page "http://dblatex.sourceforge.net")
253 (synopsis "DocBook to LaTeX Publishing")
255 "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
256 to DVI, PostScript or PDF by translating them in pure LaTeX as a first
257 process. MathML 2.0 markups are supported too. It started as a clone of
259 ;; lib/contrib/which is under an X11 license