gnu: Add gom.
[jackhill/guix/guix.git] / gnu / packages / java.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
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 java)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix utils)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages attr)
27 #:use-module (gnu packages autotools)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages bash)
30 #:use-module (gnu packages cpio)
31 #:use-module (gnu packages cups)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages fontutils)
34 #:use-module (gnu packages gawk)
35 #:use-module (gnu packages gcc)
36 #:use-module (gnu packages gl)
37 #:use-module (gnu packages gnuzilla) ;nss
38 #:use-module (gnu packages ghostscript) ;lcms
39 #:use-module (gnu packages gnome)
40 #:use-module (gnu packages gtk)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages linux) ;alsa
43 #:use-module (gnu packages wget)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages mit-krb5)
47 #:use-module (gnu packages xml)
48 #:use-module (gnu packages xorg)
49 #:use-module (gnu packages zip)
50 #:use-module (gnu packages texinfo)
51 #:use-module ((srfi srfi-1) #:select (fold alist-delete)))
52
53 (define-public swt
54 (package
55 (name "swt")
56 (version "4.4.2")
57 (source (origin
58 (method url-fetch)
59 (uri (string-append
60 "http://ftp-stud.fht-esslingen.de/pub/Mirrors/"
61 "eclipse/eclipse/downloads/drops4/R-" version
62 "-201502041700/swt-" version "-gtk-linux-x86.zip"))
63 (sha256
64 (base32
65 "0lzyqr8k2zm5s8fmnrx5kxpslxfs0i73y26fwfms483x45izzwj8"))))
66 (build-system gnu-build-system)
67 (arguments
68 `(#:make-flags '("-f" "make_linux.mak")
69 #:tests? #f ; no "check" target
70 #:phases
71 (alist-replace
72 'unpack
73 (lambda _
74 (and (mkdir "swt")
75 (zero? (system* "unzip" (assoc-ref %build-inputs "source") "-d" "swt"))
76 (chdir "swt")
77 (mkdir "src")
78 (zero? (system* "unzip" "src.zip" "-d" "src"))
79 (chdir "src")))
80 (alist-replace
81 'build
82 (lambda* (#:key inputs outputs #:allow-other-keys)
83 (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
84 (setenv "JAVA_HOME" (assoc-ref inputs "icedtea6"))
85
86 ;; Build shared libraries. Users of SWT have to set the system
87 ;; property swt.library.path to the "lib" directory of this
88 ;; package output.
89 (mkdir-p lib)
90 (setenv "OUTPUT_DIR" lib)
91 (zero? (system* "bash" "build.sh"))
92
93 ;; build jar
94 (mkdir "build")
95 (for-each (lambda (file)
96 (format #t "Compiling ~s\n" file)
97 (system* "javac" "-d" "build" file))
98 (find-files "." "\\.java"))
99 (zero? (system* "jar" "cvf" "swt.jar" "-C" "build" "."))))
100 (alist-cons-after
101 'install 'install-java-files
102 (lambda* (#:key outputs #:allow-other-keys)
103 (let ((java (string-append (assoc-ref outputs "out")
104 "/share/java")))
105 (mkdir-p java)
106 (copy-file "swt.jar" (string-append java "/swt.jar"))) #t)
107 (alist-delete 'configure %standard-phases))))))
108 (inputs
109 `(("xulrunner" ,icecat)
110 ("gtk" ,gtk+-2)
111 ("libxtst" ,libxtst)
112 ("libxt" ,libxt)
113 ("mesa" ,mesa)
114 ("glu" ,glu)))
115 (native-inputs
116 `(("pkg-config" ,pkg-config)
117 ("unzip" ,unzip)
118 ("icedtea6" ,icedtea6 "jdk")))
119 (home-page "https://www.eclipse.org/swt/")
120 (synopsis "Widget toolkit for Java")
121 (description
122 "SWT is a widget toolkit for Java designed to provide efficient, portable
123 access to the user-interface facilities of the operating systems on which it
124 is implemented.")
125 ;; SWT code is licensed under EPL1.0
126 ;; Gnome and Gtk+ bindings contain code licensed under LGPLv2.1
127 ;; Cairo bindings contain code under MPL1.1
128 ;; XULRunner 1.9 bindings contain code under MPL2.0
129 (license (list
130 license:epl1.0
131 license:mpl1.1
132 license:mpl2.0
133 license:lgpl2.1+))))
134
135 (define-public ant
136 (package
137 (name "ant")
138 (version "1.9.4")
139 (source (origin
140 (method url-fetch)
141 (uri (string-append
142 "https://www.apache.org/dist/ant/source/apache-ant-"
143 version "-src.tar.gz"))
144 (sha256
145 (base32
146 "09kf5s1ir0rdrclsy174bsvbdcbajza9fja490w4mmvcpkw3zpak"))))
147 (build-system gnu-build-system)
148 (arguments
149 `(#:tests? #f ; no "check" target
150 #:phases
151 (alist-cons-after
152 'unpack 'remove-scripts
153 ;; Remove bat / cmd scripts for DOS as well as the antRun and runant
154 ;; wrappers.
155 (lambda _
156 (for-each delete-file
157 (find-files "src/script"
158 "(.*\\.(bat|cmd)|runant.*|antRun.*)")))
159 (alist-replace
160 'build
161 (lambda _
162 (setenv "JAVA_HOME"
163 (assoc-ref %build-inputs "icedtea6"))
164 ;; Disable tests to avoid dependency on hamcrest-core, which needs
165 ;; Ant to build. This is necessary in addition to disabling the
166 ;; "check" phase, because the dependency on "test-jar" would always
167 ;; result in the tests to be run.
168 (substitute* "build.xml"
169 (("depends=\"jars,test-jar\"") "depends=\"jars\""))
170 (zero? (system* "bash" "bootstrap.sh"
171 (string-append "-Ddist.dir="
172 (assoc-ref %outputs "out")))))
173 (alist-delete
174 'configure
175 (alist-delete 'install %standard-phases))))))
176 (native-inputs
177 `(("icedtea6" ,icedtea6 "jdk")))
178 (home-page "http://ant.apache.org")
179 (synopsis "Build tool for Java")
180 (description
181 "Ant is a platform-independent build tool for Java. It is similar to
182 make but is implemented using the Java language, requires the Java platform,
183 and is best suited to building Java projects. Ant uses XML to describe the
184 build process and its dependencies, whereas Make uses Makefile format.")
185 (license license:asl2.0)))
186
187 (define-public icedtea6
188 (package
189 (name "icedtea6")
190 (version "1.13.7")
191 (source (origin
192 (method url-fetch)
193 (uri (string-append
194 "http://icedtea.wildebeest.org/download/source/icedtea6-"
195 version ".tar.xz"))
196 (sha256
197 (base32
198 "0fqq898h0mk554mya5z4j9p4x6sg2qj0ckqzx65x49zcjjp69jm5"))
199 (modules '((guix build utils)))
200 (snippet
201 '(substitute* "Makefile.in"
202 ;; link against libgcj to avoid linker error
203 (("-o native-ecj")
204 "-lgcj -o native-ecj")
205 ;; do not leak information about the build host
206 (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
207 "DISTRIBUTION_ID=\"\\\"guix\\\"\"")))))
208 (build-system gnu-build-system)
209 (outputs '("out" ; Java Runtime Environment
210 "jdk" ; Java Development Kit
211 "doc")) ; all documentation
212 (arguments
213 `(;; There are many failing tests and many are known to fail upstream.
214 ;;
215 ;; * Hotspot VM tests:
216 ;; FAILED: compiler/7082949/Test7082949.java
217 ;; FAILED: compiler/7088020/Test7088020.java
218 ;; FAILED: runtime/6929067/Test6929067.sh
219 ;; FAILED: serviceability/sa/jmap-hashcode/Test8028623.java
220 ;; => Test results: passed: 161; failed: 4
221 ;;
222 ;; * langtools tests:
223 ;; FAILED: com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
224 ;; FAILED: tools/javac/6627362/T6627362.java
225 ;; FAILED: tools/javac/7003595/T7003595.java
226 ;; FAILED: tools/javac/7024568/T7024568.java
227 ;; FAILED: tools/javap/4111861/T4111861.java
228 ;; FAILED: tools/javap/ListTest.java
229 ;; FAILED: tools/javap/OptionTest.java
230 ;; FAILED: tools/javap/T4884240.java
231 ;; FAILED: tools/javap/T4975569.java
232 ;; --> fails because of insignificant whitespace differences
233 ;; in output of javap
234 ;; FAILED: tools/javap/T6868539.java
235 ;; => Test results: passed: 1,445; failed: 10
236 ;;
237 ;; * JDK tests:
238 ;; Tests are incomplete because of a segfault after this test:
239 ;; javax/crypto/spec/RC5ParameterSpec/RC5ParameterSpecEquals.java
240 ;; A bug report has already been filed upstream:
241 ;; http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2188
242 ;;
243 ;; The tests require xvfb-run, a wrapper script around Xvfb, which
244 ;; has not been packaged yet. Without it many AWT tests fail, so I
245 ;; made no attempts to make a list of failing JDK tests. At least
246 ;; 222 tests are failing of which at least 132 are AWT tests.
247 #:tests? #f
248
249 ;; The DSOs use $ORIGIN to refer to each other, but (guix build
250 ;; gremlin) doesn't support it yet, so skip this phase.
251 #:validate-runpath? #f
252
253 #:modules ((guix build utils)
254 (guix build gnu-build-system)
255 (ice-9 popen)
256 (ice-9 rdelim))
257
258 #:configure-flags
259 (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
260 (ecj (string-append gcjdir "/share/java/ecj.jar"))
261 (jdk (string-append gcjdir "/lib/jvm/"))
262 (gcj (string-append gcjdir "/bin/gcj")))
263 `("--enable-bootstrap"
264 "--enable-nss"
265 "--without-rhino"
266 "--disable-downloading"
267 "--disable-tests" ;they are run in the check phase instead
268 ,(string-append "--with-openjdk-src-dir=" "./openjdk")
269 ,(string-append "--with-javac=" jdk "/bin/javac")
270 ,(string-append "--with-ecj-jar=" ecj)
271 ,(string-append "--with-gcj=" gcj)
272 ,(string-append "--with-jdk-home=" jdk)
273 ,(string-append "--with-java=" jdk "/bin/java")))
274 #:phases
275 (alist-replace
276 'unpack
277 (lambda* (#:key source inputs #:allow-other-keys)
278 (and (zero? (system* "tar" "xvf" source))
279 (zero? (system* "tar" "xvjf"
280 (assoc-ref inputs "ant-bootstrap")))
281 (begin
282 (patch-shebang "apache-ant-1.9.4/bin/ant")
283 (chdir (string-append ,name "-" ,version))
284 (mkdir "openjdk")
285 (with-directory-excursion "openjdk"
286 (copy-file (assoc-ref inputs "openjdk6-src")
287 "openjdk6-src.tar.xz")
288 (zero? (system* "tar" "xvf" "openjdk6-src.tar.xz"))))))
289 (alist-cons-after
290 'unpack 'patch-patches
291 (lambda _
292 ;; shebang in patches so that they apply cleanly
293 (substitute* '("patches/jtreg-jrunscript.patch"
294 "patches/hotspot/hs23/drop_unlicensed_test.patch")
295 (("#!/bin/sh") (string-append "#!" (which "sh"))))
296
297 ;; fix path to alsa header in patch
298 (substitute* "patches/openjdk/6799141-split_out_versions.patch"
299 (("ALSA_INCLUDE=/usr/include/alsa/version.h")
300 (string-append "ALSA_INCLUDE="
301 (assoc-ref %build-inputs "alsa-lib")
302 "/include/alsa/version.h"))))
303 (alist-cons-after
304 'unpack 'patch-paths
305 (lambda _
306 ;; buildtree.make generates shell scripts, so we need to replace
307 ;; the generated shebang
308 (substitute* '("openjdk/hotspot/make/linux/makefiles/buildtree.make")
309 (("/bin/sh") (which "bash")))
310
311 (let ((corebin (string-append
312 (assoc-ref %build-inputs "coreutils") "/bin/"))
313 (binbin (string-append
314 (assoc-ref %build-inputs "binutils") "/bin/"))
315 (grepbin (string-append
316 (assoc-ref %build-inputs "grep") "/bin/")))
317 (substitute* '("openjdk/jdk/make/common/shared/Defs-linux.gmk"
318 "openjdk/corba/make/common/shared/Defs-linux.gmk")
319 (("UNIXCOMMAND_PATH = /bin/")
320 (string-append "UNIXCOMMAND_PATH = " corebin))
321 (("USRBIN_PATH = /usr/bin/")
322 (string-append "USRBIN_PATH = " corebin))
323 (("DEVTOOLS_PATH *= */usr/bin/")
324 (string-append "DEVTOOLS_PATH = " corebin))
325 (("COMPILER_PATH *= */usr/bin/")
326 (string-append "COMPILER_PATH = "
327 (assoc-ref %build-inputs "gcc") "/bin/"))
328 (("DEF_OBJCOPY *=.*objcopy")
329 (string-append "DEF_OBJCOPY = " (which "objcopy"))))
330
331 ;; fix hard-coded utility paths
332 (substitute* '("openjdk/jdk/make/common/shared/Defs-utils.gmk"
333 "openjdk/corba/make/common/shared/Defs-utils.gmk")
334 (("ECHO *=.*echo")
335 (string-append "ECHO = " (which "echo")))
336 (("^GREP *=.*grep")
337 (string-append "GREP = " (which "grep")))
338 (("EGREP *=.*egrep")
339 (string-append "EGREP = " (which "egrep")))
340 (("CPIO *=.*cpio")
341 (string-append "CPIO = " (which "cpio")))
342 (("READELF *=.*readelf")
343 (string-append "READELF = " (which "readelf")))
344 (("^ *AR *=.*ar")
345 (string-append "AR = " (which "ar")))
346 (("^ *TAR *=.*tar")
347 (string-append "TAR = " (which "tar")))
348 (("AS *=.*as")
349 (string-append "AS = " (which "as")))
350 (("LD *=.*ld")
351 (string-append "LD = " (which "ld")))
352 (("STRIP *=.*strip")
353 (string-append "STRIP = " (which "strip")))
354 (("NM *=.*nm")
355 (string-append "NM = " (which "nm")))
356 (("^SH *=.*sh")
357 (string-append "SH = " (which "bash")))
358 (("^FIND *=.*find")
359 (string-append "FIND = " (which "find")))
360 (("LDD *=.*ldd")
361 (string-append "LDD = " (which "ldd")))
362 (("NAWK *=.*(n|g)awk")
363 (string-append "NAWK = " (which "gawk")))
364 (("XARGS *=.*xargs")
365 (string-append "XARGS = " (which "xargs")))
366 (("UNZIP *=.*unzip")
367 (string-append "UNZIP = " (which "unzip")))
368 (("ZIPEXE *=.*zip")
369 (string-append "ZIPEXE = " (which "zip")))
370 (("SED *=.*sed")
371 (string-append "SED = " (which "sed"))))
372
373 ;; Some of these timestamps cause problems as they are more than
374 ;; 10 years ago, failing the build process.
375 (substitute*
376 "openjdk/jdk/src/share/classes/java/util/CurrencyData.properties"
377 (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN")
378 (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
379 (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
380 (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY"))))
381 (alist-cons-before
382 'configure 'set-additional-paths
383 (lambda* (#:key inputs #:allow-other-keys)
384 (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
385 (gcjlib (string-append gcjdir "/lib"))
386 (antpath (string-append (getcwd) "/../apache-ant-1.9.4"))
387 ;; Get target-specific include directory so that
388 ;; libgcj-config.h is found when compiling hotspot.
389 (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include"))
390 (str (read-line port)))
391 (close-pipe port)
392 str)))
393 (setenv "CPATH"
394 (string-append gcjinclude ":"
395 (assoc-ref %build-inputs "libxrender")
396 "/include/X11/extensions" ":"
397 (assoc-ref %build-inputs "libxtst")
398 "/include/X11/extensions" ":"
399 (assoc-ref %build-inputs "libxinerama")
400 "/include/X11/extensions" ":"
401 (or (getenv "CPATH") "")))
402 (setenv "ALT_CUPS_HEADERS_PATH"
403 (string-append (assoc-ref %build-inputs "cups")
404 "/include"))
405 (setenv "ALT_FREETYPE_HEADERS_PATH"
406 (string-append (assoc-ref %build-inputs "freetype")
407 "/include"))
408 (setenv "ALT_FREETYPE_LIB_PATH"
409 (string-append (assoc-ref %build-inputs "freetype")
410 "/lib"))
411 (setenv "PATH" (string-append antpath "/bin:"
412 (getenv "PATH")))))
413 (alist-cons-before
414 'check 'fix-test-framework
415 (lambda _
416 ;; Fix PATH in test environment
417 (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java"
418 (("PATH=/bin:/usr/bin")
419 (string-append "PATH=" (getenv "PATH"))))
420 (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java"
421 (("/usr/bin/env") (which "env")))
422 #t)
423 (alist-cons-before
424 'check 'fix-hotspot-tests
425 (lambda _
426 (with-directory-excursion "openjdk/hotspot/test/"
427 (substitute* "jprt.config"
428 (("PATH=\"\\$\\{path4sdk\\}\"")
429 (string-append "PATH=" (getenv "PATH")))
430 (("make=/usr/bin/make")
431 (string-append "make=" (which "make"))))
432 (substitute* '("runtime/6626217/Test6626217.sh"
433 "runtime/7110720/Test7110720.sh")
434 (("/bin/rm") (which "rm"))
435 (("/bin/cp") (which "cp"))
436 (("/bin/mv") (which "mv"))))
437 #t)
438 (alist-cons-before
439 'check 'fix-jdk-tests
440 (lambda _
441 (with-directory-excursion "openjdk/jdk/test/"
442 (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
443 (("/bin/pwd") (which "pwd")))
444 (substitute* "com/sun/jdi/ShellScaffold.sh"
445 (("/bin/kill") (which "kill")))
446 (substitute* "start-Xvfb.sh"
447 ;;(("/usr/bin/X11/Xvfb") (which "Xvfb"))
448 (("/usr/bin/nohup") (which "nohup")))
449 (substitute* "javax/security/auth/Subject/doAs/Test.sh"
450 (("/bin/rm") (which "rm")))
451 (substitute* "tools/launcher/MultipleJRE.sh"
452 (("echo \"#!/bin/sh\"")
453 (string-append "echo \"#!" (which "rm") "\""))
454 (("/usr/bin/zip") (which "zip")))
455 (substitute* "com/sun/jdi/OnThrowTest.java"
456 (("#!/bin/sh") (string-append "#!" (which "sh"))))
457 (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java"
458 (("/usr/bin/uptime") (which "uptime")))
459 (substitute* "java/lang/ProcessBuilder/Basic.java"
460 (("/usr/bin/env") (which "env"))
461 (("/bin/false") (which "false"))
462 (("/bin/true") (which "true"))
463 (("/bin/cp") (which "cp"))
464 (("/bin/sh") (which "sh")))
465 (substitute* "java/lang/ProcessBuilder/FeelingLucky.java"
466 (("/bin/sh") (which "sh")))
467 (substitute* "java/lang/ProcessBuilder/Zombies.java"
468 (("/usr/bin/perl") (which "perl"))
469 (("/bin/ps") (which "ps"))
470 (("/bin/true") (which "true")))
471 (substitute* "java/lang/Runtime/exec/ConcurrentRead.java"
472 (("/usr/bin/tee") (which "tee")))
473 (substitute* "java/lang/Runtime/exec/ExecWithDir.java"
474 (("/bin/true") (which "true")))
475 (substitute* "java/lang/Runtime/exec/ExecWithInput.java"
476 (("/bin/cat") (which "cat")))
477 (substitute* "java/lang/Runtime/exec/ExitValue.java"
478 (("/bin/sh") (which "sh"))
479 (("/bin/true") (which "true"))
480 (("/bin/kill") (which "kill")))
481 (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java"
482 (("/usr/bin/echo") (which "echo")))
483 (substitute* "java/lang/Runtime/exec/LotsOfOutput.java"
484 (("/usr/bin/cat") (which "cat")))
485 (substitute* "java/lang/Runtime/exec/SleepyCat.java"
486 (("/bin/cat") (which "cat"))
487 (("/bin/sleep") (which "sleep"))
488 (("/bin/sh") (which "sh")))
489 (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java"
490 (("/bin/cat") (which "cat")))
491 (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java"
492 (("/bin/chmod") (which "chmod")))
493 (substitute* "java/util/zip/ZipFile/Assortment.java"
494 (("/bin/sh") (which "sh"))))
495 #t)
496 (alist-replace
497 'check
498 (lambda _
499 ;; The "make check-*" targets always return zero, so we need to
500 ;; check for errors in the associated log files to determine
501 ;; whether any tests have failed.
502 (use-modules (ice-9 rdelim))
503 (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
504 (checker (lambda (port)
505 (let loop ()
506 (let ((line (read-line port)))
507 (cond
508 ((eof-object? line) #t)
509 ((regexp-exec error-pattern line) #f)
510 (else (loop)))))))
511 (run-test (lambda (test)
512 (system* "make" test)
513 (call-with-input-file
514 (string-append "test/" test ".log")
515 checker))))
516 (or #t ; skip tests
517 (and (run-test "check-hotspot")
518 (run-test "check-langtools")
519 (run-test "check-jdk")))))
520 (alist-replace
521 'install
522 (lambda* (#:key outputs #:allow-other-keys)
523 (let ((doc (string-append (assoc-ref outputs "doc") "/share/doc/" ,name))
524 (jre (assoc-ref outputs "out"))
525 (jdk (assoc-ref outputs "jdk")))
526 (copy-recursively "openjdk.build/docs" doc)
527 (copy-recursively "openjdk.build/j2re-image" jre)
528 (copy-recursively "openjdk.build/j2sdk-image" jdk)))
529 %standard-phases)))))))))))
530 (native-inputs
531 `(("ant-bootstrap"
532 ,(origin
533 (method url-fetch)
534 (uri "https://www.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.bz2")
535 (sha256
536 (base32
537 "1kw801p8h5x4f0g8i5yknppssrj5a3xy1aqrkpfnk22bd1snbh90"))))
538 ("alsa-lib" ,alsa-lib)
539 ("attr" ,attr)
540 ("autoconf" ,autoconf)
541 ("automake" ,automake)
542 ("coreutils" ,coreutils)
543 ("diffutils" ,diffutils) ;for tests
544 ("gawk" ,gawk)
545 ("grep" ,grep)
546 ("libtool" ,libtool)
547 ("pkg-config" ,pkg-config)
548 ("cups" ,cups)
549 ("wget" ,wget)
550 ("which" ,which)
551 ("cpio" ,cpio)
552 ("zip" ,zip)
553 ("unzip" ,unzip)
554 ("fastjar" ,fastjar)
555 ("libxslt" ,libxslt) ;for xsltproc
556 ("mit-krb5" ,mit-krb5)
557 ("nss" ,nss)
558 ("libx11" ,libx11)
559 ("libxt" ,libxt)
560 ("libxtst" ,libxtst)
561 ("libxi" ,libxi)
562 ("libxinerama" ,libxinerama)
563 ("libxrender" ,libxrender)
564 ("libjpeg" ,libjpeg)
565 ("libpng" ,libpng)
566 ("giflib" ,giflib)
567 ("perl" ,perl)
568 ("procps" ,procps) ;for "free", even though I'm not sure we should use it
569 ("openjdk6-src"
570 ,(origin
571 (method url-fetch)
572 (uri "https://java.net/downloads/openjdk6/openjdk-6-src-b35-14_apr_2015.tar.gz")
573 (sha256
574 (base32
575 "05glw29vy4yw9rkjy9y8wg6ybzi89gjwi19qpnfda978x02r2x5p"))))
576 ("lcms" ,lcms)
577 ("zlib" ,zlib)
578 ("gtk" ,gtk+-2)
579 ("fontconfig" ,fontconfig)
580 ("freetype" ,freetype)
581 ("gcj" ,gcj-4.8)))
582 (home-page "http://icedtea.classpath.org")
583 (synopsis "Java development kit")
584 (description
585 "The OpenJDK built with the IcedTea build harness.")
586 ;; IcedTea is released under the GPL2 + Classpath exception, which is the
587 ;; same license as both GNU Classpath and OpenJDK.
588 (license license:gpl2+)))
589
590 (define-public icedtea7
591 (let* ((version "2.5.5")
592 (drop (lambda (name hash)
593 (origin
594 (method url-fetch)
595 (uri (string-append
596 "http://icedtea.classpath.org/download/drops/"
597 "/icedtea7/" version "/" name ".tar.bz2"))
598 (sha256 (base32 hash))))))
599 (package (inherit icedtea6)
600 (name "icedtea7")
601 (version version)
602 (source (origin
603 (method url-fetch)
604 (uri (string-append
605 "http://icedtea.wildebeest.org/download/source/icedtea-"
606 version ".tar.xz"))
607 (sha256
608 (base32
609 "1irxk2ndwsfk4c1zbzb5h3rpwv2bc9bhfjvz6p4dws5476vsxrq9"))
610 (modules '((guix build utils)))
611 (snippet
612 '(substitute* "Makefile.in"
613 ;; link against libgcj to avoid linker error
614 (("-o native-ecj")
615 "-lgcj -o native-ecj")
616 ;; do not leak information about the build host
617 (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
618 "DISTRIBUTION_ID=\"\\\"guix\\\"\"")))))
619 (arguments
620 `(;; There are many test failures. Some are known to
621 ;; fail upstream, others relate to not having an X
622 ;; server running at test time, yet others are a
623 ;; complete mystery to me.
624
625 ;; hotspot: passed: 241; failed: 45; error: 2
626 ;; langtools: passed: 1,934; failed: 26
627 ;; jdk: unknown
628 #:tests? #f
629 ;; Apparently, the C locale is needed for some of the tests.
630 #:locale "C"
631 ,@(substitute-keyword-arguments (package-arguments icedtea6)
632 ((#:configure-flags flags)
633 `(delete "--with-openjdk-src-dir=./openjdk" ,flags))
634 ((#:phases phases)
635 `(modify-phases ,phases
636 (replace
637 'unpack
638 (lambda* (#:key source inputs #:allow-other-keys)
639 (let ((target (string-append "icedtea-" ,version))
640 (unpack (lambda (drop dir)
641 (mkdir dir)
642 (zero? (system* "tar" "xvjf"
643 (assoc-ref inputs drop)
644 "-C" dir
645 "--strip-components=1")))))
646 (and (zero? (system* "tar" "xvf" source))
647 (chdir target)
648 (unpack "openjdk-drop" "openjdk")
649 (unpack "corba-drop" "openjdk/corba")
650 (unpack "jdk-drop" "openjdk/jdk")
651 (unpack "hotspot-drop" "openjdk/hotspot")
652
653 ;; The build framework checks the tarballs, so we
654 ;; need to keep them around even though we have
655 ;; already unpacked some of them for patching.
656 (begin
657 (copy-file (assoc-ref inputs "openjdk-drop")
658 "openjdk.tar.bz2")
659 (copy-file (assoc-ref inputs "corba-drop")
660 "corba.tar.bz2")
661 (copy-file (assoc-ref inputs "hotspot-drop")
662 "hotspot.tar.bz2")
663 (copy-file (assoc-ref inputs "jaxp-drop")
664 "jaxp.tar.bz2")
665 (copy-file (assoc-ref inputs "jaxws-drop")
666 "jaxws.tar.bz2")
667 (copy-file (assoc-ref inputs "jdk-drop")
668 "jdk.tar.bz2")
669 (copy-file (assoc-ref inputs "langtools-drop")
670 "langtools.tar.bz2")
671 #t)))))
672 (replace
673 'set-additional-paths
674 (lambda* (#:key inputs #:allow-other-keys)
675 (let (;; Get target-specific include directory so that
676 ;; libgcj-config.h is found when compiling hotspot.
677 (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include"))
678 (str (read-line port)))
679 (close-pipe port)
680 str)))
681 (substitute* "openjdk/jdk/make/common/shared/Sanity.gmk"
682 (("ALSA_INCLUDE=/usr/include/alsa/version.h")
683 (string-append "ALSA_INCLUDE="
684 (assoc-ref inputs "alsa-lib")
685 "/include/alsa/version.h")))
686 (setenv "CC" "gcc")
687 (setenv "CPATH"
688 (string-append gcjinclude ":"
689 (assoc-ref inputs "libxrender")
690 "/include/X11/extensions" ":"
691 (assoc-ref inputs "libxtst")
692 "/include/X11/extensions" ":"
693 (assoc-ref inputs "libxinerama")
694 "/include/X11/extensions" ":"
695 (or (getenv "CPATH") "")))
696 (setenv "ALT_OBJCOPY" (which "objcopy"))
697 (setenv "ALT_CUPS_HEADERS_PATH"
698 (string-append (assoc-ref inputs "cups")
699 "/include"))
700 (setenv "ALT_FREETYPE_HEADERS_PATH"
701 (string-append (assoc-ref inputs "freetype")
702 "/include"))
703 (setenv "ALT_FREETYPE_LIB_PATH"
704 (string-append (assoc-ref inputs "freetype")
705 "/lib")))))
706 (add-after
707 'unpack 'fix-x11-extension-include-path
708 (lambda* (#:key inputs #:allow-other-keys)
709 (substitute* "openjdk/jdk/make/sun/awt/mawt.gmk"
710 (((string-append "\\$\\(firstword \\$\\(wildcard "
711 "\\$\\(OPENWIN_HOME\\)"
712 "/include/X11/extensions\\).*$"))
713 (string-append (assoc-ref inputs "libxrender")
714 "/include/X11/extensions"
715 " -I" (assoc-ref inputs "libxtst")
716 "/include/X11/extensions"
717 " -I" (assoc-ref inputs "libxinerama")
718 "/include/X11/extensions"))
719 (("\\$\\(wildcard /usr/include/X11/extensions\\)\\)") ""))
720 #t))
721 (replace
722 'fix-test-framework
723 (lambda _
724 ;; Fix PATH in test environment
725 (substitute* "test/jtreg/com/sun/javatest/regtest/Main.java"
726 (("PATH=/bin:/usr/bin")
727 (string-append "PATH=" (getenv "PATH"))))
728 (substitute* "test/jtreg/com/sun/javatest/util/SysEnv.java"
729 (("/usr/bin/env") (which "env")))
730 (substitute* "openjdk/hotspot/test/test_env.sh"
731 (("/bin/rm") (which "rm"))
732 (("/bin/cp") (which "cp"))
733 (("/bin/mv") (which "mv")))
734 #t))
735 (delete 'patch-patches))))))
736 (native-inputs
737 `(("ant" ,ant)
738 ("openjdk-drop"
739 ,(drop "openjdk"
740 "03gxqn17cxwl1nspnwigacaqd28p02d45f396j5f4kkbzfnbl0ak"))
741 ("corba-drop"
742 ,(drop "corba"
743 "0ldcckknn2f92jv1144cnn0z3wmvxln28wc00rc6xxblnjcnamzh"))
744 ("jaxp-drop"
745 ,(drop "jaxp"
746 "0mnjdziffcnyqlyvf8dw1hrl4kiiwmh8ia0ym417wgvnjpaihci9"))
747 ("jaxws-drop"
748 ,(drop "jaxws"
749 "1gkmypnhygx2mxhca3ngy620k993wi2cc1wysc0np06y1rkx1mkn"))
750 ("jdk-drop"
751 ,(drop "jdk"
752 "10x43mqjfn43jlckic0nyf7apyyjyr910cdmmvy41kvw8ljhvg61"))
753 ("langtools-drop"
754 ,(drop "langtools"
755 "0q5nqc14r6vmhxgikw3wgdcc0r9symp830v13isnv8qdjgm6kcki"))
756 ("hotspot-drop"
757 ,(drop "hotspot"
758 "1yqxfd2jwbm5y41wscyfx8h0fr3h8ny2g2mda5iwd8sikxsaj96p"))
759 ,@(fold alist-delete (package-native-inputs icedtea6)
760 '("openjdk6-src" "ant-bootstrap")))))))