batik.scm 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
  3. ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  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. (define-module (gnu packages batik)
  20. #:use-module ((guix licenses) #:prefix license:)
  21. #:use-module (guix utils)
  22. #:use-module (guix download)
  23. #:use-module (guix git-download)
  24. #:use-module (guix packages)
  25. #:use-module (guix build-system ant)
  26. #:use-module (gnu packages)
  27. #:use-module (gnu packages compression)
  28. #:use-module (gnu packages java)
  29. #:use-module (gnu packages textutils)
  30. #:use-module (gnu packages xml))
  31. (define-public java-w3c-smil-3.0
  32. (package
  33. (name "java-w3c-smil")
  34. (version "3.0")
  35. (source #f)
  36. (build-system ant-build-system)
  37. (arguments
  38. `(#:jar-name "w3c-smil.jar"
  39. #:source-dir "."
  40. #:tests? #f ; No tests exist.
  41. #:phases
  42. (modify-phases %standard-phases
  43. (replace 'unpack
  44. (lambda* (#:key source #:allow-other-keys)
  45. ;; https://www.w3.org/TR/SMIL3/smil-timing.html#q142
  46. (mkdir-p "org/w3c/dom/smil")
  47. (call-with-output-file "org/w3c/dom/smil/ElementTimeControl.java"
  48. (lambda (port)
  49. (format port "
  50. package org.w3c.dom.smil;
  51. import org.w3c.dom.DOMException;
  52. public interface ElementTimeControl {
  53. public boolean beginElement();
  54. public boolean beginElementAt(float offset);
  55. public boolean endElement();
  56. public boolean endElementAt(float offset);
  57. }
  58. ")))
  59. (call-with-output-file "org/w3c/dom/smil/TimeEvent.java"
  60. (lambda (port)
  61. (format port "
  62. package org.w3c.dom.smil;
  63. import org.w3c.dom.events.Event;
  64. import org.w3c.dom.views.AbstractView;
  65. public interface TimeEvent extends Event {
  66. public AbstractView getView();
  67. public int getDetail();
  68. public void initTimeEvent(String typeArg,
  69. AbstractView viewArg,
  70. int detailArg);
  71. }
  72. ")))
  73. #t)))))
  74. (native-inputs
  75. `(("unzip" ,unzip)))
  76. (home-page "https://www.w3.org/Style/CSS/SAC/")
  77. (synopsis "W3C SAC interface for CSS parsers in Java")
  78. (description "This package provides a SAC interface by the W3C.
  79. SAC is an interface for CSS parsers.")
  80. (license license:w3c)))
  81. (define-public java-w3c-svg-1.0
  82. (package
  83. (name "java-w3c-svg")
  84. (version "20010904")
  85. (source
  86. (origin
  87. (method url-fetch)
  88. (uri (string-append "http://www.w3.org/TR/2001/REC-SVG-" version
  89. "/java-binding.zip"))
  90. (sha256
  91. (base32
  92. "0gnxvx51bg6ijplf6l2q0i1m07101f7fickawshfygnsdjqfdnbp"))))
  93. (build-system ant-build-system)
  94. (arguments
  95. `(#:jar-name "w3c-svg.jar"
  96. #:source-dir "."
  97. #:tests? #f ; No tests exist.
  98. #:phases
  99. (modify-phases %standard-phases
  100. (replace 'unpack
  101. (lambda* (#:key source #:allow-other-keys)
  102. (invoke "unzip" source)))
  103. (add-after 'unpack 'patch-interface
  104. (lambda _
  105. ;; Make it compatible with batik.
  106. ;; This is equivalent to usingxml commons externals'
  107. ;; "externals" part from https://xerces.apache.org/mirrors.cgi
  108. (substitute* "SVGFEConvolveMatrixElement.java"
  109. (("public SVGAnimatedLength[ ]*getKernelUnitLength")
  110. "public SVGAnimatedNumber getKernelUnitLength"))
  111. (substitute* "SVGFEMorphologyElement.java"
  112. (("public SVGAnimatedLength[ ]*getRadius")
  113. "public SVGAnimatedNumber getRadius"))
  114. (call-with-output-file "EventListenerInitializer.java"
  115. (lambda (port)
  116. (format port "
  117. // License: http://www.apache.org/licenses/LICENSE-2.0
  118. package org.w3c.dom.svg;
  119. public interface EventListenerInitializer {
  120. public void initializeEventListeners(SVGDocument doc);
  121. }
  122. ")))
  123. #t)))))
  124. (propagated-inputs
  125. `(("java-w3c-smil" ,java-w3c-smil-3.0)))
  126. (native-inputs
  127. `(("unzip" ,unzip)))
  128. (home-page "https://www.w3.org/Style/CSS/SAC/")
  129. (synopsis "W3C SVG 1.0 interface")
  130. (description "This package provides a SVG 1.0 interface.")
  131. (license license:w3c)))
  132. (define-public java-w3c-svg
  133. (package
  134. (inherit java-w3c-svg-1.0)
  135. (version "20110816")
  136. (source
  137. (origin
  138. (method url-fetch)
  139. (uri (string-append "http://www.w3.org/TR/2011/REC-SVG11-" version
  140. "/java-binding.zip"))
  141. (sha256
  142. (base32
  143. "0jicqcrxav8ggs37amgvvwgc2f0qp1c5wns4rb2i3si83s2m09ns"))))
  144. (arguments
  145. (substitute-keyword-arguments (package-arguments java-w3c-svg-1.0)
  146. ((#:phases phases)
  147. `(modify-phases ,phases
  148. (delete 'patch-interface)))))
  149. (propagated-inputs
  150. `())
  151. (synopsis "W3C SVG interface")
  152. (description "This package provides a SVG interface.")))
  153. (define-public java-w3c-sac
  154. (package
  155. (name "java-w3c-sac")
  156. (version "1.3")
  157. (source
  158. (origin
  159. (method url-fetch)
  160. (uri (string-append "https://www.w3.org/2002/06/sacjava-" version
  161. ".zip"))
  162. (sha256
  163. (base32
  164. "1djp2nnzf8jchnwz1ij9i5jfx4cg1ryf3lbw133yzjy0wkhcla52"))))
  165. (build-system ant-build-system)
  166. (arguments
  167. `(#:jar-name "w3c-sac.jar"
  168. #:source-dir "sac-1.3"
  169. #:tests? #f ; No tests exist.
  170. #:phases
  171. (modify-phases %standard-phases
  172. (replace 'unpack
  173. (lambda* (#:key source #:allow-other-keys)
  174. (invoke "unzip" source))))))
  175. (native-inputs
  176. `(("unzip" ,unzip)))
  177. (home-page "https://www.w3.org/Style/CSS/SAC/")
  178. (synopsis "W3C SAC interface for CSS parsers in Java")
  179. (description "This package provides a SAC interface by the W3C.
  180. SAC is an interface for CSS parsers.")
  181. (license license:w3c)))
  182. (define-public java-xmlgraphics-commons
  183. (package
  184. (name "java-xmlgraphics-commons")
  185. (version "2.6")
  186. (source
  187. (origin
  188. (method url-fetch)
  189. (uri (string-append
  190. "mirror://apache/xmlgraphics/commons/source/xmlgraphics-commons-"
  191. version "-src.tar.gz"))
  192. (sha256
  193. (base32 "18gndjwzdd6vhp59fn8cwn6i6q0v0ym8nmwn65rcykdrzz0nvl72"))
  194. (modules '((guix build utils)))
  195. (snippet
  196. `(begin
  197. (delete-file-recursively "lib")
  198. #t))))
  199. (build-system ant-build-system)
  200. (arguments
  201. `(#:build-target "jar-main"
  202. #:test-target "junit"
  203. #:phases
  204. (modify-phases %standard-phases
  205. (add-after 'unpack 'make-reproducible
  206. (lambda _
  207. (substitute* "build.xml"
  208. (("<attribute name=\"Build-Id\" value=\"[^\"]*\"")
  209. "<attribute name=\"Build-Id\" value=\"\""))
  210. #t))
  211. (add-before 'build 'prepare-build-directories
  212. (lambda _
  213. (mkdir "lib")
  214. (mkdir "lib/build")
  215. #t))
  216. (replace 'install
  217. (lambda* (#:key outputs #:allow-other-keys)
  218. (let* ((out (assoc-ref outputs "out"))
  219. (out-share (string-append out "/share/java")))
  220. (for-each (lambda (name)
  221. (install-file name out-share))
  222. (find-files "build"
  223. "xmlgraphics-commons.*\\.jar$"))
  224. #t))))))
  225. (native-inputs
  226. `(("java-apache-xml-commons-resolver" ,java-apache-xml-commons-resolver)
  227. ("java-asm" ,java-asm)
  228. ("java-cglib" ,java-cglib)
  229. ("java-hamcrest" ,java-hamcrest-core)
  230. ("java-junit" ,java-junit)
  231. ("java-mockito" ,java-mockito-1)
  232. ("java-objenesis" ,java-objenesis)))
  233. (propagated-inputs
  234. `(("java-commons-io" ,java-commons-io)
  235. ("java-commons-logging-minimal" ,java-commons-logging-minimal)))
  236. (home-page "https://xmlgraphics.apache.org/commons/")
  237. (synopsis "XMLGraphics constants")
  238. (description "This package provides XMLGraphics constants (originally
  239. from @code{batik}).")
  240. (license license:asl2.0)))