substitute: Honor the number of columns of the client terminal.
[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>
c915b404
LC
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages docbook)
21 #:use-module (gnu packages)
22 #:use-module (gnu packages compression)
2efb3dda
EB
23 #:use-module (gnu packages imagemagick)
24 #:use-module (gnu packages inkscape)
25 #:use-module (gnu packages texlive)
26 #:use-module (gnu packages python)
b777d784 27 #:use-module (gnu packages base)
2efb3dda 28 #:use-module (gnu packages xml)
c915b404
LC
29 #:use-module (guix licenses)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix build-system trivial)
2efb3dda 33 #:use-module (guix build-system python)
c915b404
LC
34 #:autoload (gnu packages zip) (unzip))
35
36(define-public docbook-xml
37 (package
38 (name "docbook-xml")
39 (version "4.5")
40 (source (origin
41 (method url-fetch)
42 (uri (string-append "http://www.docbook.org/xml/" version
43 "/docbook-xml-" version ".zip"))
44 (sha256
45 (base32
46 "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
47 (build-system trivial-build-system)
48 (arguments
49 '(#:builder (begin
50 (use-modules (guix build utils))
51
52 (let* ((unzip
53 (string-append (assoc-ref %build-inputs "unzip")
54 "/bin/unzip"))
55 (source (assoc-ref %build-inputs "source"))
56 (out (assoc-ref %outputs "out"))
57 (dtd (string-append out "/xml/dtd/docbook")))
58 (mkdir-p dtd)
59 (with-directory-excursion dtd
a6639cf7
JD
60 (system* unzip source))
61 (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
62 (("uri=\"")
63 (string-append
64 "uri=\"file://" dtd "/")))))
65 #:modules ((guix build utils))))
c915b404
LC
66 (native-inputs `(("unzip" ,unzip)))
67 (home-page "http://docbook.org")
68 (synopsis "DocBook XML DTDs for document authoring")
69 (description
70 "DocBook is general purpose XML and SGML document type particularly well
71suited to books and papers about computer hardware and software (though it is
72by no means limited to these applications.) This package provides XML DTDs.")
73 (license (x11-style "" "See file headers."))))
74
1cac3de6
JD
75(define-public docbook-xml-4.4
76 (package (inherit docbook-xml)
77 (version "4.4")
78 (source (origin
79 (method url-fetch)
80 (uri (string-append "http://www.docbook.org/xml/" version
81 "/docbook-xml-" version ".zip"))
82 (sha256
83 (base32
84 "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
85
86(define-public docbook-xml-4.3
87 (package (inherit docbook-xml)
88 (version "4.3")
89 (source (origin
90 (method url-fetch)
91 (uri (string-append "http://www.docbook.org/xml/" version
92 "/docbook-xml-" version ".zip"))
93 (sha256
94 (base32
95 "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
96
aec149e3
FB
97(define-public docbook-xml-4.2
98 (package (inherit docbook-xml)
99 (version "4.2")
100 (source (origin
101 (method url-fetch)
102 (uri (string-append "http://www.docbook.org/xml/" version
103 "/docbook-xml-" version ".zip"))
104 (sha256
105 (base32
106 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
107
c915b404
LC
108(define-public docbook-xsl
109 (package
110 (name "docbook-xsl")
a37a3077 111 (version "1.78.1")
c915b404
LC
112 (source (origin
113 (method url-fetch)
114 (uri (string-append "mirror://sourceforge/docbook/docbook-xsl-"
115 version ".tar.bz2"))
116 (sha256
117 (base32
a37a3077 118 "0rxl013ncmz1n6ymk2idvx3hix9pdabk8xn01cpcv32wmfb753y9"))))
c915b404
LC
119 (build-system trivial-build-system)
120 (arguments
7f4bf030 121 `(#:builder (let ((name-version (string-append ,name "-" ,version)))
c915b404
LC
122 (use-modules (guix build utils))
123
124 (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
125 (tar (assoc-ref %build-inputs "tar"))
126 (source (assoc-ref %build-inputs "source"))
127 (out (assoc-ref %outputs "out"))
128 (xsl (string-append out "/xml/xsl")))
129 (setenv "PATH" (string-append bzip2 "/bin"))
130 (system* (string-append tar "/bin/tar") "xvf" source)
131
132 (mkdir-p xsl)
7f4bf030
JD
133 (copy-recursively name-version
134 (string-append xsl "/" name-version))
135
136 (substitute* (string-append xsl "/" name-version "/catalog.xml")
a124bbd2
SB
137 (("rewritePrefix=\"./")
138 (string-append "rewritePrefix=\"file://" xsl "/"
139 name-version "/")))))
7f4bf030 140 #:modules ((guix build utils))))
c915b404
LC
141 (native-inputs `(("bzip2" ,bzip2)
142 ("tar" ,tar)))
143 (home-page "http://docbook.org")
144 (synopsis "DocBook XSL style sheets for document authoring")
145 (description
146 "This package provides XSL style sheets for DocBook.")
147 (license (x11-style "" "See 'COPYING' file."))))
2efb3dda
EB
148
149(define-public dblatex
150 (package
151 (name "dblatex")
152 (version "0.3.5")
153 (source (origin
154 (method url-fetch)
155 (uri (string-append "mirror://sourceforge/dblatex/dblatex-"
156 version ".tar.bz2"))
157 (sha256
158 (base32
159 "0h3472n33pabrn8qwggsahkrjx8lybpwlc3zprby3w3w3x5i830f"))))
160 (build-system python-build-system)
161 ;; TODO: Add xfig/transfig for fig2dev utility
162 (inputs
163 `(("python-setuptools" ,python-setuptools)
164 ("texlive" ,texlive)
165 ("imagemagick" ,imagemagick) ;for convert
166 ("inkscape" ,inkscape) ;for svg conversion
167 ("docbook" ,docbook-xml)
168 ("libxslt" ,libxslt))) ;for xsltproc
169 (arguments
170 `(#:python ,python-2 ;'print' syntax
171 #:tests? #f ;no 'test' command
172 #:phases
173 (alist-cons-after
174 'wrap 'set-path
175 (lambda* (#:key inputs outputs #:allow-other-keys)
176 (let ((out (assoc-ref outputs "out")))
177 ;; dblatex executes helper programs at runtime.
178 (wrap-program (string-append out "/bin/dblatex")
179 `("PATH" ":" prefix
180 ,(map (lambda (input)
181 (string-append (assoc-ref inputs input)
182 "/bin"))
183 '("libxslt" "texlive"
184 "imagemagick" "inkscape"))))))
185 %standard-phases)))
186 (home-page "http://dblatex.sourceforge.net")
187 (synopsis "DocBook to LaTeX Publishing")
188 (description
189 "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
190to DVI, PostScript or PDF by translating them in pure LaTeX as a first
191process. MathML 2.0 markups are supported too. It started as a clone of
192DB2LaTeX.")
193 ;; lib/contrib/which is under an X11 license
194 (license gpl2+)))