diff options
Diffstat (limited to 'gnu/packages/java.scm')
-rw-r--r-- | gnu/packages/java.scm | 418 |
1 files changed, 387 insertions, 31 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 70141a5f05..35f905136f 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -37,6 +37,7 @@ #:use-module (guix hg-download) #:use-module (guix git-download) #:use-module (guix svn-download) + #:use-module ((guix build utils) #:select (alist-replace)) #:use-module (guix utils) #:use-module (guix build-system ant) #:use-module (guix build-system gnu) @@ -290,7 +291,8 @@ language.") (uri (string-append "mirror://sourceforge/jamvm/jamvm/" "JamVM%20" version "/jamvm-" version ".tar.gz")) - (patches (search-patches "jamvm-arm.patch")) + (patches (search-patches "jamvm-1.5.1-aarch64-support.patch" + "jamvm-1.5.1-armv7-support.patch")) (sha256 (base32 "06lhi03l3b0h48pc7x58bk9my2nrcf1flpmglvys3wyad6yraf36")) @@ -306,13 +308,30 @@ language.") (assoc-ref %build-inputs "classpath")) "--disable-int-caching" "--enable-runtime-reloc-checks" - "--enable-ffi"))) + "--enable-ffi") + #:phases + ,(if (string-prefix? "aarch64" (or (%current-system) + (%current-target-system))) + ;; Makefiles and the configure script need to be regenerated to + ;; incorporate support for AArch64. + '(modify-phases %standard-phases + (replace 'bootstrap + (lambda _ (invoke "autoreconf" "-vif")))) + '%standard-phases))) (inputs `(("classpath" ,classpath-bootstrap) ("jikes" ,jikes) ("libffi" ,libffi) ("zip" ,zip) ("zlib" ,zlib))) + (native-inputs + (if (string-prefix? "aarch64" (or (%current-system) + (%current-target-system))) + ;; Additional packages needed for autoreconf. + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool)) + '())) (home-page "http://jamvm.sourceforge.net/") (synopsis "Small Java Virtual Machine") (description "JamVM is a Java Virtual Machine conforming to the JVM @@ -697,7 +716,8 @@ machine."))) (file-name (string-append "classpath-" version "-checkout")) (sha256 (base32 - "1v2rww76ww322mpg3s12a1kkc6gkp31bm9gcxs532h0wq285fiw4")))) + "1v2rww76ww322mpg3s12a1kkc6gkp31bm9gcxs532h0wq285fiw4")) + (patches (search-patches "classpath-aarch64-support.patch")))) (arguments `(#:make-flags ;; Ensure that the initial heap size is smaller than the maximum @@ -763,7 +783,9 @@ machine."))) (base32 "1nl0zxz8y5x8gwsrm7n32bry4dx8x70p8z3s9jbdvs8avyb8whkn")) (patches - (search-patches "jamvm-2.0.0-disable-branch-patching.patch")) + (search-patches "jamvm-2.0.0-disable-branch-patching.patch" + "jamvm-2.0.0-opcode-guard.patch" + "jamvm-2.0.0-aarch64-support.patch")) (snippet '(begin ;; Remove precompiled software. @@ -771,9 +793,10 @@ machine."))) #t)))) (build-system gnu-build-system) (arguments - `(#:configure-flags - (list (string-append "--with-classpath-install-dir=" - (assoc-ref %build-inputs "classpath"))))) + (substitute-keyword-arguments (package-arguments jamvm-1-bootstrap) + ((#:configure-flags _) + '(list (string-append "--with-classpath-install-dir=" + (assoc-ref %build-inputs "classpath")))))) (inputs `(("classpath" ,classpath-devel) ("ecj-javac-wrapper" ,ecj-javac-wrapper) @@ -804,6 +827,8 @@ machine."))) (sha256 (base32 "0bg9sb4f7qbq77c0zf9m17p47ga0kf0r9622g9p12ysg26jd1ksg")) + (patches (search-patches + "icedtea-6-extend-hotspot-aarch64-support.patch")) (modules '((guix build utils))) (snippet '(begin @@ -832,7 +857,8 @@ machine."))) `("--enable-bootstrap" "--enable-nss" "--without-rhino" - "--with-parallel-jobs" + ,(string-append "--with-parallel-jobs=" + (number->string (parallel-job-count))) "--disable-downloading" "--disable-tests" ,(string-append "--with-ecj=" @@ -865,11 +891,8 @@ machine."))) (assoc-ref inputs (string-append part "-src")) part)) - '("jdk" "corba" + '("jdk" "hotspot" "corba" "langtools" "jaxp" "jaxws"))) - (with-directory-excursion "openjdk" - (invoke "tar" "xvf" (assoc-ref inputs "hotspot-src")) - (rename-file "hg-checkout" "hotspot")) (substitute* "patches/freetypeversion.patch" (("REQUIRED_FREETYPE_VERSION = 2.2.1") "REQUIRED_FREETYPE_VERSION = 2.10.1")) @@ -1095,9 +1118,7 @@ machine."))) (changeset "jdk6-b41"))) (sha256 (base32 - "07lc1z4k5dj9nrc1wvwmpvxr3xgxrdkdh53xb95skk5ij49yagfd")) - (patches - (search-patches "icedtea-6-hotspot-gcc-segfault-workaround.patch")))) + "07lc1z4k5dj9nrc1wvwmpvxr3xgxrdkdh53xb95skk5ij49yagfd")))) ("corba-src" ,(origin (method hg-fetch) @@ -1208,6 +1229,8 @@ bootstrapping purposes.") "--enable-bootstrap" "--enable-nss" "--without-rhino" + ,(string-append "--with-parallel-jobs=" + (number->string (parallel-job-count))) "--disable-downloading" "--disable-tests" ;they are run in the check phase instead "--with-openjdk-src-dir=./openjdk.src" @@ -1636,7 +1659,7 @@ bootstrapping purposes.") (base32 "17bdv39n4lh8l5737c96f3xgamx4y305m067p01cywgp7zaddqws")) (patches (search-patches - "icedtea-7-hotspot-gcc-segfault-workaround.patch")))) + "icedtea-7-hotspot-aarch64-use-c++98.patch")))) ("ant" ,ant-bootstrap) ("attr" ,attr) ("coreutils" ,coreutils) @@ -1739,6 +1762,8 @@ IcedTea build harness.") `( ;;"--disable-bootstrap" "--enable-bootstrap" "--enable-nss" + ,(string-append "--with-parallel-jobs=" + (number->string (parallel-job-count))) "--disable-downloading" "--disable-system-pcsc" "--disable-system-sctp" @@ -1830,16 +1855,8 @@ new Date();")) ,(drop "langtools" "15wizy123vhk40chl1b4p552jf2pw2hdww0myf11qab425axz4nw")) ("hotspot-drop" - ,(origin - (method url-fetch) - (uri (string-append - "http://icedtea.classpath.org/download/drops" - "/icedtea8/" version "/hotspot.tar.xz")) - (sha256 - (base32 - "1ciz1w9j0kz7s1dxdhyqq71nla9icyz6qvn0b9z2zgkklqa98qmm")) - (patches (search-patches - "icedtea-7-hotspot-gcc-segfault-workaround.patch")))) + ,(drop "hotspot" + "1ciz1w9j0kz7s1dxdhyqq71nla9icyz6qvn0b9z2zgkklqa98qmm")) ("nashorn-drop" ,(drop "nashorn" "19pzl3ppaw8j6r5cnyp8qiw3hxijh3hdc46l39g5yfhdl4pr4hpa")) @@ -2409,14 +2426,14 @@ new Date();")) (define-public ant/java8 (package (inherit ant-bootstrap) (name "ant") - (version "1.10.1") + (version "1.10.8") (source (origin (method url-fetch) (uri (string-append "mirror://apache/ant/source/apache-ant-" version "-src.tar.gz")) (sha256 (base32 - "10p3dh77lkzzzcy32dk9azljixzadp46fggjfbvgkl8mmb8cxxv8")) + "066k2isig5xm70cihj9p73hkp5w7h5zbfqz5kxb6cwr9cb86xl2k")) (modules '((guix build utils))) (snippet '(begin @@ -2444,7 +2461,7 @@ new Date();")) ;; "check" phase, because the dependency on "test-jar" would always ;; result in the tests to be run. (substitute* "build.xml" - (("depends=\"jars,test-jar\"") "depends=\"jars\"")) + (("depends=\"jars,test-jar") "depends=\"jars")) (invoke "bash" "bootstrap.sh" (string-append "-Ddist.dir=" (assoc-ref outputs "out"))))))))) @@ -2457,14 +2474,14 @@ new Date();")) ;; requires Java 8. (define-public ant (package (inherit ant/java8) - (version "1.9.9") + (version "1.9.15") (source (origin (method url-fetch) (uri (string-append "mirror://apache/ant/source/apache-ant-" version "-src.tar.gz")) (sha256 (base32 - "1k28mka0m3isy9yr8gz84kz1f3f879rwaxrd44vdn9xbfwvwk86n")))) + "1xy30f1w5gaqk6g3f0vw7ygix4rb6032qkcw42y4z8wd9jihgygd")))) (native-inputs `(("jdk" ,icedtea-7 "jdk") ("zip" ,zip) @@ -5118,6 +5135,72 @@ including java-asm.") ((#:tests? _) #f))) (native-inputs `()))) +(define-public java-asm-8 + (package + (inherit java-asm) + (version "8.0.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.ow2.org/asm/asm") + (commit (string-append + "ASM_" (string-join (string-split version #\.) + "_"))))) + (file-name (git-file-name "java-asm" version)) + (sha256 + (base32 + "1s6j27zc1i76gh891w2g48b1c3abp9w8zp5j54yb1vm5h8djkd69")))) + (arguments + `(#:jar-name "asm8.jar" + #:source-dir "asm/src/main/java" + #:test-dir "asm/src/test" + ;; tests depend on junit5 + #:tests? #f)) + (propagated-inputs '()) + (native-inputs '()))) + +(define-public java-asm-tree-8 + (package + (inherit java-asm-8) + (name "java-asm-tree") + (arguments + `(#:jar-name "asm-tree.jar" + #:source-dir "asm-tree/src/main/java" + #:test-dir "asm-tree/src/test" + ;; tests depend on junit5 + #:tests? #f)) + (inputs + `(("java-asm" ,java-asm-8))))) + +(define-public java-asm-analysis-8 + (package + (inherit java-asm-8) + (name "java-asm-analysis") + (arguments + `(#:jar-name "asm-analysis.jar" + #:source-dir "asm-analysis/src/main/java" + #:test-dir "asm-analysis/src/test" + ;; tests depend on junit5 + #:tests? #f)) + (inputs + `(("java-asm" ,java-asm-8) + ("java-asm-tree" ,java-asm-tree-8))))) + +(define-public java-asm-util-8 + (package + (inherit java-asm-8) + (name "java-asm-util") + (arguments + `(#:jar-name "asm-util8.jar" + #:source-dir "asm-util/src/main/java" + #:test-dir "asm-util/src/test" + ;; tests depend on junit5 + #:tests? #f)) + (inputs + `(("java-asm" ,java-asm-8) + ("java-asm-analysis" ,java-asm-analysis-8) + ("java-asm-tree" ,java-asm-tree-8))))) + (define-public java-cglib (package (name "java-cglib") @@ -8372,6 +8455,184 @@ text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR generates a parser that can build and walk parse trees."))) +(define-public java-antlr4-runtime-4.1 + (package + (inherit java-antlr4-runtime) + (version "4.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/antlr/antlr4") + (commit version))) + (file-name (git-file-name "antlr4" version)) + (sha256 + (base32 + "1i8hmx5an58cjyvhji0xgpvd6lq00z1k1mjys025q2wqc25wv4c1")))) + (arguments + (substitute-keyword-arguments (package-arguments java-antlr4-runtime) + ((#:phases phases) + `(modify-phases ,phases + (add-before 'configure 'chmod + (lambda _ + (chmod "build.xml" #o644) + #t)))))) + (inputs + `(("java-treelayout" ,java-treelayout))))) + +(define-public antlr4-4.1 + (package + (inherit antlr4) + (version (package-version java-antlr4-runtime-4.1)) + (source (package-source java-antlr4-runtime-4.1)) + (arguments + (substitute-keyword-arguments (package-arguments antlr4) + ((#:test-dir _) + "tool/test") + ((#:test-exclude excludes) + `(list "**/TestParseErrors.java" + "**/TestTopologicalSort.java" + ,@excludes)) + ((#:phases phases) + `(modify-phases ,phases + (delete 'generate-unicode) + (replace 'check + (lambda _ + (invoke "ant" "check") + #t)) + (add-before 'configure 'chmod + (lambda _ + (chmod "build.xml" #o644) + #t)) + (delete 'remove-graphemes) + (delete 'remove-unrelated-languages) + (delete 'generate-test-parsers))))) + (inputs + (alist-replace + "java-antlr4-runtime" (list java-antlr4-runtime-4.1) + (package-inputs antlr4))))) + +(define-public java-tunnelvisionlabs-antlr4-runtime-annotations + (package + (inherit java-antlr4-runtime) + (name "java-tunnelvisionlabs-antlr4-runtime-annotations") + (version "4.7.4") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tunnelvisionlabs/antlr4") + (commit (string-append version "-opt")))) + (file-name (git-file-name "java-tunnelvisionlabs-antlr4" version)) + (sha256 + (base32 + "1mf2lvvsszpialsk23ma83pwp50nd32lrbjpa847zlm5gmranbr8")) + (patches + (search-patches "java-antlr4-Add-standalone-generator.patch" + "java-tunnelvisionlabs-antlr-code-too-large.patch")))) + (arguments + `(#:jar-name "java-antlr4-runtime-annotations.jar" + #:source-dir "runtime/JavaAnnotations/src" + #:tests? #f; no tests + #:phases + (modify-phases %standard-phases + (add-after 'build 'copy-resources + (lambda _ + (copy-recursively "runtime/JavaAnnotations/resources" + "build/classes") + #t)) + (add-after 'copy-resources 'rebuild-jar + (lambda _ + (invoke "ant" "jar") + #t))))) + (inputs '()) + (native-inputs '()) + (synopsis "Annotations for ANTLR's runtime library") + (description "This package contains annotations used during the build of +the runtime library of ANTLR."))) + +;; the runtime of this library requires a lexer that is generated by antlr4. +;; However, antlr4 itself requires this library at build and run-time. We +;; use antlr4@4.1, the closest version of antlr that doesn't need this +;; bootstrap process, to generate the lexer. The generated lexer is built +;; for the 4.1 runtime, which is slightly different from this runtime. +;; So, we build the runtime with antlr 4.1, with a broken xml lexer, that we +;; use to build antlr4. We then re-use this antlr4 to build the runtime, and +;; the proper, working, runtime to build antlr4 again. +(define java-tunnelvisionlabs-antlr4-runtime-bootstrap + (package + (inherit java-antlr4-runtime) + (name "java-tunnelvisionlabs-antlr4-runtime") + (version (package-version java-tunnelvisionlabs-antlr4-runtime-annotations)) + (source (package-source java-tunnelvisionlabs-antlr4-runtime-annotations)) + (arguments + `(#:jar-name "java-antlr4-runtime.jar" + #:source-dir "runtime/Java/src" + #:tests? #f; tests require antlr4, but antlr4 depends on this package + #:phases + (modify-phases %standard-phases + (add-before 'build 'generate-xpath-lexer + (lambda _ + (invoke "antlr4" "-lib" "runtime/Java/src/org/antlr/v4/runtime/tree/xpath" + "-visitor" "-no-listener" + "-package" "org.antlr.v4.runtime.tree.xpath" + "runtime/Java/src/org/antlr/v4/runtime/tree/xpath/XPathLexer.g4") + ;; Generated code is for an incompatible version of the runtime + (substitute* "runtime/Java/src/org/antlr/v4/runtime/tree/xpath/XPathLexer.java" + (("LexerATNSimulator\\(this,_ATN,_decisionToDFA,_sharedContextCache\\)") + "LexerATNSimulator(this,_ATN)")) + #t)) + (add-before 'build 'copy-resources + (lambda _ + (copy-recursively "runtime/Java/src/main/dot" + "build/classes") + #t))))) + (native-inputs + `(("antlr4" ,antlr4-4.1) + ("java-tunnelvisionlabs-antlr4-runtime-annotations" + ,java-tunnelvisionlabs-antlr4-runtime-annotations))))) + +(define java-tunnelvisionlabs-antlr4-bootstrap + (package + (inherit antlr4) + (name "java-tunnelvisionlabs-antlr4") + (version (package-version java-tunnelvisionlabs-antlr4-runtime-annotations)) + (source (package-source java-tunnelvisionlabs-antlr4-runtime-annotations)) + (arguments + (substitute-keyword-arguments (package-arguments antlr4) + ((#:test-dir _) + "tool/test:runtime-testsuite/src") + ((#:phases phases) + `(modify-phases ,phases + (delete 'remove-unrelated-languages) + (delete 'remove-graphemes) + (delete 'generate-test-parsers) + (delete 'check))))) + (native-inputs '()) + (inputs + `(("antlr3" ,antlr3) + ("java-antlr4-runtime" ,java-tunnelvisionlabs-antlr4-runtime-bootstrap) + ("java-tunnelvisionlabs-antlr4-runtime-annotations" + ,java-tunnelvisionlabs-antlr4-runtime-annotations) + ("java-icu4j" ,java-icu4j) + ("java-jsonp-api" ,java-jsonp-api) + ("java-stringtemplate" ,java-stringtemplate) + ("java-treelayout" ,java-treelayout))))) + +(define-public java-tunnelvisionlabs-antlr4-runtime + (package + (inherit java-tunnelvisionlabs-antlr4-runtime-bootstrap) + (native-inputs + (alist-replace + "antlr4" (list java-tunnelvisionlabs-antlr4-bootstrap) + (package-native-inputs java-tunnelvisionlabs-antlr4-runtime-bootstrap))))) + +(define-public java-tunnelvisionlabs-antlr4 + (package + (inherit java-tunnelvisionlabs-antlr4-bootstrap) + (inputs + (alist-replace + "java-antlr4-runtime" (list java-tunnelvisionlabs-antlr4-runtime) + (package-inputs java-tunnelvisionlabs-antlr4-bootstrap))))) + (define-public java-commons-cli-1.2 ;; This is a bootstrap dependency for Maven2. (package @@ -13183,3 +13444,98 @@ in Java, usable from Groovy, Kotlin, Scala, etc.") used in JVM-based languages. They serve as an additional documentation and can be interpreted by IDEs and static analysis tools to improve code analysis.") (license license:expat))) + +(define-public java-javaparser + (package + (name "java-javaparser") + (version "3.16.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/javaparser/javaparser") + (commit (string-append "javaparser-parent-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1a4jk12ffa31fa0y8vda0739vpfj1206p0nha842b7bixbvwamv9")) + (modules '((guix build utils))) + (snippet + '(begin + (for-each delete-file + (find-files "." "\\.jar$")) + #t)))) + (build-system ant-build-system) + (arguments + `(#:tests? #f; tests require jbehave and junit5 + #:phases + (modify-phases %standard-phases + (add-before 'build 'fill-template + (lambda _ + (with-directory-excursion "javaparser-core/src/main" + (copy-file "java-templates/com/github/javaparser/JavaParserBuild.java" + "java/com/github/javaparser/JavaParserBuild.java") + (substitute* "java/com/github/javaparser/JavaParserBuild.java" + (("\\$\\{project.version\\}") ,version) + (("\\$\\{project.name\\}") "javaparser") + (("\\$\\{project.build.finalName\\}") "javaparser") + (("\\$\\{maven.version\\}") "fake") + (("\\$\\{maven.build.version\\}") "fake") + (("\\$\\{build.timestamp\\}") "0") + (("\\$\\{java.vendor\\}") "Guix") + (("\\$\\{java.vendor.url\\}") "https://gnu.org/software/guix") + (("\\$\\{java.version\\}") "1.8") + (("\\$\\{os.arch\\}") "any") + (("\\$\\{os.name\\}") "GuixSD") + (("\\$\\{os.version\\}") "not available"))) + #t)) + (add-before 'build 'generate-javacc + (lambda _ + (with-directory-excursion "javaparser-core/src/main/java" + (invoke "java" "javacc" "../javacc/java.jj")) + #t)) + (add-before 'build 'copy-javacc-support + (lambda _ + (with-directory-excursion "javaparser-core/src/main" + (copy-recursively "javacc-support" "java")) + #t)) + (replace 'build + (lambda _ + (define (build name) + (format #t "Building ~a~%" name) + (delete-file-recursively "build/classes") + (mkdir-p "build/classes") + (apply invoke "javac" + "-cp" (string-append (getenv "CLASSPATH") ":" + (string-join (find-files "build/jar" ".") + ":")) + "-d" "build/classes" + (find-files (string-append name "/src/main/java") + ".*.java")) + (invoke "jar" "-cf" (string-append "build/jar/" name ".jar") + "-C" "build/classes" ".")) + (mkdir-p "build/classes") + (mkdir-p "build/test-classes") + (mkdir-p "build/jar") + (build "javaparser-core") + (build "javaparser-core-serialization") + (build "javaparser-core-generators") + (build "javaparser-core-metamodel-generator") + (build "javaparser-symbol-solver-core") + #t)) + (replace 'install + (install-jars "build/jar"))))) + (inputs + `(("java-guava" ,java-guava) + ("java-jboss-javassist" ,java-jboss-javassist) + ("java-jsonp-api" ,java-jsonp-api))) + (native-inputs + `(("javacc" ,javacc))) + (home-page "http://javaparser.org/") + (synopsis "Parser for Java") + (description + "This project contains a set of libraries implementing a Java 1.0 - Java +11 Parser with advanced analysis functionalities.") + (license (list + ;; either lgpl or asl + license:lgpl3+ + license:asl2.0)))) |