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