Commit | Line | Data |
---|---|---|
2c4be1ad DM |
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) | |
02803fdf DM |
29 | #:use-module (gnu packages textutils) |
30 | #:use-module (gnu packages xml)) | |
2c4be1ad DM |
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))) | |
da99c46f DM |
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/") | |
9096c006 DM |
142 | (synopsis "W3C SVG 1.0 interface") |
143 | (description "This package provides a SVG 1.0 interface.") | |
da99c46f DM |
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")))) | |
b2eda4a5 DM |
158 | (arguments |
159 | (substitute-keyword-arguments (package-arguments java-w3c-svg-1.0) | |
160 | ((#:phases phases) | |
161 | `(modify-phases ,phases | |
162 | (delete 'patch-interface))))) | |
da99c46f | 163 | (propagated-inputs |
9096c006 DM |
164 | `()) |
165 | (synopsis "W3C SVG interface") | |
166 | (description "This package provides a SVG interface."))) | |
283f57d8 DM |
167 | |
168 | (define-public java-w3c-sac | |
169 | (package | |
170 | (name "java-w3c-sac") | |
171 | (version "1.3") | |
172 | (source | |
173 | (origin | |
174 | (method url-fetch) | |
175 | (uri (string-append "https://www.w3.org/2002/06/sacjava-" version | |
176 | ".zip")) | |
177 | (sha256 | |
178 | (base32 | |
179 | "1djp2nnzf8jchnwz1ij9i5jfx4cg1ryf3lbw133yzjy0wkhcla52")))) | |
180 | (build-system ant-build-system) | |
181 | (arguments | |
182 | `(#:jar-name "w3c-sac.jar" | |
183 | #:source-dir "sac-1.3" | |
184 | #:tests? #f ; No tests exist. | |
185 | #:phases | |
186 | (modify-phases %standard-phases | |
187 | (replace 'unpack | |
188 | (lambda* (#:key source #:allow-other-keys) | |
189 | (invoke "unzip" source)))))) | |
190 | (native-inputs | |
191 | `(("unzip" ,unzip))) | |
192 | (home-page "https://www.w3.org/Style/CSS/SAC/") | |
193 | (synopsis "W3C SAC interface for CSS parsers in Java") | |
194 | (description "This package provides a SAC interface by the W3C. | |
195 | SAC is an interface for CSS parsers.") | |
196 | (license license:w3c))) | |
52d2725a DM |
197 | |
198 | (define-public java-xmlgraphics-commons | |
199 | (package | |
200 | (name "java-xmlgraphics-commons") | |
201 | (version "2.3") | |
202 | (source | |
203 | (origin | |
204 | (method url-fetch) | |
205 | (uri (string-append | |
206 | "mirror://apache/xmlgraphics/commons/source/xmlgraphics-commons-" | |
207 | version "-src.tar.gz")) | |
208 | (sha256 | |
209 | (base32 | |
02803fdf DM |
210 | "0a432a4ca3vgnbada5cy9mlmfzmq6hi4i176drfxrp17q2d43w23")) |
211 | (modules '((guix build utils))) | |
212 | (snippet | |
213 | `(begin | |
214 | (delete-file-recursively "lib") | |
215 | #t)))) | |
52d2725a DM |
216 | (build-system ant-build-system) |
217 | (arguments | |
218 | `(#:build-target "jar-main" | |
05dae403 | 219 | #:test-target "junit" |
52d2725a DM |
220 | #:phases |
221 | (modify-phases %standard-phases | |
222 | (add-after 'unpack 'make-reproducible | |
223 | (lambda _ | |
224 | (substitute* "build.xml" | |
225 | (("<attribute name=\"Build-Id\" value=\"[^\"]*\"") | |
226 | "<attribute name=\"Build-Id\" value=\"\"")) | |
227 | #t)) | |
02803fdf DM |
228 | (add-before 'build 'prepare-build-directories |
229 | (lambda _ | |
230 | (mkdir "lib") | |
231 | (mkdir "lib/build") | |
232 | #t)) | |
52d2725a DM |
233 | (replace 'install |
234 | (lambda* (#:key outputs #:allow-other-keys) | |
235 | (let* ((out (assoc-ref outputs "out")) | |
236 | (out-share (string-append out "/share/java"))) | |
237 | (for-each (lambda (name) | |
238 | (install-file name out-share)) | |
239 | (find-files "build" | |
240 | "xmlgraphics-commons.*\\.jar$")) | |
241 | #t)))))) | |
242 | (native-inputs | |
02803fdf | 243 | `(("java-apache-xml-commons-resolver" ,java-apache-xml-commons-resolver) |
12a0b38c | 244 | ("java-asm" ,java-asm) |
3158425e | 245 | ("java-cglib" ,java-cglib) |
02803fdf DM |
246 | ("java-hamcrest" ,java-hamcrest-core) |
247 | ("java-junit" ,java-junit) | |
248 | ("java-mockito" ,java-mockito-1) | |
249 | ("java-objenesis" ,java-objenesis))) | |
250 | (propagated-inputs | |
251 | `(("java-commons-io" ,java-commons-io) | |
252 | ("java-commons-logging-minimal" ,java-commons-logging-minimal))) | |
52d2725a DM |
253 | (home-page "https://xmlgraphics.apache.org/commons/") |
254 | (synopsis "XMLGraphics constants") | |
255 | (description "This package provides XMLGraphics constants (originally | |
256 | from @code{batik}).") | |
257 | (license license:asl2.0))) |