gnu: python-pandas: Fix build on 32-bit.
[jackhill/guix/guix.git] / gnu / packages / java.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
4 ;;; Copyright © 2016, 2017 Roel Janssen <roel@gnu.org>
5 ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
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
22 (define-module (gnu packages java)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix utils)
27 #:use-module (guix build-system ant)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages attr)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bash)
34 #:use-module (gnu packages certs)
35 #:use-module (gnu packages cpio)
36 #:use-module (gnu packages cups)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages fontutils)
39 #:use-module (gnu packages gawk)
40 #:use-module (gnu packages gcc)
41 #:use-module (gnu packages gl)
42 #:use-module (gnu packages gnuzilla) ;nss
43 #:use-module (gnu packages ghostscript) ;lcms
44 #:use-module (gnu packages gnome)
45 #:use-module (gnu packages gtk)
46 #:use-module (gnu packages image)
47 #:use-module (gnu packages linux) ;alsa
48 #:use-module (gnu packages wget)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages perl)
51 #:use-module (gnu packages kerberos)
52 #:use-module (gnu packages xml)
53 #:use-module (gnu packages xorg)
54 #:use-module (gnu packages zip)
55 #:use-module (gnu packages texinfo)
56 #:use-module ((srfi srfi-1) #:select (fold alist-delete))
57 #:use-module (srfi srfi-11)
58 #:use-module (ice-9 match))
59
60 (define-public java-swt
61 (package
62 (name "java-swt")
63 (version "4.6")
64 (source
65 ;; The types of many variables and procedures differ in the sources
66 ;; dependent on whether the target architecture is a 32-bit system or a
67 ;; 64-bit system. Instead of patching the sources on demand in a build
68 ;; phase we download either the 32-bit archive (which mostly uses "int"
69 ;; types) or the 64-bit archive (which mostly uses "long" types).
70 (let ((hash32 "0jmx1h65wqxsyjzs64i2z6ryiynllxzm13cq90fky2qrzagcw1ir")
71 (hash64 "0wnd01xssdq9pgx5xqh5lfiy3dmk60dzzqdxzdzf883h13692lgy")
72 (file32 "x86")
73 (file64 "x86_64"))
74 (let-values (((hash file)
75 (match (or (%current-target-system) (%current-system))
76 ("x86_64-linux" (values hash64 file64))
77 (_ (values hash32 file32)))))
78 (origin
79 (method url-fetch)
80 (uri (string-append
81 "http://ftp-stud.fht-esslingen.de/pub/Mirrors/"
82 "eclipse/eclipse/downloads/drops4/R-" version
83 "-201606061100/swt-" version "-gtk-linux-" file ".zip"))
84 (sha256 (base32 hash))))))
85 (build-system ant-build-system)
86 (arguments
87 `(#:jar-name "swt.jar"
88 #:tests? #f ; no "check" target
89 #:phases
90 (modify-phases %standard-phases
91 (replace 'unpack
92 (lambda* (#:key source #:allow-other-keys)
93 (and (mkdir "swt")
94 (zero? (system* "unzip" source "-d" "swt"))
95 (chdir "swt")
96 (mkdir "src")
97 (zero? (system* "unzip" "src.zip" "-d" "src")))))
98 ;; The classpath contains invalid icecat jars. Since we don't need
99 ;; anything other than the JDK on the classpath, we can simply unset
100 ;; it.
101 (add-after 'configure 'unset-classpath
102 (lambda _ (unsetenv "CLASSPATH") #t))
103 (add-before 'build 'build-native
104 (lambda* (#:key inputs outputs #:allow-other-keys)
105 (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
106 ;; Build shared libraries. Users of SWT have to set the system
107 ;; property swt.library.path to the "lib" directory of this
108 ;; package output.
109 (mkdir-p lib)
110 (setenv "OUTPUT_DIR" lib)
111 (with-directory-excursion "src"
112 (zero? (system* "bash" "build.sh"))))))
113 (add-after 'install 'install-native
114 (lambda* (#:key outputs #:allow-other-keys)
115 (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
116 (for-each (lambda (file)
117 (install-file file lib))
118 (find-files "." "\\.so$"))
119 #t))))))
120 (inputs
121 `(("xulrunner" ,icecat)
122 ("gtk" ,gtk+-2)
123 ("libxtst" ,libxtst)
124 ("libxt" ,libxt)
125 ("mesa" ,mesa)
126 ("glu" ,glu)))
127 (native-inputs
128 `(("pkg-config" ,pkg-config)
129 ("unzip" ,unzip)))
130 (home-page "https://www.eclipse.org/swt/")
131 (synopsis "Widget toolkit for Java")
132 (description
133 "SWT is a widget toolkit for Java designed to provide efficient, portable
134 access to the user-interface facilities of the operating systems on which it
135 is implemented.")
136 ;; SWT code is licensed under EPL1.0
137 ;; Gnome and Gtk+ bindings contain code licensed under LGPLv2.1
138 ;; Cairo bindings contain code under MPL1.1
139 ;; XULRunner 1.9 bindings contain code under MPL2.0
140 (license (list
141 license:epl1.0
142 license:mpl1.1
143 license:mpl2.0
144 license:lgpl2.1+))))
145
146 (define-public clojure
147 (let* ((remove-archives '(begin
148 (for-each delete-file
149 (find-files "." ".*\\.(jar|zip)"))
150 #t))
151 (submodule (lambda (prefix version hash)
152 (origin
153 (method url-fetch)
154 (uri (string-append "https://github.com/clojure/"
155 prefix version ".tar.gz"))
156 (sha256 (base32 hash))
157 (modules '((guix build utils)))
158 (snippet remove-archives)))))
159 (package
160 (name "clojure")
161 (version "1.8.0")
162 (source
163 (origin
164 (method url-fetch)
165 (uri
166 (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
167 version "/clojure-" version ".zip"))
168 (sha256
169 (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))
170 (modules '((guix build utils)))
171 (snippet remove-archives)))
172 (build-system ant-build-system)
173 (arguments
174 `(#:modules ((guix build ant-build-system)
175 (guix build utils)
176 (ice-9 ftw)
177 (ice-9 regex)
178 (srfi srfi-1)
179 (srfi srfi-26))
180 #:test-target "test"
181 #:phases
182 (modify-phases %standard-phases
183 (add-after 'unpack 'unpack-submodule-sources
184 (lambda* (#:key inputs #:allow-other-keys)
185 (for-each
186 (lambda (name)
187 (mkdir-p name)
188 (with-directory-excursion name
189 (or (zero? (system* "tar"
190 ;; Use xz for repacked tarball.
191 "--xz"
192 "--extract"
193 "--verbose"
194 "--file" (assoc-ref inputs name)
195 "--strip-components=1"))
196 (error "failed to unpack tarball" name)))
197 (copy-recursively (string-append name "/src/main/clojure/")
198 "src/clj/"))
199 '("data-generators-src"
200 "java-classpath-src"
201 "test-check-src"
202 "test-generative-src"
203 "tools-namespace-src"
204 "tools-reader-src"))
205 #t))
206 ;; The javadoc target is not built by default.
207 (add-after 'build 'build-doc
208 (lambda _
209 (zero? (system* "ant" "javadoc"))))
210 ;; Needed since no install target is provided.
211 (replace 'install
212 (lambda* (#:key outputs #:allow-other-keys)
213 (let ((java-dir (string-append (assoc-ref outputs "out")
214 "/share/java/")))
215 ;; Install versioned to avoid collisions.
216 (install-file (string-append "clojure-" ,version ".jar")
217 java-dir)
218 #t)))
219 ;; Needed since no install-doc target is provided.
220 (add-after 'install 'install-doc
221 (lambda* (#:key outputs #:allow-other-keys)
222 (let ((doc-dir (string-append (assoc-ref outputs "out")
223 "/share/doc/clojure-"
224 ,version "/")))
225 (copy-recursively "doc/clojure" doc-dir)
226 (copy-recursively "target/javadoc/"
227 (string-append doc-dir "javadoc/"))
228 (for-each (cut install-file <> doc-dir)
229 (filter (cut string-match
230 ".*\\.(html|markdown|md|txt)"
231 <>)
232 (scandir "./")))
233 #t))))))
234 ;; The native-inputs below are needed to run the tests.
235 (native-inputs
236 `(("data-generators-src"
237 ,(submodule "data.generators/archive/data.generators-"
238 "0.1.2"
239 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
240 ("java-classpath-src"
241 ,(submodule "java.classpath/archive/java.classpath-"
242 "0.2.3"
243 "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
244 ("test-check-src"
245 ,(submodule "test.check/archive/test.check-"
246 "0.9.0"
247 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
248 ("test-generative-src"
249 ,(submodule "test.generative/archive/test.generative-"
250 "0.5.2"
251 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
252 ("tools-namespace-src"
253 ,(submodule "tools.namespace/archive/tools.namespace-"
254 "0.2.11"
255 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))
256 ("tools-reader-src"
257 ,(submodule "tools.reader/archive/tools.reader-"
258 "0.10.0"
259 "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))))
260 (home-page "https://clojure.org/")
261 (synopsis "Lisp dialect running on the JVM")
262 (description "Clojure is a dynamic, general-purpose programming language,
263 combining the approachability and interactive development of a scripting
264 language with an efficient and robust infrastructure for multithreaded
265 programming. Clojure is a compiled language, yet remains completely dynamic
266 – every feature supported by Clojure is supported at runtime. Clojure
267 provides easy access to the Java frameworks, with optional type hints and type
268 inference, to ensure that calls to Java can avoid reflection.
269
270 Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
271 and a powerful macro system. Clojure is predominantly a functional programming
272 language, and features a rich set of immutable, persistent data structures.
273 When mutable state is needed, Clojure offers a software transactional memory
274 system and reactive Agent system that ensure clean, correct, multithreaded
275 designs.")
276 ;; Clojure is licensed under EPL1.0
277 ;; ASM bytecode manipulation library is licensed under BSD-3
278 ;; Guava Murmur3 hash implementation is licensed under APL2.0
279 ;; src/clj/repl.clj is licensed under CPL1.0
280 ;;
281 ;; See readme.html or readme.txt for details.
282 (license (list license:epl1.0
283 license:bsd-3
284 license:asl2.0
285 license:cpl1.0)))))
286
287 (define-public ant
288 (package
289 (name "ant")
290 (version "1.9.6")
291 (source (origin
292 (method url-fetch)
293 (uri (string-append "mirror://apache/ant/source/apache-ant-"
294 version "-src.tar.gz"))
295 (sha256
296 (base32
297 "1396wflczyxjxl603dhxjvd559f289lha9y2f04f71c7hapjl3am"))))
298 (build-system gnu-build-system)
299 (arguments
300 `(#:tests? #f ; no "check" target
301 #:phases
302 (alist-cons-after
303 'unpack 'remove-scripts
304 ;; Remove bat / cmd scripts for DOS as well as the antRun and runant
305 ;; wrappers.
306 (lambda _
307 (for-each delete-file
308 (find-files "src/script"
309 "(.*\\.(bat|cmd)|runant.*|antRun.*)")))
310 (alist-replace
311 'build
312 (lambda _
313 (setenv "JAVA_HOME" (string-append (assoc-ref %build-inputs "gcj")
314 "/lib/jvm"))
315 ;; Disable tests to avoid dependency on hamcrest-core, which needs
316 ;; Ant to build. This is necessary in addition to disabling the
317 ;; "check" phase, because the dependency on "test-jar" would always
318 ;; result in the tests to be run.
319 (substitute* "build.xml"
320 (("depends=\"jars,test-jar\"") "depends=\"jars\""))
321 (zero? (system* "bash" "bootstrap.sh"
322 (string-append "-Ddist.dir="
323 (assoc-ref %outputs "out")))))
324 (alist-delete
325 'configure
326 (alist-delete 'install %standard-phases))))))
327 (native-inputs
328 `(("gcj" ,gcj)))
329 (home-page "http://ant.apache.org")
330 (synopsis "Build tool for Java")
331 (description
332 "Ant is a platform-independent build tool for Java. It is similar to
333 make but is implemented using the Java language, requires the Java platform,
334 and is best suited to building Java projects. Ant uses XML to describe the
335 build process and its dependencies, whereas Make uses Makefile format.")
336 (license license:asl2.0)))
337
338 (define-public icedtea-7
339 (let* ((version "2.6.9")
340 (drop (lambda (name hash)
341 (origin
342 (method url-fetch)
343 (uri (string-append
344 "http://icedtea.classpath.org/download/drops/"
345 "/icedtea7/" version "/" name ".tar.bz2"))
346 (sha256 (base32 hash))))))
347 (package
348 (name "icedtea")
349 (version version)
350 (source (origin
351 (method url-fetch)
352 (uri (string-append
353 "http://icedtea.wildebeest.org/download/source/icedtea-"
354 version ".tar.xz"))
355 (sha256
356 (base32
357 "1slmajiakq7sk137vgqq9c93r5s620a46lw2jwbnzxhysjw3wkwf"))
358 (modules '((guix build utils)))
359 (snippet
360 '(substitute* "Makefile.in"
361 ;; link against libgcj to avoid linker error
362 (("-o native-ecj")
363 "-lgcj -o native-ecj")
364 ;; do not leak information about the build host
365 (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
366 "DISTRIBUTION_ID=\"\\\"guix\\\"\"")))))
367 (build-system gnu-build-system)
368 (outputs '("out" ; Java Runtime Environment
369 "jdk" ; Java Development Kit
370 "doc")) ; all documentation
371 (arguments
372 `(;; There are many test failures. Some are known to
373 ;; fail upstream, others relate to not having an X
374 ;; server running at test time, yet others are a
375 ;; complete mystery to me.
376
377 ;; hotspot: passed: 241; failed: 45; error: 2
378 ;; langtools: passed: 1,934; failed: 26
379 ;; jdk: unknown
380 #:tests? #f
381
382 ;; The DSOs use $ORIGIN to refer to each other, but (guix build
383 ;; gremlin) doesn't support it yet, so skip this phase.
384 #:validate-runpath? #f
385
386 ;; Apparently, the C locale is needed for some of the tests.
387 #:locale "C"
388
389 #:modules ((guix build utils)
390 (guix build gnu-build-system)
391 (ice-9 match)
392 (ice-9 popen)
393 (ice-9 rdelim)
394 (srfi srfi-19)
395 (srfi srfi-26))
396
397 #:configure-flags
398 (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
399 (ecj (string-append gcjdir "/share/java/ecj.jar"))
400 (jdk (string-append gcjdir "/lib/jvm/"))
401 (gcj (string-append gcjdir "/bin/gcj")))
402 ;; TODO: package pcsc and sctp, and add to inputs
403 `("--disable-system-pcsc"
404 "--disable-system-sctp"
405 "--enable-bootstrap"
406 "--enable-nss"
407 "--without-rhino"
408 "--disable-downloading"
409 "--disable-tests" ;they are run in the check phase instead
410 "--with-openjdk-src-dir=./openjdk.src"
411 ,(string-append "--with-javac=" jdk "/bin/javac")
412 ,(string-append "--with-ecj-jar=" ecj)
413 ,(string-append "--with-gcj=" gcj)
414 ,(string-append "--with-jdk-home=" jdk)
415 ,(string-append "--with-java=" jdk "/bin/java")))
416
417 #:phases
418 (modify-phases %standard-phases
419 (replace 'unpack
420 (lambda* (#:key source inputs #:allow-other-keys)
421 (let ((target (string-append "icedtea-" ,version))
422 (unpack (lambda* (name #:optional dir)
423 (let ((dir (or dir
424 (string-drop-right name 5))))
425 (mkdir dir)
426 (zero? (system* "tar" "xvf"
427 (assoc-ref inputs name)
428 "-C" dir
429 "--strip-components=1"))))))
430 (mkdir target)
431 (and
432 (zero? (system* "tar" "xvf" source
433 "-C" target "--strip-components=1"))
434 (chdir target)
435 (unpack "openjdk-src" "openjdk.src")
436 (with-directory-excursion "openjdk.src"
437 (for-each unpack
438 (filter (cut string-suffix? "-drop" <>)
439 (map (match-lambda
440 ((name . _) name))
441 inputs))))
442 #t))))
443 (add-after 'unpack 'fix-x11-extension-include-path
444 (lambda* (#:key inputs #:allow-other-keys)
445 (substitute* "openjdk.src/jdk/make/sun/awt/mawt.gmk"
446 (((string-append "\\$\\(firstword \\$\\(wildcard "
447 "\\$\\(OPENWIN_HOME\\)"
448 "/include/X11/extensions\\).*$"))
449 (string-append (assoc-ref inputs "libxrender")
450 "/include/X11/extensions"
451 " -I" (assoc-ref inputs "libxtst")
452 "/include/X11/extensions"
453 " -I" (assoc-ref inputs "libxinerama")
454 "/include/X11/extensions"))
455 (("\\$\\(wildcard /usr/include/X11/extensions\\)\\)") ""))
456 #t))
457 (add-after 'unpack 'patch-paths
458 (lambda _
459 ;; buildtree.make generates shell scripts, so we need to replace
460 ;; the generated shebang
461 (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make")
462 (("/bin/sh") (which "bash")))
463
464 (let ((corebin (string-append
465 (assoc-ref %build-inputs "coreutils") "/bin/"))
466 (binbin (string-append
467 (assoc-ref %build-inputs "binutils") "/bin/"))
468 (grepbin (string-append
469 (assoc-ref %build-inputs "grep") "/bin/")))
470 (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk"
471 "openjdk.src/corba/make/common/shared/Defs-linux.gmk")
472 (("UNIXCOMMAND_PATH = /bin/")
473 (string-append "UNIXCOMMAND_PATH = " corebin))
474 (("USRBIN_PATH = /usr/bin/")
475 (string-append "USRBIN_PATH = " corebin))
476 (("DEVTOOLS_PATH *= */usr/bin/")
477 (string-append "DEVTOOLS_PATH = " corebin))
478 (("COMPILER_PATH *= */usr/bin/")
479 (string-append "COMPILER_PATH = "
480 (assoc-ref %build-inputs "gcc") "/bin/"))
481 (("DEF_OBJCOPY *=.*objcopy")
482 (string-append "DEF_OBJCOPY = " (which "objcopy"))))
483
484 ;; fix path to alsa header
485 (substitute* "openjdk.src/jdk/make/common/shared/Sanity.gmk"
486 (("ALSA_INCLUDE=/usr/include/alsa/version.h")
487 (string-append "ALSA_INCLUDE="
488 (assoc-ref %build-inputs "alsa-lib")
489 "/include/alsa/version.h")))
490
491 ;; fix hard-coded utility paths
492 (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk"
493 "openjdk.src/corba/make/common/shared/Defs-utils.gmk")
494 (("ECHO *=.*echo")
495 (string-append "ECHO = " (which "echo")))
496 (("^GREP *=.*grep")
497 (string-append "GREP = " (which "grep")))
498 (("EGREP *=.*egrep")
499 (string-append "EGREP = " (which "egrep")))
500 (("CPIO *=.*cpio")
501 (string-append "CPIO = " (which "cpio")))
502 (("READELF *=.*readelf")
503 (string-append "READELF = " (which "readelf")))
504 (("^ *AR *=.*ar")
505 (string-append "AR = " (which "ar")))
506 (("^ *TAR *=.*tar")
507 (string-append "TAR = " (which "tar")))
508 (("AS *=.*as")
509 (string-append "AS = " (which "as")))
510 (("LD *=.*ld")
511 (string-append "LD = " (which "ld")))
512 (("STRIP *=.*strip")
513 (string-append "STRIP = " (which "strip")))
514 (("NM *=.*nm")
515 (string-append "NM = " (which "nm")))
516 (("^SH *=.*sh")
517 (string-append "SH = " (which "bash")))
518 (("^FIND *=.*find")
519 (string-append "FIND = " (which "find")))
520 (("LDD *=.*ldd")
521 (string-append "LDD = " (which "ldd")))
522 (("NAWK *=.*(n|g)awk")
523 (string-append "NAWK = " (which "gawk")))
524 (("XARGS *=.*xargs")
525 (string-append "XARGS = " (which "xargs")))
526 (("UNZIP *=.*unzip")
527 (string-append "UNZIP = " (which "unzip")))
528 (("ZIPEXE *=.*zip")
529 (string-append "ZIPEXE = " (which "zip")))
530 (("SED *=.*sed")
531 (string-append "SED = " (which "sed"))))
532
533 ;; Some of these timestamps cause problems as they are more than
534 ;; 10 years ago, failing the build process.
535 (substitute*
536 "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties"
537 (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN")
538 (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
539 (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
540 (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY")))
541 #t))
542 (add-before 'configure 'set-additional-paths
543 (lambda* (#:key inputs #:allow-other-keys)
544 (let ( ;; Get target-specific include directory so that
545 ;; libgcj-config.h is found when compiling hotspot.
546 (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include"))
547 (str (read-line port)))
548 (close-pipe port)
549 str)))
550 (substitute* "openjdk.src/jdk/make/common/shared/Sanity.gmk"
551 (("ALSA_INCLUDE=/usr/include/alsa/version.h")
552 (string-append "ALSA_INCLUDE="
553 (assoc-ref inputs "alsa-lib")
554 "/include/alsa/version.h")))
555 (setenv "CC" "gcc")
556 (setenv "CPATH"
557 (string-append gcjinclude ":"
558 (assoc-ref inputs "libxcomposite")
559 "/include/X11/extensions" ":"
560 (assoc-ref inputs "libxrender")
561 "/include/X11/extensions" ":"
562 (assoc-ref inputs "libxtst")
563 "/include/X11/extensions" ":"
564 (assoc-ref inputs "libxinerama")
565 "/include/X11/extensions" ":"
566 (or (getenv "CPATH") "")))
567 (setenv "ALT_OBJCOPY" (which "objcopy"))
568 (setenv "ALT_CUPS_HEADERS_PATH"
569 (string-append (assoc-ref inputs "cups")
570 "/include"))
571 (setenv "ALT_FREETYPE_HEADERS_PATH"
572 (string-append (assoc-ref inputs "freetype")
573 "/include"))
574 (setenv "ALT_FREETYPE_LIB_PATH"
575 (string-append (assoc-ref inputs "freetype")
576 "/lib")))
577 #t))
578 (add-before 'check 'fix-test-framework
579 (lambda _
580 ;; Fix PATH in test environment
581 (substitute* "test/jtreg/com/sun/javatest/regtest/Main.java"
582 (("PATH=/bin:/usr/bin")
583 (string-append "PATH=" (getenv "PATH"))))
584 (substitute* "test/jtreg/com/sun/javatest/util/SysEnv.java"
585 (("/usr/bin/env") (which "env")))
586 (substitute* "openjdk.src/hotspot/test/test_env.sh"
587 (("/bin/rm") (which "rm"))
588 (("/bin/cp") (which "cp"))
589 (("/bin/mv") (which "mv")))
590 #t))
591 (add-before 'check 'fix-hotspot-tests
592 (lambda _
593 (with-directory-excursion "openjdk.src/hotspot/test/"
594 (substitute* "jprt.config"
595 (("PATH=\"\\$\\{path4sdk\\}\"")
596 (string-append "PATH=" (getenv "PATH")))
597 (("make=/usr/bin/make")
598 (string-append "make=" (which "make"))))
599 (substitute* '("runtime/6626217/Test6626217.sh"
600 "runtime/7110720/Test7110720.sh")
601 (("/bin/rm") (which "rm"))
602 (("/bin/cp") (which "cp"))
603 (("/bin/mv") (which "mv"))))
604 #t))
605 (add-before 'check 'fix-jdk-tests
606 (lambda _
607 (with-directory-excursion "openjdk.src/jdk/test/"
608 (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
609 (("/bin/pwd") (which "pwd")))
610 (substitute* "com/sun/jdi/ShellScaffold.sh"
611 (("/bin/kill") (which "kill")))
612 (substitute* "start-Xvfb.sh"
613 ;;(("/usr/bin/X11/Xvfb") (which "Xvfb"))
614 (("/usr/bin/nohup") (which "nohup")))
615 (substitute* "javax/security/auth/Subject/doAs/Test.sh"
616 (("/bin/rm") (which "rm")))
617 (substitute* "tools/launcher/MultipleJRE.sh"
618 (("echo \"#!/bin/sh\"")
619 (string-append "echo \"#!" (which "rm") "\""))
620 (("/usr/bin/zip") (which "zip")))
621 (substitute* "com/sun/jdi/OnThrowTest.java"
622 (("#!/bin/sh") (string-append "#!" (which "sh"))))
623 (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java"
624 (("/usr/bin/uptime") (which "uptime")))
625 (substitute* "java/lang/ProcessBuilder/Basic.java"
626 (("/usr/bin/env") (which "env"))
627 (("/bin/false") (which "false"))
628 (("/bin/true") (which "true"))
629 (("/bin/cp") (which "cp"))
630 (("/bin/sh") (which "sh")))
631 (substitute* "java/lang/ProcessBuilder/FeelingLucky.java"
632 (("/bin/sh") (which "sh")))
633 (substitute* "java/lang/ProcessBuilder/Zombies.java"
634 (("/usr/bin/perl") (which "perl"))
635 (("/bin/ps") (which "ps"))
636 (("/bin/true") (which "true")))
637 (substitute* "java/lang/Runtime/exec/ConcurrentRead.java"
638 (("/usr/bin/tee") (which "tee")))
639 (substitute* "java/lang/Runtime/exec/ExecWithDir.java"
640 (("/bin/true") (which "true")))
641 (substitute* "java/lang/Runtime/exec/ExecWithInput.java"
642 (("/bin/cat") (which "cat")))
643 (substitute* "java/lang/Runtime/exec/ExitValue.java"
644 (("/bin/sh") (which "sh"))
645 (("/bin/true") (which "true"))
646 (("/bin/kill") (which "kill")))
647 (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java"
648 (("/usr/bin/echo") (which "echo")))
649 (substitute* "java/lang/Runtime/exec/LotsOfOutput.java"
650 (("/usr/bin/cat") (which "cat")))
651 (substitute* "java/lang/Runtime/exec/SleepyCat.java"
652 (("/bin/cat") (which "cat"))
653 (("/bin/sleep") (which "sleep"))
654 (("/bin/sh") (which "sh")))
655 (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java"
656 (("/bin/cat") (which "cat")))
657 (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java"
658 (("/bin/chmod") (which "chmod")))
659 (substitute* "java/util/zip/ZipFile/Assortment.java"
660 (("/bin/sh") (which "sh"))))
661 #t))
662 (replace 'check
663 (lambda _
664 ;; The "make check-*" targets always return zero, so we need to
665 ;; check for errors in the associated log files to determine
666 ;; whether any tests have failed.
667 (use-modules (ice-9 rdelim))
668 (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
669 (checker (lambda (port)
670 (let loop ()
671 (let ((line (read-line port)))
672 (cond
673 ((eof-object? line) #t)
674 ((regexp-exec error-pattern line) #f)
675 (else (loop)))))))
676 (run-test (lambda (test)
677 (system* "make" test)
678 (call-with-input-file
679 (string-append "test/" test ".log")
680 checker))))
681 (or #t ; skip tests
682 (and (run-test "check-hotspot")
683 (run-test "check-langtools")
684 (run-test "check-jdk"))))))
685 (replace 'install
686 (lambda* (#:key outputs #:allow-other-keys)
687 (let ((doc (string-append (assoc-ref outputs "doc")
688 "/share/doc/icedtea"))
689 (jre (assoc-ref outputs "out"))
690 (jdk (assoc-ref outputs "jdk")))
691 (copy-recursively "openjdk.build/docs" doc)
692 (copy-recursively "openjdk.build/j2re-image" jre)
693 (copy-recursively "openjdk.build/j2sdk-image" jdk))
694 #t))
695 ;; By default IcedTea only generates an empty keystore. In order to
696 ;; be able to use certificates in Java programs we need to generate a
697 ;; keystore from a set of certificates. For convenience we use the
698 ;; certificates from the nss-certs package.
699 (add-after 'install 'install-keystore
700 (lambda* (#:key inputs outputs #:allow-other-keys)
701 (let* ((keystore "cacerts")
702 (certs-dir (string-append (assoc-ref inputs "nss-certs")
703 "/etc/ssl/certs"))
704 (keytool (string-append (assoc-ref outputs "jdk")
705 "/bin/keytool")))
706 (define (extract-cert file target)
707 (call-with-input-file file
708 (lambda (in)
709 (call-with-output-file target
710 (lambda (out)
711 (let loop ((line (read-line in 'concat))
712 (copying? #f))
713 (cond
714 ((eof-object? line) #t)
715 ((string-prefix? "-----BEGIN" line)
716 (display line out)
717 (loop (read-line in 'concat) #t))
718 ((string-prefix? "-----END" line)
719 (display line out)
720 #t)
721 (else
722 (when copying? (display line out))
723 (loop (read-line in 'concat) copying?)))))))))
724 (define (import-cert cert)
725 (format #t "Importing certificate ~a\n" (basename cert))
726 (let ((temp "tmpcert"))
727 (extract-cert cert temp)
728 (let ((port (open-pipe* OPEN_WRITE keytool
729 "-import"
730 "-alias" (basename cert)
731 "-keystore" keystore
732 "-storepass" "changeit"
733 "-file" temp)))
734 (display "yes\n" port)
735 (when (not (zero? (status:exit-val (close-pipe port))))
736 (format #t "failed to import ~a\n" cert)))
737 (delete-file temp)))
738
739 ;; This is necessary because the certificate directory contains
740 ;; files with non-ASCII characters in their names.
741 (setlocale LC_ALL "en_US.utf8")
742 (setenv "LC_ALL" "en_US.utf8")
743
744 (for-each import-cert (find-files certs-dir "\\.pem$"))
745 (mkdir-p (string-append (assoc-ref outputs "out")
746 "/lib/security"))
747 (mkdir-p (string-append (assoc-ref outputs "jdk")
748 "/jre/lib/security"))
749
750 ;; The cacerts files we are going to overwrite are chmod'ed as
751 ;; read-only (444) in icedtea-8 (which derives from this
752 ;; package). We have to change this so we can overwrite them.
753 (chmod (string-append (assoc-ref outputs "out")
754 "/lib/security/" keystore) #o644)
755 (chmod (string-append (assoc-ref outputs "jdk")
756 "/jre/lib/security/" keystore) #o644)
757
758 (install-file keystore
759 (string-append (assoc-ref outputs "out")
760 "/lib/security"))
761 (install-file keystore
762 (string-append (assoc-ref outputs "jdk")
763 "/jre/lib/security"))
764 #t))))))
765 (native-inputs
766 `(("openjdk-src"
767 ,(drop "openjdk"
768 "08a4d1sg5m9l99lc7gafc7dmzmf4d8jvij5pffxv8rf6pk7psk24"))
769 ("corba-drop"
770 ,(drop "corba"
771 "12br49cfrqgvms0bnaij7fvnakvb6q8dlpqja64rg5q5r3x4gps8"))
772 ("jaxp-drop"
773 ,(drop "jaxp"
774 "07v2y3pll6z2wma94qilgffwyn2n4jna01mrhqwkb27whfpjfkmz"))
775 ("jaxws-drop"
776 ,(drop "jaxws"
777 "18rw64jjpq14v56d0q1xvz8knl0kf02rcday7fvlaxrbbj19km55"))
778 ("jdk-drop"
779 ,(drop "jdk"
780 "1ig7xipi3vzm6cphy5fdraxi72p27xsg2qb51yqx9qwsmlrv1zj4"))
781 ("langtools-drop"
782 ,(drop "langtools"
783 "0sn9qv9nnhaan2smbhrv54lfhwsjhgd3b3h736p5d2hzpw8kicry"))
784 ("hotspot-drop"
785 ,(drop "hotspot"
786 "16ijxy8br8dla339m4i90wr9xpf7s8z3nrhfyxm7jahr8injpzyl"))
787 ("ant" ,ant)
788 ("attr" ,attr)
789 ("autoconf" ,autoconf)
790 ("automake" ,automake)
791 ("coreutils" ,coreutils)
792 ("diffutils" ,diffutils) ;for tests
793 ("gawk" ,gawk)
794 ("grep" ,grep)
795 ("libtool" ,libtool)
796 ("pkg-config" ,pkg-config)
797 ("wget" ,wget)
798 ("which" ,which)
799 ("cpio" ,cpio)
800 ("zip" ,zip)
801 ("unzip" ,unzip)
802 ("fastjar" ,fastjar)
803 ("libxslt" ,libxslt) ;for xsltproc
804 ("nss-certs" ,nss-certs)
805 ("perl" ,perl)
806 ("procps" ,procps) ;for "free", even though I'm not sure we should use it
807 ("gcj" ,gcj)))
808 (inputs
809 `(("alsa-lib" ,alsa-lib)
810 ("cups" ,cups)
811 ("libx11" ,libx11)
812 ("libxcomposite" ,libxcomposite)
813 ("libxt" ,libxt)
814 ("libxtst" ,libxtst)
815 ("libxi" ,libxi)
816 ("libxinerama" ,libxinerama)
817 ("libxrender" ,libxrender)
818 ("libjpeg" ,libjpeg)
819 ("libpng" ,libpng)
820 ("mit-krb5" ,mit-krb5)
821 ("nss" ,nss)
822 ("giflib" ,giflib)
823 ("fontconfig" ,fontconfig)
824 ("freetype" ,freetype)
825 ("lcms" ,lcms)
826 ("zlib" ,zlib)
827 ("gtk" ,gtk+-2)))
828 (home-page "http://icedtea.classpath.org")
829 (synopsis "Java development kit")
830 (description
831 "This package provides the Java development kit OpenJDK built with the
832 IcedTea build harness.")
833 ;; IcedTea is released under the GPL2 + Classpath exception, which is the
834 ;; same license as both GNU Classpath and OpenJDK.
835 (license license:gpl2+))))
836
837 (define-public icedtea-8
838 (let* ((version "3.3.0")
839 (drop (lambda (name hash)
840 (origin
841 (method url-fetch)
842 (uri (string-append
843 "http://icedtea.classpath.org/download/drops/"
844 "/icedtea8/" version "/" name ".tar.xz"))
845 (sha256 (base32 hash))))))
846 (package (inherit icedtea-7)
847 (version "3.3.0")
848 (source (origin
849 (method url-fetch)
850 (uri (string-append
851 "http://icedtea.wildebeest.org/download/source/icedtea-"
852 version ".tar.xz"))
853 (sha256
854 (base32
855 "02vmxa6gc6gizcri1fy797qmmm9y77vgi7gy9pwkk4agcw4zyr5p"))
856 (modules '((guix build utils)))
857 (snippet
858 '(begin
859 (substitute* "acinclude.m4"
860 ;; Do not embed build time
861 (("(DIST_ID=\"Custom build).*$" _ prefix)
862 (string-append prefix "\"\n"))
863 ;; Do not leak information about the build host
864 (("DIST_NAME=\"\\$build_os\"")
865 "DIST_NAME=\"guix\""))
866 #t))))
867 (arguments
868 (substitute-keyword-arguments (package-arguments icedtea-7)
869 ((#:configure-flags flags)
870 `(let ((jdk (assoc-ref %build-inputs "jdk")))
871 `(;;"--disable-bootstrap"
872 "--enable-bootstrap"
873 "--enable-nss"
874 "--disable-downloading"
875 "--disable-system-pcsc"
876 "--disable-system-sctp"
877 "--disable-tests" ;they are run in the check phase instead
878 "--with-openjdk-src-dir=./openjdk.src"
879 ,(string-append "--with-jdk-home=" jdk))))
880 ((#:phases phases)
881 `(modify-phases ,phases
882 (delete 'fix-x11-extension-include-path)
883 (delete 'patch-paths)
884 (delete 'set-additional-paths)
885 (delete 'patch-patches)
886 (add-after 'unpack 'patch-jni-libs
887 ;; Hardcode dynamically loaded libraries.
888 (lambda _
889 (let* ((library-path (search-path-as-string->list
890 (getenv "LIBRARY_PATH")))
891 (find-library (lambda (name)
892 (search-path
893 library-path
894 (string-append "lib" name ".so")))))
895 (for-each
896 (lambda (file)
897 (catch 'encoding-error
898 (lambda ()
899 (substitute* file
900 (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
901 _ name version)
902 (format #f "\"~a\"" (find-library name)))
903 (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
904 (format #f "\"~a\"" (find-library name)))))
905 (lambda _
906 ;; Those are safe to skip.
907 (format (current-error-port)
908 "warning: failed to substitute: ~a~%"
909 file))))
910 (find-files "openjdk.src/jdk/src/solaris/native"
911 "\\.c|\\.h"))
912 #t)))
913 (replace 'install
914 (lambda* (#:key outputs #:allow-other-keys)
915 (let ((doc (string-append (assoc-ref outputs "doc")
916 "/share/doc/icedtea"))
917 (jre (assoc-ref outputs "out"))
918 (jdk (assoc-ref outputs "jdk")))
919 (copy-recursively "openjdk.build/docs" doc)
920 (copy-recursively "openjdk.build/images/j2re-image" jre)
921 (copy-recursively "openjdk.build/images/j2sdk-image" jdk)
922 #t)))))))
923 (native-inputs
924 `(("jdk" ,icedtea-7 "jdk")
925 ("openjdk-src"
926 ,(drop "openjdk"
927 "0889n19w6rvpzxgmmk9hlgzdh9ya95qkc2ajgpnzr3h69g15nz48"))
928 ("corba-drop"
929 ,(drop "corba"
930 "0qcb72hhlsjgp6h9wd048qgyc88b7lfnxyc51xfyav0nhpfjnj8r"))
931 ("jaxp-drop"
932 ,(drop "jaxp"
933 "1vyc7dw10x5k45jmi348y8min6sg651ns12zzn30fjzhpfi36nds"))
934 ("jaxws-drop"
935 ,(drop "jaxws"
936 "1dki6p39z1ms94cjvj5hd9q75q75g244c0xib82pma3q74jg6hx4"))
937 ("jdk-drop"
938 ,(drop "jdk"
939 "17czby3nylcglp7l3d90a4pz1izc1sslifv8hrmynm9hn4m9d3k8"))
940 ("langtools-drop"
941 ,(drop "langtools"
942 "1h4azc21k58g9gn2y686wrvn9ahgac0ii7jhrrrmb5c1kjs0y2qv"))
943 ("hotspot-drop"
944 ,(drop "hotspot"
945 "12bfgwhrjfhgj6a2dsysdwhirg0jx88pi44y7s8a1bdan1mp03r8"))
946 ("nashorn-drop"
947 ,(drop "nashorn"
948 "0bg9r16jffc64fhyczn4jpx7bkfw7w62prw65mh66vshqk4lbh0f"))
949 ("shenandoah-drop"
950 ,(drop "shenandoah"
951 "0abjlsvz669i06mlks28wnh11mm55y5613990pn5j7hfbw8a34q5"))
952 ,@(fold alist-delete (package-native-inputs icedtea-7)
953 '("gcj" "openjdk-src" "corba-drop" "jaxp-drop" "jaxws-drop"
954 "jdk-drop" "langtools-drop" "hotspot-drop")))))))
955
956 (define-public icedtea icedtea-7)
957
958 (define-public java-xz
959 (package
960 (name "java-xz")
961 (version "1.6")
962 (source (origin
963 (method url-fetch)
964 (uri (string-append "http://tukaani.org/xz/xz-java-" version ".zip"))
965 (sha256
966 (base32
967 "1z3p1ri1gvl07inxn0agx44ck8n7wrzfmvkz8nbq3njn8r9wba8x"))))
968 (build-system ant-build-system)
969 (arguments
970 `(#:tests? #f ; There are no tests to run.
971 #:jar-name ,(string-append "xz-" version ".jar")
972 #:phases
973 (modify-phases %standard-phases
974 ;; The unpack phase enters the "maven" directory by accident.
975 (add-after 'unpack 'chdir
976 (lambda _ (chdir "..") #t)))))
977 (native-inputs
978 `(("unzip" ,unzip)))
979 (home-page "http://tukaani.org/xz/java.html")
980 (synopsis "Implementation of XZ data compression in pure Java")
981 (description "This library aims to be a complete implementation of XZ data
982 compression in pure Java. Single-threaded streamed compression and
983 decompression and random access decompression have been fully implemented.")
984 (license license:public-domain)))
985
986 ;; java-hamcrest-core uses qdox version 1.12. We package this version instead
987 ;; of the latest release.
988 (define-public java-qdox-1.12
989 (package
990 (name "java-qdox")
991 (version "1.12.1")
992 (source (origin
993 (method url-fetch)
994 (uri (string-append "http://central.maven.org/maven2/"
995 "com/thoughtworks/qdox/qdox/" version
996 "/qdox-" version "-sources.jar"))
997 (sha256
998 (base32
999 "0hlfbqq2avf5s26wxkksqmkdyk6zp9ggqn37c468m96mjv0n9xfl"))))
1000 (build-system ant-build-system)
1001 (arguments
1002 `(;; Tests require junit
1003 #:tests? #f
1004 #:jar-name "qdox.jar"
1005 #:phases
1006 (modify-phases %standard-phases
1007 (replace 'unpack
1008 (lambda* (#:key source #:allow-other-keys)
1009 (mkdir "src")
1010 (with-directory-excursion "src"
1011 (zero? (system* "jar" "-xf" source)))))
1012 ;; At this point we don't have junit, so we must remove the API
1013 ;; tests.
1014 (add-after 'unpack 'delete-tests
1015 (lambda _
1016 (delete-file-recursively "src/com/thoughtworks/qdox/junit")
1017 #t)))))
1018 (home-page "http://qdox.codehaus.org/")
1019 (synopsis "Parse definitions from Java source files")
1020 (description
1021 "QDox is a high speed, small footprint parser for extracting
1022 class/interface/method definitions from source files complete with JavaDoc
1023 @code{@@tags}. It is designed to be used by active code generators or
1024 documentation tools.")
1025 (license license:asl2.0)))
1026
1027 (define-public java-jarjar
1028 (package
1029 (name "java-jarjar")
1030 (version "1.4")
1031 (source (origin
1032 (method url-fetch)
1033 (uri (string-append
1034 "https://storage.googleapis.com/google-code-archive-downloads/v2/"
1035 "code.google.com/jarjar/jarjar-src-" version ".zip"))
1036 (sha256
1037 (base32
1038 "1v8irhni9cndcw1l1wxqgry013s2kpj0qqn57lj2ji28xjq8ndjl"))))
1039 (build-system ant-build-system)
1040 (arguments
1041 `(;; Tests require junit, which ultimately depends on this package.
1042 #:tests? #f
1043 #:build-target "jar"
1044 #:phases
1045 (modify-phases %standard-phases
1046 (replace 'install
1047 (lambda* (#:key outputs #:allow-other-keys)
1048 (let ((target (string-append (assoc-ref outputs "out")
1049 "/share/java")))
1050 (install-file (string-append "dist/jarjar-" ,version ".jar")
1051 target))
1052 #t)))))
1053 (native-inputs
1054 `(("unzip" ,unzip)))
1055 (home-page "https://code.google.com/archive/p/jarjar/")
1056 (synopsis "Repackage Java libraries")
1057 (description
1058 "Jar Jar Links is a utility that makes it easy to repackage Java
1059 libraries and embed them into your own distribution. Jar Jar Links includes
1060 an Ant task that extends the built-in @code{jar} task.")
1061 (license license:asl2.0)))
1062
1063 (define-public java-hamcrest-core
1064 (package
1065 (name "java-hamcrest-core")
1066 (version "1.3")
1067 (source (origin
1068 (method url-fetch)
1069 (uri (string-append "https://github.com/hamcrest/JavaHamcrest/"
1070 "archive/hamcrest-java-" version ".tar.gz"))
1071 (sha256
1072 (base32
1073 "11g0s105fmwzijbv08lx8jlb521yravjmxnpgdx08fvg1kjivhva"))
1074 (modules '((guix build utils)))
1075 (snippet
1076 '(begin
1077 ;; Delete bundled thirds-party jar archives.
1078 (delete-file-recursively "lib")
1079 #t))))
1080 (build-system ant-build-system)
1081 (arguments
1082 `(#:tests? #f ; Tests require junit
1083 #:make-flags (list (string-append "-Dversion=" ,version))
1084 #:build-target "core"
1085 #:phases
1086 (modify-phases %standard-phases
1087 ;; Disable unit tests, because they require junit, which requires
1088 ;; hamcrest-core. We also give a fixed value to the "Built-Date"
1089 ;; attribute from the manifest for reproducibility.
1090 (add-before 'configure 'patch-build.xml
1091 (lambda _
1092 (substitute* "build.xml"
1093 (("unit-test, ") "")
1094 (("\\$\\{build.timestamp\\}") "guix"))
1095 #t))
1096 ;; Java's "getMethods()" returns methods in an unpredictable order.
1097 ;; To make the output of the generated code deterministic we must
1098 ;; sort the array of methods.
1099 (add-after 'unpack 'make-method-order-deterministic
1100 (lambda _
1101 (substitute* "hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java"
1102 (("import java\\.util\\.Iterator;" line)
1103 (string-append line "\n"
1104 "import java.util.Arrays; import java.util.Comparator;"))
1105 (("allMethods = cls\\.getMethods\\(\\);" line)
1106 (string-append "_" line
1107 "
1108 private Method[] getSortedMethods() {
1109 Arrays.sort(_allMethods, new Comparator<Method>() {
1110 @Override
1111 public int compare(Method a, Method b) {
1112 return a.toString().compareTo(b.toString());
1113 }
1114 });
1115 return _allMethods;
1116 }
1117
1118 private Method[] allMethods = getSortedMethods();")))))
1119 (add-before 'build 'do-not-use-bundled-qdox
1120 (lambda* (#:key inputs #:allow-other-keys)
1121 (substitute* "build.xml"
1122 (("lib/generator/qdox-1.12.jar")
1123 (string-append (assoc-ref inputs "java-qdox-1.12")
1124 "/share/java/qdox.jar")))
1125 #t))
1126 ;; build.xml searches for .jar files in this directoy, which
1127 ;; we remove from the source archive.
1128 (add-before 'build 'create-dummy-directories
1129 (lambda _
1130 (mkdir-p "lib/integration")
1131 #t))
1132 (replace 'install
1133 (lambda* (#:key outputs #:allow-other-keys)
1134 (install-file (string-append "build/hamcrest-core-"
1135 ,version ".jar")
1136 (string-append (assoc-ref outputs "out")
1137 "/share/java")))))))
1138 (native-inputs
1139 `(("java-qdox-1.12" ,java-qdox-1.12)
1140 ("java-jarjar" ,java-jarjar)))
1141 (home-page "http://hamcrest.org/")
1142 (synopsis "Library of matchers for building test expressions")
1143 (description
1144 "This package provides a library of matcher objects (also known as
1145 constraints or predicates) allowing @code{match} rules to be defined
1146 declaratively, to be used in other frameworks. Typical scenarios include
1147 testing frameworks, mocking libraries and UI validation rules.")
1148 (license license:bsd-2)))
1149
1150 (define-public java-junit
1151 (package
1152 (name "java-junit")
1153 (version "4.12")
1154 (source (origin
1155 (method url-fetch)
1156 (uri (string-append "https://github.com/junit-team/junit/"
1157 "archive/r" version ".tar.gz"))
1158 (file-name (string-append name "-" version ".tar.gz"))
1159 (sha256
1160 (base32
1161 "090dn5v1vs0b3acyaqc0gjf6p8lmd2h24wfzsbq7sly6b214anws"))
1162 (modules '((guix build utils)))
1163 (snippet
1164 '(begin
1165 ;; Delete bundled jar archives.
1166 (delete-file-recursively "lib")
1167 #t))))
1168 (build-system ant-build-system)
1169 (arguments
1170 `(#:tests? #f ; no tests
1171 #:jar-name "junit.jar"))
1172 (inputs
1173 `(("java-hamcrest-core" ,java-hamcrest-core)))
1174 (home-page "http://junit.org/")
1175 (synopsis "Test framework for Java")
1176 (description
1177 "JUnit is a simple framework to write repeatable tests for Java projects.
1178 JUnit provides assertions for testing expected results, test fixtures for
1179 sharing common test data, and test runners for running tests.")
1180 (license license:epl1.0)))