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