docbook.scm 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. (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))
  35. (define-public docbook-xml
  36. (package
  37. (name "docbook-xml")
  38. (version "4.5")
  39. (source (origin
  40. (method url-fetch)
  41. (uri (string-append "http://www.docbook.org/xml/" version
  42. "/docbook-xml-" version ".zip"))
  43. (sha256
  44. (base32
  45. "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf"))))
  46. (build-system trivial-build-system)
  47. (arguments
  48. '(#:builder (begin
  49. (use-modules (guix build utils))
  50. (let* ((unzip
  51. (string-append (assoc-ref %build-inputs "unzip")
  52. "/bin/unzip"))
  53. (source (assoc-ref %build-inputs "source"))
  54. (out (assoc-ref %outputs "out"))
  55. (dtd (string-append out "/xml/dtd/docbook")))
  56. (mkdir-p dtd)
  57. (with-directory-excursion dtd
  58. (invoke unzip source))
  59. (substitute* (string-append out "/xml/dtd/docbook/catalog.xml")
  60. (("uri=\"")
  61. (string-append
  62. "uri=\"file://" dtd "/")))
  63. #t))
  64. #:modules ((guix build utils))))
  65. (native-inputs `(("unzip" ,unzip)))
  66. (home-page "http://docbook.org")
  67. (synopsis "DocBook XML DTDs for document authoring")
  68. (description
  69. "DocBook is general purpose XML and SGML document type particularly well
  70. suited to books and papers about computer hardware and software (though it is
  71. by no means limited to these applications.) This package provides XML DTDs.")
  72. (license (x11-style "" "See file headers."))))
  73. (define-public docbook-xml-4.4
  74. (package (inherit docbook-xml)
  75. (version "4.4")
  76. (source (origin
  77. (method url-fetch)
  78. (uri (string-append "http://www.docbook.org/xml/" version
  79. "/docbook-xml-" version ".zip"))
  80. (sha256
  81. (base32
  82. "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82"))))))
  83. (define-public docbook-xml-4.3
  84. (package (inherit docbook-xml)
  85. (version "4.3")
  86. (source (origin
  87. (method url-fetch)
  88. (uri (string-append "http://www.docbook.org/xml/" version
  89. "/docbook-xml-" version ".zip"))
  90. (sha256
  91. (base32
  92. "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3"))))))
  93. (define-public docbook-xml-4.2
  94. (package (inherit docbook-xml)
  95. (version "4.2")
  96. (source (origin
  97. (method url-fetch)
  98. (uri (string-append "http://www.docbook.org/xml/" version
  99. "/docbook-xml-" version ".zip"))
  100. (sha256
  101. (base32
  102. "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
  103. (define-public docbook-xml-4.1.2
  104. (package (inherit docbook-xml)
  105. (version "4.1.2")
  106. (source (origin
  107. (method url-fetch)
  108. (uri (string-append "http://www.docbook.org/xml/" version
  109. "/docbkx412.zip"))
  110. (sha256
  111. (base32
  112. "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
  113. (arguments
  114. '(#:modules ((guix build utils))
  115. #:builder
  116. (begin
  117. (use-modules (guix build utils))
  118. (let ((source (assoc-ref %build-inputs "source"))
  119. (unzip (string-append (assoc-ref %build-inputs "unzip")
  120. "/bin/unzip"))
  121. (dtd (string-append (assoc-ref %outputs "out")
  122. "/xml/dtd/docbook")))
  123. (mkdir-p dtd)
  124. (invoke unzip source "-d" dtd)))))))
  125. (define-public docbook-xsl
  126. (package
  127. (name "docbook-xsl")
  128. (version "1.79.1")
  129. (source (origin
  130. (method url-fetch)
  131. (uri (string-append "mirror://sourceforge/docbook/docbook-xsl/"
  132. version "/docbook-xsl-" version ".tar.bz2"))
  133. (patches (search-patches "docbook-xsl-nonrecursive-string-subst.patch"))
  134. (sha256
  135. (base32
  136. "0s59lihif2fr7rznckxr2kfyrvkirv76r1zvidp9b5mj28p4apvj"))
  137. (modules '((guix build utils)))
  138. (snippet
  139. '(begin
  140. (for-each delete-file (find-files "." "\\.jar$"))
  141. #t))))
  142. (build-system trivial-build-system)
  143. (arguments
  144. `(#:builder (let ((name-version (string-append ,name "-" ,version)))
  145. (use-modules (guix build utils))
  146. (let* ((bzip2 (assoc-ref %build-inputs "bzip2"))
  147. (xz (assoc-ref %build-inputs "xz"))
  148. (tar (assoc-ref %build-inputs "tar"))
  149. (source (assoc-ref %build-inputs "source"))
  150. (out (assoc-ref %outputs "out"))
  151. (xsl (string-append out "/xml/xsl")))
  152. (setenv "PATH" (string-append bzip2 "/bin" ":" xz "/bin"))
  153. (invoke (string-append tar "/bin/tar") "xvf" source)
  154. (mkdir-p xsl)
  155. (copy-recursively name-version
  156. (string-append xsl "/" name-version))
  157. (substitute* (string-append xsl "/" name-version "/catalog.xml")
  158. (("rewritePrefix=\"./")
  159. (string-append "rewritePrefix=\"file://" xsl "/"
  160. name-version "/")))
  161. #t))
  162. #:modules ((guix build utils))))
  163. (native-inputs `(("bzip2" ,bzip2)
  164. ("xz" ,xz) ;needed for repacked tarballs
  165. ("tar" ,tar)))
  166. (home-page "http://docbook.org")
  167. (synopsis "DocBook XSL style sheets for document authoring")
  168. (description
  169. "This package provides XSL style sheets for DocBook.")
  170. (license (x11-style "" "See 'COPYING' file."))))
  171. (define-public dblatex
  172. (package
  173. (name "dblatex")
  174. (version "0.3.10")
  175. (source (origin
  176. (method url-fetch)
  177. (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
  178. "dblatex-" version "/dblatex-"
  179. version ".tar.bz2"))
  180. (sha256
  181. (base32
  182. "1yicd861rqz78i2khl35j7nvc0ccv4jx4hzqrbhll17082vrdmkg"))))
  183. (build-system python-build-system)
  184. ;; TODO: Add xfig/transfig for fig2dev utility
  185. (inputs
  186. `(("texlive" ,(texlive-union (list texlive-latex-amsfonts
  187. texlive-latex-anysize
  188. texlive-latex-appendix
  189. texlive-latex-changebar
  190. texlive-latex-colortbl
  191. texlive-latex-eepic
  192. texlive-latex-eso-pic
  193. texlive-latex-fancybox
  194. texlive-latex-fancyhdr
  195. texlive-latex-fancyvrb
  196. texlive-latex-float
  197. texlive-latex-footmisc
  198. texlive-latex-hyperref
  199. texlive-latex-jknapltx
  200. texlive-latex-listings
  201. texlive-latex-multirow
  202. texlive-latex-oberdiek
  203. texlive-latex-overpic
  204. texlive-latex-pdfpages
  205. texlive-latex-subfigure
  206. texlive-latex-titlesec
  207. texlive-latex-url
  208. texlive-latex-wasysym
  209. texlive-fonts-amsfonts
  210. texlive-fonts-ec
  211. texlive-fonts-rsfs
  212. texlive-fonts-stmaryrd
  213. texlive-generic-ifxetex)))
  214. ("imagemagick" ,imagemagick) ;for convert
  215. ("inkscape" ,inkscape) ;for svg conversion
  216. ("docbook" ,docbook-xml)
  217. ("libxslt" ,libxslt))) ;for xsltproc
  218. (arguments
  219. `(#:python ,python-2 ;'print' syntax
  220. ;; Using setuptools causes an invalid "package_base" path in
  221. ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
  222. ;; by dblatex's setup.py stripping the root path when creating the
  223. ;; script. (dblatex's setup.py still uses distutils and thus has to
  224. ;; create the script by itself. The feature for creating scripts is one
  225. ;; of setuptools' features.)
  226. ;; See this thread for details:
  227. ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
  228. #:use-setuptools? #f
  229. #:tests? #f ;no 'test' command
  230. #:phases
  231. (modify-phases %standard-phases
  232. (add-after 'wrap 'set-path
  233. (lambda* (#:key inputs outputs #:allow-other-keys)
  234. (let ((out (assoc-ref outputs "out")))
  235. ;; dblatex executes helper programs at runtime.
  236. (wrap-program (string-append out "/bin/dblatex")
  237. `("PATH" ":" prefix
  238. ,(map (lambda (input)
  239. (string-append (assoc-ref inputs input)
  240. "/bin"))
  241. '("libxslt" "texlive"
  242. "imagemagick" "inkscape"))))
  243. #t))))))
  244. (home-page "http://dblatex.sourceforge.net")
  245. (synopsis "DocBook to LaTeX Publishing")
  246. (description
  247. "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
  248. to DVI, PostScript or PDF by translating them in pure LaTeX as a first
  249. process. MathML 2.0 markups are supported too. It started as a clone of
  250. DB2LaTeX.")
  251. ;; lib/contrib/which is under an X11 license
  252. (license gpl2+)))