projects/guix·blob version-0.9.0 · refs

751 lines · 34.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Ricardo Wurmus <[email protected]>
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 (install-file "swt.jar" java)
106 #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
123access to the user-interface facilities of the operating systems on which it
124is 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" (string-append (assoc-ref %build-inputs "gcj")
163 "/lib/jvm"))
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 `(("gcj" ,gcj)))
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
182make but is implemented using the Java language, requires the Java platform,
183and is best suited to building Java projects. Ant uses XML to describe the
184build 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.8")
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 "1nqaq2xjz88rfzm94l28c0cc48gdiwl8ijw9c46s14z3awwn5g7w"))
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 (begin
280 (chdir (string-append ,name "-" ,version))
281 (mkdir "openjdk")
282 (with-directory-excursion "openjdk"
283 (copy-file (assoc-ref inputs "openjdk6-src")
284 "openjdk6-src.tar.xz")
285 (zero? (system* "tar" "xvf" "openjdk6-src.tar.xz"))))))
286 (alist-cons-after
287 'unpack 'patch-patches
288 (lambda _
289 ;; shebang in patches so that they apply cleanly
290 (substitute* '("patches/jtreg-jrunscript.patch"
291 "patches/hotspot/hs23/drop_unlicensed_test.patch")
292 (("#!/bin/sh") (string-append "#!" (which "sh"))))
293
294 ;; fix path to alsa header in patch
295 (substitute* "patches/openjdk/6799141-split_out_versions.patch"
296 (("ALSA_INCLUDE=/usr/include/alsa/version.h")
297 (string-append "ALSA_INCLUDE="
298 (assoc-ref %build-inputs "alsa-lib")
299 "/include/alsa/version.h"))))
300 (alist-cons-after
301 'unpack 'patch-paths
302 (lambda _
303 ;; buildtree.make generates shell scripts, so we need to replace
304 ;; the generated shebang
305 (substitute* '("openjdk/hotspot/make/linux/makefiles/buildtree.make")
306 (("/bin/sh") (which "bash")))
307
308 (let ((corebin (string-append
309 (assoc-ref %build-inputs "coreutils") "/bin/"))
310 (binbin (string-append
311 (assoc-ref %build-inputs "binutils") "/bin/"))
312 (grepbin (string-append
313 (assoc-ref %build-inputs "grep") "/bin/")))
314 (substitute* '("openjdk/jdk/make/common/shared/Defs-linux.gmk"
315 "openjdk/corba/make/common/shared/Defs-linux.gmk")
316 (("UNIXCOMMAND_PATH = /bin/")
317 (string-append "UNIXCOMMAND_PATH = " corebin))
318 (("USRBIN_PATH = /usr/bin/")
319 (string-append "USRBIN_PATH = " corebin))
320 (("DEVTOOLS_PATH *= */usr/bin/")
321 (string-append "DEVTOOLS_PATH = " corebin))
322 (("COMPILER_PATH *= */usr/bin/")
323 (string-append "COMPILER_PATH = "
324 (assoc-ref %build-inputs "gcc") "/bin/"))
325 (("DEF_OBJCOPY *=.*objcopy")
326 (string-append "DEF_OBJCOPY = " (which "objcopy"))))
327
328 ;; fix hard-coded utility paths
329 (substitute* '("openjdk/jdk/make/common/shared/Defs-utils.gmk"
330 "openjdk/corba/make/common/shared/Defs-utils.gmk")
331 (("ECHO *=.*echo")
332 (string-append "ECHO = " (which "echo")))
333 (("^GREP *=.*grep")
334 (string-append "GREP = " (which "grep")))
335 (("EGREP *=.*egrep")
336 (string-append "EGREP = " (which "egrep")))
337 (("CPIO *=.*cpio")
338 (string-append "CPIO = " (which "cpio")))
339 (("READELF *=.*readelf")
340 (string-append "READELF = " (which "readelf")))
341 (("^ *AR *=.*ar")
342 (string-append "AR = " (which "ar")))
343 (("^ *TAR *=.*tar")
344 (string-append "TAR = " (which "tar")))
345 (("AS *=.*as")
346 (string-append "AS = " (which "as")))
347 (("LD *=.*ld")
348 (string-append "LD = " (which "ld")))
349 (("STRIP *=.*strip")
350 (string-append "STRIP = " (which "strip")))
351 (("NM *=.*nm")
352 (string-append "NM = " (which "nm")))
353 (("^SH *=.*sh")
354 (string-append "SH = " (which "bash")))
355 (("^FIND *=.*find")
356 (string-append "FIND = " (which "find")))
357 (("LDD *=.*ldd")
358 (string-append "LDD = " (which "ldd")))
359 (("NAWK *=.*(n|g)awk")
360 (string-append "NAWK = " (which "gawk")))
361 (("XARGS *=.*xargs")
362 (string-append "XARGS = " (which "xargs")))
363 (("UNZIP *=.*unzip")
364 (string-append "UNZIP = " (which "unzip")))
365 (("ZIPEXE *=.*zip")
366 (string-append "ZIPEXE = " (which "zip")))
367 (("SED *=.*sed")
368 (string-append "SED = " (which "sed"))))
369
370 ;; Some of these timestamps cause problems as they are more than
371 ;; 10 years ago, failing the build process.
372 (substitute*
373 "openjdk/jdk/src/share/classes/java/util/CurrencyData.properties"
374 (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN")
375 (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN")
376 (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON")
377 (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY"))))
378 (alist-cons-before
379 'configure 'set-additional-paths
380 (lambda* (#:key inputs #:allow-other-keys)
381 (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
382 (gcjlib (string-append gcjdir "/lib"))
383 ;; Get target-specific include directory so that
384 ;; libgcj-config.h is found when compiling hotspot.
385 (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include"))
386 (str (read-line port)))
387 (close-pipe port)
388 str)))
389 (setenv "CPATH"
390 (string-append gcjinclude ":"
391 (assoc-ref %build-inputs "libxrender")
392 "/include/X11/extensions" ":"
393 (assoc-ref %build-inputs "libxtst")
394 "/include/X11/extensions" ":"
395 (assoc-ref %build-inputs "libxinerama")
396 "/include/X11/extensions" ":"
397 (or (getenv "CPATH") "")))
398 (setenv "ALT_CUPS_HEADERS_PATH"
399 (string-append (assoc-ref %build-inputs "cups")
400 "/include"))
401 (setenv "ALT_FREETYPE_HEADERS_PATH"
402 (string-append (assoc-ref %build-inputs "freetype")
403 "/include"))
404 (setenv "ALT_FREETYPE_LIB_PATH"
405 (string-append (assoc-ref %build-inputs "freetype")
406 "/lib"))))
407 (alist-cons-before
408 'check 'fix-test-framework
409 (lambda _
410 ;; Fix PATH in test environment
411 (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java"
412 (("PATH=/bin:/usr/bin")
413 (string-append "PATH=" (getenv "PATH"))))
414 (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java"
415 (("/usr/bin/env") (which "env")))
416 #t)
417 (alist-cons-before
418 'check 'fix-hotspot-tests
419 (lambda _
420 (with-directory-excursion "openjdk/hotspot/test/"
421 (substitute* "jprt.config"
422 (("PATH=\"\\$\\{path4sdk\\}\"")
423 (string-append "PATH=" (getenv "PATH")))
424 (("make=/usr/bin/make")
425 (string-append "make=" (which "make"))))
426 (substitute* '("runtime/6626217/Test6626217.sh"
427 "runtime/7110720/Test7110720.sh")
428 (("/bin/rm") (which "rm"))
429 (("/bin/cp") (which "cp"))
430 (("/bin/mv") (which "mv"))))
431 #t)
432 (alist-cons-before
433 'check 'fix-jdk-tests
434 (lambda _
435 (with-directory-excursion "openjdk/jdk/test/"
436 (substitute* "com/sun/jdi/JdbReadTwiceTest.sh"
437 (("/bin/pwd") (which "pwd")))
438 (substitute* "com/sun/jdi/ShellScaffold.sh"
439 (("/bin/kill") (which "kill")))
440 (substitute* "start-Xvfb.sh"
441 ;;(("/usr/bin/X11/Xvfb") (which "Xvfb"))
442 (("/usr/bin/nohup") (which "nohup")))
443 (substitute* "javax/security/auth/Subject/doAs/Test.sh"
444 (("/bin/rm") (which "rm")))
445 (substitute* "tools/launcher/MultipleJRE.sh"
446 (("echo \"#!/bin/sh\"")
447 (string-append "echo \"#!" (which "rm") "\""))
448 (("/usr/bin/zip") (which "zip")))
449 (substitute* "com/sun/jdi/OnThrowTest.java"
450 (("#!/bin/sh") (string-append "#!" (which "sh"))))
451 (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java"
452 (("/usr/bin/uptime") (which "uptime")))
453 (substitute* "java/lang/ProcessBuilder/Basic.java"
454 (("/usr/bin/env") (which "env"))
455 (("/bin/false") (which "false"))
456 (("/bin/true") (which "true"))
457 (("/bin/cp") (which "cp"))
458 (("/bin/sh") (which "sh")))
459 (substitute* "java/lang/ProcessBuilder/FeelingLucky.java"
460 (("/bin/sh") (which "sh")))
461 (substitute* "java/lang/ProcessBuilder/Zombies.java"
462 (("/usr/bin/perl") (which "perl"))
463 (("/bin/ps") (which "ps"))
464 (("/bin/true") (which "true")))
465 (substitute* "java/lang/Runtime/exec/ConcurrentRead.java"
466 (("/usr/bin/tee") (which "tee")))
467 (substitute* "java/lang/Runtime/exec/ExecWithDir.java"
468 (("/bin/true") (which "true")))
469 (substitute* "java/lang/Runtime/exec/ExecWithInput.java"
470 (("/bin/cat") (which "cat")))
471 (substitute* "java/lang/Runtime/exec/ExitValue.java"
472 (("/bin/sh") (which "sh"))
473 (("/bin/true") (which "true"))
474 (("/bin/kill") (which "kill")))
475 (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java"
476 (("/usr/bin/echo") (which "echo")))
477 (substitute* "java/lang/Runtime/exec/LotsOfOutput.java"
478 (("/usr/bin/cat") (which "cat")))
479 (substitute* "java/lang/Runtime/exec/SleepyCat.java"
480 (("/bin/cat") (which "cat"))
481 (("/bin/sleep") (which "sleep"))
482 (("/bin/sh") (which "sh")))
483 (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java"
484 (("/bin/cat") (which "cat")))
485 (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java"
486 (("/bin/chmod") (which "chmod")))
487 (substitute* "java/util/zip/ZipFile/Assortment.java"
488 (("/bin/sh") (which "sh"))))
489 #t)
490 (alist-replace
491 'check
492 (lambda _
493 ;; The "make check-*" targets always return zero, so we need to
494 ;; check for errors in the associated log files to determine
495 ;; whether any tests have failed.
496 (use-modules (ice-9 rdelim))
497 (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
498 (checker (lambda (port)
499 (let loop ()
500 (let ((line (read-line port)))
501 (cond
502 ((eof-object? line) #t)
503 ((regexp-exec error-pattern line) #f)
504 (else (loop)))))))
505 (run-test (lambda (test)
506 (system* "make" test)
507 (call-with-input-file
508 (string-append "test/" test ".log")
509 checker))))
510 (or #t ; skip tests
511 (and (run-test "check-hotspot")
512 (run-test "check-langtools")
513 (run-test "check-jdk")))))
514 (alist-replace
515 'install
516 (lambda* (#:key outputs #:allow-other-keys)
517 (let ((doc (string-append (assoc-ref outputs "doc") "/share/doc/" ,name))
518 (jre (assoc-ref outputs "out"))
519 (jdk (assoc-ref outputs "jdk")))
520 (copy-recursively "openjdk.build/docs" doc)
521 (copy-recursively "openjdk.build/j2re-image" jre)
522 (copy-recursively "openjdk.build/j2sdk-image" jdk)))
523 %standard-phases)))))))))))
524 (native-inputs
525 `(("ant" ,ant)
526 ("alsa-lib" ,alsa-lib)
527 ("attr" ,attr)
528 ("autoconf" ,autoconf)
529 ("automake" ,automake)
530 ("coreutils" ,coreutils)
531 ("diffutils" ,diffutils) ;for tests
532 ("gawk" ,gawk)
533 ("grep" ,grep)
534 ("libtool" ,libtool)
535 ("pkg-config" ,pkg-config)
536 ("cups" ,cups)
537 ("wget" ,wget)
538 ("which" ,which)
539 ("cpio" ,cpio)
540 ("zip" ,zip)
541 ("unzip" ,unzip)
542 ("fastjar" ,fastjar)
543 ("libxslt" ,libxslt) ;for xsltproc
544 ("mit-krb5" ,mit-krb5)
545 ("nss" ,nss)
546 ("libx11" ,libx11)
547 ("libxt" ,libxt)
548 ("libxtst" ,libxtst)
549 ("libxi" ,libxi)
550 ("libxinerama" ,libxinerama)
551 ("libxrender" ,libxrender)
552 ("libjpeg" ,libjpeg)
553 ("libpng" ,libpng)
554 ("giflib" ,giflib)
555 ("perl" ,perl)
556 ("procps" ,procps) ;for "free", even though I'm not sure we should use it
557 ("openjdk6-src"
558 ,(origin
559 (method url-fetch)
560 (uri "https://java.net/downloads/openjdk6/openjdk-6-src-b36-22_jul_2015.tar.gz")
561 (sha256
562 (base32
563 "0mdckpazjijf6ggxzah2nq99lgsi0jk9pjbxhfq39b9lawvb45ln"))))
564 ("lcms" ,lcms)
565 ("zlib" ,zlib)
566 ("gtk" ,gtk+-2)
567 ("fontconfig" ,fontconfig)
568 ("freetype" ,freetype)
569 ("gcj" ,gcj)))
570 (home-page "http://icedtea.classpath.org")
571 (synopsis "Java development kit")
572 (description
573 "The OpenJDK built with the IcedTea build harness.")
574 ;; IcedTea is released under the GPL2 + Classpath exception, which is the
575 ;; same license as both GNU Classpath and OpenJDK.
576 (license license:gpl2+)))
577
578(define-public icedtea7
579 (let* ((version "2.6.2")
580 (drop (lambda (name hash)
581 (origin
582 (method url-fetch)
583 (uri (string-append
584 "http://icedtea.classpath.org/download/drops/"
585 "/icedtea7/" version "/" name ".tar.bz2"))
586 (sha256 (base32 hash))))))
587 (package (inherit icedtea6)
588 (name "icedtea7")
589 (version version)
590 (source (origin
591 (method url-fetch)
592 (uri (string-append
593 "http://icedtea.wildebeest.org/download/source/icedtea-"
594 version ".tar.xz"))
595 (sha256
596 (base32
597 "0xi0w8gpxx3r68hyi7fb991hxb3rqfp7895nfsl4wj3sa1f5ds5y"))
598 (modules '((guix build utils)))
599 (snippet
600 '(substitute* "Makefile.in"
601 ;; link against libgcj to avoid linker error
602 (("-o native-ecj")
603 "-lgcj -o native-ecj")
604 ;; do not leak information about the build host
605 (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
606 "DISTRIBUTION_ID=\"\\\"guix\\\"\"")))))
607 (arguments
608 `(;; There are many test failures. Some are known to
609 ;; fail upstream, others relate to not having an X
610 ;; server running at test time, yet others are a
611 ;; complete mystery to me.
612
613 ;; hotspot: passed: 241; failed: 45; error: 2
614 ;; langtools: passed: 1,934; failed: 26
615 ;; jdk: unknown
616 #:tests? #f
617 ;; Apparently, the C locale is needed for some of the tests.
618 #:locale "C"
619 ,@(substitute-keyword-arguments (package-arguments icedtea6)
620 ((#:configure-flags flags)
621 `(delete "--with-openjdk-src-dir=./openjdk"
622 ;; TODO: package pcsc and sctp, and add to inputs
623 (append '("--disable-system-pcsc"
624 "--disable-system-sctp")
625 ,flags)))
626 ((#:phases phases)
627 `(modify-phases ,phases
628 (replace
629 'unpack
630 (lambda* (#:key source inputs #:allow-other-keys)
631 (let ((target (string-append "icedtea-" ,version))
632 (unpack (lambda (drop dir)
633 (mkdir dir)
634 (zero? (system* "tar" "xvjf"
635 (assoc-ref inputs drop)
636 "-C" dir
637 "--strip-components=1")))))
638 (and (zero? (system* "tar" "xvf" source))
639 (chdir target)
640 (unpack "openjdk-drop" "openjdk")
641 (unpack "corba-drop" "openjdk/corba")
642 (unpack "jdk-drop" "openjdk/jdk")
643 (unpack "hotspot-drop" "openjdk/hotspot")
644
645 ;; The build framework checks the tarballs, so we
646 ;; need to keep them around even though we have
647 ;; already unpacked some of them for patching.
648 (begin
649 (copy-file (assoc-ref inputs "openjdk-drop")
650 "openjdk.tar.bz2")
651 (copy-file (assoc-ref inputs "corba-drop")
652 "corba.tar.bz2")
653 (copy-file (assoc-ref inputs "hotspot-drop")
654 "hotspot.tar.bz2")
655 (copy-file (assoc-ref inputs "jaxp-drop")
656 "jaxp.tar.bz2")
657 (copy-file (assoc-ref inputs "jaxws-drop")
658 "jaxws.tar.bz2")
659 (copy-file (assoc-ref inputs "jdk-drop")
660 "jdk.tar.bz2")
661 (copy-file (assoc-ref inputs "langtools-drop")
662 "langtools.tar.bz2")
663 #t)))))
664 (replace
665 'set-additional-paths
666 (lambda* (#:key inputs #:allow-other-keys)
667 (let (;; Get target-specific include directory so that
668 ;; libgcj-config.h is found when compiling hotspot.
669 (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include"))
670 (str (read-line port)))
671 (close-pipe port)
672 str)))
673 (substitute* "openjdk/jdk/make/common/shared/Sanity.gmk"
674 (("ALSA_INCLUDE=/usr/include/alsa/version.h")
675 (string-append "ALSA_INCLUDE="
676 (assoc-ref inputs "alsa-lib")
677 "/include/alsa/version.h")))
678 (setenv "CC" "gcc")
679 (setenv "CPATH"
680 (string-append gcjinclude ":"
681 (assoc-ref inputs "libxrender")
682 "/include/X11/extensions" ":"
683 (assoc-ref inputs "libxtst")
684 "/include/X11/extensions" ":"
685 (assoc-ref inputs "libxinerama")
686 "/include/X11/extensions" ":"
687 (or (getenv "CPATH") "")))
688 (setenv "ALT_OBJCOPY" (which "objcopy"))
689 (setenv "ALT_CUPS_HEADERS_PATH"
690 (string-append (assoc-ref inputs "cups")
691 "/include"))
692 (setenv "ALT_FREETYPE_HEADERS_PATH"
693 (string-append (assoc-ref inputs "freetype")
694 "/include"))
695 (setenv "ALT_FREETYPE_LIB_PATH"
696 (string-append (assoc-ref inputs "freetype")
697 "/lib")))))
698 (add-after
699 'unpack 'fix-x11-extension-include-path
700 (lambda* (#:key inputs #:allow-other-keys)
701 (substitute* "openjdk/jdk/make/sun/awt/mawt.gmk"
702 (((string-append "\\$\\(firstword \\$\\(wildcard "
703 "\\$\\(OPENWIN_HOME\\)"
704 "/include/X11/extensions\\).*$"))
705 (string-append (assoc-ref inputs "libxrender")
706 "/include/X11/extensions"
707 " -I" (assoc-ref inputs "libxtst")
708 "/include/X11/extensions"
709 " -I" (assoc-ref inputs "libxinerama")
710 "/include/X11/extensions"))
711 (("\\$\\(wildcard /usr/include/X11/extensions\\)\\)") ""))
712 #t))
713 (replace
714 'fix-test-framework
715 (lambda _
716 ;; Fix PATH in test environment
717 (substitute* "test/jtreg/com/sun/javatest/regtest/Main.java"
718 (("PATH=/bin:/usr/bin")
719 (string-append "PATH=" (getenv "PATH"))))
720 (substitute* "test/jtreg/com/sun/javatest/util/SysEnv.java"
721 (("/usr/bin/env") (which "env")))
722 (substitute* "openjdk/hotspot/test/test_env.sh"
723 (("/bin/rm") (which "rm"))
724 (("/bin/cp") (which "cp"))
725 (("/bin/mv") (which "mv")))
726 #t))
727 (delete 'patch-patches))))))
728 (native-inputs
729 `(("openjdk-drop"
730 ,(drop "openjdk"
731 "0jabxc8iw7ciz6f2qshcpla66qniy686vnxnfx3h2yw7syvas4a9"))
732 ("corba-drop"
733 ,(drop "corba"
734 "1bw22djg8mfqqn8kp8mpbj9vi4pl8dk67qwwrny67d0fvirixylj"))
735 ("jaxp-drop"
736 ,(drop "jaxp"
737 "1h3g2dwbj8ihicl73qbr4cvvc3i5bs5ckrpja1nx6g5b56xa7kcl"))
738 ("jaxws-drop"
739 ,(drop "jaxws"
740 "1m1h7455qn4pdhb5yamdl9965iz9260lzwl3njcs35vi14v7fihl"))
741 ("jdk-drop"
742 ,(drop "jdk"
743 "1wcaxf2chnlpk34q04c23im6z32dy8fr6f9giz3ih65nyvah3n3s"))
744 ("langtools-drop"
745 ,(drop "langtools"
746 "0da3cmm8nwz7dk2sqnywvidaa0kjnyzzi33p2lkdi4415f8yhgx5"))
747 ("hotspot-drop"
748 ,(drop "hotspot"
749 "0fn3cjhqsgbkfzychkvvw6whxil2n9dr6q0196ywxzkinny1hjcq"))
750 ,@(fold alist-delete (package-native-inputs icedtea6)
751 '("openjdk6-src")))))))