projects/guix·blob python-team · refs

352 lines · 13.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Danny Milosavljevic <[email protected]>
3;;; Copyright © 2020 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2023 Frank Pursel <[email protected]>
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages batik)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix utils)
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix packages)
27 #:use-module (guix build-system ant)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages java)
31 #:use-module (gnu packages java-xml)
32 #:use-module (gnu packages javascript)
33 #:use-module (gnu packages textutils)
34 #:use-module (gnu packages xml))
35
36(define-public java-libbatik
37 (package
38 (name "java-libbatik")
39 (version "1.16")
40 (source (origin
41 (method url-fetch)
42 (uri (string-append
43 "https://dlcdn.apache.org/xmlgraphics/batik/source/batik-src-"
44 version ".tar.gz"))
45 (sha256
46 (base32
47 "18ys0j7i861ydvimbm3a7dyvny48x5b37zfkvznlys7vcb2qz5z1"))
48 (modules '((guix build utils)))
49 (snippet '(begin
50 ;; Identify and delete bundled jars.
51 (format #t "~%~a~%" "Removing sourced jars")
52 (for-each (lambda (f)
53 (delete-file f)
54 (format #t "Deleted: ~a~%" f))
55 (find-files "." "\\.jar$"))))))
56 (build-system ant-build-system)
57 (arguments
58 `(#:jar-name "batik.jar"
59 #:source-dir "sources/src/main/java"
60 #:test-dir "sources/src/test"
61 ;; Tests are successful -- exclusions in lieu of
62 ;; deleting duplicated util tests.
63 #:test-exclude (list "**/util/*.java")
64 #:phases (modify-phases %standard-phases
65 (add-after 'unpack 'src-consolidation
66 (lambda _
67 (mkdir-p "sources")
68 (let ((cwd (getcwd))
69 (sub-dirs (list "anim"
70 "awt-util"
71 "bridge"
72 "codec"
73 "constants"
74 "css"
75 "dom"
76 "ext"
77 "extension"
78 "gui-util"
79 "gvt"
80 "i18n"
81 "parser"
82 "script"
83 "slideshow"
84 "svgbrowser"
85 "svg-dom"
86 "svggen"
87 "svgpp"
88 "svgrasterizer"
89 "swing"
90 "test"
91 "test-svg"
92 "transcoder"
93 "ttf2svg"
94 "util"
95 "xml"
96 "test-swing")))
97 (for-each (lambda (sdir)
98 (copy-recursively (string-append "batik-"
99 sdir)
100 "sources/")) sub-dirs))
101 ;; Test prep
102 (copy-recursively "test-resources" "sources")
103 ;; Remove scripting subdirs for jpython, and jacl.
104 (for-each (lambda (rfile)
105 (delete-file rfile)
106 (format #t "Deleted: ~s\n" rfile))
107 (append (find-files (string-append
108 "sources/src/main/java/org/"
109 "apache/batik/script/jpython"))
110 (find-files (string-append
111 "sources/src/main/java/org/"
112 "apache/batik/script/jacl")))))))))
113 (native-inputs (list java-jaxen
114 java-jdom
115 quickjs
116 java-jaxp
117 java-junit
118 java-xerces
119 java-xmlgraphics-commons
120 libxslt
121 rhino))
122 (home-page "https://xmlgraphics.apache.org/batik/")
123 (synopsis "Java based toolkit for Scalable Vector Graphics")
124 (description
125 "Batik is a Java-based toolkit for applications or
126applets that want to use images in the Scalable Vector Graphics (SVG)
127format for various purposes, such as display, generation or manipulation.")
128 (license license:asl2.0)))
129
130(define-public java-w3c-smil-3.0
131 (package
132 (name "java-w3c-smil")
133 (version "3.0")
134 (source #f)
135 (build-system ant-build-system)
136 (arguments
137 `(#:jar-name "w3c-smil.jar"
138 #:source-dir "."
139 #:tests? #f ; No tests exist.
140 #:phases
141 (modify-phases %standard-phases
142 (replace 'unpack
143 (lambda* (#:key source #:allow-other-keys)
144 ;; https://www.w3.org/TR/SMIL3/smil-timing.html#q142
145 (mkdir-p "org/w3c/dom/smil")
146 (call-with-output-file "org/w3c/dom/smil/ElementTimeControl.java"
147 (lambda (port)
148 (format port "
149package org.w3c.dom.smil;
150
151import org.w3c.dom.DOMException;
152
153public interface ElementTimeControl {
154 public boolean beginElement();
155
156 public boolean beginElementAt(float offset);
157
158 public boolean endElement();
159
160 public boolean endElementAt(float offset);
161}
162")))
163 (call-with-output-file "org/w3c/dom/smil/TimeEvent.java"
164 (lambda (port)
165 (format port "
166package org.w3c.dom.smil;
167
168import org.w3c.dom.events.Event;
169import org.w3c.dom.views.AbstractView;
170
171public interface TimeEvent extends Event {
172 public AbstractView getView();
173
174 public int getDetail();
175
176 public void initTimeEvent(String typeArg,
177 AbstractView viewArg,
178 int detailArg);
179
180}
181")))
182 #t)))))
183 (native-inputs
184 (list 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.
188SAC is an interface for CSS parsers.")
189 (license license:w3c)))
190
191(define-public java-w3c-svg-1.0
192 (package
193 (name "java-w3c-svg")
194 (version "20010904")
195 (source
196 (origin
197 (method url-fetch)
198 (uri (string-append "http://www.w3.org/TR/2001/REC-SVG-" version
199 "/java-binding.zip"))
200 (sha256
201 (base32
202 "0gnxvx51bg6ijplf6l2q0i1m07101f7fickawshfygnsdjqfdnbp"))))
203 (build-system ant-build-system)
204 (arguments
205 `(#:jar-name "w3c-svg.jar"
206 #:source-dir "."
207 #:tests? #f ; No tests exist.
208 #:phases
209 (modify-phases %standard-phases
210 (replace 'unpack
211 (lambda* (#:key source #:allow-other-keys)
212 (invoke "unzip" source)))
213 (add-after 'unpack 'patch-interface
214 (lambda _
215 ;; Make it compatible with batik.
216 ;; This is equivalent to usingxml commons externals'
217 ;; "externals" part from https://xerces.apache.org/mirrors.cgi
218 (substitute* "SVGFEConvolveMatrixElement.java"
219 (("public SVGAnimatedLength[ ]*getKernelUnitLength")
220 "public SVGAnimatedNumber getKernelUnitLength"))
221 (substitute* "SVGFEMorphologyElement.java"
222 (("public SVGAnimatedLength[ ]*getRadius")
223 "public SVGAnimatedNumber getRadius"))
224 (call-with-output-file "EventListenerInitializer.java"
225 (lambda (port)
226 (format port "
227// License: http://www.apache.org/licenses/LICENSE-2.0
228package org.w3c.dom.svg;
229public interface EventListenerInitializer {
230 public void initializeEventListeners(SVGDocument doc);
231}
232
233")))
234 #t)))))
235 (propagated-inputs
236 (list java-w3c-smil-3.0))
237 (native-inputs
238 (list unzip))
239 (home-page "https://www.w3.org/Style/CSS/SAC/")
240 (synopsis "W3C SVG 1.0 interface")
241 (description "This package provides a SVG 1.0 interface.")
242 (license license:w3c)))
243
244(define-public java-w3c-svg
245 (package
246 (inherit java-w3c-svg-1.0)
247 (version "20110816")
248 (source
249 (origin
250 (method url-fetch)
251 (uri (string-append "http://www.w3.org/TR/2011/REC-SVG11-" version
252 "/java-binding.zip"))
253 (sha256
254 (base32
255 "0jicqcrxav8ggs37amgvvwgc2f0qp1c5wns4rb2i3si83s2m09ns"))))
256 (arguments
257 (substitute-keyword-arguments (package-arguments java-w3c-svg-1.0)
258 ((#:phases phases)
259 `(modify-phases ,phases
260 (delete 'patch-interface)))))
261 (propagated-inputs
262 `())
263 (synopsis "W3C SVG interface")
264 (description "This package provides a SVG interface.")))
265
266(define-public java-w3c-sac
267 (package
268 (name "java-w3c-sac")
269 (version "1.3")
270 (source
271 (origin
272 (method url-fetch)
273 (uri (string-append "https://www.w3.org/2002/06/sacjava-" version
274 ".zip"))
275 (sha256
276 (base32
277 "1djp2nnzf8jchnwz1ij9i5jfx4cg1ryf3lbw133yzjy0wkhcla52"))))
278 (build-system ant-build-system)
279 (arguments
280 `(#:jar-name "w3c-sac.jar"
281 #:source-dir "sac-1.3"
282 #:tests? #f ; No tests exist.
283 #:phases
284 (modify-phases %standard-phases
285 (replace 'unpack
286 (lambda* (#:key source #:allow-other-keys)
287 (invoke "unzip" source))))))
288 (native-inputs
289 (list unzip))
290 (home-page "https://www.w3.org/Style/CSS/SAC/")
291 (synopsis "W3C SAC interface for CSS parsers in Java")
292 (description "This package provides a SAC interface by the W3C.
293SAC is an interface for CSS parsers.")
294 (license license:w3c)))
295
296(define-public java-xmlgraphics-commons
297 (package
298 (name "java-xmlgraphics-commons")
299 (version "2.6")
300 (source
301 (origin
302 (method url-fetch)
303 (uri (string-append
304 "mirror://apache/xmlgraphics/commons/source/xmlgraphics-commons-"
305 version "-src.tar.gz"))
306 (sha256
307 (base32 "18gndjwzdd6vhp59fn8cwn6i6q0v0ym8nmwn65rcykdrzz0nvl72"))
308 (modules '((guix build utils)))
309 (snippet
310 `(begin
311 (delete-file-recursively "lib")
312 #t))))
313 (build-system ant-build-system)
314 (arguments
315 `(#:build-target "jar-main"
316 #:test-target "junit"
317 #:phases
318 (modify-phases %standard-phases
319 (add-after 'unpack 'make-reproducible
320 (lambda _
321 (substitute* "build.xml"
322 (("<attribute name=\"Build-Id\" value=\"[^\"]*\"")
323 "<attribute name=\"Build-Id\" value=\"\""))
324 #t))
325 (add-before 'build 'prepare-build-directories
326 (lambda _
327 (mkdir "lib")
328 (mkdir "lib/build")
329 #t))
330 (replace 'install
331 (lambda* (#:key outputs #:allow-other-keys)
332 (let* ((out (assoc-ref outputs "out"))
333 (out-share (string-append out "/share/java")))
334 (for-each (lambda (name)
335 (install-file name out-share))
336 (find-files "build"
337 "xmlgraphics-commons.*\\.jar$"))
338 #t))))))
339 (native-inputs
340 `(("java-apache-xml-commons-resolver" ,java-apache-xml-commons-resolver)
341 ("java-cglib" ,java-cglib)
342 ("java-hamcrest" ,java-hamcrest-core)
343 ("java-junit" ,java-junit)
344 ("java-mockito" ,java-mockito-1)
345 ("java-objenesis" ,java-objenesis)))
346 (propagated-inputs
347 (list java-commons-io java-commons-logging-minimal))
348 (home-page "https://xmlgraphics.apache.org/commons/")
349 (synopsis "XMLGraphics constants")
350 (description "This package provides XMLGraphics constants (originally
351from @code{batik}).")
352 (license license:asl2.0)))