Commit | Line | Data |
---|---|---|
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> |
c915b404 LC |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
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. | |
14 | ;;; | |
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. | |
19 | ;;; | |
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/>. | |
22 | ||
23 | (define-module (gnu packages docbook) | |
24 | #:use-module (gnu packages) | |
25 | #:use-module (gnu packages compression) | |
2efb3dda EB |
26 | #:use-module (gnu packages imagemagick) |
27 | #:use-module (gnu packages inkscape) | |
8f9ac901 | 28 | #:use-module (gnu packages tex) |
2efb3dda | 29 | #:use-module (gnu packages python) |
b777d784 | 30 | #:use-module (gnu packages base) |
2efb3dda | 31 | #:use-module (gnu packages xml) |
c915b404 LC |
32 | #:use-module (guix licenses) |
33 | #:use-module (guix packages) | |
34 | #:use-module (guix download) | |
35 | #:use-module (guix build-system trivial) | |
148585c2 | 36 | #:use-module (guix build-system python)) |
c915b404 | 37 | |
bf7321cc MB |
38 | (define-public docbook-xml-5 |
39 | (package | |
40 | (name "docbook-xml") | |
41 | (version "5.0.1") | |
42 | (source (origin | |
43 | (method url-fetch) | |
44 | (uri (string-append "https://www.docbook.org/xml/" version | |
45 | "/docbook-" version ".zip")) | |
46 | (sha256 | |
47 | (base32 | |
48 | "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs")))) | |
49 | (build-system trivial-build-system) | |
50 | (arguments | |
51 | `(#:modules ((guix build utils)) | |
52 | #:builder | |
53 | (begin | |
54 | (use-modules (guix build utils)) | |
55 | (let* ((unzip | |
56 | (string-append (assoc-ref %build-inputs "unzip") | |
57 | "/bin/unzip")) | |
58 | (source (assoc-ref %build-inputs "source")) | |
59 | (out (assoc-ref %outputs "out")) | |
60 | (dtd (string-append out "/xml/dtd/docbook"))) | |
61 | (invoke unzip source) | |
62 | (mkdir-p dtd) | |
63 | (copy-recursively (string-append "docbook-" ,version) dtd) | |
64 | (with-directory-excursion dtd | |
65 | (substitute* (string-append out "/xml/dtd/docbook/catalog.xml") | |
66 | (("uri=\"") | |
67 | (string-append | |
68 | "uri=\"file://" dtd "/"))) | |
69 | #t))))) | |
70 | (native-inputs `(("unzip" ,unzip))) | |
71 | (home-page "https://docbook.org") | |
72 | (synopsis "DocBook XML DTDs for document authoring") | |
73 | (description | |
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.")))) | |
78 | ||
c915b404 LC |
79 | (define-public docbook-xml |
80 | (package | |
bf7321cc | 81 | (inherit docbook-xml-5) |
c915b404 LC |
82 | (name "docbook-xml") |
83 | (version "4.5") | |
84 | (source (origin | |
85 | (method url-fetch) | |
e6711212 | 86 | (uri (string-append "https://www.docbook.org/xml/" version |
c915b404 LC |
87 | "/docbook-xml-" version ".zip")) |
88 | (sha256 | |
89 | (base32 | |
90 | "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf")))) | |
c915b404 LC |
91 | (arguments |
92 | '(#:builder (begin | |
93 | (use-modules (guix build utils)) | |
94 | ||
95 | (let* ((unzip | |
96 | (string-append (assoc-ref %build-inputs "unzip") | |
97 | "/bin/unzip")) | |
98 | (source (assoc-ref %build-inputs "source")) | |
99 | (out (assoc-ref %outputs "out")) | |
100 | (dtd (string-append out "/xml/dtd/docbook"))) | |
101 | (mkdir-p dtd) | |
102 | (with-directory-excursion dtd | |
e3cfef22 | 103 | (invoke unzip source)) |
a6639cf7 | 104 | (substitute* (string-append out "/xml/dtd/docbook/catalog.xml") |
bf7321cc MB |
105 | (("uri=\"") |
106 | (string-append | |
e3cfef22 MW |
107 | "uri=\"file://" dtd "/"))) |
108 | #t)) | |
bf7321cc | 109 | #:modules ((guix build utils)))))) |
c915b404 | 110 | |
1cac3de6 JD |
111 | (define-public docbook-xml-4.4 |
112 | (package (inherit docbook-xml) | |
1e47d0e2 | 113 | (version "4.4") |
1cac3de6 JD |
114 | (source (origin |
115 | (method url-fetch) | |
e6711212 | 116 | (uri (string-append "https://www.docbook.org/xml/" version |
1cac3de6 JD |
117 | "/docbook-xml-" version ".zip")) |
118 | (sha256 | |
119 | (base32 | |
120 | "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82")))))) | |
121 | ||
122 | (define-public docbook-xml-4.3 | |
123 | (package (inherit docbook-xml) | |
1e47d0e2 | 124 | (version "4.3") |
1cac3de6 JD |
125 | (source (origin |
126 | (method url-fetch) | |
e6711212 | 127 | (uri (string-append "https://www.docbook.org/xml/" version |
1cac3de6 JD |
128 | "/docbook-xml-" version ".zip")) |
129 | (sha256 | |
130 | (base32 | |
131 | "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3")))))) | |
132 | ||
aec149e3 FB |
133 | (define-public docbook-xml-4.2 |
134 | (package (inherit docbook-xml) | |
1e47d0e2 | 135 | (version "4.2") |
aec149e3 FB |
136 | (source (origin |
137 | (method url-fetch) | |
e6711212 | 138 | (uri (string-append "https://www.docbook.org/xml/" version |
aec149e3 FB |
139 | "/docbook-xml-" version ".zip")) |
140 | (sha256 | |
141 | (base32 | |
142 | "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c")))))) | |
143 | ||
1e47d0e2 ML |
144 | (define-public docbook-xml-4.1.2 |
145 | (package (inherit docbook-xml) | |
146 | (version "4.1.2") | |
147 | (source (origin | |
148 | (method url-fetch) | |
e6711212 | 149 | (uri (string-append "https://www.docbook.org/xml/" version |
1e47d0e2 ML |
150 | "/docbkx412.zip")) |
151 | (sha256 | |
152 | (base32 | |
153 | "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h")))) | |
154 | (arguments | |
155 | '(#:modules ((guix build utils)) | |
156 | #:builder | |
157 | (begin | |
158 | (use-modules (guix build utils)) | |
159 | (let ((source (assoc-ref %build-inputs "source")) | |
160 | (unzip (string-append (assoc-ref %build-inputs "unzip") | |
161 | "/bin/unzip")) | |
162 | (dtd (string-append (assoc-ref %outputs "out") | |
163 | "/xml/dtd/docbook"))) | |
164 | (mkdir-p dtd) | |
e3cfef22 | 165 | (invoke unzip source "-d" dtd))))))) |
1e47d0e2 | 166 | |
c915b404 LC |
167 | (define-public docbook-xsl |
168 | (package | |
169 | (name "docbook-xsl") | |
cf7daaf5 | 170 | (version "1.79.1") |
c915b404 LC |
171 | (source (origin |
172 | (method url-fetch) | |
de67e922 LF |
173 | (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/" |
174 | version "/docbook-xsl-" version ".tar.bz2")) | |
0f72f052 | 175 | (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch")) |
c915b404 LC |
176 | (sha256 |
177 | (base32 | |
52f1687d MB |
178 | "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj")) |
179 | (modules '((guix build utils))) | |
180 | (snippet | |
181 | '(begin | |
182 | (for-each delete-file (find-files "." "\\.jar$")) | |
183 | #t)))) | |
c915b404 LC |
184 | (build-system trivial-build-system) |
185 | (arguments | |
7f4bf030 | 186 | `(#:builder (let ((name-version (string-append ,name "-" ,version))) |
c915b404 LC |
187 | (use-modules (guix build utils)) |
188 | ||
189 | (let* ((bzip2 (assoc-ref %build-inputs "bzip2")) | |
0f72f052 | 190 | (xz (assoc-ref %build-inputs "xz")) |
c915b404 LC |
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"))) | |
0f72f052 | 195 | (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin")) |
e3cfef22 | 196 | (invoke (string-append tar "/bin/tar") "xvf" source) |
c915b404 LC |
197 | |
198 | (mkdir-p xsl) | |
7f4bf030 JD |
199 | (copy-recursively name-version |
200 | (string-append xsl "/" name-version)) | |
201 | ||
202 | (substitute* (string-append xsl "/" name-version "/catalog.xml") | |
a124bbd2 SB |
203 | (("rewritePrefix=\"./") |
204 | (string-append "rewritePrefix=\"file://" xsl "/" | |
e3cfef22 MW |
205 | name-version "/"))) |
206 | #t)) | |
207 | #:modules ((guix build utils)))) | |
c915b404 | 208 | (native-inputs `(("bzip2" ,bzip2) |
52f1687d | 209 | ("xz" ,xz) ;needed for repacked tarballs |
c915b404 | 210 | ("tar" ,tar))) |
e6711212 | 211 | (home-page "https://docbook.org") |
c915b404 LC |
212 | (synopsis "DocBook XSL style sheets for document authoring") |
213 | (description | |
214 | "This package provides XSL style sheets for DocBook.") | |
215 | (license (x11-style "" "See 'COPYING' file.")))) | |
2efb3dda EB |
216 | |
217 | (define-public dblatex | |
218 | (package | |
219 | (name "dblatex") | |
8419a7ed | 220 | (version "0.3.11") |
2efb3dda EB |
221 | (source (origin |
222 | (method url-fetch) | |
de67e922 LF |
223 | (uri (string-append "mirror://sourceforge/dblatex/dblatex/" |
224 | "dblatex-" version "/dblatex-" | |
2efb3dda EB |
225 | version ".tar.bz2")) |
226 | (sha256 | |
227 | (base32 | |
8419a7ed | 228 | "0rp1bc2lgisigscq1i7zxfd2qdaxxxld6khbcxss4pq7fpi9fzkv")))) |
2efb3dda EB |
229 | (build-system python-build-system) |
230 | ;; TODO: Add xfig/transfig for fig2dev utility | |
231 | (inputs | |
f75aa97f | 232 | `(("texlive" ,(texlive-union (list texlive-amsfonts |
b81dd94a RW |
233 | texlive-latex-anysize |
234 | texlive-latex-appendix | |
235 | texlive-latex-changebar | |
236 | texlive-latex-colortbl | |
237 | texlive-latex-eepic | |
238 | texlive-latex-eso-pic | |
239 | texlive-latex-fancybox | |
240 | texlive-latex-fancyhdr | |
241 | texlive-latex-fancyvrb | |
242 | texlive-latex-float | |
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 | |
253 | texlive-latex-url | |
254 | texlive-latex-wasysym | |
255 | ||
b81dd94a RW |
256 | texlive-fonts-ec |
257 | texlive-fonts-rsfs | |
258 | texlive-fonts-stmaryrd | |
259 | ||
260 | texlive-generic-ifxetex))) | |
2efb3dda EB |
261 | ("imagemagick" ,imagemagick) ;for convert |
262 | ("inkscape" ,inkscape) ;for svg conversion | |
263 | ("docbook" ,docbook-xml) | |
264 | ("libxslt" ,libxslt))) ;for xsltproc | |
265 | (arguments | |
266 | `(#:python ,python-2 ;'print' syntax | |
447b9473 HG |
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: | |
3cc0342b MB |
274 | ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html |
275 | #:use-setuptools? #f | |
2efb3dda EB |
276 | #:tests? #f ;no 'test' command |
277 | #:phases | |
d2d1144d TGR |
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") | |
284 | `("PATH" ":" prefix | |
285 | ,(map (lambda (input) | |
286 | (string-append (assoc-ref inputs input) | |
287 | "/bin")) | |
288 | '("libxslt" "texlive" | |
289 | "imagemagick" "inkscape")))) | |
290 | #t)))))) | |
2efb3dda EB |
291 | (home-page "http://dblatex.sourceforge.net") |
292 | (synopsis "DocBook to LaTeX Publishing") | |
293 | (description | |
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 | |
297 | DB2LaTeX.") | |
298 | ;; lib/contrib/which is under an X11 license | |
299 | (license gpl2+))) |