Commit | Line | Data |
---|---|---|
0760e3a1 RW |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> | |
559239af | 3 | ;;; Copyright © 2016 Leo Famulari <leo@famulari.name> |
0760e3a1 RW |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
8 | ;;; under the terms of the GNU General Public License as published by | |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | (define-module (gnu packages java) | |
21 | #:use-module ((guix licenses) #:prefix license:) | |
22 | #:use-module (guix packages) | |
23 | #:use-module (guix download) | |
f6789047 | 24 | #:use-module (guix utils) |
0760e3a1 RW |
25 | #:use-module (guix build-system gnu) |
26 | #:use-module (gnu packages) | |
27 | #:use-module (gnu packages attr) | |
28 | #:use-module (gnu packages autotools) | |
29 | #:use-module (gnu packages base) | |
30 | #:use-module (gnu packages bash) | |
31 | #:use-module (gnu packages cpio) | |
32 | #:use-module (gnu packages cups) | |
33 | #:use-module (gnu packages compression) | |
34 | #:use-module (gnu packages fontutils) | |
35 | #:use-module (gnu packages gawk) | |
36 | #:use-module (gnu packages gcc) | |
8581c813 | 37 | #:use-module (gnu packages gl) |
0760e3a1 RW |
38 | #:use-module (gnu packages gnuzilla) ;nss |
39 | #:use-module (gnu packages ghostscript) ;lcms | |
40 | #:use-module (gnu packages gnome) | |
41 | #:use-module (gnu packages gtk) | |
42 | #:use-module (gnu packages image) | |
43 | #:use-module (gnu packages linux) ;alsa | |
44 | #:use-module (gnu packages wget) | |
0760e3a1 RW |
45 | #:use-module (gnu packages pkg-config) |
46 | #:use-module (gnu packages perl) | |
47 | #:use-module (gnu packages mit-krb5) | |
48 | #:use-module (gnu packages xml) | |
49 | #:use-module (gnu packages xorg) | |
50 | #:use-module (gnu packages zip) | |
f6789047 RW |
51 | #:use-module (gnu packages texinfo) |
52 | #:use-module ((srfi srfi-1) #:select (fold alist-delete))) | |
0760e3a1 | 53 | |
8581c813 RW |
54 | (define-public swt |
55 | (package | |
56 | (name "swt") | |
57 | (version "4.4.2") | |
58 | (source (origin | |
59 | (method url-fetch) | |
60 | (uri (string-append | |
61 | "http://ftp-stud.fht-esslingen.de/pub/Mirrors/" | |
62 | "eclipse/eclipse/downloads/drops4/R-" version | |
63 | "-201502041700/swt-" version "-gtk-linux-x86.zip")) | |
64 | (sha256 | |
65 | (base32 | |
66 | "0lzyqr8k2zm5s8fmnrx5kxpslxfs0i73y26fwfms483x45izzwj8")))) | |
67 | (build-system gnu-build-system) | |
68 | (arguments | |
69 | `(#:make-flags '("-f" "make_linux.mak") | |
70 | #:tests? #f ; no "check" target | |
71 | #:phases | |
72 | (alist-replace | |
73 | 'unpack | |
74 | (lambda _ | |
75 | (and (mkdir "swt") | |
76 | (zero? (system* "unzip" (assoc-ref %build-inputs "source") "-d" "swt")) | |
77 | (chdir "swt") | |
78 | (mkdir "src") | |
79 | (zero? (system* "unzip" "src.zip" "-d" "src")) | |
80 | (chdir "src"))) | |
81 | (alist-replace | |
82 | 'build | |
83 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
84 | (let ((lib (string-append (assoc-ref outputs "out") "/lib"))) | |
d2540f80 | 85 | (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) |
8581c813 RW |
86 | |
87 | ;; Build shared libraries. Users of SWT have to set the system | |
88 | ;; property swt.library.path to the "lib" directory of this | |
89 | ;; package output. | |
90 | (mkdir-p lib) | |
91 | (setenv "OUTPUT_DIR" lib) | |
92 | (zero? (system* "bash" "build.sh")) | |
93 | ||
94 | ;; build jar | |
95 | (mkdir "build") | |
96 | (for-each (lambda (file) | |
97 | (format #t "Compiling ~s\n" file) | |
98 | (system* "javac" "-d" "build" file)) | |
99 | (find-files "." "\\.java")) | |
100 | (zero? (system* "jar" "cvf" "swt.jar" "-C" "build" ".")))) | |
101 | (alist-cons-after | |
102 | 'install 'install-java-files | |
103 | (lambda* (#:key outputs #:allow-other-keys) | |
104 | (let ((java (string-append (assoc-ref outputs "out") | |
105 | "/share/java"))) | |
96c46210 LC |
106 | (install-file "swt.jar" java) |
107 | #t)) | |
8581c813 RW |
108 | (alist-delete 'configure %standard-phases)))))) |
109 | (inputs | |
110 | `(("xulrunner" ,icecat) | |
111 | ("gtk" ,gtk+-2) | |
112 | ("libxtst" ,libxtst) | |
113 | ("libxt" ,libxt) | |
114 | ("mesa" ,mesa) | |
115 | ("glu" ,glu))) | |
116 | (native-inputs | |
117 | `(("pkg-config" ,pkg-config) | |
118 | ("unzip" ,unzip) | |
d2540f80 | 119 | ("jdk" ,icedtea "jdk"))) |
8581c813 RW |
120 | (home-page "https://www.eclipse.org/swt/") |
121 | (synopsis "Widget toolkit for Java") | |
122 | (description | |
123 | "SWT is a widget toolkit for Java designed to provide efficient, portable | |
124 | access to the user-interface facilities of the operating systems on which it | |
125 | is implemented.") | |
126 | ;; SWT code is licensed under EPL1.0 | |
127 | ;; Gnome and Gtk+ bindings contain code licensed under LGPLv2.1 | |
128 | ;; Cairo bindings contain code under MPL1.1 | |
129 | ;; XULRunner 1.9 bindings contain code under MPL2.0 | |
130 | (license (list | |
131 | license:epl1.0 | |
132 | license:mpl1.1 | |
133 | license:mpl2.0 | |
134 | license:lgpl2.1+)))) | |
135 | ||
9953fa76 RW |
136 | (define-public ant |
137 | (package | |
138 | (name "ant") | |
dffdef0f | 139 | (version "1.9.6") |
9953fa76 RW |
140 | (source (origin |
141 | (method url-fetch) | |
535e2a2f RW |
142 | (uri (string-append "mirror://apache/ant/source/apache-ant-" |
143 | version "-src.tar.gz")) | |
9953fa76 RW |
144 | (sha256 |
145 | (base32 | |
dffdef0f | 146 | "1396wflczyxjxl603dhxjvd559f289lha9y2f04f71c7hapjl3am")))) |
9953fa76 RW |
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 _ | |
60eb5614 RW |
162 | (setenv "JAVA_HOME" (string-append (assoc-ref %build-inputs "gcj") |
163 | "/lib/jvm")) | |
9953fa76 RW |
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 | |
60eb5614 | 177 | `(("gcj" ,gcj))) |
9953fa76 RW |
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 | ||
d0287406 | 187 | (define-public icedtea-6 |
0760e3a1 | 188 | (package |
5452588c | 189 | (name "icedtea") |
559239af | 190 | (version "1.13.10") |
0760e3a1 RW |
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 | |
559239af | 198 | "1mq08sfyfjlfw0c1czjs47303zv4h91s1jc0nhdlra4rbbx0g2d0")) |
0760e3a1 RW |
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) | |
0e309f1e RW |
209 | (outputs '("out" ; Java Runtime Environment |
210 | "jdk" ; Java Development Kit | |
211 | "doc")) ; all documentation | |
0760e3a1 RW |
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 | |
fb799cb7 LC |
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 | ||
4cbaf2ab RW |
253 | #:modules ((guix build utils) |
254 | (guix build gnu-build-system) | |
255 | (ice-9 popen) | |
256 | (ice-9 rdelim)) | |
257 | ||
0760e3a1 RW |
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 | |
d9148890 | 268 | "--with-openjdk-src-dir=./openjdk.src" |
0760e3a1 RW |
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)) | |
0760e3a1 | 279 | (begin |
9f40b117 | 280 | (chdir (string-append "icedtea6-" ,version)) |
d9148890 RW |
281 | (mkdir "openjdk.src") |
282 | (with-directory-excursion "openjdk.src" | |
0760e3a1 RW |
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 | |
4d80586a | 287 | 'unpack 'patch-patches |
0760e3a1 | 288 | (lambda _ |
0760e3a1 RW |
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") | |
4d80586a RW |
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 | |
d9148890 | 305 | (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make") |
4d80586a | 306 | (("/bin/sh") (which "bash"))) |
0760e3a1 | 307 | |
4d80586a RW |
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/"))) | |
d9148890 RW |
314 | (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk" |
315 | "openjdk.src/corba/make/common/shared/Defs-linux.gmk") | |
4d80586a RW |
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")))) | |
0760e3a1 | 327 | |
4d80586a | 328 | ;; fix hard-coded utility paths |
d9148890 RW |
329 | (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk" |
330 | "openjdk.src/corba/make/common/shared/Defs-utils.gmk") | |
4d80586a RW |
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"))) | |
4d80586a RW |
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")))) | |
0760e3a1 | 369 | |
4d80586a RW |
370 | ;; Some of these timestamps cause problems as they are more than |
371 | ;; 10 years ago, failing the build process. | |
372 | (substitute* | |
d9148890 | 373 | "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties" |
4d80586a RW |
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")))) | |
0760e3a1 | 378 | (alist-cons-before |
3893c80a | 379 | 'configure 'set-additional-paths |
0760e3a1 RW |
380 | (lambda* (#:key inputs #:allow-other-keys) |
381 | (let* ((gcjdir (assoc-ref %build-inputs "gcj")) | |
382 | (gcjlib (string-append gcjdir "/lib")) | |
4cbaf2ab RW |
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))) | |
0760e3a1 | 389 | (setenv "CPATH" |
4cbaf2ab RW |
390 | (string-append gcjinclude ":" |
391 | (assoc-ref %build-inputs "libxrender") | |
0760e3a1 RW |
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") | |
d4bf4c8f | 406 | "/lib")))) |
0760e3a1 | 407 | (alist-cons-before |
47c8ba5a | 408 | 'check 'fix-test-framework |
0760e3a1 RW |
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"))) | |
47c8ba5a RW |
416 | #t) |
417 | (alist-cons-before | |
418 | 'check 'fix-hotspot-tests | |
0760e3a1 | 419 | (lambda _ |
d9148890 | 420 | (with-directory-excursion "openjdk.src/hotspot/test/" |
47c8ba5a RW |
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 _ | |
d9148890 | 435 | (with-directory-excursion "openjdk.src/jdk/test/" |
47c8ba5a RW |
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) | |
5452588c RW |
517 | (let ((doc (string-append (assoc-ref outputs "doc") |
518 | "/share/doc/icedtea")) | |
47c8ba5a RW |
519 | (jre (assoc-ref outputs "out")) |
520 | (jdk (assoc-ref outputs "jdk"))) | |
521 | (copy-recursively "openjdk.build/docs" doc) | |
522 | (copy-recursively "openjdk.build/j2re-image" jre) | |
523 | (copy-recursively "openjdk.build/j2sdk-image" jdk))) | |
524 | %standard-phases))))))))))) | |
0760e3a1 | 525 | (native-inputs |
d4bf4c8f | 526 | `(("ant" ,ant) |
0760e3a1 RW |
527 | ("alsa-lib" ,alsa-lib) |
528 | ("attr" ,attr) | |
529 | ("autoconf" ,autoconf) | |
530 | ("automake" ,automake) | |
531 | ("coreutils" ,coreutils) | |
532 | ("diffutils" ,diffutils) ;for tests | |
533 | ("gawk" ,gawk) | |
534 | ("grep" ,grep) | |
535 | ("libtool" ,libtool) | |
536 | ("pkg-config" ,pkg-config) | |
537 | ("cups" ,cups) | |
538 | ("wget" ,wget) | |
539 | ("which" ,which) | |
540 | ("cpio" ,cpio) | |
541 | ("zip" ,zip) | |
542 | ("unzip" ,unzip) | |
543 | ("fastjar" ,fastjar) | |
544 | ("libxslt" ,libxslt) ;for xsltproc | |
545 | ("mit-krb5" ,mit-krb5) | |
546 | ("nss" ,nss) | |
547 | ("libx11" ,libx11) | |
548 | ("libxt" ,libxt) | |
549 | ("libxtst" ,libxtst) | |
550 | ("libxi" ,libxi) | |
551 | ("libxinerama" ,libxinerama) | |
552 | ("libxrender" ,libxrender) | |
553 | ("libjpeg" ,libjpeg) | |
554 | ("libpng" ,libpng) | |
555 | ("giflib" ,giflib) | |
556 | ("perl" ,perl) | |
557 | ("procps" ,procps) ;for "free", even though I'm not sure we should use it | |
558 | ("openjdk6-src" | |
559 | ,(origin | |
560 | (method url-fetch) | |
559239af | 561 | (uri "https://java.net/downloads/openjdk6/openjdk-6-src-b38-20_jan_2016.tar.gz") |
0760e3a1 RW |
562 | (sha256 |
563 | (base32 | |
559239af | 564 | "1fapj9w4ahzf5nwvdgi1dsxjyh9dqbcvf9638r60h1by13wjqk5p")))) |
0760e3a1 RW |
565 | ("lcms" ,lcms) |
566 | ("zlib" ,zlib) | |
567 | ("gtk" ,gtk+-2) | |
568 | ("fontconfig" ,fontconfig) | |
569 | ("freetype" ,freetype) | |
397dbde8 | 570 | ("gcj" ,gcj))) |
0760e3a1 RW |
571 | (home-page "http://icedtea.classpath.org") |
572 | (synopsis "Java development kit") | |
573 | (description | |
574 | "The OpenJDK built with the IcedTea build harness.") | |
575 | ;; IcedTea is released under the GPL2 + Classpath exception, which is the | |
576 | ;; same license as both GNU Classpath and OpenJDK. | |
577 | (license license:gpl2+))) | |
f6789047 | 578 | |
a243e12a | 579 | (define-public icedtea-7 |
03675cad | 580 | (let* ((version "2.6.4") |
f6789047 RW |
581 | (drop (lambda (name hash) |
582 | (origin | |
583 | (method url-fetch) | |
584 | (uri (string-append | |
585 | "http://icedtea.classpath.org/download/drops/" | |
586 | "/icedtea7/" version "/" name ".tar.bz2")) | |
587 | (sha256 (base32 hash)))))) | |
d0287406 | 588 | (package (inherit icedtea-6) |
f6789047 RW |
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 | |
03675cad | 597 | "0r31h8nlsrbfdkgbjbb7phwgcwglc9siznzrr40lqnm9xrgkc2nj")) |
f6789047 RW |
598 | (modules '((guix build utils))) |
599 | (snippet | |
600 | '(substitute* "Makefile.in" | |
47da6268 RW |
601 | ;; link against libgcj to avoid linker error |
602 | (("-o native-ecj") | |
603 | "-lgcj -o native-ecj") | |
f6789047 RW |
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" | |
d0287406 | 619 | ,@(substitute-keyword-arguments (package-arguments icedtea-6) |
d9148890 RW |
620 | ((#:modules modules) |
621 | `((ice-9 match) | |
622 | (srfi srfi-26) | |
623 | ,@modules)) | |
f6789047 | 624 | ((#:configure-flags flags) |
d9148890 RW |
625 | ;; TODO: package pcsc and sctp, and add to inputs |
626 | `(append '("--disable-system-pcsc" | |
627 | "--disable-system-sctp") | |
628 | ,flags)) | |
f6789047 RW |
629 | ((#:phases phases) |
630 | `(modify-phases ,phases | |
d9148890 RW |
631 | (replace 'unpack |
632 | (lambda* (#:key source inputs #:allow-other-keys) | |
633 | (let ((target (string-append "icedtea-" ,version)) | |
634 | (unpack (lambda* (name #:optional dir) | |
635 | (let ((dir (or dir | |
636 | (string-drop-right name 5)))) | |
637 | (mkdir dir) | |
638 | (zero? (system* "tar" "xvf" | |
639 | (assoc-ref inputs name) | |
640 | "-C" dir | |
641 | "--strip-components=1")))))) | |
642 | (mkdir target) | |
643 | (and | |
644 | (zero? (system* "tar" "xvf" source | |
645 | "-C" target "--strip-components=1")) | |
646 | (chdir target) | |
647 | (unpack "openjdk-src" "openjdk.src") | |
648 | (with-directory-excursion "openjdk.src" | |
649 | (for-each unpack | |
650 | (filter (cut string-suffix? "-drop" <>) | |
651 | (map (match-lambda | |
652 | ((name . _) name)) | |
653 | inputs)))) | |
654 | #t)))) | |
f6789047 RW |
655 | (replace |
656 | 'set-additional-paths | |
657 | (lambda* (#:key inputs #:allow-other-keys) | |
47da6268 RW |
658 | (let (;; Get target-specific include directory so that |
659 | ;; libgcj-config.h is found when compiling hotspot. | |
660 | (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include")) | |
661 | (str (read-line port))) | |
662 | (close-pipe port) | |
663 | str))) | |
d9148890 | 664 | (substitute* "openjdk.src/jdk/make/common/shared/Sanity.gmk" |
47da6268 RW |
665 | (("ALSA_INCLUDE=/usr/include/alsa/version.h") |
666 | (string-append "ALSA_INCLUDE=" | |
667 | (assoc-ref inputs "alsa-lib") | |
668 | "/include/alsa/version.h"))) | |
669 | (setenv "CC" "gcc") | |
670 | (setenv "CPATH" | |
671 | (string-append gcjinclude ":" | |
672 | (assoc-ref inputs "libxrender") | |
673 | "/include/X11/extensions" ":" | |
674 | (assoc-ref inputs "libxtst") | |
675 | "/include/X11/extensions" ":" | |
676 | (assoc-ref inputs "libxinerama") | |
677 | "/include/X11/extensions" ":" | |
678 | (or (getenv "CPATH") ""))) | |
679 | (setenv "ALT_OBJCOPY" (which "objcopy")) | |
680 | (setenv "ALT_CUPS_HEADERS_PATH" | |
681 | (string-append (assoc-ref inputs "cups") | |
682 | "/include")) | |
683 | (setenv "ALT_FREETYPE_HEADERS_PATH" | |
684 | (string-append (assoc-ref inputs "freetype") | |
685 | "/include")) | |
686 | (setenv "ALT_FREETYPE_LIB_PATH" | |
687 | (string-append (assoc-ref inputs "freetype") | |
688 | "/lib"))))) | |
f6789047 RW |
689 | (add-after |
690 | 'unpack 'fix-x11-extension-include-path | |
691 | (lambda* (#:key inputs #:allow-other-keys) | |
d9148890 | 692 | (substitute* "openjdk.src/jdk/make/sun/awt/mawt.gmk" |
f6789047 RW |
693 | (((string-append "\\$\\(firstword \\$\\(wildcard " |
694 | "\\$\\(OPENWIN_HOME\\)" | |
695 | "/include/X11/extensions\\).*$")) | |
696 | (string-append (assoc-ref inputs "libxrender") | |
697 | "/include/X11/extensions" | |
698 | " -I" (assoc-ref inputs "libxtst") | |
699 | "/include/X11/extensions" | |
700 | " -I" (assoc-ref inputs "libxinerama") | |
701 | "/include/X11/extensions")) | |
702 | (("\\$\\(wildcard /usr/include/X11/extensions\\)\\)") "")) | |
703 | #t)) | |
704 | (replace | |
705 | 'fix-test-framework | |
706 | (lambda _ | |
707 | ;; Fix PATH in test environment | |
708 | (substitute* "test/jtreg/com/sun/javatest/regtest/Main.java" | |
709 | (("PATH=/bin:/usr/bin") | |
710 | (string-append "PATH=" (getenv "PATH")))) | |
711 | (substitute* "test/jtreg/com/sun/javatest/util/SysEnv.java" | |
712 | (("/usr/bin/env") (which "env"))) | |
d9148890 | 713 | (substitute* "openjdk.src/hotspot/test/test_env.sh" |
f6789047 RW |
714 | (("/bin/rm") (which "rm")) |
715 | (("/bin/cp") (which "cp")) | |
716 | (("/bin/mv") (which "mv"))) | |
717 | #t)) | |
718 | (delete 'patch-patches)))))) | |
719 | (native-inputs | |
d9148890 | 720 | `(("openjdk-src" |
f6789047 | 721 | ,(drop "openjdk" |
03675cad | 722 | "1qjjf71nq80ac2d08hbaa8589d31vk313z3rkirnwq5df8cyf0mv")) |
f6789047 RW |
723 | ("corba-drop" |
724 | ,(drop "corba" | |
03675cad | 725 | "025warxhjal3nr7w1xyd16k0f32fwkchifpaslzyidsga3hgmfr6")) |
f6789047 RW |
726 | ("jaxp-drop" |
727 | ,(drop "jaxp" | |
03675cad | 728 | "0qiz6swb78w9c0mf88pf0gflgm5rp9k0l6fv6sdl7dki691b0z09")) |
f6789047 RW |
729 | ("jaxws-drop" |
730 | ,(drop "jaxws" | |
03675cad | 731 | "18fz4gl4fdlcmqvh1mlpd9h0gj0qizpfa7njkax97aysmsm08xns")) |
f6789047 RW |
732 | ("jdk-drop" |
733 | ,(drop "jdk" | |
03675cad | 734 | "0qsx5d9pgwlz9vbpapw4jwpajqc6rwk1150cjb33i4n3z709jccx")) |
f6789047 RW |
735 | ("langtools-drop" |
736 | ,(drop "langtools" | |
03675cad | 737 | "1k6plx96smf86z303gb30hncssa8f40qdryzsdv349iwqwacxc7r")) |
f6789047 RW |
738 | ("hotspot-drop" |
739 | ,(drop "hotspot" | |
03675cad | 740 | "0r9ffzyf5vxs8wg732szqcil0ksc8lcxzihdv3viz7d67dy42irp")) |
d0287406 | 741 | ,@(fold alist-delete (package-native-inputs icedtea-6) |
d4bf4c8f | 742 | '("openjdk6-src"))))))) |
d2540f80 | 743 | |
a243e12a | 744 | (define-public icedtea icedtea-7) |