summaryrefslogtreecommitdiff
path: root/gnu/packages/java.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/java.scm')
-rw-r--r--gnu/packages/java.scm182
1 files changed, 123 insertions, 59 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 6c7e5f9b15..9a6ca926be 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -9,7 +9,7 @@
;;; Copyright © 2017, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
-;;; Copyright © 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2019, 2020, 2021 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
@@ -17,6 +17,7 @@
;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com>
;;; Copyright © 2021 Mike Gerwitz <mtg@gnu.org>
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -130,24 +131,11 @@
(base32 "0lpbnb4dq4azmsvlhp6khq1gy42kyqyjv8gww74g5lm2y6blm4fa"))))
(build-system gnu-build-system)
(arguments
- `(#:configure-flags (list "--enable-debuginfo" "--disable-static")
- #:phases (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key build target native-inputs inputs outputs
- (configure-flags '()) out-of-source? system
- #:allow-other-keys)
- (let ((configure (assoc-ref %standard-phases 'configure))
- (enable-64bit? (member system '("aarch64-linux"
- "x86_64-linux"
- "mips64el-linux"))))
- (configure #:build build #:target target
- #:native-inputs native-inputs
- #:inputs inputs #:outputs outputs
- #:configure-flags `(,(if enable-64bit?
- "--enable-64bit"
- '())
- ,@configure-flags)
- #:out-of-source? out-of-source?)))))))
+ `(#:configure-flags (list "--enable-debuginfo"
+ "--disable-static"
+ ,@(if (target-64bit?)
+ `("--enable-64bit")
+ '()))))
(synopsis "ANTLR C Library")
(description "LIBANTLR3C provides run-time C libraries for ANTLR3 (ANother
Tool for Language Recognition v3).")
@@ -243,13 +231,13 @@ only faster.")
(sha256
(base32
"0i99wf9xd3hw1sj2sazychb9prx8nadxh2clgvk3zlmb28v0jbfz"))
- (patches (search-patches "classpath-aarch64-support.patch"))))
+ (patches (search-patches "classpath-aarch64-support.patch"
+ "classpath-miscompilation.patch"))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags
(list (string-append "JAVAC="
- (assoc-ref %build-inputs "jikes")
- "/bin/jikes")
+ (search-input-file %build-inputs "/bin/jikes"))
"--disable-Werror"
"--disable-gmp"
"--disable-gtk-peer"
@@ -260,17 +248,6 @@ only faster.")
"--disable-gjdoc")
#:phases
(modify-phases %standard-phases
- ;; XXX: This introduces a memory leak as we remove a call to free up
- ;; memory for the file name string. This was necessary because of a
- ;; runtime error that would have prevented us from building
- ;; ant-bootstrap later. See https://issues.guix.gnu.org/issue/36685
- ;; for the gnarly details.
- (add-after 'unpack 'remove-call-to-free
- (lambda _
- (substitute* "native/jni/java-io/java_io_VMFile.c"
- (("result = cpio_isFileExists.*" m)
- (string-append m "\n//")))
- #t))
(add-after 'install 'install-data
(lambda _ (invoke "make" "install-data"))))))
(native-inputs
@@ -374,16 +351,15 @@ JNI.")
(modify-phases %standard-phases
(delete 'bootstrap)
(delete 'configure)
- (replace 'build
+ (add-before 'build 'define-java-environment-variables
(lambda* (#:key inputs #:allow-other-keys)
+ ;; First, set environment variables (eases debugging on -K).
(setenv "JAVA_HOME" (assoc-ref inputs "jamvm"))
- (setenv "JAVACMD"
- (search-input-file inputs "/bin/jamvm"))
- (setenv "JAVAC"
- (search-input-file inputs "/bin/jikes"))
- (setenv "CLASSPATH"
- (search-input-file inputs "/lib/rt.jar"))
-
+ (setenv "JAVACMD" (search-input-file inputs "/bin/jamvm"))
+ (setenv "JAVAC" (search-input-file inputs "/bin/jikes"))
+ (setenv "CLASSPATH" (search-input-file inputs "/lib/rt.jar"))))
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
;; Ant complains if this file doesn't exist.
(setenv "HOME" "/tmp")
(with-output-to-file "/tmp/.ant.properties"
@@ -932,6 +908,33 @@ machine.")))
"patches/hotspot/hs23/drop_unlicensed_test.patch")
(("#!/bin/sh") (string-append "#!" (which "sh"))))
#t))
+ (add-after 'unpack 'fix-openjdk
+ (lambda _
+ (substitute* "openjdk/jdk/make/common/Defs-linux.gmk"
+ (("CFLAGS_COMMON = -fno-strict-aliasing" all)
+ (string-append all " -fcommon")))
+ (substitute* "openjdk/hotspot/src/share/vm/code/relocInfo.hpp"
+ (("inline friend relocInfo prefix_relocInfo\\(int datalen = 0\\);")
+ "inline friend relocInfo prefix_relocInfo(int datalen);"))
+ (substitute*
+ '("openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c"
+ "openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c")
+ (("#include <sys/sysctl.h>")
+ "#include <linux/sysctl.h>"))
+ ;; It looks like the "h = 31 * h + c" line of the jsum()
+ ;; function gets miscompiled. After a few iterations of the loop
+ ;; the result of "31 * h" is always 0x8000000000000000.
+ ;; Bad optimization maybe...
+ ;; Transform "31 * h + c" into a convoluted "32 * h + c - h"
+ ;; as a workaround.
+ (substitute* "openjdk/hotspot/src/share/vm/memory/dump.cpp"
+ (("h = 31 \\* h \\+ c;")
+ "jlong h0 = h;\nfor(int i = 0; i < 5; i++) h += h;\nh += c - h0;"))
+ ;; Our gcc version is higher than 4.3; replace the failing
+ ;; expression to test this by its result.
+ (substitute* "openjdk/jdk/make/sun/font/Makefile"
+ (("\"\\$\\(shell expr.*0\"")
+ "\"1\" \"0\""))))
(add-after 'unpack 'patch-paths
(lambda* (#:key inputs #:allow-other-keys)
;; buildtree.make generates shell scripts, so we need to replace
@@ -1100,6 +1103,7 @@ machine.")))
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/")
(changeset "jdk6-b41")))
+ (file-name "jdk6-checkout")
(sha256
(base32
"14q47yfg586fs64w30g8mk92m5dkxsvr36zzh0ra99xk5x0x96mv"))))
@@ -1109,6 +1113,7 @@ machine.")))
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/jdk/")
(changeset "jdk6-b41")))
+ (file-name "jdk-checkout")
(sha256
(base32
"165824nhg1k1dx6zs9dny0j49rmk35jw5b13dmz8c77jfajml4v9"))))
@@ -1118,6 +1123,7 @@ machine.")))
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/hotspot/")
(changeset "jdk6-b41")))
+ (file-name "hotspot-checkout")
(sha256
(base32
"07lc1z4k5dj9nrc1wvwmpvxr3xgxrdkdh53xb95skk5ij49yagfd"))))
@@ -1127,6 +1133,7 @@ machine.")))
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/corba/")
(changeset "jdk6-b41")))
+ (file-name "corba-checkout")
(sha256
(base32
"1p9g1r9dnax2iwp7yb59qx7m4nmshqhwmrb2b8jj8zgbd9dl2i3q"))))
@@ -1136,6 +1143,7 @@ machine.")))
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/langtools/")
(changeset "jdk6-b41")))
+ (file-name "langtools-checkout")
(sha256
(base32
"1x52wd67fynbbd9ild6fb4wvba3f5hhwk03qdjfazd0a1qr37z3d"))))
@@ -1145,6 +1153,7 @@ machine.")))
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/jaxp/")
(changeset "jdk6-b41")))
+ (file-name "jaxp-checkout")
(sha256
(base32
"0shlqrvzpr4nrkmv215lbxnby63s3yvbdh1yxcayznsyqwa4nlxm"))))
@@ -1154,6 +1163,7 @@ machine.")))
(uri (hg-reference
(url "http://hg.openjdk.java.net/jdk6/jdk6/jaxws/")
(changeset "jdk6-b41")))
+ (file-name "jaxws-checkout")
(sha256
(base32
"0835lkw8vib1xhp8lxnybhlvzdh699hbi4mclxanydjk63zbpxk0"))))))
@@ -1276,6 +1286,25 @@ bootstrapping purposes.")
"openjdk.src/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c")
(("attr/xattr.h") "sys/xattr.h"))
#t))
+ (add-after 'unpack 'fix-openjdk
+ (lambda _
+ (substitute* "openjdk.src/jdk/make/common/Defs-linux.gmk"
+ (("CFLAGS_COMMON = -fno-strict-aliasing" all)
+ (string-append all " -fcommon")))
+ (substitute*
+ '("openjdk.src/jdk/src/solaris/native/java/net/PlainSocketImpl.c"
+ "openjdk.src/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c")
+ (("#include <sys/sysctl.h>")
+ "#include <linux/sysctl.h>"))
+ ;; It looks like the "h = 31 * h + c" line of the jsum()
+ ;; function gets miscompiled. After a few iterations of the loop
+ ;; the result of "31 * h" is always 0x8000000000000000.
+ ;; Bad optimization maybe...
+ ;; Transform "31 * h + c" into a convoluted "32 * h + c - h"
+ ;; as a workaround.
+ (substitute* "openjdk.src/hotspot/src/share/vm/memory/dump.cpp"
+ (("h = 31 \\* h \\+ c;")
+ "jlong h0 = h;\nfor(int i = 0; i < 5; i++) h += h;\nh += c - h0;"))))
(add-after 'unpack 'fix-x11-extension-include-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "openjdk.src/jdk/make/sun/awt/mawt.gmk"
@@ -1764,7 +1793,9 @@ IcedTea build harness.")
(srfi srfi-26)))
((#:configure-flags flags)
`(let ((jdk (assoc-ref %build-inputs "jdk")))
- `( ;;"--disable-bootstrap"
+ `("CFLAGS=-fcommon"
+ "CXXFLAGS=-fcommon"
+ ;;"--disable-bootstrap"
"--enable-bootstrap"
"--enable-nss"
,(string-append "--with-parallel-jobs="
@@ -1829,6 +1860,13 @@ new Date();"))
(find-files "openjdk.src/jdk/src/solaris/native"
"\\.c|\\.h"))
#t)))
+ (replace 'fix-openjdk
+ (lambda _
+ (substitute*
+ '("openjdk.src/jdk/src/solaris/native/java/net/PlainSocketImpl.c"
+ "openjdk.src/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c")
+ (("#include <sys/sysctl.h>")
+ "#include <linux/sysctl.h>"))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((doc (string-append (assoc-ref outputs "doc")
@@ -1923,7 +1961,12 @@ new Date();"))
(lambda* (#:key inputs outputs #:allow-other-keys)
;; TODO: unbundle libpng and lcms
(invoke "bash" "./configure"
- (string-append "--with-freetype=" (assoc-ref inputs "freetype"))
+ ;; Add flags for compilation with gcc >= 10
+ ,(string-append "--with-extra-cflags=-fcommon"
+ " -fno-delete-null-pointer-checks"
+ " -fno-lifetime-dse")
+ (string-append "--with-freetype="
+ (assoc-ref inputs "freetype"))
"--disable-freetype-bundling"
"--disable-warnings-as-errors"
"--disable-hotspot-gtest"
@@ -2097,15 +2140,25 @@ new Date();"))
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(invoke "bash" "./configure"
- (string-append "--with-freetype=" (assoc-ref inputs "freetype"))
+ ;; Add flags for compilation with gcc >= 10
+ ,(string-append "--with-extra-cflags=-fcommon"
+ " -fno-delete-null-pointer-checks"
+ " -fno-lifetime-dse")
+ (string-append "--with-freetype="
+ (assoc-ref inputs "freetype"))
"--disable-freetype-bundling"
"--disable-warnings-as-errors"
"--disable-hotspot-gtest"
"--with-giflib=system"
"--with-libjpeg=system"
"--with-native-debug-symbols=zipped"
- (string-append "--prefix=" (assoc-ref outputs "out")))
- #t))))
+ (string-append "--prefix=" (assoc-ref outputs "out")))))
+ (add-after 'unpack 'disable-warnings-as-errors
+ (lambda _
+ ;; It looks like the "--disable-warnings-as-errors" option of
+ ;; the 'configure' phase is not working.
+ (substitute* "make/autoconf/generated-configure.sh"
+ (("-Werror") ""))))))
((#:disallowed-references _ '())
`(,(gexp-input openjdk9)
,(gexp-input openjdk9 "jdk")))))
@@ -2145,7 +2198,11 @@ new Date();"))
#:tests? #f; requires jtreg
;; TODO package jtreg
#:configure-flags
- `("--disable-option-checking" ; --enable-fast-install default flag errors otherwise
+ `(;; Add flags for compilation with gcc >= 10
+ ,(string-append "--with-extra-cflags=-fcommon"
+ " -fno-delete-null-pointer-checks"
+ " -fno-lifetime-dse")
+ "--disable-option-checking" ; --enable-fast-install default flag errors otherwise
"--disable-warnings-as-errors"
;; make validate-runpath pass, see: http://issues.guix.info/issue/32894
"--with-native-debug-symbols=zipped"
@@ -2603,6 +2660,7 @@ new Date();"))
(substitute-keyword-arguments (package-arguments ant-bootstrap)
((#:phases phases)
`(modify-phases ,phases
+ (delete 'define-java-environment-variables)
(add-after 'unpack 'remove-scripts
;; Remove bat / cmd scripts for DOS as well as the antRun and runant
;; wrappers.
@@ -3040,9 +3098,9 @@ debugging, etc.")
#t))))
(arguments
`(#:make-flags ; bootstrap from javacc-4
- (list (string-append "-Dbootstrap-jar="
- (assoc-ref %build-inputs "javacc")
- "/share/java/javacc.jar"))
+ ,#~(list (string-append "-Dbootstrap-jar="
+ #$(this-package-native-input "javacc")
+ "/share/java/javacc.jar"))
#:test-target "test"
#:phases
(modify-phases %standard-phases
@@ -3641,8 +3699,8 @@ HDF5 files, building on the libraries provided by the HDF Group.")
`(#:tests? #f ; there is no test target
#:build-target "compile"
#:make-flags
- (list "-Dbuild.compiler=javac1.8"
- (string-append "-Ddist=" (assoc-ref %outputs "out")))
+ ,#~(list "-Dbuild.compiler=javac1.8"
+ (string-append "-Ddist=" #$output))
#:phases
(modify-phases %standard-phases
(replace 'install
@@ -5394,7 +5452,7 @@ complex transformations and code analysis tools.")
(delete 'build)
(delete 'configure)
(replace 'install
- (install-pom-file (assoc-ref %build-inputs "source"))))))
+ ,#~(install-pom-file #$source)))))
(home-page "https://ow2.org")
(synopsis "Ow2.org parent pom")
(description "This package contains the parent pom for projects from ow2.org,
@@ -7955,14 +8013,14 @@ This is a part of the Apache Commons Project.")
(define-public java-commons-codec
(package
(name "java-commons-codec")
- (version "1.14")
+ (version "1.15")
(source (origin
(method url-fetch)
(uri (string-append "mirror://apache/commons/codec/source/"
"commons-codec-" version "-src.tar.gz"))
(sha256
(base32
- "11xr0agckkhm91pb5akf2mbk84yd54gyr178wj57gsm97fi7nkh9"))))
+ "01z9qmg8fd8d7p7xxipwj1vi9bmvpgqyi29kldjz2x6vzwm171jj"))))
(build-system ant-build-system)
(arguments
`(#:jar-name "java-commons-codec.jar"
@@ -7974,13 +8032,19 @@ This is a part of the Apache Commons Project.")
(add-before 'build 'copy-resources
(lambda _
(copy-recursively "src/main/resources"
- "build/classes")
- #t))
+ "build/classes")))
(add-before 'check 'copy-test-resources
(lambda _
(copy-recursively "src/test/resources"
- "build/test-classes")
- #t))
+ "build/test-classes")))
+ (add-before 'check 'skip-ravenous-test
+ (lambda _
+ ;; This test admits to being "memory hungry", but reliably fails
+ ;; even on a machine that should have plenty (12 GiB). Skip it.
+ (substitute*
+ "src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java"
+ (("\\bassertEnsureBufferSizeExpandsToMaxBufferSize.*;")
+ "return;"))))
(replace 'install (install-from-pom "pom.xml")))))
(native-inputs
`(("java-commons-lang3" ,java-commons-lang3)