;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015-2024 Ricardo Wurmus ;;; Copyright © 2016 Leo Famulari ;;; Copyright © 2016, 2017 Roel Janssen ;;; Copyright © 2017, 2019, 2021 Carlo Zancanaro ;;; Copyright © 2017-2022 Julien Lepiller ;;; Copyright © 2017 Thomas Danckaert ;;; Copyright © 2016, 2017, 2018 Alex Vong ;;; Copyright © 2017, 2019, 2021 Tobias Geerinckx-Rice ;;; Copyright © 2018, 2019 Gábor Boskovits ;;; Copyright © 2018 Chris Marusich ;;; Copyright © 2018-2024 Efraim Flashner ;;; Copyright © 2019, 2020, 2021 Björn Höfling ;;; Copyright © 2020, 2025 Janneke Nieuwenhuizen ;;; Copyright © 2020 Raghav Gururajan ;;; Copyright © 2020, 2022, 2025 Maxim Cournoyer ;;; Copyright © 2021 Vincent Legoll ;;; Copyright © 2021 Mike Gerwitz ;;; Copyright © 2021 Pierre Langlois ;;; Copyright © 2021 Guillaume Le Vaillant ;;; Copyright © 2022, 2024, 2025 Artyom V. Poptsov ;;; Copyright © 2024 Paul A. Patience ;;; Copyright © 2024 Raven Hallsby ;;; Copyright © 2025 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2025 Julian Flake ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages java) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #: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 gexp) #:use-module (guix build-system ant) #:use-module (guix build-system cmake) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system maven) #:use-module (guix build-system pyproject) #:use-module (guix build-system trivial) #:use-module (gnu packages) #:use-module (gnu packages attr) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages nss) #:use-module (gnu packages cpio) #:use-module (gnu packages cups) #:use-module (gnu packages compression) #:use-module (gnu packages elf) #:use-module (gnu packages fontutils) #:use-module (gnu packages freedesktop) ; wayland #:use-module (gnu packages gawk) #:use-module (gnu packages gcc) #:use-module (gnu packages gettext) #:use-module (gnu packages gl) #:use-module (gnu packages ghostscript) ;lcms #:use-module (gnu packages gnome) #:use-module (gnu packages groovy) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages icu4c) #:use-module (gnu packages image) #:use-module (gnu packages java-bootstrap) #:use-module (gnu packages java-compression) #:use-module (gnu packages java-xml) #:use-module (gnu packages libffi) #:use-module (gnu packages linux) ;alsa #:use-module (gnu packages maths) #:use-module (gnu packages maven) #:use-module (gnu packages maven-parent-pom) #:use-module (gnu packages ncurses) #:use-module (gnu packages ninja) #:use-module (gnu packages nss) #:use-module (gnu packages onc-rpc) #:use-module (gnu packages web) #:use-module (gnu packages wget) #:use-module (gnu packages pkg-config) #:use-module (gnu packages perl) #:use-module (gnu packages popt) #:use-module (gnu packages python-build) #:use-module (gnu packages kerberos) #:use-module (gnu packages security-token) #:use-module (gnu packages xml) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xorg) #:use-module (gnu packages texinfo) #:use-module ((srfi srfi-1) #:select (fold alist-delete)) #:use-module (srfi srfi-11) #:use-module (ice-9 match)) (define-public icedtea-7 (let* ((version "2.6.13") (drop (lambda* (name hash #:optional (patches '())) (origin (method url-fetch) (uri (string-append "http://icedtea.classpath.org/download/drops" "/icedtea7/" version "/" name ".tar.bz2")) (sha256 (base32 hash)) (patches patches))))) (package (name "icedtea") (version version) (source (origin (method url-fetch) (uri (string-append "http://icedtea.wildebeest.org/download/source/icedtea-" version ".tar.xz")) (sha256 (base32 "1w331rdqx1dcx2xb0fmjmrkdc71xqn20fxsgw8by4xhiblh88khh")) (modules '((guix build utils))) (snippet '(begin (substitute* "Makefile.in" ;; do not leak information about the build host (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"") "DISTRIBUTION_ID=\"\\\"guix\\\"\"")) #t)))) (build-system gnu-build-system) (outputs '("out" ; Java Runtime Environment "jdk" ; Java Development Kit "doc")) ; all documentation (arguments `(;; There are many test failures. Some are known to ;; fail upstream, others relate to not having an X ;; server running at test time, yet others are a ;; complete mystery to me. ;; hotspot: passed: 241; failed: 45; error: 2 ;; langtools: passed: 1,934; failed: 26 ;; jdk: unknown #:tests? #f ;; The DSOs use $ORIGIN to refer to each other, but (guix build ;; gremlin) doesn't support it yet, so skip this phase. #:validate-runpath? #f #:modules ((guix build utils) (guix build gnu-build-system) (ice-9 match) (ice-9 popen) (srfi srfi-19) (srfi srfi-26)) #:configure-flags ;; TODO: package sctp and add to inputs `("--disable-system-sctp" "--enable-system-pcsc" "--enable-system-lcms" "--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" ,(string-append "--with-ecj=" (assoc-ref %build-inputs "ecj4-javac-wrapper") "/bin/javac") ,(string-append "--with-jdk-home=" (assoc-ref %build-inputs "classpath")) ,(string-append "--with-java=" (assoc-ref %build-inputs "jamvm") "/bin/jamvm") ,(string-append "--with-jar=" (assoc-ref %build-inputs "classpath") "/bin/gjar")) #:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key source inputs #:allow-other-keys) (let ((target (string-append "icedtea-" ,version)) (unpack (lambda* (name #:optional dir) (let ((dir (or dir (string-drop-right name 5)))) (mkdir dir) (invoke "tar" "xvf" (assoc-ref inputs name) "-C" dir "--strip-components=1"))))) (mkdir target) (invoke "tar" "xvf" source "-C" target "--strip-components=1") (chdir target) (unpack "openjdk-src" "openjdk.src") (with-directory-excursion "openjdk.src" (for-each unpack (filter (cut string-suffix? "-drop" <>) (map (match-lambda ((name . _) name)) inputs))))))) (add-after 'unpack 'use-classpath (lambda* (#:key inputs #:allow-other-keys) (let ((tools (search-input-file inputs "/share/classpath/tools.zip")) (rt.jar (search-input-file inputs "/lib/rt.jar"))) ;; GNU Classpath does not provide rt.jar, but jamvm provides ;; Classpath's glibj.zip as rt.jar, so we just use that. (substitute* "Makefile.in" (("\\$\\(SYSTEM_JDK_DIR\\)/jre/lib/rt.jar") rt.jar)) ;; Make sure we can find all classes. (setenv "CLASSPATH" (string-append rt.jar ":" tools)) (setenv "JAVACFLAGS" (string-append "-cp " rt.jar ":" tools))))) (add-after 'unpack 'patch-bitrot (lambda _ (substitute* '("patches/boot/revert-6973616.patch" "openjdk.src/jdk/make/common/shared/Defs-versions.gmk") (("REQUIRED_FREETYPE_VERSION = 2.2.1") "REQUIRED_FREETYPE_VERSION = 2.10.1")) ;; As of attr 2.4.48 this header is no longer ;; included. It is provided by the libc instead. (substitute* '("configure" "openjdk.src/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c") (("attr/xattr.h") "sys/xattr.h")))) (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" " -Wno-error=implicit-function-declaration" " -Wno-error=implicit-int" " -Wno-error=incompatible-pointer-types" " -Wno-error=int-conversion"))) (substitute* '("openjdk.src/jdk/src/solaris/native/java/net/PlainSocketImpl.c" "openjdk.src/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c") (("#include ") "#include ")) ;; XXX 'ldd' in glibc 2.35 segfaults upon reading ;; openjdk.build-boot/lib/amd64/libnio.so (!). ;; It is only used as a verification step, so ignore it; ;; try removing this substitution for newer versions of glibc. (substitute* "openjdk.src/jdk/make/common/shared/Defs-linux.gmk" (("\\$\\(LDD\\) \\$1 &&") "")) ;; 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. ;; Disable optimizations of dump.cpp as a workaround. (substitute* "openjdk.src/hotspot/make/linux/makefiles/gcc.make" (("OPT_CFLAGS/NOOPT.*" all) (string-append all "\n" "OPT_CFLAGS/dump.o += -O0"))))) (add-after 'unpack 'fix-x11-extension-include-path (lambda* (#:key inputs #:allow-other-keys) (substitute* "openjdk.src/jdk/make/sun/awt/mawt.gmk" (((string-append "\\$\\(firstword \\$\\(wildcard " "\\$\\(OPENWIN_HOME\\)" "/include/X11/extensions\\).*$")) (string-append (assoc-ref inputs "libxrender") "/include/X11/extensions" " -I" (assoc-ref inputs "libxtst") "/include/X11/extensions" " -I" (assoc-ref inputs "libxinerama") "/include/X11/extensions")) (("\\$\\(wildcard /usr/include/X11/extensions\\)\\)") "")))) (add-after 'unpack 'patch-paths (lambda* (#:key inputs #:allow-other-keys) ;; buildtree.make generates shell scripts, so we need to replace ;; the generated shebang (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make") (("/bin/sh") (which "bash"))) (let ((corebin (string-append (assoc-ref inputs "coreutils") "/bin/")) (binbin (string-append (assoc-ref inputs "binutils") "/bin/")) (grepbin (string-append (assoc-ref inputs "grep") "/bin/"))) (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk" "openjdk.src/corba/make/common/shared/Defs-linux.gmk") (("UNIXCOMMAND_PATH = /bin/") (string-append "UNIXCOMMAND_PATH = " corebin)) (("USRBIN_PATH = /usr/bin/") (string-append "USRBIN_PATH = " corebin)) (("DEVTOOLS_PATH *= */usr/bin/") (string-append "DEVTOOLS_PATH = " corebin)) (("COMPILER_PATH *= */usr/bin/") (string-append "COMPILER_PATH = " (assoc-ref inputs "gcc") "/bin/")) (("DEF_OBJCOPY *=.*objcopy") (string-append "DEF_OBJCOPY = " (which "objcopy")))) ;; fix path to alsa header (substitute* "openjdk.src/jdk/make/common/shared/Sanity.gmk" (("ALSA_INCLUDE=/usr/include/alsa/version.h") (string-append "ALSA_INCLUDE=" (assoc-ref inputs "alsa-lib") "/include/alsa/version.h"))) ;; fix hard-coded utility paths (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk" "openjdk.src/corba/make/common/shared/Defs-utils.gmk") (("ECHO *=.*echo") (string-append "ECHO = " (which "echo"))) (("^GREP *=.*grep") (string-append "GREP = " (which "grep"))) (("EGREP *=.*egrep") (string-append "EGREP = " (which "egrep"))) (("CPIO *=.*cpio") (string-append "CPIO = " (which "cpio"))) (("READELF *=.*readelf") (string-append "READELF = " (which "readelf"))) (("^ *AR *=.*ar") (string-append "AR = " (which "ar"))) (("^ *TAR *=.*tar") (string-append "TAR = " (which "tar"))) (("AS *=.*as") (string-append "AS = " (which "as"))) (("LD *=.*ld") (string-append "LD = " (which "ld"))) (("STRIP *=.*strip") (string-append "STRIP = " (which "strip"))) (("NM *=.*nm") (string-append "NM = " (which "nm"))) (("^SH *=.*sh") (string-append "SH = " (which "bash"))) (("^FIND *=.*find") (string-append "FIND = " (which "find"))) (("LDD *=.*ldd") (string-append "LDD = " (which "ldd"))) (("NAWK *=.*(n|g)awk") (string-append "NAWK = " (which "gawk"))) (("XARGS *=.*xargs") (string-append "XARGS = " (which "xargs"))) (("UNZIP *=.*unzip") (string-append "UNZIP = " (which "unzip"))) (("ZIPEXE *=.*zip") (string-append "ZIPEXE = " (which "zip"))) (("SED *=.*sed") (string-append "SED = " (which "sed")))) ;; Some of these timestamps cause problems as they are more than ;; 10 years ago, failing the build process. (substitute* "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties" (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN") (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN") (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON") (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY"))))) (add-before 'configure 'set-additional-paths (lambda* (#:key inputs #:allow-other-keys) (substitute* "openjdk.src/jdk/make/common/shared/Sanity.gmk" (("ALSA_INCLUDE=/usr/include/alsa/version.h") (string-append "ALSA_INCLUDE=" (assoc-ref inputs "alsa-lib") "/include/alsa/version.h"))) (setenv "CC" "gcc") (setenv "CPATH" (string-append (assoc-ref inputs "libxcomposite") "/include/X11/extensions" ":" (assoc-ref inputs "libxrender") "/include/X11/extensions" ":" (assoc-ref inputs "libxtst") "/include/X11/extensions" ":" (assoc-ref inputs "libxinerama") "/include/X11/extensions" ":" (or (getenv "CPATH") ""))) (setenv "ALT_OBJCOPY" (which "objcopy")) (setenv "ALT_CUPS_HEADERS_PATH" (string-append (assoc-ref inputs "cups") "/include")) (setenv "ALT_FREETYPE_HEADERS_PATH" (string-append (assoc-ref inputs "freetype") "/include")) (setenv "ALT_FREETYPE_LIB_PATH" (string-append (assoc-ref inputs "freetype") "/lib")))) (add-before 'build 'disable-os-version-check ;; allow build on linux major version change (lambda _ (setenv "DISABLE_HOTSPOT_OS_VERSION_CHECK" "ok"))) (add-before 'check 'fix-test-framework (lambda _ ;; Fix PATH in test environment (substitute* "test/jtreg/com/sun/javatest/regtest/Main.java" (("PATH=/bin:/usr/bin") (string-append "PATH=" (getenv "PATH")))) (substitute* "test/jtreg/com/sun/javatest/util/SysEnv.java" (("/usr/bin/env") (which "env"))) (substitute* "openjdk.src/hotspot/test/test_env.sh" (("/bin/rm") (which "rm")) (("/bin/cp") (which "cp")) (("/bin/mv") (which "mv"))))) (add-before 'check 'fix-hotspot-tests (lambda _ (with-directory-excursion "openjdk.src/hotspot/test/" (substitute* "jprt.config" (("PATH=\"\\$\\{path4sdk\\}\"") (string-append "PATH=" (getenv "PATH"))) (("make=/usr/bin/make") (string-append "make=" (which "make")))) (substitute* '("runtime/6626217/Test6626217.sh" "runtime/7110720/Test7110720.sh") (("/bin/rm") (which "rm")) (("/bin/cp") (which "cp")) (("/bin/mv") (which "mv")))))) (add-before 'check 'fix-jdk-tests (lambda _ (with-directory-excursion "openjdk.src/jdk/test/" (substitute* "com/sun/jdi/JdbReadTwiceTest.sh" (("/bin/pwd") (which "pwd"))) (substitute* "com/sun/jdi/ShellScaffold.sh" (("/bin/kill") (which "kill"))) (substitute* "start-Xvfb.sh" ;;(("/usr/bin/X11/Xvfb") (which "Xvfb")) (("/usr/bin/nohup") (which "nohup"))) (substitute* "javax/security/auth/Subject/doAs/Test.sh" (("/bin/rm") (which "rm"))) (substitute* "tools/launcher/MultipleJRE.sh" (("echo \"#!/bin/sh\"") (string-append "echo \"#!" (which "rm") "\"")) (("/usr/bin/zip") (which "zip"))) (substitute* "com/sun/jdi/OnThrowTest.java" (("#!/bin/sh") (string-append "#!" (which "sh")))) (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java" (("/usr/bin/uptime") (which "uptime"))) (substitute* "java/lang/ProcessBuilder/Basic.java" (("/usr/bin/env") (which "env")) (("/bin/false") (which "false")) (("/bin/true") (which "true")) (("/bin/cp") (which "cp")) (("/bin/sh") (which "sh"))) (substitute* "java/lang/ProcessBuilder/FeelingLucky.java" (("/bin/sh") (which "sh"))) (substitute* "java/lang/ProcessBuilder/Zombies.java" (("/usr/bin/perl") (which "perl")) (("/bin/ps") (which "ps")) (("/bin/true") (which "true"))) (substitute* "java/lang/Runtime/exec/ConcurrentRead.java" (("/usr/bin/tee") (which "tee"))) (substitute* "java/lang/Runtime/exec/ExecWithDir.java" (("/bin/true") (which "true"))) (substitute* "java/lang/Runtime/exec/ExecWithInput.java" (("/bin/cat") (which "cat"))) (substitute* "java/lang/Runtime/exec/ExitValue.java" (("/bin/sh") (which "sh")) (("/bin/true") (which "true")) (("/bin/kill") (which "kill"))) (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java" (("/usr/bin/echo") (which "echo"))) (substitute* "java/lang/Runtime/exec/LotsOfOutput.java" (("/usr/bin/cat") (which "cat"))) (substitute* "java/lang/Runtime/exec/SleepyCat.java" (("/bin/cat") (which "cat")) (("/bin/sleep") (which "sleep")) (("/bin/sh") (which "sh"))) (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java" (("/bin/cat") (which "cat"))) (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java" (("/bin/chmod") (which "chmod"))) (substitute* "java/util/zip/ZipFile/Assortment.java" (("/bin/sh") (which "sh")))))) (replace 'check (lambda* (#:key tests? #:allow-other-keys) ;; The "make check-*" targets always return zero, so we need to ;; check for errors in the associated log files to determine ;; whether any tests have failed. (when tests? (use-modules (ice-9 rdelim)) (let* ((error-pattern (make-regexp "^(Error|FAILED):.*")) (checker (lambda (port) (let loop () (let ((line (read-line port))) (cond ((eof-object? line) #t) ((regexp-exec error-pattern line) (error "test failed")) (else (loop))))))) (run-test (lambda (test) (invoke "make" test) (call-with-input-file (string-append "test/" test ".log") checker)))) (run-test "check-hotspot") (run-test "check-langtools") (run-test "check-jdk"))))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((doc (string-append (assoc-ref outputs "doc") "/share/doc/icedtea")) (jre (assoc-ref outputs "out")) (jdk (assoc-ref outputs "jdk"))) (copy-recursively "openjdk.build/docs" doc) (copy-recursively "openjdk.build/j2re-image" jre) (copy-recursively "openjdk.build/j2sdk-image" jdk)))) ;; Some of the libraries in the lib/amd64 folder link to libjvm.so. ;; But that shared object is located in the server/ folder, so it ;; cannot be found. This phase creates a symbolic link in the ;; lib/amd64 folder so that the other libraries can find it. ;; ;; See: ;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html ;; ;; FIXME: Find the bug in the build system, so that this symlink is ;; not needed. (add-after 'install 'install-libjvm (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((lib-path (string-append (assoc-ref outputs "out") ;; See 'INSTALL_ARCH_DIR' in ;; 'configure'. ,(match (%current-system) ("i686-linux" "/lib/i386") ("x86_64-linux" "/lib/amd64") ("armhf-linux" "/lib/arm") ("aarch64-linux" "/lib/aarch64") ("powerpc-linux" "/lib/ppc") ;; We need a catch-all, dropping ;; '-linux' works in most cases. (_ (string-append "/lib/" (string-drop-right (%current-system) 6))))))) (symlink (string-append lib-path "/server/libjvm.so") (string-append lib-path "/libjvm.so"))))) ;; By default IcedTea only generates an empty keystore. In order to ;; be able to use certificates in Java programs we need to generate a ;; keystore from a set of certificates. For convenience we use the ;; certificates from the nss-certs package. (add-after 'install 'install-keystore (lambda* (#:key inputs outputs #:allow-other-keys) (use-modules (ice-9 rdelim)) (let* ((keystore "cacerts") (certs-dir (search-input-directory inputs "etc/ssl/certs")) (keytool (string-append (assoc-ref outputs "jdk") "/bin/keytool"))) (define (extract-cert file target) (call-with-input-file file (lambda (in) (call-with-output-file target (lambda (out) (let loop ((line (read-line in 'concat)) (copying? #f)) (cond ((eof-object? line) #t) ((string-prefix? "-----BEGIN" line) (display line out) (loop (read-line in 'concat) #t)) ((string-prefix? "-----END" line) (display line out) #t) (else (when copying? (display line out)) (loop (read-line in 'concat) copying?))))))))) (define (import-cert cert) (format #t "Importing certificate ~a\n" (basename cert)) (let ((temp "tmpcert")) (extract-cert cert temp) (let ((port (open-pipe* OPEN_WRITE keytool "-import" "-alias" (basename cert) "-keystore" keystore "-storepass" "changeit" "-file" temp))) (display "yes\n" port) (when (not (zero? (status:exit-val (close-pipe port)))) (format #t "failed to import ~a\n" cert))) (delete-file temp))) ;; This is necessary because the certificate directory contains ;; files with non-ASCII characters in their names. (setlocale LC_ALL "C.UTF-8") (setenv "LC_ALL" "C.UTF-8") (for-each import-cert (find-files certs-dir "\\.pem$")) (mkdir-p (string-append (assoc-ref outputs "out") "/lib/security")) (mkdir-p (string-append (assoc-ref outputs "jdk") "/jre/lib/security")) ;; The cacerts files we are going to overwrite are chmod'ed as ;; read-only (444) in icedtea-8 (which derives from this ;; package). We have to change this so we can overwrite them. (chmod (string-append (assoc-ref outputs "out") "/lib/security/" keystore) #o644) (chmod (string-append (assoc-ref outputs "jdk") "/jre/lib/security/" keystore) #o644) (install-file keystore (string-append (assoc-ref outputs "out") "/lib/security")) (install-file keystore (string-append (assoc-ref outputs "jdk") "/jre/lib/security")))))))) (native-inputs ;; XXX: Compiling with gcc-14 will encounter the following error: ;; BUILD FAILED: ;; /tmp/guix-build-icedtea-2.6.13.drv-0/icedtea-2.6.13/openjdk/langtools/ ;; make/build.xml:452: The following error occurred while executing this ;; line: ;; java.lang.AbstractMethodError: java.lang.Throwable.toString()Ljava/lang/String; `(("gcc" ,gcc-13) ("openjdk-src" ,(drop "openjdk" "0l34ikyf62hbzlf9032alzkkqvf7bpmckz4gvirvph755w7gka8l")) ("corba-drop" ,(drop "corba" "050gv2jbg1pi6qkn8w18bwpbklfa5b0kymjvan9pncddbj8m84fz")) ("jaxp-drop" ,(drop "jaxp" "1k6yldwnxfzdg5926r1nlfv8d1r1j7rlp2nkz6gqh05vgyamnfhl")) ("jaxws-drop" ,(drop "jaxws" "110j7jlz47x2gg6f7653x12mssan5kvj9l9h1m1c8c92drfxbqyk")) ("jdk-drop" ,(drop "jdk" "0d1mca38ksxvdskp9im3pp7fdijhj1n3lwq9w13r9s4v3qyskgdd" (search-patches "jdk-currency-time-bomb.patch"))) ("langtools-drop" ,(drop "langtools" "0nq5236fzxn3p6x8cgncl56mzcmsj07q9gymysnws4c8byc6n0qj")) ("hotspot-drop" ,(origin (method url-fetch) (uri (string-append "http://icedtea.classpath.org/downloads/drops" "/icedtea7/" version "/hotspot.tar.bz2")) (sha256 (base32 "17bdv39n4lh8l5737c96f3xgamx4y305m067p01cywgp7zaddqws")) (patches (search-patches "icedtea-7-hotspot-aarch64-use-c++98.patch" "icedtea-7-hotspot-pointer-comparison.patch")))) ("ant" ,ant-bootstrap) ("attr" ,attr) ("classpath" ,classpath-devel) ("coreutils" ,coreutils) ("diffutils" ,diffutils) ;for tests ("ecj4-javac-wrapper" ,ecj4-javac-wrapper) ("fastjar" ,fastjar) ;only for the configure phase; we actually use gjar ("gawk" ,gawk) ("grep" ,grep) ("jamvm" ,jamvm-with-ecj4) ("libtool" ,libtool) ("pkg-config" ,pkg-config) ("wget" ,wget) ("which" ,which) ("cpio" ,cpio) ("zip" ,zip) ("unzip" ,unzip) ("libxslt" ,libxslt) ;for xsltproc ("nss-certs" ,nss-certs) ("perl" ,perl) ("procps" ,procps))) ;for "free", even though I'm not sure we should use it (inputs (list alsa-lib cups fontconfig freetype giflib gtk+-2 lcms libjpeg-turbo libpng libx11 libxcomposite libxi libxinerama libxrender libxt libxtst mit-krb5 nss pcsc-lite zlib)) (home-page "https://icedtea.classpath.org") (synopsis "Java development kit") (description "This package provides the Java development kit OpenJDK built with the IcedTea build harness.") ;; 'configure' lists "mips" and "mipsel", but not "mips64el'. (supported-systems (delete "mips64el-linux" %supported-systems)) ;; IcedTea is released under the GPL2 + Classpath exception, which is the ;; same license as both GNU Classpath and OpenJDK. (license license:gpl2+)))) (define-public icedtea-8 (let* ((version "3.19.0") (drop (lambda* (name hash #:optional (patches '())) (origin (method url-fetch) (uri (string-append "http://icedtea.classpath.org/download/drops" "/icedtea8/" version "/" name ".tar.xz")) (sha256 (base32 hash)) (patches patches))))) (package (inherit icedtea-7) (version "3.19.0") (source (origin (method url-fetch) (uri (string-append "http://icedtea.wildebeest.org/download/source/icedtea-" version ".tar.xz")) (sha256 (base32 "1cmms7cb2sav3ywc36ynqmybzx73sl279rm6j8i5nqrmp98ixmpf")) (modules '((guix build utils))) (snippet '(substitute* '("configure" "acinclude.m4") ;; Do not embed build time (("(DIST_ID=\"Custom build).*$" _ prefix) (string-append prefix "\"\n")) ;; Do not leak information about the build host (("DIST_NAME=\"\\$build_os\"") "DIST_NAME=\"guix\""))))) (arguments `(#:imported-modules ((guix build ant-build-system) ,@%default-gnu-imported-modules) #:disallowed-references ,(list (gexp-input (this-package-native-input "jdk") "jdk")) ,@(substitute-keyword-arguments (package-arguments icedtea-7) ((#:modules modules) `((guix build utils) (guix build gnu-build-system) ((guix build ant-build-system) #:prefix ant:) (ice-9 match) (ice-9 popen) (srfi srfi-19) (srfi srfi-26))) ((#:configure-flags flags) `(let ((jdk (assoc-ref %build-inputs "jdk"))) `(,(string-append "CFLAGS=-fcommon" " -Wno-error=implicit-function-declaration" " -Wno-error=implicit-int" " -Wno-error=incompatible-pointer-types" " -Wno-error=int-conversion") "CXXFLAGS=-fcommon" "--enable-bootstrap" "--enable-nss" ,(string-append "--with-parallel-jobs=" (number->string (parallel-job-count))) ;; Java Flight Recorder isn't supported on some architectures. ,@(if ,(target-ppc32?) `("--enable-jfr=no") '()) "--disable-docs" ; This phase can take hours on slow machines. "--disable-downloading" "--disable-system-pcsc" "--disable-system-sctp" "--disable-tests" ;they are run in the check phase instead "--with-openjdk-src-dir=./openjdk.src" ,(string-append "--with-jdk-home=" jdk)))) ((#:phases phases) `(modify-phases ,phases (delete 'fix-x11-extension-include-path) (delete 'patch-paths) (delete 'set-additional-paths) (delete 'patch-patches) (delete 'patch-bitrot) (delete 'use-classpath) ;; Prevent passing -j (parallel-job-count) to make (replace 'build (lambda* (#:key (make-flags '()) #:allow-other-keys) (apply invoke "make" make-flags))) ;; Prevent the keytool from recording the current time when ;; adding certificates at build time. (add-after 'unpack 'patch-keystore (lambda _ (substitute* "openjdk.src/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java" (("date = new Date\\(\\);") "\ date = (System.getenv(\"SOURCE_DATE_EPOCH\") != null) ?\ new Date(Long.parseLong(System.getenv(\"SOURCE_DATE_EPOCH\"))) :\ new Date();")) #t)) (add-after 'unpack 'patch-jni-libs ;; Hardcode dynamically loaded libraries. (lambda _ (define remove (@ (srfi srfi-1) remove)) (define (icedtea-or-openjdk? path) (or (string-contains path "openjdk") (string-contains path "icedtea"))) (let* ((library-path (remove icedtea-or-openjdk? (search-path-as-string->list (getenv "LIBRARY_PATH")))) (find-library (lambda (name) (or (search-path library-path (string-append "lib" name ".so")) (string-append "lib" name ".so"))))) (for-each (lambda (file) (catch 'decoding-error (lambda () (substitute* file (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" _ name version) (string-append "\"" (find-library name) "\"")) (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) (string-append "\"" (find-library name) "\"")))) (lambda _ ;; Those are safe to skip. (format (current-error-port) "warning: failed to substitute: ~a~%" file)))) (find-files "openjdk.src/jdk/src/solaris/native" "\\.c|\\.h"))))) (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 ") "#include ")))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((doc (string-append (assoc-ref outputs "doc") "/share/doc/icedtea")) (jre (assoc-ref outputs "out")) (jdk (assoc-ref outputs "jdk"))) (copy-recursively "openjdk.build/docs" doc) (copy-recursively "openjdk.build/images/j2re-image" jre) (copy-recursively "openjdk.build/images/j2sdk-image" jdk) ;; Install the nss.cfg file to JRE to enable SSL/TLS ;; support via NSS. (copy-file (string-append jdk "/jre/lib/security/nss.cfg") (string-append jre "/lib/security/nss.cfg"))))) (add-after 'install 'strip-jar-timestamps (assoc-ref ant:%standard-phases 'strip-jar-timestamps))))))) (native-inputs `(("jdk" ,icedtea-7 "jdk") ("openjdk-src" ,(drop "openjdk" "1l3bzmd3s38scxpwamfhnwbv7vndgjq6hz3bl58437fgl9kgbl69")) ("aarch32-drop" ,(drop "aarch32" "0k4dwpi3x3lj41rj32xyxbn76r7cb2g2whh44r1z4iwhw1xd2lpq")) ("corba-drop" ,(drop "corba" "0xhh6gf5gh5c6vf1607xcy49wnp5prch2rim13x14wvsn817xf0r")) ("jaxp-drop" ,(drop "jaxp" "043g335rgi5ipl8dp3q2cc3gcfhxk77ipxs43sv344z71bn8xmxr")) ("jaxws-drop" ,(drop "jaxws" "1pc0pv4v2mn2mjc0vp19d94v2150xigyhxsmckqasy647zcm6w0r")) ("jdk-drop" ,(drop "jdk" "1742lcm55l8zhi522x83v65ccr0rd6511q9rj7crw44x3ymdrhrv" (search-patches "jdk-currency-time-bomb2.patch"))) ("langtools-drop" ,(drop "langtools" "08iz7p2xcddlphipf6gahyabr5cawlnydap12p1n4f0md069b50b")) ("hotspot-drop" ,(drop "hotspot" "1ffaxfnb3yn1i7crivqigc1r1q0z6cp044i6nfring4z6c8pfhd2")) ("nashorn-drop" ,(drop "nashorn" "15fn7cpm2i1npa88h57njxg0f8qkrqhrc30pb54d3hxlx5zyjl94")) ("shenandoah-drop" ,(drop "shenandoah" "1jjzjjx1ykyhbc4llh8249dlr8j5g1ki6r7g9baj2mxyb9whc5nq")) ,@(fold alist-delete (package-native-inputs icedtea-7) '("openjdk-src" "corba-drop" "jaxp-drop" "jaxws-drop" "jdk-drop" "langtools-drop" "hotspot-drop" "classpath" "ecj4-javac-wrapper" "jamvm" "fastjar"))))))) (define-public icedtea icedtea-8) (define-public openjdk9 (package (name "openjdk") (version "9.181") (source (origin (method hg-fetch) (uri (hg-reference (url "https://hg.openjdk.org/jdk/jdk") (changeset "jdk-9+181"))) (file-name (hg-file-name name version)) (modules '((guix build utils))) (snippet '(for-each delete-file (find-files "." ".*.(bin|exe|jar)$"))) (sha256 (base32 "1v92nzdqx07c35x945awzir4yk0fk22vky6fpp8mq9js930sxsz0")) (patches (search-patches "openjdk-9-pointer-comparison.patch" "openjdk-9-classlist-reproducibility.patch" "openjdk-currency-time-bomb.patch" "openjdk-9-jar-reproducibility.patch" "openjdk-9-module-reproducibility.patch" "openjdk-9-module2-reproducibility.patch" "openjdk-9-module3-reproducibility.patch" "openjdk-9-idlj-reproducibility.patch" "openjdk-9-setsignalhandler.patch")))) (build-system gnu-build-system) (outputs '("out" "jdk" "doc")) (arguments `(#:imported-modules ((guix build ant-build-system) ,@%default-gnu-imported-modules) #:modules ((guix build utils) (guix build gnu-build-system) (ice-9 popen)) #:tests? #f ; require jtreg #:make-flags '("all") #:disallowed-references ,(list (this-package-native-input "icedtea") (gexp-input (this-package-native-input "icedtea") "jdk")) #:phases (modify-phases %standard-phases ,@(if (target-aarch64?) `((add-after 'unpack 'patch-for-aarch64 (lambda _ (substitute* "hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp" ;; This line is duplicated, so remove both occurrences, ;; then add back one occurrence by substituting a ;; comment that occurs once. (("using MacroAssembler::call_VM_leaf_base;") "") (("Interpreter specific version of call_VM_base") "Interpreter specific version of call_VM_base using MacroAssembler::call_VM_leaf_base;"))))) '()) (add-after 'patch-source-shebangs 'fix-java-shebangs (lambda _ ;; This file was "fixed" by patch-source-shebangs, but it requires ;; this exact first line. (substitute* "jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem" (("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n")))) (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) ;; TODO: unbundle libpng and lcms (invoke "bash" "./configure" ;; Add flags for compilation with gcc >= 10 ,(string-append "--with-extra-cflags=-fcommon" " -fno-delete-null-pointer-checks" " -fno-lifetime-dse" ;; flags for compilation with gcc >= 14. " -Wno-error=int-conversion") (string-append "--with-freetype=" (assoc-ref inputs "freetype")) "--disable-freetype-bundling" "--disable-warnings-as-errors" "--disable-hotspot-gtest" "--with-giflib=system" "--with-libjpeg=system" (string-append "--prefix=" (assoc-ref outputs "out"))))) (add-before 'build 'write-source-revision-file (lambda _ (with-output-to-file ".src-rev" (lambda _ (display ,version))))) (replace 'build (lambda* (#:key make-flags parallel-build? #:allow-other-keys) (apply invoke "make" `(,@(if parallel-build? (list (string-append "JOBS=" (number->string (parallel-job-count)))) '("JOBS=1")) ,@make-flags)))) (add-after 'unpack 'patch-jni-libs ;; Hardcode dynamically loaded libraries. (lambda _ (define remove (@ (srfi srfi-1) remove)) (define (icedtea-or-openjdk? path) (or (string-contains path "openjdk") (string-contains path "icedtea"))) (let* ((library-path (remove icedtea-or-openjdk? (search-path-as-string->list (getenv "LIBRARY_PATH")))) (find-library (lambda (name) (or (search-path library-path (string-append "lib" name ".so")) (string-append "lib" name ".so"))))) (for-each (lambda (file) (catch 'decoding-error (lambda () (substitute* file (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)" _ name version) (string-append "\"" (find-library name) "\"")) (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name) (string-append "\"" (find-library name) "\"")))) (lambda _ ;; Those are safe to skip. (format (current-error-port) "warning: failed to substitute: ~a~%" file)))) (find-files "." "\\.c$|\\.h$"))))) ;; By default OpenJDK only generates an empty keystore. In order to ;; be able to use certificates in Java programs we need to generate a ;; keystore from a set of certificates. For convenience we use the ;; certificates from the nss-certs package. (add-after 'install 'install-keystore (lambda* (#:key inputs outputs #:allow-other-keys) (use-modules (ice-9 rdelim)) (let* ((keystore "cacerts") (certs-dir (search-input-directory inputs "etc/ssl/certs")) (keytool (string-append (assoc-ref outputs "jdk") "/bin/keytool"))) (define (extract-cert file target) (call-with-input-file file (lambda (in) (call-with-output-file target (lambda (out) (let loop ((line (read-line in 'concat)) (copying? #f)) (cond ((eof-object? line) #t) ((string-prefix? "-----BEGIN" line) (display line out) (loop (read-line in 'concat) #t)) ((string-prefix? "-----END" line) (display line out) #t) (else (when copying? (display line out)) (loop (read-line in 'concat) copying?))))))))) (define (import-cert cert) (format #t "Importing certificate ~a\n" (basename cert)) (let ((temp "tmpcert")) (extract-cert cert temp) (let ((port (open-pipe* OPEN_WRITE keytool "-import" "-alias" (basename cert) "-keystore" keystore "-storepass" "changeit" "-file" temp))) (display "yes\n" port) (when (not (zero? (status:exit-val (close-pipe port)))) (format #t "failed to import ~a\n" cert))) (delete-file temp))) ;; This is necessary because the certificate directory contains ;; files with non-ASCII characters in their names. (setlocale LC_ALL "C.UTF-8") (setenv "LC_ALL" "C.UTF-8") (copy-file (string-append (assoc-ref outputs "out") "/lib/security/cacerts") keystore) (chmod keystore #o644) (for-each import-cert (find-files certs-dir "\\.pem$")) (mkdir-p (string-append (assoc-ref outputs "out") "/lib/security")) (mkdir-p (string-append (assoc-ref outputs "jdk") "/lib/security")) ;; The cacerts files we are going to overwrite are chmod'ed as ;; read-only (444) in icedtea-8 (which derives from this ;; package). We have to change this so we can overwrite them. (chmod (string-append (assoc-ref outputs "out") "/lib/security/" keystore) #o644) (chmod (string-append (assoc-ref outputs "jdk") "/lib/security/" keystore) #o644) (install-file keystore (string-append (assoc-ref outputs "out") "/lib/security")) (install-file keystore (string-append (assoc-ref outputs "jdk") "/lib/security"))))) ;; Some of the libraries in the lib/ folder link to libjvm.so. ;; But that shared object is located in the server/ folder, so it ;; cannot be found. This phase creates a symbolic link in the ;; lib/ folder so that the other libraries can find it. ;; ;; See: ;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html ;; ;; FIXME: Find the bug in the build system, so that this symlink is ;; not needed. (add-after 'install 'install-libjvm (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((lib-out (string-append (assoc-ref outputs "out") "/lib")) (lib-jdk (string-append (assoc-ref outputs "jdk") "/lib"))) (symlink (string-append lib-jdk "/server/libjvm.so") (string-append lib-jdk "/libjvm.so")) (symlink (string-append lib-out "/server/libjvm.so") (string-append lib-out "/libjvm.so"))))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (jdk (assoc-ref outputs "jdk")) (doc (assoc-ref outputs "doc")) (images (car (find-files "build" ".*-server-release" #:directories? #t)))) (copy-recursively (string-append images "/images/jdk") jdk) (copy-recursively (string-append images "/images/jre") out) (copy-recursively (string-append images "/images/docs") doc)))) (add-after 'install 'strip-zip-timestamps (lambda* (#:key outputs #:allow-other-keys) (for-each (lambda (zip) (let ((dir (mkdtemp "zip-contents.XXXXXX"))) (with-directory-excursion dir ;; This is an exact copy of the implementation of invoke, ;; but this accepts exit code 1 as OK. (let ((code (system* "unzip" "--" zip))) ;; jmod files are zip files with an extra header in ;; front. unzip will warn about that -- but otherwise ;; work. (when (> (status:exit-val code) 1) ; 1 is just a warning (raise (condition (&invoke-error (program "unzip") (arguments (list "--" zip)) (exit-status (status:exit-val code)) (term-signal (status:term-sig code)) (stop-signal (status:stop-sig code)))))))) (delete-file zip) (for-each (lambda (file) (let ((s (lstat file))) (format #t "reset ~a~%" file) (utime file 1 1 0 0 AT_SYMLINK_NOFOLLOW))) (find-files dir #:directories? #t)) (with-directory-excursion dir (let ((files (cons "./META-INF/MANIFEST.MF" (append (find-files "./META-INF" ".*") ;; for jmod: (list "./classes/module-info.class") (find-files "." ".*"))))) (apply invoke "zip" "--symlinks" "-0" "-X" zip files) (when (string-suffix? ".jmod" zip) (let ((new-zip (string-append zip "n")) (contents (call-with-input-file zip (@ (ice-9 binary-ports) get-bytevector-all)))) (call-with-output-file new-zip (lambda (output-port) ((@ (ice-9 binary-ports) put-bytevector) output-port #vu8(#x4a #x4d #x01 #x00)) ; JM ((@ (ice-9 binary-ports) put-bytevector) output-port contents))) (rename-file new-zip zip))))))) (append (find-files (string-append (assoc-ref outputs "doc") "/api") "\\.zip$") (find-files (assoc-ref outputs "doc") "src\\.zip$") (find-files (assoc-ref outputs "jdk") "src\\.zip$") (find-files (assoc-ref outputs "jdk") "\\.jmod$") (find-files (assoc-ref outputs "jdk") "\\.diz$") (find-files (assoc-ref outputs "out") "\\.diz$") (list (string-append (assoc-ref outputs "jdk") "/lib/jrt-fs.jar")) (find-files (string-append (assoc-ref outputs "jdk") "/demo") "\\.jar$")))))))) (inputs (list alsa-lib cups fontconfig freetype giflib lcms elfutils libjpeg-turbo libice libpng libx11 libxcomposite libxi libxinerama libxrender libxt libxtst)) (native-inputs (list icedtea-8 `(,icedtea-8 "jdk") ;; XXX: The build system fails with newer versions of GNU Make. gnu-make-4.2 nss-certs unzip which zip)) (home-page "https://openjdk.org/projects/jdk9/") (synopsis "Java development kit") (description "This package provides the Java development kit OpenJDK.") (license license:gpl2+))) (define-public openjdk10 (package (inherit openjdk9) (name "openjdk") (version "10.46") (source (origin (method hg-fetch) (uri (hg-reference (url "https://hg.openjdk.org/jdk/jdk") (changeset "jdk-10+46"))) (file-name (hg-file-name name version)) (modules '((guix build utils))) (snippet `(begin (for-each delete-file (find-files "." ".*.(bin|exe|jar)$")))) (sha256 (base32 "0i47ar8lxzjrkkiwbzybfxs473390h4jq9ahm3xqdvy5zpchxy3y")) (patches (search-patches "openjdk-10-char-reproducibility.patch" "openjdk-10-classlist-reproducibility.patch" "openjdk-10-corba-reproducibility.patch" "openjdk-10-idlj-reproducibility.patch" "openjdk-10-module-reproducibility.patch" "openjdk-10-module3-reproducibility.patch" "openjdk-10-module4-reproducibility.patch" "openjdk-10-jar-reproducibility.patch" "openjdk-10-jtask-reproducibility.patch" "openjdk-10-pointer-comparison.patch" "openjdk-10-setsignalhandler.patch" "openjdk-currency-time-bomb2.patch")))) (arguments (substitute-keyword-arguments (package-arguments openjdk9) ((#:phases phases) `(modify-phases ,phases ,@(if (target-aarch64?) `((replace 'patch-for-aarch64 (lambda _ (substitute* "src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp" ;; This line is duplicated, so remove both occurrences, ;; then add back one occurrence by substituting a ;; comment that occurs once. (("using MacroAssembler::call_VM_leaf_base;") "") (("Interpreter specific version of call_VM_base") (string-append "Interpreter specific version of call_VM_base\n" " using MacroAssembler::call_VM_leaf_base;")))))) '()) (replace 'fix-java-shebangs (lambda _ ;; This file was "fixed" by patch-source-shebangs, but it requires ;; this exact first line. (substitute* "make/data/blacklistedcertsconverter/blacklisted.certs.pem" (("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n")))) (add-after 'unpack 'remove-timestamping (lambda _ (substitute* "./src/hotspot/share/runtime/vm_version.cpp" (("__DATE__") "") (("__TIME__") "")))) (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (invoke "bash" "./configure" ;; Add flags for compilation with gcc >= 10 ,(string-append "--with-extra-cflags=-fcommon" " -fno-delete-null-pointer-checks" " -fno-lifetime-dse" ;; flags for compilation with gcc >= 14. " -Wno-error=int-conversion") (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"))))) (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 _ '()) `(,(this-package-native-input "openjdk9") ,(gexp-input (this-package-native-input "openjdk9") "jdk"))))) (native-inputs `(("openjdk9" ,openjdk9) ("openjdk9:jdk" ,openjdk9 "jdk") ("make@4.2" ,gnu-make-4.2) ("nss-certs" ,nss-certs) ("unzip" ,unzip) ("which" ,which) ("zip" ,zip))))) (define-public openjdk11 (package (name "openjdk") (version "11.0.22") (source (origin (method url-fetch) (uri (string-append "https://openjdk-sources.osci.io/openjdk11/openjdk-" version "-ga.tar.xz")) (file-name (string-append name "-" version ".tar.xz")) (sha256 (base32 "18ca4syp9xlrqjgyjkb1sp9835riy6aym5xs81r8byrz6jlb2473")) (modules '((guix build utils))) (snippet '(for-each delete-file (find-files "." "\\.(bin|exe|jar)$"))) (patches (search-patches "openjdk-10-module3-reproducibility.patch" "openjdk-10-module4-reproducibility.patch" "openjdk-10-char-reproducibility.patch" "openjdk-11-classlist-reproducibility.patch" "openjdk-10-jar-reproducibility.patch" "openjdk-10-jtask-reproducibility.patch" "openjdk-currency-time-bomb2.patch")))) (build-system gnu-build-system) (outputs '("out" "jdk" "doc")) (arguments (list ;; Prevent a java.util.ConcurrentModificationException. #:parallel-build? #f #:modules `((guix build gnu-build-system) (guix build utils) (ice-9 match) (ice-9 popen) (srfi srfi-1) (srfi srfi-26)) #:disallowed-references (list (this-package-native-input "openjdk") (gexp-input (this-package-native-input "openjdk") "jdk")) #:tests? #f ; requires jtreg ;; TODO package jtreg #:configure-flags #~(list ;; Add flags for compilation with gcc >= 10. #$(string-append "--with-extra-cflags=-fcommon" " -fno-delete-null-pointer-checks" " -fno-lifetime-dse" ;; flags for compilation with gcc >= 14. " -Wno-error=int-conversion") ;; Otherwise, the '--enable-fast-install' causes an error. "--disable-option-checking" "--disable-warnings-as-errors" ;; Make validate-runpath pass (see: ;; http://issues.guix.info/issue/32894). "--with-native-debug-symbols=zipped" ;; Do not use the bundled libraries. "--with-giflib=system" "--with-lcms=system" "--with-libjpeg=system" "--with-libpng=system" "--with-version-pre=" ;; Should be set by SOURCE_DATE_EPOCH handler, but isn't being ;; set; do it manually. "--with-hotspot-build-time=1970-01-01T00:00:01" "--enable-reproducible-build" ; to be sure ;; Allow the build system to locate the system freetype. (string-append "--with-freetype-include=" #$(this-package-input "freetype") "/include") (string-append "--with-freetype-lib=" #$(this-package-input "freetype") "/lib")) #:phases #~(modify-phases %standard-phases (add-after 'patch-source-shebangs 'fix-java-shebangs (lambda _ ;; This file was "fixed" by patch-source-shebangs, but it requires ;; this exact first line. (substitute* "make/data/blockedcertsconverter/blocked.certs.pem" (("^#!.*") "#! java BlockedCertsConverter SHA-256\n")))) (add-after 'unpack 'remove-timestamping (lambda _ (substitute* "src/hotspot/share/runtime/abstract_vm_version.cpp" (("__DATE__") "") (("__TIME__") "")))) (add-after 'unpack 'patch-jni-libs ;; Hardcode dynamically loaded libraries. (lambda _ (define remove (@ (srfi srfi-1) remove)) (define (icedtea-or-openjdk? path) (or (string-contains path "openjdk") (string-contains path "icedtea"))) (let* ((library-path (remove icedtea-or-openjdk? (search-path-as-string->list (getenv "LIBRARY_PATH")))) (find-library (lambda (name) (or (search-path library-path (string-append "lib" name ".so")) (string-append "lib" name ".so"))))) (for-each (lambda (file) (catch 'decoding-error (lambda () (substitute* file (("VERSIONED_JNI_LIB_NAME\\(\"([^\"]*)\", \"([^\"]*)\"\\)" _ name version) (string-append "\"" (find-library name) "\"")) (("JNI_LIB_NAME\\(\"([^\"]*)\"\\)" _ name) (string-append "\"" (find-library name) "\"")))) (lambda _ ;; Those are safe to skip. (format (current-error-port) "warning: failed to substitute: ~a~%" file)))) (find-files "." "\\.c$|\\.h$"))))) (add-before 'build 'write-source-revision-file (lambda _ (with-output-to-file ".src-rev" (lambda _ (display #$version))))) (replace 'build (lambda* (#:key parallel-build? make-flags #:allow-other-keys) (apply invoke "make" "all" `(,@(if parallel-build? (list (string-append "JOBS=" (number->string (parallel-job-count)))) '("JOBS=1")) ,@make-flags)))) ;; jdk 11 does not build jre by default any more; so explicitly build ;; it (see: ;; https://github.com/AdoptOpenJDK/openjdk-build/issues/356). (add-after 'build 'build-jre (lambda* (#:key parallel-build? make-flags #:allow-other-keys) (apply invoke "make" "legacy-jre-image" `(,@(if parallel-build? (list (string-append "JOBS=" (number->string (parallel-job-count)))) '("JOBS=1")) ,@make-flags)))) (replace 'install (lambda _ (let ((images (car (find-files "build" "-server-release" #:directories? #t)))) (copy-recursively (string-append images "/images/jdk") #$output:jdk) (copy-recursively (string-append images "/images/jre") #$output) (copy-recursively (string-append images "/images/docs") #$output:doc)))) ;; Some of the libraries in the lib/ folder link to libjvm.so. ;; But that shared object is located in the server/ folder, so it ;; cannot be found. This phase creates a symbolic link in the ;; lib/ folder so that the other libraries can find it. ;; ;; See: ;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html ;; ;; FIXME: Find the bug in the build system, so that this symlink is ;; not needed. (add-after 'install 'install-libjvm (lambda _ (let ((lib-out (string-append #$output "/lib")) (lib-jdk (string-append #$output:jdk "/lib"))) (symlink (string-append lib-jdk "/server/libjvm.so") (string-append lib-jdk "/libjvm.so")) (symlink (string-append lib-out "/server/libjvm.so") (string-append lib-out "/libjvm.so"))))) (add-after 'install 'strip-character-data-timestamps (lambda _ (let ((archive (string-append #$output:jdk "/lib/src.zip")) (dir (mkdtemp "zip-contents.XXXXXX"))) (with-directory-excursion dir (invoke "unzip" archive)) (delete-file archive) (with-directory-excursion dir (let ((char-data-files (find-files "." "CharacterData"))) (for-each (lambda (file) (substitute* file (((string-append "This file was generated " "AUTOMATICALLY from a template " "file.*")) (string-append "This file was generated " "AUTOMATICALLY from a template " "file")))) char-data-files))) (with-directory-excursion dir (let ((files (find-files "." #:directories? #t))) (apply invoke "zip" "-0" "-X" archive files)))))) (add-after 'strip-character-data-timestamps 'remove-extraneous-files (lambda* (#:key outputs #:allow-other-keys) ;; Remove the *.diz and src.zip files for space considerations. ;; The former are compressed debuginfo files not typically ;; shipped with Java distributions, while the later corresponds ;; to Java core API source files. (for-each delete-file (append-map (cut find-files <> "(^src\\.zip|\\.diz)$") (map (match-lambda ((name . dir) dir)) outputs))))) (add-after 'remove-extraneous-files 'strip-archive-timestamps (lambda _ (use-modules (ice-9 binary-ports) (rnrs bytevectors)) (letrec ((repack-archive (lambda (archive) (let ((dir (mkdtemp "zip-contents.XXXXXX"))) (with-directory-excursion dir (invoke "unzip" archive)) (delete-file archive) (for-each (compose repack-archive canonicalize-path) (find-files dir "(ct\\.sym|\\.jar)$")) (let ((reset-file-timestamp (lambda (file) (let ((s (lstat file))) (unless (eq? (stat:type s) 'symlink) (format #t "reset ~a~%" file) (utime file 0 0 0 0)))))) (for-each reset-file-timestamp (find-files dir #:directories? #t))) (with-directory-excursion dir (let ((files (find-files "." #:directories? #t))) (apply invoke "zip" "-0" "-X" archive files))))))) (for-each repack-archive (find-files #$output:doc "\\.zip$")) (for-each repack-archive (find-files #$output:jdk "\\.(zip|jar)$")) (repack-archive (string-append #$output:jdk "/lib/ct.sym")) (let ((repack-jmod (lambda (file-name) (call-with-input-file file-name (lambda (file) (let ((header #vu8(#x4a #x4d #x01 #x00))) (if (equal? (get-bytevector-n file (bytevector-length header)) header) (let* ((header-length (bytevector-length header)) (temp-file (mkstemp! (string-copy "temp-file.XXXXXX"))) (temp-filename (port-filename temp-file)) (content-length (- (stat:size (stat file)) header-length))) (sendfile temp-file file content-length header-length) (delete-file file-name) (close-port temp-file) (repack-archive (canonicalize-path temp-filename)) (call-with-output-file file-name (lambda (file) (put-bytevector file header) (call-with-input-file temp-filename (lambda (temp-file) (sendfile file temp-file (stat:size (stat temp-file)) 0))))))))))))) (for-each repack-jmod (find-files #$output:jdk "\\.jmod$")))))) (add-after 'install 'remove-timestamp-from-api-summary (lambda _ (substitute* (string-append #$output:doc "/api/overview-summary.html") (("Generated by javadoc \\(11-internal\\).*$") "Generated by javadoc (11-internal) -->\n"))))))) (inputs (list alsa-lib cups fontconfig freetype giflib lcms libjpeg-turbo libpng libx11 libxext libxrandr libxrender libxt libxtst)) (native-inputs (list autoconf bash ; not bash-minimal, needs ulimit openjdk10 `(,openjdk10 "jdk") gnu-make-4.2 nss-certs pkg-config unzip which zip)) (home-page "https://openjdk.org/projects/jdk/11/") (synopsis "Java development kit") (description "This package provides the Java development kit OpenJDK.") (license license:gpl2+))) (define-syntax make-openjdk ;; Return an OpenJDK package at VERSION with checksum HASH, using BOOTSTRAP, ;; the bootstrap package. One or more FIELD can be provided to further ;; refine the package definition; for convenience, the BASE, NAME and ;; VERSION are defined in their scope. (lambda (x) (syntax-case x () ((_ bootstrap version* hash field ...) (with-syntax ((base (datum->syntax x 'base)) (name (datum->syntax x 'name)) (version (datum->syntax x 'version))) #'(let ((base (package (inherit bootstrap) (name "openjdk") (version version*) (source (origin (inherit (package-source bootstrap)) (method git-fetch) (uri (git-reference (url (format #f "https://github.com/openjdk/jdk~au" (version-major version*))) (commit (string-append "jdk-" version* "-ga")))) (file-name (git-file-name name version)) (sha256 (base32 hash)))) (properties '((release-tag-prefix . "jdk-") (release-tag-suffix . "-ga") (release-tag-version-delimiter . "."))) (native-inputs (modify-inputs (package-native-inputs bootstrap) (replace "openjdk" bootstrap))) (home-page (string-append "https://openjdk.java.net/projects/jdk/" (version-major version))))) (name "openjdk") (version version*)) (package (inherit base) field ...))))))) (define-public openjdk12 (make-openjdk openjdk11 "12.33" "0pi2gwib3j2imi4l623iaywrmvfh9rqzh82lj2gxqbrmg55swvjf" (source (origin (method url-fetch) (uri "http://hg.openjdk.java.net/jdk/jdk/archive/0276cba45aac.tar.bz2") (file-name (string-append name "-" version ".tar.bz2")) (sha256 (base32 "0pi2gwib3j2imi4l623iaywrmvfh9rqzh82lj2gxqbrmg55swvjf")) (modules '((guix build utils))) (snippet '(for-each delete-file (find-files "." "\\.(bin|exe|jar)$"))) (patches (search-patches "openjdk-10-setsignalhandler.patch")))) (arguments (substitute-keyword-arguments (package-arguments openjdk11) ;; Re-enable parallel build. ((#:parallel-build? _ #t) #t) ((#:phases phases) #~(modify-phases #$phases #$@(if (target-aarch64?) #~((add-after 'unpack 'patch-for-aarch64 (lambda _ (substitute* "src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp" ;; This line is duplicated, so remove both occurrences, ;; then add back one occurrence by substituting a ;; comment that occurs once. (("using MacroAssembler::call_VM_leaf_base;") "") (("Interpreter specific version of call_VM_base") (string-append "Interpreter specific version of call_VM_base\n" " using MacroAssembler::call_VM_leaf_base;")))))) #~()) (replace 'remove-timestamping (lambda _ (substitute* "src/hotspot/share/runtime/vm_version.cpp" (("__DATE__") "") (("__TIME__") "")))) (replace 'fix-java-shebangs (lambda _ ;; 'blocked' was renamed to 'blacklisted' in this version for ;; some reason. (substitute* "make/data/blacklistedcertsconverter/\ blacklisted.certs.pem" (("^#!.*") "#! java BlacklistedCertsConverter SHA-256\n")))))))))) (define-public openjdk13 (make-openjdk openjdk12 "13.0.14" "1v92i5rhahqkjw8mz09c9qasnxqc67ygy0y266kdmm534z0da755" (source (origin (inherit (package-source base)) (patches (search-patches "openjdk-13-classlist-reproducibility.patch" "openjdk-10-jtask-reproducibility.patch")))) (arguments (substitute-keyword-arguments (package-arguments openjdk12) ((#:phases phases) #~(modify-phases #$phases (replace 'remove-timestamping (lambda _ (substitute* "src/hotspot/share/runtime/abstract_vm_version.cpp" (("__DATE__") "") (("__TIME__") "")))))))))) (define-public openjdk14 (make-openjdk openjdk13 "14.0.2" "07k9bsbxwyf2z2n50z96nvhsdai916mxdxcr5lm44jz7f6xrwfq6" (source (origin (inherit (package-source base)) (snippet ;override snippet '(begin ;; The m4 macro uses 'help' to search for builtins, which is ;; not available in bash-minimal (substitute* "make/autoconf/basics.m4" (("if help") "if command -v")) (for-each delete-file (find-files "." "\\.(bin|exe|jar)$")))) (patches (search-patches "openjdk-10-setsignalhandler.patch" "openjdk-10-jtask-reproducibility.patch" "openjdk-13-classlist-reproducibility.patch")))))) (define-public openjdk15 (make-openjdk openjdk14 "15.0.10" "0hdllv348bws6m992bh73jik18x0sv0k2m9l817b3zb7q802sp7x" (source (origin (inherit (package-source base)) (modules '()) (snippet #f) (patches (search-patches "openjdk-15-jtask-reproducibility.patch" "openjdk-15-xcursor-no-dynamic.patch")))) (inputs (modify-inputs (package-inputs base) (append libxcursor))) ;for our patch to work (native-inputs (modify-inputs (package-native-inputs base) (delete "make" ;remove old gnu-make-4.2 "openjdk") ;to remove non-jdk output (append `(,openjdk14 "jdk")))))) (define-public openjdk16 (make-openjdk openjdk15 "16.0.2" "0587px2qbz07g3xi4a3ya6m630p72dvkxcn0bj1813pxnwvcgigz" (source (origin (inherit (package-source base)) (patches (search-patches "openjdk-15-xcursor-no-dynamic.patch" "openjdk-10-setsignalhandler.patch")))))) (define-public openjdk17 (make-openjdk openjdk16 "17.0.10" "1bq1rqnipz6wdr05s20gm8nlpb3328ljxckzvc5ag0gf7fzlhn5f" (source (origin (inherit (package-source base)) (patches (search-patches "openjdk-15-xcursor-no-dynamic.patch")))) (arguments (substitute-keyword-arguments (package-arguments openjdk16) ((#:phases phases) #~(modify-phases #$phases (replace 'fix-java-shebangs (lambda _ ;; 'blacklisted' was renamed back to 'blocked'. (substitute* "make/data/blockedcertsconverter/blocked.certs.pem" (("^#!.*") "#! java BlockedCertsConverter SHA-256\n")))))))))) (define-public openjdk18 (make-openjdk openjdk17 "18.0.2.1" "0zxanjzz4p3psqahlidh55vx1ldanq70c2ygk3gcfn9a94vnr9rg")) (define-public openjdk19 (make-openjdk openjdk18 "19.0.2" "08kvx7n8qhhfl25pig966881j5h4x7y0pf4brq16x0283fc0f4d4" (arguments (substitute-keyword-arguments (package-arguments openjdk18) ((#:phases phases) #~(modify-phases #$phases (replace 'fix-java-shebangs (lambda _ ;; Update file path. (substitute* "src/java.base/share/data/blockedcertsconverter/blocked.certs.pem" (("^#!.*") "#! java BlockedCertsConverter SHA-256\n")))) (add-before 'configure 'define-java-environment-variables (lambda* (#:key inputs #:allow-other-keys) ;; Fix for "valid range 1980-01-01T00:00:02Z to 2099-12-31T23:59:59Z". (setenv "SOURCE_DATE_EPOCH" "1234567890"))))))))) (define-public openjdk20 (make-openjdk openjdk19 "20.0.2" "1af1v2c3d8x4c6shzl6cv9qwq7a4hn5map5pjh9vjcky0hkzd489")) (define-public openjdk21 (make-openjdk openjdk20 "21.0.2" "0d1g3wnzr5whjpq8gvxq0h7kd7lxd3xgc6bh3kg8vzz096asn0kj" (source (origin (inherit (package-source base)) (patches (search-patches "openjdk-21-fix-rpath.patch" "openjdk-15-xcursor-no-dynamic.patch")))) (arguments (substitute-keyword-arguments (package-arguments base) ((#:phases phases) #~(modify-phases #$phases (replace 'fix-java-shebangs (lambda _ ;; 'blacklisted' was renamed back to 'blocked'. (substitute* "src/java.base/share/data/blockedcertsconverter/blocked.certs.pem" (("^#!.*") "#! java BlockedCertsConverter SHA-256\n")))))))))) (define-public openjdk22 (make-openjdk openjdk21 "22.0.2" "1nj414yj6v9qrlm48yv5llr4jmgj9g20v6zsd39xrdx4x4x4p3b6" (arguments (substitute-keyword-arguments (package-arguments base) ((#:phases phases) #~(modify-phases #$phases (add-after 'unpack 'do-not-disable-new-dtags (lambda _ ;; Our validate-runpath phases checks for RUNPATH, not RPATH. (substitute* "make/autoconf/flags-cflags.m4" ((" -Wl,--disable-new-dtags") "")))))))))) (define-public openjdk23 (make-openjdk openjdk22 "23.0.2" "0kxllznzhgqfn8b97krg2yp1ag41g4phmgqahrvzafd2bq6zclnf" (source (origin (inherit (package-source base)) ;; The 'openjdk-21-fix-rpath.patch' no longer applies, and it ;; appears not needed anymore. The ;; 'openjdk-15-xcursor-no-dynamic.patch' doesn't apply anymore; ;; the fix should be pursued in libx11 (see: ;; https://issues.guix.gnu.org/54654) (patches '()))))) (define-public openjdk24 (make-openjdk openjdk23 "24.0.1" "0h6sbzbjyqg85iml41pswdh2z3d7h2hhb0sd5yll37r1mj5lsxmx")) (define-public openjdk25 (make-openjdk openjdk24 "25.0.1" "10v7pr0aplv7qjpnqbgh27lcm89ixhg5g62ydg0dvcj0d24r95xp" (outputs '("out" "jdk" "doc" "graal-builder-jdk")) (arguments (substitute-keyword-arguments (package-arguments base) ;; Set version string to "25.0.1+8" instead of "25.0.1+-adhoc...". ;; GraalVM's JVMCIVersionCheck requires java.vm.version to be parseable ;; as a release version (pre() empty or "ea"), not an adhoc build. ;; Build number 8 comes from the jdk-25.0.1+8 tag which points to the ;; same commit as jdk-25.0.1-ga (78770bfaefd23ae77ec4f8ddd769c1c2d9c282df). ((#:configure-flags flags #~'()) #~(append #$flags '("--with-version-opt=" "--with-version-build=8"))) ((#:phases phases) #~(modify-phases #$phases ;; Build graal-builder-image after the regular images. (add-after 'build 'build-graal-builder-image (lambda* (#:key parallel-build? make-flags #:allow-other-keys) (apply invoke "make" "graal-builder-image" `(,@(if parallel-build? (list (string-append "JOBS=" (number->string (parallel-job-count)))) '("JOBS=1")) ,@make-flags)))) ;; Install the graal-builder-jdk to the extra output. (add-after 'install 'install-graal-builder-jdk (lambda* (#:key outputs #:allow-other-keys) (let ((images (car (find-files "build" "-server-release" #:directories? #t)))) (copy-recursively (string-append images "/images/graal-builder-jdk") (assoc-ref outputs "graal-builder-jdk"))))) ;; Create libjvm.so symlink for graal-builder-jdk output. (add-after 'install-graal-builder-jdk 'install-libjvm-graal-builder-jdk (lambda* (#:key outputs #:allow-other-keys) (let ((lib-graal (string-append (assoc-ref outputs "graal-builder-jdk") "/lib"))) (symlink (string-append lib-graal "/server/libjvm.so") (string-append lib-graal "/libjvm.so"))))))))))) ;;; Convenience alias to point to the latest version of OpenJDK. (define-public openjdk openjdk25) ;; This version of JBR is here in order to be able to build custom ;; IntelliJ plugins. Those usually need both jbr11 and jbr17 for ;; tests. (define-public jbr11 (package (inherit openjdk11) (name "jbr") (version "11_0_16-b2248") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/JetBrains/JetBrainsRuntime.git") (commit (string-append "jb" version)))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "1fnrdx0wb21ghm6jczjzk7b9fz9hbdzd62512xhwpzvca57v2z09")))) (arguments (substitute-keyword-arguments (package-arguments openjdk11) ((#:configure-flags configure-flags) #~(append #$configure-flags (list "--with-jvm-features=shenandoahgc" "--enable-cds=yes" "--with-vendor-name=JetBrains s.r.o" "--with-vendor-url=https://www.jetbrains.com/" "--with-vendor-bug-url=https://youtrack.jetbrains.com/issues/JBR"))))) (synopsis "JetBrains Java Runtime") (description "This package provides a Java runtime environment for and Java development kit. It supports enhanced class redefinition (DCEVM), includes a number of improvements in font rendering, keyboards support, windowing/focus subsystems, HiDPI, accessibility, and performance, provides better desktop integration and bugfixes not yet present in OpenJDK.") (home-page "https://www.jetbrains.com/") (license license:gpl2+))) (define-public jbr17 (package (inherit openjdk17) (name "jbr") (version "17.0.11b1207.30") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/JetBrains/JetBrainsRuntime.git") (commit (string-append "jbr-release-" version)))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "5bbf5z8faf9sdkig2fwkj06hb7hs9s3bpzzvbqn2i75lbwqk3bln")) (patches (search-patches "jbr-17-xcursor-no-dynamic.patch")))) (arguments (substitute-keyword-arguments (package-arguments openjdk17) ((#:configure-flags configure-flags) #~(append #$configure-flags (list "--with-jvm-features=shenandoahgc" "--enable-cds=yes" "--with-vendor-name=JetBrains s.r.o" "--with-vendor-url=https://www.jetbrains.com/" "--with-vendor-bug-url=https://youtrack.jetbrains.com/issues/JBR"))))) (synopsis "JetBrains Java Runtime") (description "This package provides a Java runtime environment for and Java development kit. It supports enhanced class redefinition (DCEVM), includes a number of improvements in font rendering, keyboards support, windowing/focus subsystems, HiDPI, accessibility, and performance, provides better desktop integration and bugfixes not yet present in OpenJDK.") (home-page "https://www.jetbrains.com/") (license license:gpl2+))) (define-public jbr21 (package (inherit openjdk21) (name "jbr") (version "21.0.3b509.11") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/JetBrains/JetBrainsRuntime.git") (commit (string-append "jbr-release-" version)))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "03xkghbp0b1czc2ags9n8ilprf9sy4bhsma0wf8xfapqn6d2sfyd")) (patches (search-patches "openjdk-21-fix-rpath.patch" "jbr-17-xcursor-no-dynamic.patch")))) (inputs `(("wayland" ,wayland) ("libxkbcommon" ,libxkbcommon) ; for wayland ,@(package-inputs openjdk21))) (arguments (substitute-keyword-arguments (package-arguments openjdk21) ((#:configure-flags configure-flags) #~(append #$configure-flags (list "--with-jvm-features=shenandoahgc" "--enable-cds=yes" "--with-vendor-name=JetBrains s.r.o" "--with-vendor-url=https://www.jetbrains.com/" "--with-vendor-bug-url=https://youtrack.jetbrains.com/issues/JBR"))))) (synopsis "JetBrains Java Runtime") (description "This package provides a Java runtime environment for and Java development kit. It supports enhanced class redefinition (DCEVM), includes a number of improvements in font rendering, keyboards support, windowing/focus subsystems, HiDPI, accessibility, and performance, provides better desktop integration and bugfixes not yet present in OpenJDK.") (home-page "https://www.jetbrains.com/") (license license:gpl2+))) (define-public ant/java8 (package (name "ant") (version "1.10.15") (source (origin (method url-fetch) (uri (string-append "mirror://apache/ant/source/apache-ant-" version "-src.tar.gz")) (sha256 (base32 "1ccr852dxg5affdqafg04gi3l89q5c6l9lqrz50jhj05kidljax2")) (modules '((guix build utils))) (snippet '(begin (for-each delete-file (find-files "lib/optional" "\\.jar$")) #t)))) (build-system gnu-build-system) (arguments (list #:modules '((srfi srfi-1) (guix build gnu-build-system) (guix build utils)) #:tests? #f ;no "check" target #:phases #~(modify-phases %standard-phases (add-after 'unpack 'remove-scripts ;; Remove bat / cmd scripts for DOS as well as the antRun and runant ;; wrappers. (lambda _ (for-each delete-file (find-files "src/script" "(.*\\.(bat|cmd)|runant.*|antRun.*)")))) (delete 'bootstrap) (delete 'configure) (replace 'build (lambda* (#:key inputs #:allow-other-keys) (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) ;; Disable tests to avoid dependency on hamcrest-core, which needs ;; Ant to build. This is necessary in addition to disabling the ;; "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")) (invoke "bash" "bootstrap.sh" (string-append "-Ddist.dir=" #$output)))) (add-after 'build 'strip-jar-timestamps ;based on ant-build-system (lambda _ (define (repack-archive jar) (let* ((dir (mkdtemp "jar-contents.XXXXXX")) (manifest (string-append dir "/META-INF/MANIFESTS.MF"))) (with-directory-excursion dir (invoke "unzip" jar)) (delete-file jar) ;; XXX: copied from (gnu build install) (for-each (lambda (file) (let ((s (lstat file))) (unless (eq? (stat:type s) 'symlink) (utime file 0 0 0 0)))) (find-files dir #:directories? #t)) ;; It is important that the manifest appears first. (with-directory-excursion dir (let* ((files (find-files "." ".*" #:directories? #t)) ;; To ensure that the reference scanner can ;; detect all store references in the jars ;; we disable compression with the "-0" option. (command (if (file-exists? manifest) `("zip" "-0" "-X" ,jar ,manifest ,@files) `("zip" "-0" "-X" ,jar ,@files)))) (apply invoke command))))) (for-each repack-archive (find-files (string-append #$output "/lib") "\\.jar$")))) (delete 'install)))) (native-inputs `(("jdk" ,icedtea-8 "jdk") ("zip" ,zip) ("unzip" ,unzip))) (home-page "https://ant.apache.org") (synopsis "Build tool for Java") (description "Ant is a platform-independent build tool for Java. It is similar to make but is implemented using the Java language, requires the Java platform, and is best suited to building Java projects. Ant uses XML to describe the build process and its dependencies, whereas Make uses Makefile format.") (license license:asl2.0))) ;; The 1.9.x series is the last that can be built with GCJ. The 1.10.x series ;; requires Java 8. (define-public ant (package (inherit ant/java8) (version "1.9.15") (source (origin (method url-fetch) (uri (string-append "mirror://apache/ant/source/apache-ant-" version "-src.tar.gz")) (sha256 (base32 "1xy30f1w5gaqk6g3f0vw7ygix4rb6032qkcw42y4z8wd9jihgygd")))) ;; XXX: we do this to avoid a rebuild. This mess will be cleaned up ;; later. (arguments (substitute-keyword-arguments `(#:modules ((srfi srfi-1) (guix build gnu-build-system) (guix build utils)) #:tests? #f ; no "check" target #:phases (modify-phases %standard-phases (delete 'bootstrap) (delete 'configure) (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")))) (replace 'build (lambda* (#:key inputs outputs #:allow-other-keys) ;; Ant complains if this file doesn't exist. (setenv "HOME" "/tmp") (with-output-to-file "/tmp/.ant.properties" (lambda _ (display ""))) ;; Use jikes instead of javac for tags in build.xml (setenv "ANT_OPTS" "-Dbuild.compiler=jikes") ;; jikes produces lots of warnings, but they are not very ;; interesting, so we silence them. (setenv "$BOOTJAVAC_OPTS" "-nowarn") ;; Without these JamVM options the build may freeze. (substitute* "bootstrap.sh" (("^\"\\$\\{JAVACMD\\}\" " m) ,@(if (string-prefix? "armhf" (or (%current-system) (%current-target-system))) `((string-append m "-Xnocompact ")) `((string-append m "-Xnocompact -Xnoinlining "))))) ;; Disable tests because we are bootstrapping and thus don't have ;; any of the dependencies required to build and run the tests. (substitute* "build.xml" (("depends=\"jars,test-jar\"") "depends=\"jars\"")) (invoke "bash" "bootstrap.sh" (string-append "-Ddist.dir=" (assoc-ref outputs "out"))))) (add-after 'build 'strip-jar-timestamps ;based on ant-build-system (lambda* (#:key outputs #:allow-other-keys) (define (repack-archive jar) (let* ((dir (mkdtemp "jar-contents.XXXXXX")) (manifest (string-append dir "/META-INF/MANIFESTS.MF"))) (with-directory-excursion dir (invoke "unzip" jar)) (delete-file jar) ;; XXX: copied from (gnu build install) (for-each (lambda (file) (let ((s (lstat file))) (unless (eq? (stat:type s) 'symlink) (utime file 0 0 0 0)))) (find-files dir #:directories? #t)) ;; It is important that the manifest appears first. (with-directory-excursion dir (let* ((files (find-files "." ".*" #:directories? #t)) ;; To ensure that the reference scanner can ;; detect all store references in the jars ;; we disable compression with the "-0" option. (command (if (file-exists? manifest) `("zip" "-0" "-X" ,jar ,manifest ,@files) `("zip" "-0" "-X" ,jar ,@files)))) (apply invoke command))))) (for-each repack-archive (find-files (string-append (assoc-ref %outputs "out") "/lib") "\\.jar$")))) (delete 'install))) ((#: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. (lambda _ (for-each delete-file (find-files "src/script" "(.*\\.(bat|cmd)|runant.*|antRun.*)")) #t)) (replace 'build (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) ;; Disable tests to avoid dependency on hamcrest-core, which needs ;; Ant to build. This is necessary in addition to disabling the ;; "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")) (invoke "bash" "bootstrap.sh" (string-append "-Ddist.dir=" (assoc-ref outputs "out"))))))))) (native-inputs `(("jdk" ,icedtea-7 "jdk") ("zip" ,zip) ("unzip" ,unzip))))) (define-public ant-apache-bcel (package (inherit ant/java8) (name "ant-apache-bcel") (arguments (substitute-keyword-arguments (package-arguments ant/java8) ((#:phases phases) #~(modify-phases #$phases (add-after 'unpack 'link-bcel (lambda* (#:key inputs #:allow-other-keys) (for-each (lambda (file) (symlink file (string-append "lib/optional/" (basename file)))) (find-files (assoc-ref inputs "java-commons-bcel") "\\.jar$")))) (add-after 'build 'install (lambda _ (let ((share (string-append #$output "/share/java")) (bin (string-append #$output "/bin")) (lib (string-append #$output "/lib"))) (mkdir-p share) (install-file (string-append lib "/ant-apache-bcel.jar") share) (delete-file-recursively bin) (delete-file-recursively lib)))))))) (inputs (modify-inputs (package-inputs ant/java8) (prepend java-commons-bcel))))) (define-public ant-junit (package (inherit ant/java8) (name "ant-junit") (arguments (substitute-keyword-arguments (package-arguments ant/java8) ((#:phases phases) #~(modify-phases #$phases (add-after 'unpack 'link-junit (lambda* (#:key inputs #:allow-other-keys) (for-each (lambda (file) (symlink file (string-append "lib/optional/" (basename file)))) (find-files (assoc-ref inputs "java-junit") "\\.jar$")))) (add-after 'build 'install (lambda _ (let ((share (string-append #$output "/share/java")) (bin (string-append #$output "/bin")) (lib (string-append #$output "/lib"))) (mkdir-p share) (install-file (string-append lib "/ant-junit.jar") share) (delete-file-recursively bin) (delete-file-recursively lib)))))))) (inputs (modify-inputs (package-inputs ant/java8) (prepend java-junit))))) (define-public libantlr3c (package (name "libantlr3c") (version "3.4") (source (origin (method url-fetch) (uri (string-append "https://www.antlr3.org/download/C/" name "-" version ".tar.gz")) (sha256 (base32 "0lpbnb4dq4azmsvlhp6khq1gy42kyqyjv8gww74g5lm2y6blm4fa")))) (build-system gnu-build-system) (arguments (list #:configure-flags #~(list "--enable-debuginfo" "--disable-static" #$@(if (target-64bit?) #~("--enable-64bit") #~()) #$@(if (target-riscv64?) #~("--disable-abiflags") #~())))) (synopsis "ANTLR C Library") (description "LIBANTLR3C provides run-time C libraries for ANTLR3 (ANother Tool for Language Recognition v3).") (home-page "https://www.antlr3.org/") (license license:bsd-3))) (define-public drip ;; Last release is from 2014, with a few important commits afterwards. (let ((commit "a4bd00df0199e78243847f06cc04ecaea31f8f08")) (package (name "drip") (version (git-version "0.2.4" "1" commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ninjudd/drip") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "0wzmjwfyldr3jn49517xd8yn7dgdk8h88qkga3kjyg1zc375ylg2")))) (build-system gnu-build-system) (native-inputs `(("jdk" ,icedtea "jdk"))) (arguments (list #:tests? #f ; No tests. #:phases #~(modify-phases %standard-phases (delete 'configure) (add-before 'build 'relax-gcc-14-strictness (lambda _ (substitute* "Makefile" ((" gcc(.*)$" all options) (string-append " gcc" " -Wno-error=incompatible-pointer-types" " -Wno-error=implicit-function-declaration" options))))) (add-before 'install 'fix-wrapper (lambda* (#:key inputs #:allow-other-keys) (let ((jps (search-input-file inputs "/bin/jps"))) (substitute* "bin/drip" (("jps") jps) (("brew update && brew upgrade drip") "guix pull && guix install drip") ;; No need to make: (("\\(cd -- \"\\$drip_dir\" && make -s\\) \\|\\| exit 1") "") ;; No need to include source: (("\\[\\[ -r \\$drip_dir/src/org/flatland/drip/Main\\.java \\]\\]") "true"))))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((bin (string-append #$output "/bin")) (share (string-append #$output "/share/drip"))) (mkdir-p bin) (for-each (lambda (file) (install-file (string-append "bin/" file) bin)) '("drip" "drip_daemon" "drip_proxy")) (install-file "drip.jar" share) (substitute* (string-append bin "/drip") (("drip_dir=\\$bin_dir/..") (string-append "drip_dir=" share))))))))) (home-page "https://github.com/ninjudd/drip") (synopsis "Faster Java Virtual Machine launching") (description "Drip is a launcher for the Java Virtual Machine that provides much faster startup times than the @command{java} command. The @command{drip} script is intended to be a drop-in replacement for the @command{java} command, only faster.") (license license:epl1.0)))) (define-public java-openjfx-build (package (name "java-openjfx-build") ;; This is a java-8 version (version "8.202") (source (origin (method hg-fetch) (uri (hg-reference (url "http://hg.openjdk.java.net/openjfx/8u-dev/rt") (changeset (string-append (string-join (string-split version #\.) "u") "-ga")))) (file-name (string-append name "-" version "-checkout")) (modules '((guix build utils))) (snippet '(begin ;; Delete included gradle jar (delete-file-recursively "gradle/wrapper") #t)) (sha256 (base32 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f")) (patches (search-patches "java-openjfx-build-jdk_version.patch")))) (build-system ant-build-system) (arguments `(#:jar-name "java-openjfx.jar" #:source-dir "buildSrc/src/main/java" #:test-dir "buildSrc/src/test" #:phases (modify-phases %standard-phases (add-before 'configure 'generate-jsl-parser (lambda _ (invoke "antlr3" "-o" "buildSrc/src/main/java/com/sun/scenario/effect/compiler" "buildSrc/src/main/antlr/JSL.g")))))) (inputs (list antlr3 java-stringtemplate)) (native-inputs (list java-junit java-hamcrest-core)) (home-page "https://openjfx.io") (synopsis "Graphical application toolkit in Java") (description "OpenJFX is a client application platform for desktop, mobile and embedded systems built on Java. Its goal is to produce a modern, efficient, and fully featured toolkit for developing rich client applications. This package contains base classes for the OpenJFX distribution and helper classes for building other parts of the distribution.") (license license:gpl2))) ;gpl2 only, with classpath exception (define-public java-openjfx-base (package (inherit java-openjfx-build) (name "java-openjfx-base") (arguments `(#:jar-name "java-openjfx-base.jar" #:source-dir "modules/base/src/main/java:modules/base/src/main/java8:modules/base/src/main/version-info" #:test-dir "modules/base/src/test" #:phases (modify-phases %standard-phases (add-before 'check 'remove-empty-file (lambda _ (with-directory-excursion "modules/base/src/test/java" ;; These files are completely commented, but junit expects them to ;; contain a class, so tests fail. (delete-file "com/sun/javafx/property/adapter/PropertyDescriptorTest.java") (delete-file "com/sun/javafx/property/adapter/ReadOnlyPropertyDescriptorTest.java") (delete-file "javafx/beans/property/PropertiesTest.java") (delete-file "javafx/beans/property/adapter/ReadOnlyJavaBeanPropertyBuilder_General_Test.java") ;; This one fails (delete-file "com/sun/javafx/runtime/VersionInfoTest.java")) #t))))) (propagated-inputs (list java-openjfx-build)) (description "OpenJFX is a client application platform for desktop, mobile and embedded systems built on Java. Its goal is to produce a modern, efficient, and fully featured toolkit for developing rich client applications. This package contains base classes for the OpenJFX distribution."))) (define-public java-openjfx-graphics (package (inherit java-openjfx-build) (name "java-openjfx-graphics") (arguments `(#:jar-name "java-openjfx-graphics.jar" #:source-dir "modules/graphics/src/main/java" #:tests? #f; require X #:test-dir "modules/graphics/src/test" #:phases (modify-phases %standard-phases (add-after 'unpack 'copy-missing-file (lambda* (#:key inputs #:allow-other-keys) (let ((target "modules/graphics/src/main/native-prism-sw/JNativeSurface.c")) (copy-file (assoc-ref inputs "JNativeSurface.c") target) ;; XXX: looks like the missing file we found isn't *quite* ;; compatible... (substitute* target (("case TYPE_INT_ARGB:") ""))))) (add-after 'build 'build-native (lambda* (#:key inputs outputs #:allow-other-keys) (let ((jdk (assoc-ref inputs "jdk")) (class-file->class-name (lambda (class-file) (string-map (lambda (c) (if (char=? c #\/) #\. c)) (string-drop-right class-file (string-length ".class")))))) (setenv "CPPFLAGS" (string-append "-DINLINE=inline " "-DLINUX " "-I" jdk "/include " "-I" jdk "/include/linux " "-I " (getcwd) "/build/classes/include " "-I " (getcwd) "/modules/graphics/src/main/native-prism-sw")) ;; Instructions have been adapted from buildSrc/linux.gradle (with-directory-excursion "build/classes" ;; Build prism (mkdir-p "include") ;; Generate headers for prism (apply invoke "javah" "-d" "include" "-cp" "." (map class-file->class-name (append (find-files "com/sun/prism/impl" "\\.class$") (find-files "com/sun/prism" "PresentableState.*\\.class$")))) ;; ...then for prism_sw (apply invoke "javah" "-d" "include" "-cp" "." (map class-file->class-name (find-files "com/sun/pisces" "\\.class$"))) ;; ...and for prism_es2 (apply invoke "javah" "-d" "include" "-cp" "." (map class-file->class-name (find-files "com/sun/prism/es2" "\\.class$"))))) (with-directory-excursion "netbeans/native-prism" (invoke "make" "CONF=Release")) (with-directory-excursion "netbeans/native-prism-sw" (invoke "make" "CONF=Release")) ;; TODO: This fails due to unknown EGL procedure names #; (with-directory-excursion "netbeans/native-prism-es2" (invoke "make" "CONF=Release")) (let* ((out (assoc-ref outputs "out")) (dir ,(match (%current-system) ("i686-linux" "i386") ((or "armhf-linux" "aarch64-linux") "arm") ((or "x86_64-linux") "amd64") (_ "unknown"))) (target (string-append out "/share/" dir "/"))) (mkdir-p target) (for-each (lambda (file) (let ((new-name (string-append "lib" (string-map (lambda (c) (if (char=? c #\-) #\_ c)) (string-drop (basename file) (string-length "libnative-")))))) (copy-file file (string-append target new-name)))) (find-files "netbeans" "\\.so$")))))))) (propagated-inputs (list java-openjfx-base)) (inputs (list java-swt)) ;; XXX: for unknown reasons ;; modules/graphics/src/main/native-prism-sw/JNativeSurface.c is missing ;; in this revision. (native-inputs `(("JNativeSurface.c" ,(origin (method url-fetch) (uri "https://raw.githubusercontent.com/openjdk/jfx/8u20-b02\ /modules/graphics/src/main/native-prism-sw/JNativeSurface.c") (sha256 (base32 "1kp15wbnd6rn0nciczp5ibq0ikby2yysvx1gnz5fa05vl2mm8mbm")))))) (description "OpenJFX is a client application platform for desktop, mobile and embedded systems built on Java. Its goal is to produce a modern, efficient, and fully featured toolkit for developing rich client applications. This package contains graphics-related classes for the OpenJFX distribution."))) (define-public java-openjfx-media (package (inherit java-openjfx-build) (name "java-openjfx-media") (propagated-inputs `(("java-openjxf-graphics" ,java-openjfx-graphics))) (arguments `(#:jar-name "java-openjfx-media.jar" #:source-dir "modules/media/src/main/java" #:tests? #f)); no tests (description "OpenJFX is a client application platform for desktop, mobile and embedded systems built on Java. Its goal is to produce a modern, efficient, and fully featured toolkit for developing rich client applications. This package contains media-related classes for the OpenJFX distribution."))) (define-public java-openjfx-controls (package (inherit java-openjfx-build) (name "java-openjfx-controls") (propagated-inputs `(("java-openjxf-graphics" ,java-openjfx-graphics))) (arguments `(#:jar-name "java-openjfx-controls.jar" #:source-dir "modules/controls/src/main/java" #:test-dir "modules/controls/src/test" ;; TODO: tests require com.sun.javafx.pgstub, ;; javafx.collections.MockSetObserver, and ;; com.sun.javafx.binding.ExpressionHelperUtility #:tests? #false #:phases (modify-phases %standard-phases (add-after 'unpack 'copy-resources (lambda _ (copy-recursively "modules/controls/src/test/resources" "build/test-classes") (copy-recursively "modules/controls/src/main/resources" "build/classes")))))) (description "OpenJFX is a client application platform for desktop, mobile and embedded systems built on Java. Its goal is to produce a modern, efficient, and fully featured toolkit for developing rich client applications. This package contains UI control classes for the OpenJFX distribution."))) (define-public javacc-4 (package (name "javacc") (version "4.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/javacc/javacc") (commit "release_41"))) (file-name (string-append "javacc-" version "-checkout")) (sha256 (base32 "07ysav7j8r1c6h8qxrgqk6lwdp74ly0ad1935lragxml0qqc3ka0")) (modules '((guix build utils))) ;; delete bundled jars (snippet '(begin (delete-file-recursively "lib") #t)))) (build-system ant-build-system) ;; Tests fail with ;; /tmp/guix-build-javacc-4.1.drv-0/source/test/javacodeLA/build.xml:60: ;; JAVACODE failed (arguments `(#:tests? #f #:phases (modify-phases %standard-phases ;; Delete tests to avoid build failure (we don't run them anyway). (add-after 'unpack 'delete-tests (lambda _ (for-each delete-file '("src/org/javacc/JavaCCTestCase.java" "src/org/javacc/parser/ExpansionTest.java" "src/org/javacc/parser/OptionsTest.java" "src/org/javacc/jjtree/JJTreeOptionsTest.java")) (for-each delete-file-recursively '("src/org/javacc/parser/test" "src/org/javacc/jjdoc/test")) #t)) (replace 'install (install-jars "bin/lib"))))) (home-page "https://javacc.org/") (synopsis "Java parser generator") (description "Java Compiler Compiler (JavaCC) is the most popular parser generator for use with Java applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.") (license license:bsd-3))) ;; javacc-3, as javacc-4 is not properly bootstrapped: is contains a javacc.jar ;; in the bootstrap/ directory. (define-public javacc-3 (package (inherit javacc-4) (version "3.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/javacc/javacc") (commit "release_32"))) (file-name (string-append "javacc-" version "-checkout")) (sha256 (base32 "1pyf1xyh8gk83nxqn2v2mdws32l68ydznha41cxa4l2kkbq1v1g3")))) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (add-before 'build 'set-java-version (lambda _ (for-each (lambda (file) (substitute* file (("debug=") "source=\"1.4\" debug="))) (find-files "." "build.xml")) #t)) (replace 'install (install-jars "bin/lib"))))))) (define-public javacc (package (inherit javacc-4) (version "7.0.13") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/javacc/javacc") (commit (string-append "javacc-" version)))) (file-name (git-file-name "javacc" version)) (sha256 (base32 "0mwbgqk41471iqsa9q2zydyw7l76xnmndyzrpp9nswy9hql6yclw")) (modules '((guix build utils))) ;; Delete bundled jars. (snippet '(begin (for-each delete-file-recursively '("bootstrap" "lib")))))) (arguments `(#:make-flags ; bootstrap from javacc-4 ,#~(list (string-append "-Dbootstrap-jar=" #$(this-package-native-input "javacc") "/share/java/javacc.jar")) #:test-target "test" #:phases (modify-phases %standard-phases (replace 'install (install-jars "target")) (add-after 'install 'install-bin (lambda* (#:key outputs inputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (dir (string-append out "/share/java")) (bin (string-append out "/bin")) (javacc (string-append bin "/javacc"))) (mkdir-p bin) (with-output-to-file javacc (lambda _ (display (string-append "#!/bin/sh\n" (assoc-ref inputs "icedtea") "/bin/java" " -cp " dir "/javacc.jar" " `basename $0`" " $*")))) (chmod javacc #o755) ;; symlink to different names to affect the first argument and ;; change the behavior of the jar file. (symlink javacc (string-append bin "/jjdoc")) (symlink javacc (string-append bin "/jjtree")))))))) (native-inputs (list javacc-4)) (inputs (list icedtea-8)))) (define-public java-ecj (package (name "java-ecj") (version "4.6.3") (source (origin (method url-fetch) (uri (string-append "http://archive.eclipse.org/eclipse/" "downloads/drops4/R-" version "-201703010400/" "ecjsrc-" version ".jar")) (sha256 (base32 "11cfgsdgznja1pvlxkjbqykxd7pcd5655vkm7s44xmahmap15gpl")))) (build-system ant-build-system) (arguments `(#:tests? #f ; none included #:build-target "build" #:phases (modify-phases %standard-phases (add-after 'unpack 'fix-build.xml (lambda _ (substitute* "src/build.xml" (("^.*MANIFEST.*$") "") (("^.*properties.*$") " ")))) (add-before 'build 'chdir (lambda _ (chdir "src"))) (replace 'install (install-jars "."))))) (home-page "https://eclipse.org") (synopsis "Eclipse Java development tools core batch compiler") (description "This package provides the Eclipse Java core batch compiler.") (license license:epl1.0))) (define-public java-cisd-base (let ((revision 38938) (base-version "14.12.0")) (package (name "java-cisd-base") (version (string-append base-version "-" (number->string revision))) (source (origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "base/tags/release/" (version-major+minor base-version) ".x/" base-version "/base/")) (revision revision))) (file-name (string-append "java-cisd-base-" version "-checkout")) (sha256 (base32 "1i5adyf7nzclb0wydgwa1az04qliid8035vpahaandmkmigbnxiy")) (modules '((guix build utils))) (snippet '(begin ;; Delete included gradle jar (delete-file-recursively "gradle/wrapper") ;; Delete pre-built native libraries (delete-file-recursively "libs") #t)))) (build-system ant-build-system) (arguments `(#:make-flags '("-file" "build/build.xml") #:test-target "jar-test" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-after 'unpack 'unpack-build-resources (lambda* (#:key inputs #:allow-other-keys) (copy-recursively (assoc-ref inputs "build-resources") "../build_resources") #t)) (add-after 'unpack-build-resources 'fix-dependencies (lambda* (#:key inputs #:allow-other-keys) (substitute* "build/build.xml" (("\\$\\{lib\\}/testng/testng-jdk15.jar") (search-input-file inputs "/share/java/java-testng.jar")) (("\\$\\{lib\\}/commons-lang/commons-lang.jar") (search-input-file inputs (string-append "/share/java/commons-lang-" ,(package-version java-commons-lang) ".jar"))) (("\\$\\{lib\\}/commons-io/commons-io.jar") (search-input-file inputs (string-append "/lib/m2/commons-io/commons-io/" ,(package-version java-commons-io) "/commons-io-" ,(package-version java-commons-io) ".jar"))) ;; Remove dependency on svn (("string revision)) (("\\$\\{version.number\\}") ,base-version)) ;; Remove dependency on classycle (substitute* "../build_resources/ant/build-common.xml" (("string revision))) (source (origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "args4j/tags/release/" (version-major+minor base-version) ".x/" base-version "/args4j/")) (revision revision))) (file-name (string-append "java-cisd-args4j-" version "-checkout")) (sha256 (base32 "0hhqznjaivq7ips7mkwas78z42s6djsm20rrs7g1zd59rcsakxn2")))) (build-system ant-build-system) (arguments `(#:make-flags '("-file" "build/build.xml") #:tests? #f ; there are no tests #:modules ((guix build ant-build-system) (guix build utils) (guix build java-utils) (sxml simple) (sxml transform) (sxml xpath)) #:phases (modify-phases %standard-phases (add-after 'unpack 'unpack-build-resources (lambda* (#:key inputs #:allow-other-keys) (mkdir-p "../build_resources") (copy-recursively (assoc-ref inputs "build-resources") "../build_resources") (mkdir-p "../build_resources/lib"))) (add-after 'unpack-build-resources 'fix-dependencies (lambda* (#:key inputs #:allow-other-keys) ;; FIXME: There should be a more convenient abstraction for ;; editing XML files. (with-directory-excursion "../build_resources/ant/" (chmod "build-common.xml" #o664) (call-with-output-file "build-common.xml.new" (lambda (port) (sxml->xml (pre-post-order (with-input-from-file "build-common.xml" (lambda _ (xml->sxml #:trim-whitespace? #t))) `(;; Remove dependency on classycle and custom ant tasks (taskdef . ,(lambda (tag . kids) (let ((name ((sxpath '(name *text*)) kids))) (if (or (member "build-info" name) (member "dependency-checker" name) (member "build-java-subprojects" name) (member "project-classpath" name)) '() ; skip `(,tag ,@kids))))) (typedef . ,(lambda (tag . kids) (let ((name ((sxpath '(name *text*)) kids))) (if (member "recursive-jar" name) '() ; skip `(,tag ,@kids))))) (build-java-subprojects . ,(lambda _ '())) ;; Ignore everything else (*default* . ,(lambda (tag . kids) `(,tag ,@kids))) (*text* . ,(lambda (_ txt) txt)))) port))) (rename-file "build-common.xml.new" "build-common.xml")) (substitute* "build/build.xml" (("\\$\\{lib\\}/cisd-base/cisd-base.jar") (search-input-file inputs "/share/java/sis-base.jar")) ;; Remove dependency on svn (("string revision)) (("\\$\\{version.number\\}") ,base-version) ;; Don't use custom ant tasks. (("recursive-jar") "jar") (("string revision))) (source (origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "jhdf5/tags/release/" (version-major+minor base-version) ".x/" base-version "/jhdf5/")) (revision revision))) (file-name (string-append "java-cisd-jhdf5-" version "-checkout")) (sha256 (base32 "13i17s2hn0q9drdqvp8csy7770p3hdbh9rp30ihln2ldkfawdmz0")) (modules '((guix build utils))) (snippet '(begin ;; Delete included gradle jar (delete-file-recursively "gradle/wrapper") ;; Delete pre-built native libraries (delete-file-recursively "libs"))))) (build-system ant-build-system) (arguments `(#:make-flags '("-file" "build/build.xml") #:build-target "jar-all" #:test-target "jar-test" #:phases (modify-phases %standard-phases ;; FIXME: this build phase fails. (delete 'generate-jar-indices) ;; Don't erase results from the build phase when building tests. (add-after 'unpack 'separate-test-target-from-clean (lambda _ (substitute* "build/build.xml" (("\"jar-test\" depends=\"clean, ") "\"jar-test\" depends=\"")))) (add-after 'unpack 'unpack-build-resources (lambda* (#:key inputs #:allow-other-keys) (copy-recursively (assoc-ref inputs "build-resources") "../build_resources") (delete-file-recursively "../build_resources/lib/") (mkdir-p "../build_resources/lib") ;; Remove dependency on classycle (substitute* "../build_resources/ant/build-common.xml" (("string revision)) (("\\$\\{version.number\\}") ,base-version)))) (add-after 'unpack-build-resources 'fix-dependencies (lambda* (#:key inputs #:allow-other-keys) (substitute* "../build_resources/ant/build-common.xml" (("../libraries/testng/testng-jdk15.jar") (search-input-file inputs "/share/java/java-testng.jar"))) (substitute* "build/build.xml" (("\\$\\{lib\\}/sis-base/sis-base.jar") (search-input-file inputs "/share/java/sis-base.jar")) (("\\$\\{lib\\}/cisd-args4j/cisd-args4j.jar") (search-input-file inputs "/share/java/cisd-args4j.jar")) (("\\$\\{lib\\}/commons-lang/commons-lang.jar") (search-input-file inputs (string-append "/share/java/commons-lang-" ,(package-version java-commons-lang) ".jar"))) (("\\$\\{lib\\}/commons-io/commons-io.jar") (search-input-file inputs (string-append "/lib/m2/commons-io/commons-io/" ,(package-version java-commons-io) "/commons-io-" ,(package-version java-commons-io) ".jar"))) (("\\$\\{lib\\}/testng/testng-jdk15.jar") (search-input-file inputs "/share/java/java-testng.jar")) (("\\$\\{lib\\}/junit4/junit.jar") (car (find-files (assoc-ref inputs "java-junit") "jar$"))) (("\\$\\{lib\\}/jmock/hamcrest/hamcrest-core.jar") (car (find-files (assoc-ref inputs "java-hamcrest-core") "jar$")))) ;; Remove dependency on ch.rinn.restrictions (with-directory-excursion "source/java/ch/systemsx/cisd/hdf5/" (substitute* '("BitSetConversionUtils.java" "HDF5Utils.java") (("import ch.rinn.restrictions.Private;") "") (("@Private") ""))) (with-directory-excursion "sourceTest/java/ch/systemsx/cisd/hdf5/" (substitute* '("BitSetConversionTest.java" "h5ar/HDF5ArchiverTest.java") (("import ch.rinn.restrictions.Friend;") "") (("@Friend.*") "")) ;; Remove leftovers from removing @Friend (substitute* "h5ar/HDF5ArchiverTest.java" (("\\{ HDF5Archiver.class, IdCache.class, LinkRecord.class \\}\\)") ""))))) (add-before 'configure 'build-native-library (lambda* (#:key inputs #:allow-other-keys) (let ((jdk (assoc-ref inputs "jdk")) (hdf5 (assoc-ref inputs "hdf5")) (dir ,(match (%current-system) ("i686-linux" "i386-Linux") ((or "armhf-linux" "aarch64-linux") "arm-Linux") ((or "x86_64-linux") "amd64-Linux") (_ "unknown-Linux")))) (with-directory-excursion "source/c" (apply invoke `("gcc" "-shared" "-O3" "-fPIC" "-Wl,--exclude-libs,ALL" "-Wno-error=implicit-function-declaration" ,@(find-files "jhdf5" "\\.c$") ,@(find-files "hdf-java" "\\.c$") ,(string-append "-I" hdf5 "/include") ,(string-append "-I" jdk "/include") ,(string-append "-I" jdk "/include/linux") ,(string-append hdf5 "/lib/libhdf5.a") "-o" "libjhdf5.so" "-lz"))) (install-file "source/c/libjhdf5.so" (string-append "libs/native/jhdf5/" dir))))) ;; In the "check" phase we only build the test executable. (add-after 'check 'run-tests (lambda _ (invoke "java" "-jar" "targets/dist/sis-jhdf5-test.jar") (delete-file "targets/dist/sis-jhdf5-test.jar"))) (replace 'install (install-jars "targets/dist"))))) (inputs (list java-cisd-base java-cisd-args4j java-commons-lang java-commons-io hdf5-1.8 zlib)) (native-inputs `(("jdk" ,icedtea-8) ("java-testng" ,java-testng) ("java-junit" ,java-junit) ("java-jmock" ,java-jmock) ("java-hamcrest-core" ,java-hamcrest-core) ("build-resources" ,(origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "jhdf5/tags/release/" (version-major+minor base-version) ".x/" base-version "/build_resources/")) (revision revision))) (sha256 (base32 "0b6335gkm4x895rac6kfg9d3rpq0sy19ph4zpg2gyw6asfsisjhk")))))) (home-page "https://wiki-bsse.ethz.ch/display/JHDF5/") (synopsis "Java binding for HDF5") (description "JHDF5 is a high-level API in Java for reading and writing HDF5 files, building on the libraries provided by the HDF Group.") ;; The C sources are under a non-copyleft license, which looks like a ;; variant of the BSD licenses. The whole package is under the ASL2.0. (license (list license:asl2.0 (license:non-copyleft "file://source/c/COPYING")))))) (define-public java-classpathx-servletapi (package (name "java-classpathx-servletapi") (version "3.0.1") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/classpathx/servletapi/" "servletapi-" version ".tar.gz")) (sha256 (base32 "07d8h051siga2f33fra72hk12sbq1bxa4jifjg0qj0vfazjjff0x")))) (build-system ant-build-system) (arguments `(#:tests? #f ; there is no test target #:build-target "compile" #:make-flags ,#~(list "-Dbuild.compiler=javac1.8" (string-append "-Ddist=" #$output)) #:phases (modify-phases %standard-phases (replace 'install (lambda* (#:key make-flags #:allow-other-keys) (apply invoke `("ant" "dist" ,@make-flags))))))) (home-page "https://www.gnu.org/software/classpathx/") (synopsis "Java servlet API implementation") (description "This is the GNU servlet API distribution, part of the ClasspathX project. It provides implementations of version 3.0 of the servlet API and version 2.1 of the Java ServerPages API.") (license license:gpl3+))) (define-public java-javaee-servletapi (package (name "java-javaee-servletapi") (version "3.1.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/javaee/servlet-spec") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "0s03lj8w5an70lkqbjycgfrfk0kc07vbfav91jzk87gh3awf9ksl")))) (build-system ant-build-system) (arguments `(#:jar-name "javax-servletapi.jar" ;; no tests #:tests? #f #:source-dir "src/main/java" #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes/javax/servlet/http") (let ((from-prefix "src/main/java/javax/servlet/") (to-prefix "build/classes/javax/servlet/")) (for-each (lambda (f) (copy-file (string-append from-prefix f) (string-append to-prefix f))) (list "LocalStrings_ja.properties" "LocalStrings.properties" "LocalStrings_fr.properties" "http/LocalStrings_es.properties" "http/LocalStrings_ja.properties" "http/LocalStrings.properties" "http/LocalStrings_fr.properties"))) #t))))) (native-inputs (list unzip)) (home-page "https://javaee.github.io/servlet-spec/") (synopsis "Java servlet API") (description "Java Servlet is the foundation web specification in the Java Enterprise Platform. Developers can build web applications using the Servlet API to interact with the request/response workflow. This project provides information on the continued development of the Java Servlet specification.") ;; Main code is dual-licensed by Oracle under either GLP2 or CDDL 1.1. ;; Some files are licensed under ASL 2.0. (license (list license:asl2.0 license:gpl2 license:cddl1.1)))) (define-public java-swt (package (name "java-swt") (version "4.7.1a") (source ;; The types of many variables and procedures differ in the sources ;; dependent on whether the target architecture is a 32-bit system or a ;; 64-bit system. Instead of patching the sources on demand in a build ;; phase we download either the 32-bit archive (which mostly uses "int" ;; types) or the 64-bit archive (which mostly uses "long" types). (let ((hash32 "09q0cbh90d90q3a7dx9430kc4m6bijrkr4lajrmzzvi0jjdpq4v9") (hash64 "17k5hs75a87ssmc5xhwdfdm2gn4zba0r837l2455za01krnkaa2q") (file32 "x86") (file64 "x86_64")) (let-values (((hash file) (match (or (%current-target-system) (%current-system)) ("x86_64-linux" (values hash64 file64)) (_ (values hash32 file32))))) (origin (method url-fetch) (uri (string-append "https://archive.eclipse.org/eclipse/downloads/drops4/" "R-" version "-201710090410/swt-" version "-gtk-linux-" file ".zip")) (sha256 (base32 hash)))))) (build-system ant-build-system) (arguments `(#:jar-name "swt.jar" #:jdk ,icedtea-8 #:tests? #f ; no "check" target #:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key source #:allow-other-keys) (mkdir "swt") (invoke "unzip" source "-d" "swt") (chdir "swt") (mkdir "src") (invoke "unzip" "src.zip" "-d" "src"))) ;; The classpath contains invalid icecat jars. Since we don't need ;; anything other than the JDK on the classpath, we can simply unset ;; it. (add-after 'configure 'unset-classpath (lambda _ (unsetenv "CLASSPATH") #t)) (add-before 'build 'build-native (lambda* (#:key inputs outputs #:allow-other-keys) (let ((lib (string-append (assoc-ref outputs "out") "/lib"))) ;; Build shared libraries. Users of SWT have to set the system ;; property swt.library.path to the "lib" directory of this ;; package output. (mkdir-p lib) (setenv "OUTPUT_DIR" lib) (setenv "CC" ,(cc-for-target)) (with-directory-excursion "src" (invoke "bash" "build.sh"))))) (add-after 'install 'install-native (lambda* (#:key outputs #:allow-other-keys) (let ((lib (string-append (assoc-ref outputs "out") "/lib"))) (for-each (lambda (file) (install-file file lib)) (find-files "." "\\.so$")) #t)))))) (inputs `(("gtk" ,gtk+-2) ("libxtst" ,libxtst) ("libxt" ,libxt) ("mesa" ,mesa) ("glu" ,glu))) (native-inputs (list pkg-config unzip)) (home-page "https://www.eclipse.org/swt/") (synopsis "Widget toolkit for Java") (description "SWT is a widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.") ;; SWT code is licensed under EPL1.0 ;; Gnome and Gtk+ bindings contain code licensed under LGPLv2.1 ;; Cairo bindings contain code under MPL1.1 ;; XULRunner 1.9 bindings contain code under MPL2.0 (license (list license:epl1.0 license:mpl1.1 license:mpl2.0 license:lgpl2.1+)))) ;; java-hamcrest-core uses qdox version 1.12. We package this version instead ;; of the latest release. (define-public java-qdox-1.12 (package (name "java-qdox") (version "1.12.1") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "com/thoughtworks/qdox/qdox/" version "/qdox-" version "-sources.jar")) (sha256 (base32 "0hlfbqq2avf5s26wxkksqmkdyk6zp9ggqn37c468m96mjv0n9xfl")))) (build-system ant-build-system) (arguments `(;; Tests require junit #:tests? #f #:jar-name "qdox.jar" #:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key source #:allow-other-keys) (mkdir "src") (with-directory-excursion "src" (invoke "jar" "-xf" source)))) ;; At this point we don't have junit, so we must remove the API ;; tests. (add-after 'unpack 'delete-tests (lambda _ (delete-file-recursively "src/com/thoughtworks/qdox/junit") #t))))) (home-page "https://github.com/codehaus/qdox") (synopsis "Parse definitions from Java source files") (description "QDox is a high speed, small footprint parser for extracting class/interface/method definitions from source files complete with JavaDoc @code{@@tags}. It is designed to be used by active code generators or documentation tools.") (license license:asl2.0))) (define-public java-qdox (package (name "java-qdox") ; Newer version exists, but this version is required by java-plexus-component-metadata (version "2.0-M2") (source (origin (method url-fetch) ;; 2.0-M4, -M5 at https://github.com/paul-hammant/qdox ;; Older releases at https://github.com/codehaus/qdox/ ;; Note: The release at maven is pre-generated. The release at ;; github requires jflex. (uri (string-append "https://repo1.maven.org/maven2/" "com/thoughtworks/qdox/qdox/" version "/qdox-" version "-sources.jar")) (sha256 (base32 "10xxrcaicq6axszcr2jpygisa4ch4sinyx5q7kqqxv4lknrmxp5x")))) (build-system ant-build-system) (arguments `(#:jar-name "qdox.jar" #:tests? #f; no tests #:phases (modify-phases %standard-phases (add-before 'install 'create-pom (generate-pom.xml "pom.xml" "com.thoughtworks.qdox" "qdox" ,version #:name "QDox")) (replace 'install (install-from-pom "pom.xml"))))) (home-page "https://github.com/codehaus/qdox") (synopsis "Parse definitions from Java source files") (description "QDox is a high speed, small footprint parser for extracting class/interface/method definitions from source files complete with JavaDoc @code{@@tags}. It is designed to be used by active code generators or documentation tools.") (license license:asl2.0))) (define-public java-qdox-2 (package (inherit java-qdox) (name "java-qdox-2") (version "2.2.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "com/thoughtworks/qdox/qdox/" version "/qdox-" version "-sources.jar")) (sha256 (base32 "1j3xdbh590x2yiqqrrbf0bb43djyzjzjibqxfnj80341fgfhcj31")))) (arguments `(#:jar-name "qdox.jar" #:jdk ,openjdk11 #:tests? #f #:phases (modify-phases %standard-phases (add-before 'install 'create-pom (generate-pom.xml "pom.xml" "com.thoughtworks.qdox" "qdox" ,version #:name "QDox")) (replace 'install (install-from-pom "pom.xml"))))))) (define-public java-jarjar (package (name "java-jarjar") (version "1.4") (source (origin (method url-fetch) (uri (string-append "https://storage.googleapis.com/google-code-archive-downloads/v2/" "code.google.com/jarjar/jarjar-src-" version ".zip")) (sha256 (base32 "1v8irhni9cndcw1l1wxqgry013s2kpj0qqn57lj2ji28xjq8ndjl")) (modules '((guix build utils))) (snippet '(begin ;; Delete bundled thirds-party jar archives. (delete-file-recursively "lib") (delete-file "src/test/enumtest.jar") ;; the CLASSPATH needs this directory, create an empty one (mkdir-p "lib") #t)))) (build-system ant-build-system) (arguments `(;; Tests require junit, which ultimately depends on this package. #:tests? #f #:build-target "jar" #:phases (modify-phases %standard-phases (add-before 'build 'do-not-use-bundled-asm (lambda* (#:key inputs #:allow-other-keys) (substitute* "build.xml" (("") (string-append "")) (("") "") (("lib/asm-commons-4.0.jar") (car (find-files (assoc-ref inputs "java-asm-bootstrap") "asm-6.0.jar"))) (("") (string-append "" "" "" ""))) #t)) (add-before 'build 'remove-maven-dependency (lambda _ ;; We do not need to build jarjar as a maven plugin just yet, so ;; remove this file. Maven requires jarjar (but not that plugin), ;; so removing it improves the bootstrap. (delete-file "src/main/com/tonicsystems/jarjar/JarJarMojo.java") #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((target (string-append (assoc-ref outputs "out") "/share/java"))) (install-file (string-append "dist/jarjar-" ,version ".jar") target)) #t))))) (inputs (list java-asm-bootstrap)) (native-inputs (list unzip)) (home-page "https://code.google.com/archive/p/jarjar/") (synopsis "Repackage Java libraries") (description "Jar Jar Links is a utility that makes it easy to repackage Java libraries and embed them into your own distribution. Jar Jar Links includes an Ant task that extends the built-in @code{jar} task.") (license license:asl2.0))) (define-public java-hamcrest-core (package (name "java-hamcrest-core") (version "1.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/hamcrest/JavaHamcrest/") (commit (string-append "hamcrest-java-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "16fxxkrd31ahqvcaby30jgh3z1i0zxh51m24hxgz0z2agxj6bc63")) (modules '((guix build utils))) (snippet '(begin ;; Delete bundled thirds-party jar archives. (delete-file-recursively "lib") #t)))) (build-system ant-build-system) (arguments `(#:tests? #f ; Tests require junit #:modules ((guix build ant-build-system) (guix build java-utils) (guix build utils) (srfi srfi-1)) #:make-flags (list (string-append "-Dversion=" ,version)) #:test-target "unit-test" #:build-target "core" #:phases (modify-phases %standard-phases ;; Disable unit tests, because they require junit, which requires ;; hamcrest-core. We also give a fixed value to the "Built-Date" ;; attribute from the manifest for reproducibility. (add-before 'configure 'patch-build.xml (lambda _ (substitute* "build.xml" (("unit-test, ") "") (("\\$\\{build.timestamp\\}") "guix")) #t)) ;; Java's "getMethods()" returns methods in an unpredictable order. ;; To make the output of the generated code deterministic we must ;; sort the array of methods. (add-after 'unpack 'make-method-order-deterministic (lambda _ (substitute* "hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java" (("import java\\.util\\.Iterator;" line) (string-append line "\n" "import java.util.Arrays; import java.util.Comparator;")) (("allMethods = cls\\.getMethods\\(\\);" line) (string-append "_" line " private Method[] getSortedMethods() { Arrays.sort(_allMethods, new Comparator() { @Override public int compare(Method a, Method b) { return a.toString().compareTo(b.toString()); } }); return _allMethods; } private Method[] allMethods = getSortedMethods();"))) #t)) (add-before 'build 'do-not-use-bundled-qdox (lambda* (#:key inputs #:allow-other-keys) (substitute* "build.xml" (("lib/generator/qdox-1.12.jar") (string-append (assoc-ref inputs "java-qdox-1.12") "/share/java/qdox.jar"))) #t)) ;; build.xml searches for .jar files in this directoy, which ;; we remove from the source archive. (add-before 'build 'create-dummy-directories (lambda _ (mkdir-p "lib/integration") #t)) (add-before 'build 'create-pom (lambda _ (substitute* "pom/hamcrest-core.pom" (("@VERSION@") ,version)) #t)) (replace 'install (install-from-pom "pom/hamcrest-core.pom"))))) (native-inputs `(("java-qdox-1.12" ,java-qdox-1.12) ("java-jarjar" ,java-jarjar))) (propagated-inputs (list java-hamcrest-parent-pom)) (home-page "https://hamcrest.org/") (synopsis "Library of matchers for building test expressions") (description "This package provides a library of matcher objects (also known as constraints or predicates) allowing @code{match} rules to be defined declaratively, to be used in other frameworks. Typical scenarios include testing frameworks, mocking libraries and UI validation rules.") (license license:bsd-2))) (define-public java-hamcrest-parent-pom (package (inherit java-hamcrest-core) (properties '((hidden? . #t))) (name "java-hamcrest-parent-pom") (propagated-inputs '()) (native-inputs '()) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (replace 'build (lambda _ (substitute* "pom/hamcrest-parent.pom" (("@VERSION@") ,(package-version java-hamcrest-core))) #t)) (replace 'install (install-pom-file "pom/hamcrest-parent.pom"))))))) (define-public java-hamcrest-library (package (inherit java-hamcrest-core) (name "java-hamcrest-library") (arguments (substitute-keyword-arguments (package-arguments java-hamcrest-core) ((#:build-target _) "library") ((#:phases phases) `(modify-phases ,phases (add-after 'unpack 'patch-classpath-for-integration (lambda* (#:key inputs #:allow-other-keys) (substitute* "build.xml" (("build/hamcrest-core-\\$\\{version\\}\\.jar") (car (find-files (assoc-ref inputs "java-hamcrest-core") "jar$")))) #t)) (replace 'create-pom (lambda _ (substitute* "pom/hamcrest-library.pom" (("@VERSION@") ,(package-version java-hamcrest-core))) #t)) (replace 'install (install-from-pom "pom/hamcrest-library.pom")))))) (propagated-inputs (list java-hamcrest-core java-hamcrest-parent-pom)))) (define-public java-junit (package (name "java-junit") (version "4.12") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/junit-team/junit/") (commit (string-append "r" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1j8avi91px1z8rjc89cfikwrvfifdmmsarwiyrcnr59ynvpz0v8h")) (modules '((guix build utils))) (snippet '(begin ;; Delete bundled jar archives. (delete-file-recursively "lib") #t)))) (build-system ant-build-system) (arguments `(#:jar-name "junit.jar" #:source-dir "src/main/java" #:test-dir "src/test" #:test-exclude (list "**/SimpleTest.java" "**/StackTracesTest.java" "**/RuleChainTest.java" "**/TestWatchmanTest.java") #:phases (modify-phases %standard-phases (add-before 'check 'copy-test-resources (lambda _ (copy-recursively "src/test/resources" "build/test-classes") #t)) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-hamcrest-core)) (native-inputs (list java-hamcrest-library)) (home-page "https://junit.org/junit4/") (synopsis "Test framework for Java") (description "JUnit is a simple framework to write repeatable tests for Java projects. JUnit provides assertions for testing expected results, test fixtures for sharing common test data, and test runners for running tests.") (license license:epl1.0))) (define-public java-junitparams (package (name "java-junitparams") (version "1.1.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/Pragmatists/JUnitParams") (commit (string-append "JUnitParams-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0rb52xdfp99invyjrras3w0bf0a81cz30yd47rkkiyqcqj0y1q9b")))) (build-system ant-build-system) (arguments `(#:jar-name "junitparams.jar" #:source-dir "src/main/java" #:test-dir "src/test" #:test-exclude (list "**/SuperclassTest.java"))) (inputs (list java-junit)) (native-inputs (list java-junit java-hamcrest-core java-assertj)) (home-page "https://github.com/Pragmatists/JUnitParams") (synopsis "Parameterised test support for JUnit") (description "The JUnitParams project adds a new runner to JUnit and provides much easier and readable parametrised tests for JUnit.") (license license:asl2.0))) ;; JUnit BOM (Bill of Materials) for dependency version management (define (make-junit-bom version hash) (package (name "junit-bom") (version version) (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/org/junit/junit-bom/" version "/junit-bom-" version ".pom")) (sha256 (base32 hash)))) (build-system ant-build-system) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (delete 'build) (replace 'install (lambda* (#:key source outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (pom-dir (string-append out "/lib/m2/org/junit/junit-bom/" ,version))) (mkdir-p pom-dir) (copy-file source (string-append pom-dir "/junit-bom-" ,version ".pom")))))))) (home-page "https://junit.org/junit5/") (synopsis "JUnit 5 Bill of Materials") (description "This package provides a Maven BOM (Bill of Materials) for JUnit 5, used for dependency version management.") (license license:epl2.0))) (define-public junit-bom-5.11 (make-junit-bom "5.11.4" "05a1br7lqpisb5gcphaag8kn4rcqdwlm6i9knqjm7004n93vgm0r")) (define-public junit-bom-5.11.0 (make-junit-bom "5.11.0" "0kb4whmjm4xyh0n0gfj0nd38ks52yk4b23glfiisq914i3a5jx76")) (define-public java-plexus-utils (package (name "java-plexus-utils") (version "3.5.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-utils") (commit (string-append "plexus-utils-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0zm0svaffdkjqkj778zicxvij87hkbi9hhidx0343dqalikdsmqq")))) (build-system ant-build-system) ;; FIXME: The default build.xml does not include a target to install ;; javadoc files. (arguments `(#:jar-name "plexus-utils.jar" ;; 3.5.x has multi-release JAR structure with java9/java10/java11 dirs ;; under src/main/ containing duplicate classes for newer JVMs. ;; Use src/main/java to compile only the base implementation. #:source-dir "src/main/java" #:phases (modify-phases %standard-phases (add-after 'unpack 'fix-reference-to-/bin-and-/usr (lambda _ (substitute* "src/main/java/org/codehaus/plexus/util/\ cli/shell/BourneShell.java" (("/bin/sh") (which "sh")) (("/usr/") (getcwd))) #t)) (add-after 'unpack 'fix-or-disable-broken-tests (lambda _ (with-directory-excursion "src/test/java/org/codehaus/plexus/util" (substitute* '("cli/CommandlineTest.java" "cli/shell/BourneShellTest.java") (("/bin/sh") (which "sh")) (("/bin/echo") (which "echo"))) ;; This test depends on MavenProjectStub, but we don't have ;; a package for Maven. (delete-file "introspection/ReflectionValueExtractorTest.java") ;; FIXME: The command line tests fail, maybe because they use ;; absolute paths. (delete-file "cli/CommandlineTest.java") ;; These tests require openjdk jmh, which is not packaged yet (for-each delete-file (find-files "." "PerfTest.java$"))) #t)) (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes") #t)) (replace 'install (install-from-pom "pom.xml"))))) (native-inputs (list java-hamcrest-core java-junit)) (propagated-inputs (list plexus-parent-pom-10)) (home-page "https://codehaus-plexus.github.io/plexus-utils/") (synopsis "Common utilities for the Plexus framework") (description "This package provides various Java utility classes for the Plexus framework to ease working with strings, files, command lines, XML and more.") (license license:asl2.0))) (define-public java-plexus-utils-3.2.1 (package (inherit java-plexus-utils) ;; plexus-build-api needs this version, later versions don't work (version "3.2.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-utils") (commit (string-append "plexus-utils-" version)))) (file-name (git-file-name "java-plexus-utils" version)) (sha256 (base32 "1w169glixyk94jbczj8jzg897lsab46jihiaa3dhw0p06g35va8b")))))) (define-public java-plexus-xml (package (name "java-plexus-xml") (version "3.0.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-xml") (commit (string-append "plexus-xml-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0agwjmzqay7zg4wf2g7lf3gryl9hivr2cb89k0wvjx49r4rdrnhr")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-xml.jar" #:source-dir "src/main/java" #:tests? #f #:phases (modify-phases %standard-phases (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list plexus-parent-pom-20)) (home-page "https://codehaus-plexus.github.io/plexus-xml/") (synopsis "Plexus XML utilities") (description "Plexus XML provides XML parsing and writing utilities.") (license license:asl2.0))) (define-public java-plexus-utils-4 (package (inherit java-plexus-utils) (version "4.0.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-utils") (commit (string-append "plexus-utils-" version)))) (file-name (git-file-name "java-plexus-utils" version)) (sha256 (base32 "1prhjyrj985zgis89il5s91jgd3dr980dihl7zam1nda2ibl0mi9")))) (arguments (substitute-keyword-arguments (package-arguments java-plexus-utils) ;; Tests require JUnit 5 (Jupiter) which is not yet available. ((#:tests? _ #f) #f))) ;; In 4.x, the XML utilities (XmlStreamReader, XmlStreamWriter) were split ;; out into the separate plexus-xml package. (inputs (list java-plexus-xml)))) (define-public java-plexus-interpolation (package (name "java-plexus-interpolation") (version "1.26") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-interpolation") (commit (string-append "plexus-interpolation-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1rahjmhywf6d5m32qzlc9izawyvcd71abfm9k03f13rs2xmfxzlh")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-interpolation.jar" #:source-dir "src/main" #:phases (modify-phases %standard-phases (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs `(("plexus-parent-pom-5.1" ,plexus-parent-pom-5.1))) (native-inputs (list java-junit java-hamcrest-core)) (home-page "https://codehaus-plexus.github.io/plexus-interpolation/") (synopsis "Java components for interpolating ${} strings and the like") (description "Plexus interpolator is a modular, flexible interpolation framework for the expression language style commonly seen in Maven, Plexus, and other related projects. It has its foundation in the @code{org.codehaus.plexus.utils.interpolation} package within @code{plexus-utils}, but has been separated in order to allow these two libraries to vary independently of one another.") (license license:asl2.0))) (define-public java-jtidy (package (name "java-jtidy") (version "1.0.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/jtidy/jtidy") (commit (string-append "jtidy-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1i4jcg0ps2wmssk1p6yp9cd6di49pw2j30kplakvy1bnp3x7j4pp")))) (build-system ant-build-system) (arguments `(#:jar-name "jtidy.jar" #:source-dir "src/main/java" #:tests? #f #:phases (modify-phases %standard-phases (add-before 'install 'generate-pom (generate-pom.xml "pom.xml" "net.sf.jtidy" "jtidy" ,version)) (replace 'install (install-from-pom "pom.xml"))))) (home-page "https://jtidy.sourceforge.net/") (synopsis "Java port of HTML Tidy") (description "JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty printer. Like its non-Java cousin, JTidy can be used as a tool for cleaning up malformed and faulty HTML. In addition, JTidy provides a DOM interface to the document that is being processed, which effectively makes you able to use JTidy as a DOM parser for real-world HTML.") (license license:bsd-3))) (define-public java-plexus-classworlds (package (name "java-plexus-classworlds") (version "2.6.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-classworlds") (commit (string-append "plexus-classworlds-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "034k2hgvj1saalwbnzrbg4n0zgzwcpz1lhlb8q4kgglsp9pmm03s")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-classworlds.jar" #:source-dir "src/main" #:tests? #f;; FIXME: we need to generate some resources as in pom.xml #:phases (modify-phases %standard-phases (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs `(("plexus-parent-pom-5.1" ,plexus-parent-pom-5.1))) (native-inputs (list java-junit)) (home-page "https://codehaus-plexus.github.io/plexus-classworlds/") (synopsis "Java class loader framework") (description "Plexus classworlds replaces the native @code{ClassLoader} mechanism of Java. It is especially useful for dynamic loading of application components.") (license license:asl2.0))) (define java-plexus-container-default-bootstrap (package (name "java-plexus-container-default-bootstrap") (version "2.1.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-containers") (commit (string-append "plexus-containers-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0r9yq67c1hvi1pz5wmx6x6hk5fmavp8a7yal3j5hkaad757firn1")))) (build-system ant-build-system) (arguments `(#:jar-name "container-default.jar" #:source-dir "plexus-container-default/src/main/java" #:test-dir "plexus-container-default/src/test" #:tests? #f; requires plexus-archiver, which depends on this package #:phases (modify-phases %standard-phases (add-before 'build 'fix-google-collections (lambda _ ;; Google collections are now replaced with guava (substitute* "plexus-container-default/pom.xml" (("google-collections") "guava") (("com.google.collections") "com.google.guava")) #t)) (add-before 'build 'copy-resources (lambda _ (copy-recursively "plexus-container-default/src/main/resources/" "build/classes") #t)) (replace 'install (install-from-pom "plexus-container-default/pom.xml"))))) (propagated-inputs `(("java-plexus-worldclass" ,java-plexus-classworlds) ("java-geronimo-xbean-reflect" ,java-geronimo-xbean-reflect) ("java-plexus-utils" ,java-plexus-utils) ("java-junit" ,java-junit) ("java-guava" ,java-guava) ("java-plexus-containers-parent-pom" ,java-plexus-containers-parent-pom))) (home-page "https://github.com/codehaus-plexus/plexus-containers") (synopsis "Inversion-of-control container") (description "Plexus-default-container is Plexus' inversion-of-control (@dfn{IoC}) container. It is composed of its public API and its default implementation.") (license license:asl2.0))) (define java-plexus-containers-parent-pom (package (inherit java-plexus-container-default-bootstrap) (name "java-plexus-containers-parent-pom") (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (delete 'build) (replace 'install (install-pom-file "pom.xml"))))) (propagated-inputs `(("plexus-parent-pom" ,plexus-parent-pom-4.0))))) (define-public java-aircompressor (package (name "java-aircompressor") (version "0.27") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/airlift/aircompressor") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "061v9mfazig0350j8326mn0awgzfyk9dcg6jprqah9ajjfps9dry")) (patches (search-patches "java-aircompressor-remove-hadoop.patch")) (modules '((guix build utils))) (snippet '(begin ;; Remove Hadoop-related Java files (delete-file-recursively "src/main/java/io/airlift/compress/hadoop") (for-each delete-file (find-files "src/main/java" ".*Hadoop.*\\.java$")) (for-each delete-file (find-files "src/main/java" ".*Codec\\.java$")))))) (build-system ant-build-system) (arguments `(#:jar-name "aircompressor.jar" #:source-dir "src/main/java" #:tests? #f #:phases (modify-phases %standard-phases (add-before 'install 'generate-simple-pom (lambda _ ;; Generate a simple pom without parent, since airbase:112 is not available. (with-output-to-file "pom.xml" (lambda () (display " 4.0.0 io.airlift aircompressor 0.27 jar aircompressor "))))) (replace 'install (install-from-pom "pom.xml"))))) (home-page "https://github.com/airlift/aircompressor") (synopsis "Java compression library") (description "Aircompressor is a Java library with ports of LZ4, Snappy, LZO, and Zstandard compression algorithms.") (license license:asl2.0))) (define-public java-plexus-io (package (name "java-plexus-io") (version "3.6.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-io") (commit (string-append "plexus-io-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0ln51s9a6wjvkkh4q05g69422856qng467fyvbh39x27i0vhcyb0")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-io.jar" #:source-dir "src/main/java" #:tests? #f #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "src/main/resources" "build/classes") #t)) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-plexus-utils java-commons-io java-slf4j-api java-javax-inject)) (inputs (list java-jsr305)) (home-page "https://github.com/codehaus-plexus/plexus-io") (synopsis "I/O plexus components") (description "Plexus IO is a set of plexus components, which are designed for use in I/O operations. This implementation using plexus components allows reusing it in maven.") (license license:asl2.0))) (define-public java-plexus-archiver (package (name "java-plexus-archiver") (version "4.10.4") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-archiver") (commit (string-append "plexus-archiver-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0azdfcp5fbah8wqxdgs2rmyn0v8a5jciikw5ai4m9d2s92w0ypz4")) (patches (search-patches "java-plexus-archiver-add-components-xml.patch")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-archiver.jar" #:source-dir "src/main/java" #:tests? #f #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "src/main/resources" "build/classes") #t)) (add-after 'copy-resources 'create-sisu-index ;; The sisu index file is normally generated by the sisu-maven-plugin ;; during the Maven build. Since we use ant-build-system, we need to ;; create it manually. This index is required for Plexus/Sisu to ;; discover and inject the archiver components. (lambda _ (mkdir-p "build/classes/META-INF/sisu") (call-with-output-file "build/classes/META-INF/sisu/javax.inject.Named" (lambda (port) (display "org.codehaus.plexus.archiver.bzip2.BZip2Archiver org.codehaus.plexus.archiver.bzip2.BZip2UnArchiver org.codehaus.plexus.archiver.bzip2.PlexusIoBz2ResourceCollection org.codehaus.plexus.archiver.bzip2.PlexusIoBzip2ResourceCollection org.codehaus.plexus.archiver.car.CarUnArchiver org.codehaus.plexus.archiver.car.PlexusIoCarFileResourceCollection org.codehaus.plexus.archiver.dir.DirectoryArchiver org.codehaus.plexus.archiver.ear.EarArchiver org.codehaus.plexus.archiver.ear.EarUnArchiver org.codehaus.plexus.archiver.ear.PlexusIoEarFileResourceCollection org.codehaus.plexus.archiver.esb.EsbUnArchiver org.codehaus.plexus.archiver.esb.PlexusIoEsbFileResourceCollection org.codehaus.plexus.archiver.filters.JarSecurityFileSelector org.codehaus.plexus.archiver.gzip.GZipArchiver org.codehaus.plexus.archiver.gzip.GZipUnArchiver org.codehaus.plexus.archiver.gzip.PlexusIoGzResourceCollection org.codehaus.plexus.archiver.gzip.PlexusIoGzipResourceCollection org.codehaus.plexus.archiver.jar.JarArchiver org.codehaus.plexus.archiver.jar.JarToolModularJarArchiver org.codehaus.plexus.archiver.jar.JarUnArchiver org.codehaus.plexus.archiver.jar.PlexusIoJarFileResourceCollection org.codehaus.plexus.archiver.manager.DefaultArchiverManager org.codehaus.plexus.archiver.nar.NarUnArchiver org.codehaus.plexus.archiver.nar.PlexusIoNarFileResourceCollection org.codehaus.plexus.archiver.par.ParUnArchiver org.codehaus.plexus.archiver.par.PlexusIoJarFileResourceCollection org.codehaus.plexus.archiver.rar.PlexusIoRarFileResourceCollection org.codehaus.plexus.archiver.rar.RarArchiver org.codehaus.plexus.archiver.rar.RarUnArchiver org.codehaus.plexus.archiver.sar.PlexusIoSarFileResourceCollection org.codehaus.plexus.archiver.sar.SarUnArchiver org.codehaus.plexus.archiver.snappy.PlexusIoSnappyResourceCollection org.codehaus.plexus.archiver.snappy.SnappyArchiver org.codehaus.plexus.archiver.snappy.SnappyUnArchiver org.codehaus.plexus.archiver.swc.PlexusIoSwcFileResourceCollection org.codehaus.plexus.archiver.swc.SwcUnArchiver org.codehaus.plexus.archiver.tar.PlexusIoTBZ2FileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTGZFileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTXZFileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTZstdFileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTarBZip2FileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTarFileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTarGZipFileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTarSnappyFileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTarXZFileResourceCollection org.codehaus.plexus.archiver.tar.PlexusIoTarZstdFileResourceCollection org.codehaus.plexus.archiver.tar.TBZ2Archiver org.codehaus.plexus.archiver.tar.TBZ2UnArchiver org.codehaus.plexus.archiver.tar.TGZArchiver org.codehaus.plexus.archiver.tar.TGZUnArchiver org.codehaus.plexus.archiver.tar.TXZArchiver org.codehaus.plexus.archiver.tar.TXZUnArchiver org.codehaus.plexus.archiver.tar.TZstdArchiver org.codehaus.plexus.archiver.tar.TZstdUnArchiver org.codehaus.plexus.archiver.tar.TarArchiver org.codehaus.plexus.archiver.tar.TarBZip2Archiver org.codehaus.plexus.archiver.tar.TarBZip2UnArchiver org.codehaus.plexus.archiver.tar.TarGZipArchiver org.codehaus.plexus.archiver.tar.TarGZipUnArchiver org.codehaus.plexus.archiver.tar.TarSnappyArchiver org.codehaus.plexus.archiver.tar.TarSnappyUnArchiver org.codehaus.plexus.archiver.tar.TarUnArchiver org.codehaus.plexus.archiver.tar.TarXZArchiver org.codehaus.plexus.archiver.tar.TarXZUnArchiver org.codehaus.plexus.archiver.tar.TarZstdArchiver org.codehaus.plexus.archiver.tar.TarZstdUnArchiver org.codehaus.plexus.archiver.war.PlexusIoWarFileResourceCollection org.codehaus.plexus.archiver.war.WarArchiver org.codehaus.plexus.archiver.war.WarUnArchiver org.codehaus.plexus.archiver.xz.PlexusIoXZResourceCollection org.codehaus.plexus.archiver.xz.XZArchiver org.codehaus.plexus.archiver.xz.XZUnArchiver org.codehaus.plexus.archiver.zip.PlexusArchiverZipFileResourceCollection org.codehaus.plexus.archiver.zip.ZipArchiver org.codehaus.plexus.archiver.zip.ZipUnArchiver org.codehaus.plexus.archiver.zstd.PlexusIoZstdResourceCollection org.codehaus.plexus.archiver.zstd.ZstdArchiver org.codehaus.plexus.archiver.zstd.ZstdUnArchiver " port))))) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-plexus-utils java-plexus-io java-commons-compress java-aircompressor java-slf4j-api java-xz java-javax-inject)) (inputs (list java-jsr305)) (home-page "https://github.com/codehaus-plexus/plexus-archiver") (synopsis "Archiver component of the Plexus project") (description "Plexus-archiver contains a component to deal with project archives (jar).") (license license:asl2.0))) (define-public java-plexus-container-default (package (inherit java-plexus-container-default-bootstrap) (name "java-plexus-container-default") (arguments `(#:jar-name "container-default.jar" #:source-dir "plexus-container-default/src/main/java" #:test-dir "plexus-container-default/src/test" #:tests? #f ;tests use ArchiverManager.ROLE removed in java-plexus-archiver 4.10 #:test-exclude (list ;"**/*Test.java" "**/Abstract*.java" ;; Requires plexus-hierarchy "**/PlexusHierarchyTest.java" ;; Failures "**/ComponentRealmCompositionTest.java" "**/PlexusContainerTest.java") #:phases (modify-phases %standard-phases (add-before 'build 'fix-google-collections (lambda _ ;; Google collections are now replaced with guava (substitute* "plexus-container-default/pom.xml" (("google-collections") "guava") (("com.google.collections") "com.google.guava")) #t)) (add-before 'build 'copy-resources (lambda _ (copy-recursively "plexus-container-default/src/main/resources/" "build/classes") #t)) (add-before 'check 'fix-paths (lambda _ (let ((dir "plexus-container-default/src/test/java/org/codehaus")) (substitute* (string-append dir "/plexus/component/composition/" "ComponentRealmCompositionTest.java") (("src/test") "plexus-container-default/src/test")) #t))) (replace 'install (install-from-pom "plexus-container-default/pom.xml"))))) (inputs `(("worldclass" ,java-plexus-classworlds) ("xbean" ,java-geronimo-xbean-reflect) ("utils" ,java-plexus-utils) ("junit" ,java-junit) ("guava" ,java-guava))) (native-inputs `(("archiver" ,java-plexus-archiver) ("hamcrest" ,java-hamcrest-core))))) (define-public java-plexus-component-annotations (package (inherit java-plexus-container-default) (name "java-plexus-component-annotations") (arguments `(#:jar-name "plexus-component-annotations.jar" #:source-dir "plexus-component-annotations/src/main/java" #:tests? #f; no tests #:phases (modify-phases %standard-phases (replace 'install (install-from-pom "plexus-component-annotations/pom.xml"))))) (propagated-inputs (list java-plexus-containers-parent-pom)) (inputs '()) (native-inputs '()) (synopsis "Plexus descriptors generator") (description "This package is a Maven plugin to generate Plexus descriptors from source tags and class annotations."))) (define-public java-plexus-component-metadata (package (inherit java-plexus-container-default) (name "java-plexus-component-metadata") (arguments `(#:jar-name "plexus-component-metadata.jar" #:source-dir "src/main/java" #:test-dir "src/test" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'configure 'chdir (lambda _ (chdir "plexus-component-metadata") #t)) (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes/") #t)) (add-before 'build 'fix-jdom (lambda _ ;; The newer version of jdom now sets multiple features by default ;; that are not supported. ;; Skip these features (substitute* "src/main/java/org/codehaus/plexus/metadata/merge/MXParser.java" (("throw new XmlPullParserException\\(\"unsupporte feature \"\\+name\\);") "// skip")))) (add-before 'build 'reinstate-cli ;; The CLI was removed in 2.1.0, but we still need it to build some ;; maven dependencies, and some parts of maven itself. We can't use ;; the maven plugin for that yet. (lambda _ (with-output-to-file "src/main/java/org/codehaus/plexus/metadata/PlexusMetadataGeneratorCli.java" (lambda _ ;; Copied from a previous version of this package. (display "package org.codehaus.plexus.metadata; import java.io.File; import java.util.Arrays; import java.util.Collections; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.tools.cli.AbstractCli; public class PlexusMetadataGeneratorCli extends AbstractCli { public static final char SOURCE_DIRECTORY = 's'; public static final char SOURCE_ENCODING = 'e'; public static final char CLASSES_DIRECTORY = 'c'; public static final char OUTPUT_FILE = 'o'; public static final char DESCRIPTORS_DIRECTORY = 'm'; public static void main( String[] args ) throws Exception { // Call System.exit() with execute()'s return code so errors // actually cause the process to exit with non-zero status. System.exit(new PlexusMetadataGeneratorCli().execute( args )); } @Override public String getPomPropertiesPath() { return \"META-INF/maven/org.codehaus.plexus/plexus-metadata-generator/pom.properties\"; } @Override @SuppressWarnings(\"static-access\") public Options buildCliOptions( Options options ) { options.addOption( OptionBuilder.withLongOpt( \"source\" ).hasArg().withDescription( \"Source directory.\" ).create( SOURCE_DIRECTORY ) ); options.addOption( OptionBuilder.withLongOpt( \"encoding\" ).hasArg().withDescription( \"Source file encoding.\" ).create( SOURCE_ENCODING ) ); options.addOption( OptionBuilder.withLongOpt( \"classes\" ).hasArg().withDescription( \"Classes directory.\" ).create( CLASSES_DIRECTORY ) ); options.addOption( OptionBuilder.withLongOpt( \"output\" ).hasArg().withDescription( \"Output directory.\" ).create( OUTPUT_FILE ) ); options.addOption( OptionBuilder.withLongOpt( \"descriptors\" ).hasArg().withDescription( \"Descriptors directory.\" ).create( DESCRIPTORS_DIRECTORY ) ); return options; } public void invokePlexusComponent( CommandLine cli, PlexusContainer plexus ) throws Exception { MetadataGenerator metadataGenerator = plexus.lookup( MetadataGenerator.class ); MetadataGenerationRequest request = new MetadataGenerationRequest(); request.classesDirectory = new File( cli.getOptionValue( CLASSES_DIRECTORY ) ); request.classpath = Collections.emptyList(); request.sourceDirectories = Arrays.asList( new String[]{ new File( cli.getOptionValue( SOURCE_DIRECTORY ) ).getAbsolutePath() } ); request.sourceEncoding = cli.getOptionValue( SOURCE_ENCODING ); request.useContextClassLoader = true; request.outputFile = new File( cli.getOptionValue( OUTPUT_FILE ) ); request.componentDescriptorDirectory = new File( cli.getOptionValue( DESCRIPTORS_DIRECTORY ) ); metadataGenerator.generateDescriptor( request ); } }"))))) (add-before 'check 'fix-test-location (lambda _ (substitute* '("src/test/java/org/codehaus/plexus/metadata/DefaultComponentDescriptorWriterTest.java" "src/test/java/org/codehaus/plexus/metadata/merge/ComponentsXmlMergerTest.java") (("target") "build"))))))) (propagated-inputs (list java-plexus-container-default java-plexus-component-annotations java-plexus-utils java-plexus-cli java-plexus-classworlds java-commons-cli java-qdox java-jdom2 java-asm-8 maven-plugin-api maven-plugin-annotations maven-model)) (native-inputs (list maven-core-bootstrap java-junit java-guava java-geronimo-xbean-reflect)) (synopsis "Inversion-of-control container for Maven") (description "The Plexus project provides a full software stack for creating and executing software projects. Based on the Plexus container, the applications can utilise component-oriented programming to build modular, reusable components that can easily be assembled and reused. This package provides the Maven plugin generating the component metadata."))) (define-public java-plexus-container-default-1.7 (package (inherit java-plexus-container-default) (version "1.7.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-containers") (commit (string-append "plexus-containers-" version)))) (file-name (git-file-name "java-plexus-container-default" version)) (sha256 (base32 "1316hrp5vqfv0aw7miq2fp0wwy833h66h502h29vnh5sxj27x228")))) (arguments (substitute-keyword-arguments (package-arguments java-plexus-container-default) ((#:tests? _ #t) #f))))) (define java-plexus-containers-parent-pom-1.7 (package (inherit java-plexus-container-default-1.7) (name "java-plexus-containers-parent-pom") (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (delete 'build) (replace 'install (install-pom-file "pom.xml"))))) (propagated-inputs `(("plexus-parent-pom" ,plexus-parent-pom-4.0))))) (define-public java-plexus-component-annotations-1.7 (package (inherit java-plexus-container-default-1.7) (name "java-plexus-component-annotations") (arguments `(#:jar-name "plexus-component-annotations.jar" #:source-dir "plexus-component-annotations/src/main/java" #:tests? #f; no tests #:phases (modify-phases %standard-phases (replace 'install (install-from-pom "plexus-component-annotations/pom.xml"))))) (propagated-inputs `(("java-plexus-containers-parent-pom-1.7" ,java-plexus-containers-parent-pom-1.7))) (inputs '()) (native-inputs '()) (synopsis "Plexus descriptors generator") (description "This package is a Maven plugin to generate Plexus descriptors from source tags and class annotations."))) (define-public java-plexus-component-metadata-1.7 (package (inherit java-plexus-container-default-1.7) (name "java-plexus-component-metadata") (arguments `(#:jar-name "plexus-component-metadata.jar" #:source-dir "src/main/java" #:test-dir "src/test" #:phases (modify-phases %standard-phases (add-before 'configure 'chdir (lambda _ (chdir "plexus-component-metadata") #t)) (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes/") #t)) (add-before 'build 'fix-jdom (lambda _ ;; The newer version of jdom now sets multiple features by default ;; that are not supported. ;; Skip these features (substitute* "src/main/java/org/codehaus/plexus/metadata/merge/MXParser.java" (("throw new XmlPullParserException\\(\"unsupporte feature \"\\+name\\);") "// skip")))) (add-before 'check 'fix-test-location (lambda _ (substitute* '("src/test/java/org/codehaus/plexus/metadata/DefaultComponentDescriptorWriterTest.java" "src/test/java/org/codehaus/plexus/metadata/merge/ComponentsXmlMergerTest.java") (("target") "build"))))))) (propagated-inputs (list java-plexus-container-default-1.7 java-plexus-component-annotations-1.7 java-plexus-utils java-plexus-cli java-plexus-cli java-plexus-classworlds maven-plugin-api maven-plugin-annotations maven-core-bootstrap maven-model java-commons-cli java-qdox java-jdom2 java-asm-8)) (native-inputs (list java-junit java-guava java-geronimo-xbean-reflect)) (synopsis "Inversion-of-control container for Maven") (description "The Plexus project provides a full software stack for creating and executing software projects. Based on the Plexus container, the applications can utilise component-oriented programming to build modular, reusable components that can easily be assembled and reused. This package provides the Maven plugin generating the component metadata."))) (define-public java-plexus-cipher (package (name "java-plexus-cipher") (version "2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-cipher") (commit (string-append "plexus-cipher-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "01fipdsm090n8j4207fl8kbxznkgkmkkgyazf53hm1nwn6na5aai")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-cipher.jar" #:source-dir "src/main/java" #:phases (modify-phases %standard-phases (add-before 'build 'generate-javax.inject.Named (lambda _ (mkdir-p "build/classes/META-INF/sisu") (with-output-to-file "build/classes/META-INF/sisu/javax.inject.Named" (lambda _ (display "org.sonatype.plexus.components.cipher.DefaultPlexusCipher\n"))) #t)) (replace 'install (install-from-pom "pom.xml"))))) (inputs `(("java-cdi-api" ,java-cdi-api) ("java-javax-inject" ,java-javax-inject))) (propagated-inputs `(("java-sonatype-spice-parent-pom" ,java-sonatype-spice-parent-pom-15) ("java-eclipse-sisu-inject" ,java-eclipse-sisu-inject))) (native-inputs `(("java-junit" ,java-junit))) (home-page "https://github.com/sonatype/plexus-cipher") (synopsis "Encryption/decryption Component") (description "Plexus-cipher contains a component to deal with encryption and decryption.") (license license:asl2.0))) (define-public java-plexus-cipher-1.7 (package (inherit java-plexus-cipher) (version "1.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-cipher") (commit (string-append "plexus-cipher-" version)))) (file-name (git-file-name "java-plexus-cipher" version)) (sha256 (base32 "0m638nzlxbmnbcj5cwdpgs326ab584yv0k803zlx37r6iqwvf6b0")))) (arguments `(#:jar-name "plexus-cipher.jar" #:source-dir "src/main/java" #:tests? #f; FIXME: requires sisu-inject-bean #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes") (mkdir-p "build/classes/META-INF/sisu") (with-output-to-file "build/classes/META-INF/sisu/javax.inject.Named" (lambda _ (display "org.sonatype.plexus.components.cipher.DefaultPlexusCipher\n"))) #t)) (add-before 'install 'fix-test-dependency (lambda _ ;; sisu-inject-bean is only used for tests, but its scope is "provided". ;; FIXME: Liar. (substitute* "pom.xml" (("provided") "test")) #t)) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-sonatype-spice-parent-pom-15)))) (define-public java-plexus-java (package (name "java-plexus-java") (version "0.9.10") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-languages") (commit (string-append "plexus-languages-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0vmvgq5hfxs90yyxgssfpwq78l7vwx1ljwpkk594mrdr8sm668b5")) (modules '((guix build utils))) (snippet `(begin (for-each delete-file (find-files "." ".*.jar$")) #t)))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-java.java" #:jdk ,openjdk11 #:source-dir "plexus-java/src/main/java" #:test-dir "plexus-java/src/test" #:tests? #f; require mockito 2 #:phases (modify-phases %standard-phases (add-after 'build 'generate-metadata (lambda _ (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes") "org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" "--source" "plexus-java/src/main/java" "--output" "build/classes/META-INF/plexus/components.xml" "--classes" "build/classes" "--descriptors" "build/classes/META-INF") (invoke "ant" "jar") #t)) (add-before 'install 'install-parent (install-pom-file "pom.xml")) (replace 'install (install-from-pom "plexus-java/pom.xml"))))) (propagated-inputs (list java-asm java-qdox-2 java-javax-inject plexus-parent-pom-4.0)) (inputs (list java-plexus-component-annotations-1.7)) (native-inputs (list java-plexus-component-metadata-1.7 java-junit)) (home-page "https://codehaus-plexus.github.io/plexus-languages/plexus-java") (synopsis "Shared language features for Java") (description "This package contains shared language features of the Java language, for the plexus project.") (license license:asl2.0))) (define-public java-plexus-java-1 (package (inherit java-plexus-java) (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-languages") (commit (string-append "plexus-languages-" version)))) (file-name (git-file-name "java-plexus-java" version)) (sha256 (base32 "0xlhg4bz3dzakv8indfgl1k5dl5xll9h190rlyk9v1ghdzzz1iw2")) (modules '((guix build utils))) (snippet '(for-each delete-file (find-files "." "\\.jar$"))))) (arguments (substitute-keyword-arguments (package-arguments java-plexus-java) ((#:phases phases) `(modify-phases ,phases ;; Replace the plexus metadata generation with Sisu index generation (replace 'generate-metadata (lambda _ ;; Generate Sisu index for @Named components (mkdir-p "build/classes/META-INF/sisu") (with-output-to-file "build/classes/META-INF/sisu/javax.inject.Named" (lambda _ (display "org.codehaus.plexus.languages.java.jpms.LocationManager\n"))) (invoke "ant" "jar"))))))) (propagated-inputs (list java-asm-9 java-qdox-2 java-javax-inject plexus-parent-pom-15)) (native-inputs (modify-inputs (package-native-inputs java-plexus-java) (append java-eclipse-sisu-inject))))) (define-public java-plexus-compiler-api (package (name "java-plexus-compiler-api") (version "2.8.4") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-compiler") (commit (string-append "plexus-compiler-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1nq1gnn3s6z1j29gmi1hqbklsmm8b1lmnafb0191914f95mn18gk")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-compiler-api.jar" #:source-dir "plexus-compiler-api/src/main/java" #:test-dir "plexus-compiler-api/src/test" #:phases (modify-phases %standard-phases (replace 'install (install-from-pom "plexus-compiler-api/pom.xml"))))) (propagated-inputs `(("java-plexus-container-default" ,java-plexus-container-default) ("java-plexus-compiler-pom" ,java-plexus-compiler-pom) ("java-plexus-util" ,java-plexus-utils))) (native-inputs (list java-junit)) (home-page "https://github.com/codehaus-plexus/plexus-compiler") (synopsis "Plexus Compilers component's API to manipulate compilers") (description "This package contains the API used by components to manipulate compilers.") (license (list license:asl2.0 license:expat)))) (define java-plexus-compiler-pom (package (inherit java-plexus-compiler-api) (name "java-plexus-compiler-pom") (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (delete 'build) (replace 'install (install-pom-file "pom.xml")) (add-after 'install 'install-compilers (install-pom-file "plexus-compilers/pom.xml"))))) (propagated-inputs `(("plexus-components-parent-pom-4.0" ,plexus-components-parent-pom-4.0))))) (define plexus-components-parent-pom-4.0 (package (name "plexus-components-parent-pom") (version "4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-components") (commit (string-append "plexus-components-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "041bm8yv0m2i17mqg8zljib4ykpha7ijls2qfdwvkma4d39lhysi")))) (build-system ant-build-system) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (delete 'build) (replace 'install (install-pom-file "pom.xml"))))) (propagated-inputs `(("plexus-parent-pom-4.0" ,plexus-parent-pom-4.0))) (home-page "https://codehaus-plexus.github.io/plexus-components") (synopsis "Plexus parent pom") (description "This package contains the Plexus components parent POM.") (license license:asl2.0))) (define-public java-plexus-compiler-manager (package (inherit java-plexus-compiler-api) (name "java-plexus-compiler-manager") (arguments `(#:jar-name "compiler-compiler-manager.java" #:source-dir "plexus-compiler-manager/src/main/java" #:test-dir "plexus-compiler-manager/src/test" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'generate-metadata (lambda _ (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes") "org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" "--source" "plexus-compiler-manager/src/main/java" "--output" "build/classes/META-INF/plexus/components.xml" "--classes" "build/classes" "--descriptors" "build/classes/META-INF") (invoke "ant" "jar") #t)) (add-after 'generate-metadata 'rebuild (lambda _ (invoke "ant" "jar") #t)) (replace 'install (install-from-pom "plexus-compiler-manager/pom.xml"))))) (propagated-inputs (list java-plexus-compiler-api java-plexus-compiler-pom java-plexus-container-default-1.7)) (native-inputs (list unzip java-plexus-component-metadata-1.7)) (synopsis "Compiler management for Plexus Compiler component") (description "Plexus Compiler is a Plexus component to use different compilers through a uniform API. This component chooses the compiler implementation to use in a project."))) (define-public java-plexus-compiler-javac (package (inherit java-plexus-compiler-api) (name "java-plexus-compiler-javac") (arguments `(#:jar-name "plexus-compiler-javac.jar" #:source-dir "plexus-compilers/plexus-compiler-javac/src/main/java" #:jdk ,icedtea-8 #:tests? #f; depends on compiler-test -> maven-core -> ... -> this package. #:test-dir "plexus-compilers/plexus-compiler-javac/src/test" #:modules ((guix build ant-build-system) (guix build utils) (guix build java-utils) (sxml simple)) #:phases (modify-phases %standard-phases ;; We cannot use java-plexus-component-metadata to generate the metadata ;; because it ultimately depends on this package. ;; Create it manually instead (add-before 'build 'create-metadata (lambda _ (let* ((dir "build/classes/META-INF/plexus") (file (string-append dir "/components.xml"))) (mkdir-p dir) (with-output-to-file file (lambda _ (sxml->xml `(component-set (components (component (role "org.codehaus.plexus.compiler.Compiler") (role-hint "javac") (implementation "org.codehaus.plexus.compiler.javac.JavacCompiler") (isolated-realm "false")))))))) #t)) (replace 'install (install-from-pom "plexus-compilers/plexus-compiler-javac/pom.xml"))))) (propagated-inputs (list java-plexus-compiler-api java-plexus-utils java-plexus-container-default)) (synopsis "Javac Compiler support for Plexus Compiler component") (description "This package contains the Javac Compiler support for Plexus Compiler component."))) (define plexus-components-pom-1.1.20 (package (name "plexus-components-pom-1.1.20") (version "1.1.20") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-components") (commit (string-append "plexus-components-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1q254k95m9icyfsvaw8c226midg8v6v436wvivhv7im825mnp5yb")))) (build-system ant-build-system) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (delete 'build) (replace 'install (install-pom-file "pom.xml"))))) (propagated-inputs `(("plexus-parent-pom" ,plexus-parent-pom-3.1))) (home-page "https://github.com/codehaus-plexus/plexus-components") (synopsis "Maven parent pom for plexus packages") (description "This package contains the parent pom for plexus component packages.") (license license:asl2.0))) (define-public plexus-components-pom-6.6 (package (name "plexus-components-pom") (version "6.6") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-components") (commit (string-append "plexus-components-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0vfx6kvvf96zb79y3b6xhm6kppxlmv2i8nz563bymn5jmp0b9d4w")))) (build-system ant-build-system) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'configure) (delete 'build) (replace 'install (install-pom-file "pom.xml"))))) (propagated-inputs (list plexus-parent-pom-8)) (home-page "https://github.com/codehaus-plexus/plexus-components") (synopsis "Maven parent pom for plexus packages") (description "This package contains the parent pom for plexus component packages.") (license license:asl2.0))) (define-public java-plexus-digest (package (name "java-plexus-digest") (version "1.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-digest") (commit "2a52ad1bda8297fa0e287163d2fa37245ec6a430"))) (file-name (git-file-name name version)) (sha256 (base32 "19w5wxsliz8r42niry68qa665kvjsb8081dazg9vgd3pca72w07x")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-digest.jar" #:source-dir "src/main/java" #:tests? #f #:phases (modify-phases %standard-phases (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-plexus-utils plexus-components-pom-1.1.20)) (native-inputs (list java-junit)) (home-page "https://github.com/codehaus-plexus/plexus-digest") (synopsis "Hash function utilities for Java") (description "This package is a plexus component that contains hash function utilities.") (license license:asl2.0))) (define-public java-plexus-sec-dispatcher (package (name "java-plexus-sec-dispatcher") (version "2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-sec-dispatcher") (commit (string-append "plexus-sec-dispatcher-" version)))) (sha256 (base32 "0665zcyxkv2knydxgv2dn64zvy1dx9j9af12ds9s64qmzd1rk6pk")) (file-name (git-file-name name version)))) (arguments `(#:jar-name "plexus-sec-dispatcher.jar" #:source-dir "src/main/java" #:phases (modify-phases %standard-phases (add-before 'build 'generate-models (lambda* (#:key inputs #:allow-other-keys) (define (modello-single-mode file version mode) (invoke "java" "org.codehaus.modello.ModelloCli" file mode "src/main/java" version "false" "true")) (let ((file "src/main/mdo/settings-security.mdo")) (modello-single-mode file "1.0.0" "java") (modello-single-mode file "1.0.0" "xpp3-reader") (modello-single-mode file "1.0.0" "xpp3-writer")) #t)) (add-before 'build 'generate-javax.inject.Named (lambda _ (mkdir-p "build/classes/META-INF/sisu") (with-output-to-file "build/classes/META-INF/sisu/javax.inject.Named" (lambda _ (display "org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher\n"))) #t)) (add-before 'check 'fix-paths (lambda _ (copy-recursively "src/test/resources" "target") #t)) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-plexus-utils java-plexus-cipher plexus-parent-pom-8)) (native-inputs (list java-javax-inject java-modello-core ;; for modello java-plexus-container-default java-plexus-classworlds java-plexus-utils java-guava java-geronimo-xbean-reflect ;; modello plugins java-modello-plugins-java java-modello-plugins-xml java-modello-plugins-xpp3 ;; for tests java-junit)) (build-system ant-build-system) (home-page "https://github.com/sonatype/plexus-sec-dispatcher") (synopsis "Plexus Security Dispatcher Component") (description "This package is the Plexus Security Dispatcher Component. This component decrypts a string passed to it.") (license license:asl2.0))) (define-public java-plexus-sec-dispatcher-1.4 (package (inherit java-plexus-sec-dispatcher) (version "1.4") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-sec-dispatcher") (commit (string-append "sec-dispatcher-" version)))) (sha256 (base32 "1ng4yliy4cqpjr4fxxjbpwyk1wkch5f8vblm1kvwf328s4gibszs")) (file-name (git-file-name "java-plexus-sec-dispatcher" version)))) (arguments (substitute-keyword-arguments (package-arguments java-plexus-sec-dispatcher) ((#:phases phases) `(modify-phases ,phases (delete 'generate-javax.inject.Named) (add-before 'build 'generate-components.xml (lambda _ (mkdir-p "build/classes/META-INF/plexus") (with-output-to-file "build/classes/META-INF/plexus/components.xml" (lambda _ (display "\n \n \n org.sonatype.plexus.components.sec.dispatcher.SecDispatcher\n default\n org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher\n \n \n \n org.sonatype.plexus.components.cipher.PlexusCipher\n _cipher\n \n \n org.sonatype.plexus.components.sec.dispatcher.PasswordDecryptor\n _decryptors\n \n \n \n <_configuration-file>~/.settings-security.xml\n \n \n \n \n"))))))))) (propagated-inputs (list java-plexus-utils java-plexus-cipher-1.7 java-sonatype-spice-parent-pom-12)))) (define-public java-plexus-cli (package (name "java-plexus-cli") (version "1.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/sonatype/plexus-cli") (commit "a776afa6bca84e5107bedb69440329cdb24ed645"))) (file-name (string-append name "-" version)) (sha256 (base32 "0xjrlay605rypv3zd7y24vlwf0039bil3n2cqw54r1ddpysq46vx")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-cli.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:test-dir "src/test" #:phases (modify-phases %standard-phases (add-after 'unpack 'fix-error-swallowing (lambda _ ;; AbstractCli.execute() catches exceptions and calls showFatalError() ;; or showError(), but ignores any return value and always returns 0. ;; This silently swallows errors. Fix by returning 1 after errors. ;; showFatalError returns int, so we can return its value directly. ;; showError returns void, so we call it then return 1. (substitute* "src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java" (("^([ \t]+)showFatalError\\(" all indent) (string-append indent "return showFatalError(")) (("^([ \t]+)(showError\\( .* \\);)" all indent call) (string-append indent call " return 1;")))))))) (inputs (list java-commons-cli java-plexus-container-default java-plexus-classworlds)) (native-inputs (list java-plexus-utils java-junit java-guava)) (home-page "https://codehaus-plexus.github.io/plexus-cli") (synopsis "CLI building library for plexus") (description "This package is a library to help creating CLI around Plexus components.") (license license:asl2.0))) (define-public java-plexus-build-api (package (name "java-plexus-build-api") (version "0.0.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/plexus-build-api") (commit (string-append "plexus-build-api-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1d5w6c58gkx30d51v7qwv1xrhc0ly76848gihmgshj19yf6yhca0")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-build-api.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:tests? #f; FIXME: how to run the tests? #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes") (substitute* (find-files "build/classes") (("\\$\\{project.version\\}") ,version)) #t)) (add-before 'build 'generate-plexus-compontent (lambda _ (mkdir-p "build/classes/META-INF/plexus") ;; This file is required for plexus to inject this package. ;; FIXME: how is it generated? (with-output-to-file "build/classes/META-INF/plexus/components.xml" (lambda _ (display "\n \n \n org.sonatype.plexus.build.incremental.BuildContext\n default\n org.sonatype.plexus.build.incremental.DefaultBuildContext\n Filesystem based non-incremental build context implementation\n which behaves as if all files were just created.\n \n \n \n"))) #t)) (replace 'install (install-from-pom "pom.xml"))))) (inputs (list java-plexus-utils-3.2.1 java-plexus-container-default)) (home-page "https://github.com/codehaus-plexus/plexus-build-api/") (synopsis "Base build API for maven") (description "This package contains the base build API for maven and a default implementation of it. This API is about scanning files in a project and determining what files need to be rebuilt.") (license license:asl2.0))) (define-public java-modello-core (package (name "java-modello-core") (version "1.11") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/codehaus-plexus/modello") (commit (string-append "modello-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "18885sim7z9j3wy19i9083y9kc8l9xxl2px823a96q4rnqj5z8s2")))) (build-system ant-build-system) (arguments `(#:jar-name "modello-core.jar" #:source-dir "modello-core/src/main/java" #:test-dir "modello-core/src/test" #:main-class "org.codehaus.modello.ModelloCli" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes/META-INF/plexus") (copy-file "modello-core/src/main/resources/META-INF/plexus/components.xml" "build/classes/META-INF/plexus/components.xml") #t)) (add-before 'check 'fix-tests (lambda _ (with-directory-excursion "modello-core/src/test/java/org/codehaus" (substitute* '("modello/core/DefaultModelloCoreTest.java" "modello/core/io/ModelReaderTest.java") (("src/test") "modello-core/src/test"))) #t))))) (propagated-inputs (list java-plexus-utils java-plexus-container-default java-plexus-build-api)) (native-inputs (list java-junit java-plexus-classworlds java-geronimo-xbean-reflect java-guava)) (home-page "https://codehaus-plexus.github.io/modello/") (synopsis "Framework for code generation from a simple model") (description "Modello is a framework for code generation from a simple model. Modello generates code from a simple model format: based on a plugin architecture, various types of code and descriptors can be generated from the single model, including Java POJOs, XML/JSON/YAML marshallers/unmarshallers, XSD and documentation.") (license (list license:expat ;; Although this package uses only files licensed under expat, ;; other parts of the source are licensed under different ;; licenses. We include them to be inherited by other packages. license:asl2.0 ;; Some files in modello-plugin-java are licensed under a ;; 5-clause BSD license. (license:non-copyleft (string-append "file:///modello-plugins/modello-plugin-java/" "src/main/java/org/codehaus/modello/plugin/" "java/javasource/JNaming.java")))))) (define-public java-modello-plugins-java (package (inherit java-modello-core) (name "java-modello-plugins-java") (arguments `(#:jar-name "modello-plugins-java.jar" #:source-dir "modello-plugins/modello-plugin-java/src/main/java" #:test-dir "modello-plugins/modello-plugin-java/src/test" #:jdk ,icedtea-8 #:tests? #f; requires maven-model, which depends on this package #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "modello-plugins/modello-plugin-java/src/main/resources" "build/classes") #t))))) (inputs (list java-modello-core)) (synopsis "Modello Java Plugin") (description "Modello Java Plugin generates Java objects for the model."))) (define-public java-modello-plugins-xml (package (inherit java-modello-core) (name "java-modello-plugins-xml") (arguments `(#:jar-name "modello-plugins-xml.jar" #:source-dir "modello-plugins/modello-plugin-xml/src/main/java" #:test-dir "modello-plugins/modello-plugin-xml/src/test" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "modello-plugins/modello-plugin-xml/src/main/resources" "build/classes") #t)) (add-before 'check 'fix-paths (lambda _ (with-directory-excursion "modello-plugins/modello-plugin-xml/src/test" (substitute* "java/org/codehaus/modello/plugins/xml/XmlModelloPluginTest.java" (("src/test") "modello-plugins/modello-plugin-xml/src/test"))) #t))))) (propagated-inputs (list java-modello-core java-modello-plugins-java)) (synopsis "Modello XML Plugin") (description "Modello XML Plugin contains shared code for every plugins working on XML representation of the model."))) (define-public java-modello-test (package (inherit java-modello-core) (name "java-modello-test") (arguments `(#:jar-name "modello-test.jar" #:source-dir "modello-test/src/main/java" #:tests? #f; no tests #:jdk ,icedtea-8)) (inputs (list java-plexus-utils java-plexus-compiler-api java-plexus-compiler-javac java-plexus-container-default)) (synopsis "Modello test package") (description "The modello test package contains the basis to create Modello generator unit-tests, including sample models and xml files to test every feature for every plugin."))) (define-public java-modello-plugins-xpp3 (package (inherit java-modello-core) (name "java-modello-plugins-xpp3") (arguments `(#:jar-name "modello-plugins-xpp3.jar" #:source-dir "modello-plugins/modello-plugin-xpp3/src/main/java" #:test-dir "modello-plugins/modello-plugin-xpp3/src/test" ;; One of the test dependencies is maven-model which depends on this package. #:tests? #f #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "modello-plugins/modello-plugin-xpp3/src/main/resources" "build/classes") #t))))) (propagated-inputs (list java-modello-core java-modello-plugins-java java-modello-plugins-xml)) (native-inputs (modify-inputs (package-native-inputs java-modello-core) (prepend java-xmlunit java-modello-test))) (synopsis "Modello XPP3 Plugin") (description "The modello XPP3 plugin generates XML readers and writers based on the XPP3 API (XML Pull Parser)."))) (define-public java-ow-util-ant-tasks (package (name "java-ow-util-ant-tasks") (version "1.3.2") (source (origin (method url-fetch) (uri (string-append "mirror://debian/pool/main/o/ow-util-ant-tasks/" "ow-util-ant-tasks_" version ".orig.tar.gz")) (sha256 (base32 "1y5ln1g36aligwcadqksdj18i5ghqnxn523wjbzy2zyd7w58fgy5")))) (build-system ant-build-system) (arguments `(#:jar-name "ow-util-ant-tasks.jar" #:tests? #f; no tests #:phases (modify-phases %standard-phases (add-before 'build 'delete-cyclic-dependency (lambda _ ;; This file depends on asm-3, which depends on this package (delete-file "src/org/objectweb/util/ant/DependencyAnalyzer.java") ;; This file depends on xalan (delete-file "src/org/objectweb/util/ant/Xalan2Liaison.java"))) (add-before 'build 'fix-new-ant (lambda _ (substitute* "src/org/objectweb/util/ant/MultipleCopy.java" ((", destFile.getAbsolutePath\\(\\)") ", new String[] { destFile.getAbsolutePath() }"))))))) (home-page "https://packages.debian.org/source/stretch/ow-util-ant-tasks") (synopsis "Replacement for base ant tasks") (description "This library is used in the legacy build process of several key frameworks developed by ObjectWeb, among them legacy versions of the ObjectWeb ASM bytecode manipulation framework.") (license license:lgpl2.0+))) (define-public java-asm (package (name "java-asm") (version "6.0") (source (origin (method url-fetch) (uri (string-append "https://download.forge.ow2.org/asm/" "asm-" version ".tar.gz")) (sha256 (base32 "115l5pqblirdkmzi32dxx7gbcm4jy0s14y5wircr6h8jdr9aix00")))) (build-system ant-build-system) (arguments `(#:build-target "compile" ;; The tests require an old version of Janino, which no longer compiles ;; with the JDK7. #:tests? #f #:make-flags (list ;; We don't need these extra ant tasks, but the build system asks us to ;; provide a path anyway. "-Dobjectweb.ant.tasks.path=dummy-path" ;; The java-aqute.bndlib JAR file will be put onto the classpath and ;; used during the build automatically by ant-build-system, but ;; java-asm's build.xml fails unless we provide something here. "-Dbiz.aQute.bnd.path=dummy-path") #:phases (modify-phases %standard-phases (add-before 'build 'remove-bnd-dependency (lambda _ ;; This file is the only one to require bnd, and is not needed ;; because we don't build a bundle. (delete-file "src/org/objectweb/asm/tools/ModuleInfoBndPlugin.java") #t)) (add-before 'install 'build-jars (lambda* (#:key make-flags #:allow-other-keys) ;; We cannot use the "jar" target because it depends on a couple ;; of unpackaged, complicated tools. (mkdir "dist") (invoke "jar" "-cf" (string-append "dist/asm-" ,version ".jar") "-C" "output/build/tmp" "."))) (add-before 'install 'fix-pom (lambda _ (substitute* (find-files "archive" "\\.pom$") (("@product.artifact@") ,version)) #t)) (add-before 'install 'install-parent (install-pom-file "archive/asm-parent.pom")) (replace 'install (install-from-pom "archive/asm.pom"))))) (native-inputs (list java-junit)) (propagated-inputs (list java-org-ow2-parent-pom-1.3)) (home-page "https://asm.ow2.io/") (synopsis "Very small and fast Java bytecode manipulation framework") (description "ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or dynamically generate classes, directly in binary form. The provided common transformations and analysis algorithms allow easily assembling custom complex transformations and code analysis tools.") (license license:bsd-3))) (define-public java-org-ow2-parent-pom-1.3 (package (name "java-org-ow2-parent-pom") (version "1.3") (source (origin (method url-fetch) (uri "https://repo1.maven.org/maven2/org/ow2/ow2/1.3/ow2-1.3.pom") (sha256 (base32 "1yr8hfx8gffpppa4ii6cvrsq029a6x8hzy7nsavxhs60s9kmq8ai")))) (build-system ant-build-system) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (delete 'unpack) (delete 'build) (delete 'configure) (replace 'install ,#~(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, including java-asm.") (properties '((hidden? . #t))) (license license:lgpl2.1+))) (define-public java-asm-bootstrap (package (inherit java-asm) (name "java-asm-bootstrap") (properties '((hidden? . #t))) (arguments (substitute-keyword-arguments (package-arguments java-asm) ((#:tests? _) #f))) (native-inputs `()))) (define-public java-asm-3 (package (inherit java-asm) (version "3.1") (source (origin (method git-fetch) (uri (git-reference (url "https://gitlab.ow2.org/asm/asm") (commit "ASM_3_1"))) (file-name (git-file-name "java-asm" version)) (sha256 (base32 "0xbyf2sl8j6mrvfpg2da0vjdp906rac62l66gkk82x5cn3vc30h4")) (modules '((guix build utils))) (snippet `(for-each delete-file (find-files "." "\\.jar$"))))) (arguments `(#:build-target "jar" #:test-target "test" #:tests? #f; require legacy test software #:phases (modify-phases %standard-phases (replace 'install (install-jars "output/dist")) (delete 'generate-jar-indices)))) (native-inputs (list java-ow-util-ant-tasks)))) (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 (list 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 (list java-asm-8 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 (list java-asm-8 java-asm-analysis-8 java-asm-tree-8)))) (define-public java-asm-commons-8 (package (inherit java-asm-8) (name "java-asm-commons") (arguments (list #:jar-name "asm-commons8.jar" #:source-dir "asm-commons/src/main/java" #:test-dir "asm-commons/src/test" ;; tests depend on junit5 #:tests? #f)) (inputs (list java-asm-8 java-asm-analysis-8 java-asm-tree-8)))) (define-public java-asm-9 (package (inherit java-asm) (version "9.7.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 "0q1i01al9mpggf3256iwmhx9yj9pg52v4vi1gdni2x9jcikq65lf")))) (arguments `(#:jar-name "asm.jar" #:source-dir "asm/src/main/java" #:test-dir "asm/src/test" #:jdk ,openjdk11 ;; tests depend on junit5 #:tests? #f #:phases (modify-phases %standard-phases ;; ASM 9.x uses Gradle, not Maven - generate synthetic pom.xml (add-before 'install 'generate-pom (generate-pom.xml "pom.xml" "org.ow2.asm" "asm" ,version)) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs '()) (native-inputs '()))) (define-public java-asm-tree-9 (package (inherit java-asm-9) (name "java-asm-tree") (arguments `(#:jar-name "asm-tree.jar" #:source-dir "asm-tree/src/main/java" #:test-dir "asm-tree/src/test" #:jdk ,openjdk11 ;; tests depend on junit5 #:tests? #f)) (inputs (list java-asm-9)))) (define-public java-asm-analysis-9 (package (inherit java-asm-9) (name "java-asm-analysis") (arguments `(#:jar-name "asm-analysis.jar" #:source-dir "asm-analysis/src/main/java" #:test-dir "asm-analysis/src/test" #:jdk ,openjdk11 ;; tests depend on junit5 #:tests? #f)) (inputs (list java-asm-9 java-asm-tree-9)))) (define-public java-asm-util-9 (package (inherit java-asm-9) (name "java-asm-util") (arguments `(#:jar-name "asm-util.jar" #:source-dir "asm-util/src/main/java" #:test-dir "asm-util/src/test" #:jdk ,openjdk11 ;; tests depend on junit5 #:tests? #f #:phases (modify-phases %standard-phases (add-before 'install 'generate-pom (generate-pom.xml "pom.xml" "org.ow2.asm" "asm-util" ,(package-version java-asm-9))) (replace 'install (install-from-pom "pom.xml"))))) (inputs (list java-asm-9 java-asm-analysis-9 java-asm-tree-9)))) (define-public java-asm-commons-9 (package (inherit java-asm-9) (name "java-asm-commons") (arguments (list #:jar-name "asm-commons8.jar" #:source-dir "asm-commons/src/main/java" #:test-dir "asm-commons/src/test" #:jdk openjdk11 ;; tests depend on junit5 #:tests? #f)) (inputs (list java-asm-9 java-asm-analysis-9 java-asm-tree-9)))) ;;; Java packages for GraalVM Truffle (specific versions required) (define-public java-asm-for-graal-truffle (package (inherit java-asm-9) (name "java-asm-for-graal-truffle") (version "9.7.1") (source (origin (method git-fetch) (uri (git-reference (url "https://gitlab.ow2.org/asm/asm") (commit "ASM_9_7_1"))) (file-name (git-file-name name version)) (sha256 (base32 "0q1i01al9mpggf3256iwmhx9yj9pg52v4vi1gdni2x9jcikq65lf")))) (arguments `(#:jar-name "asm9.jar" #:source-dir "asm/src/main/java" #:test-dir "asm/src/test" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'create-sources-jar (lambda _ (invoke "jar" "cf" "build/jar/asm9-sources.jar" "-C" "asm/src/main/java" "."))) (add-after 'install 'install-sources-jar (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (install-file "build/jar/asm9-sources.jar" share))))))))) (define-public java-asm-tree-for-graal-truffle (package (inherit java-asm-tree-9) (name "java-asm-tree-for-graal-truffle") (version "9.7.1") (source (package-source java-asm-for-graal-truffle)) (arguments `(#:jar-name "asm-tree.jar" #:source-dir "asm-tree/src/main/java" #:test-dir "asm-tree/src/test" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'create-sources-jar (lambda _ (invoke "jar" "cf" "build/jar/asm-tree-sources.jar" "-C" "asm-tree/src/main/java" "."))) (add-after 'install 'install-sources-jar (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (install-file "build/jar/asm-tree-sources.jar" share))))))) (inputs (list java-asm-for-graal-truffle)))) (define-public java-asm-analysis-for-graal-truffle (package (inherit java-asm-analysis-9) (name "java-asm-analysis-for-graal-truffle") (version "9.7.1") (source (package-source java-asm-for-graal-truffle)) (inputs (list java-asm-for-graal-truffle java-asm-tree-for-graal-truffle)))) (define-public java-asm-util-for-graal-truffle (package (inherit java-asm-util-9) (name "java-asm-util-for-graal-truffle") (version "9.7.1") (source (package-source java-asm-for-graal-truffle)) (arguments `(#:jar-name "asm-util8.jar" #:source-dir "asm-util/src/main/java" #:test-dir "asm-util/src/test" #:jdk ,openjdk11 #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'create-sources-jar (lambda _ (invoke "jar" "cf" "build/jar/asm-util-sources.jar" "-C" "asm-util/src/main/java" "."))) (add-after 'install 'install-sources-jar (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (install-file "build/jar/asm-util-sources.jar" share))))))) (inputs (list java-asm-for-graal-truffle java-asm-analysis-for-graal-truffle java-asm-tree-for-graal-truffle)))) (define-public java-asm-commons-for-graal-truffle (package (inherit java-asm-commons-9) (name "java-asm-commons-for-graal-truffle") (version "9.7.1") (source (package-source java-asm-for-graal-truffle)) (arguments `(#:jar-name "asm-commons8.jar" #:source-dir "asm-commons/src/main/java" #:test-dir "asm-commons/src/test" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'create-sources-jar (lambda _ (invoke "jar" "cf" "build/jar/asm-commons-sources.jar" "-C" "asm-commons/src/main/java" "."))) (add-after 'install 'install-sources-jar (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (install-file "build/jar/asm-commons-sources.jar" share))))))) (inputs (list java-asm-for-graal-truffle java-asm-analysis-for-graal-truffle java-asm-tree-for-graal-truffle)))) ;; Truffle needs hamcrest-core 1.3, which is the exact version in Guix. ;; We create a separate package to keep graal-truffle dependencies explicit. (define-public java-hamcrest-core-for-graal-truffle (package (inherit java-hamcrest-core) (name "java-hamcrest-core-for-graal-truffle"))) ;; mx expects NINJA as a zip file containing a ninja binary. ;; We create a zip from Guix's ninja package. (define-public ninja-for-graal-truffle (package (name "ninja-for-graal-truffle") (version "1.10.2") ; Version mx expects (source #f) (build-system trivial-build-system) (arguments (list #:modules '((guix build utils)) #:builder #~(begin (use-modules (guix build utils)) (let* ((ninja-bin (string-append #$(this-package-input "ninja") "/bin/ninja")) (out #$output) (share (string-append out "/share/ninja")) (zip-file (string-append share "/ninja.zip"))) (mkdir-p share) ;; Create a zip file containing the ninja binary (invoke #$(file-append (@ (gnu packages compression) zip) "/bin/zip") "-j" zip-file ninja-bin))))) (inputs (list (@ (gnu packages ninja) ninja))) (home-page "https://ninja-build.org/") (synopsis "Ninja build tool packaged for GraalVM mx") (description "Ninja build system repackaged as a zip for GraalVM's mx build tool.") (license license:asl2.0))) ;;; TODO: VisualVM need to be built from source for GraalVM Truffle. ;; ASM 9.8 - required by mx's internal tools (jacoco for code coverage) (define-public java-asm-for-graal-mx (package (inherit java-asm-9) (name "java-asm-for-graal-mx") (version "9.8") (source (origin (method git-fetch) (uri (git-reference (url "https://gitlab.ow2.org/asm/asm") (commit "ASM_9_8"))) (file-name (git-file-name name version)) (sha256 (base32 "0ky0vz83k0r0n477la0sjyvc44ffym8kf988rqzyxnb1kvwq4b92")))) (arguments `(#:jar-name "asm9.jar" #:source-dir "asm/src/main/java" #:test-dir "asm/src/test" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'create-sources-jar (lambda _ (invoke "jar" "cf" "build/jar/asm9-sources.jar" "-C" "asm/src/main/java" "."))) (add-after 'install 'install-sources-jar (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (install-file "build/jar/asm9-sources.jar" share))))))))) (define-public java-asm-tree-for-graal-mx (package (inherit java-asm-tree-9) (name "java-asm-tree-for-graal-mx") (version "9.8") (source (package-source java-asm-for-graal-mx)) (arguments `(#:jar-name "asm-tree.jar" #:source-dir "asm-tree/src/main/java" #:test-dir "asm-tree/src/test" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'create-sources-jar (lambda _ (invoke "jar" "cf" "build/jar/asm-tree-sources.jar" "-C" "asm-tree/src/main/java" "."))) (add-after 'install 'install-sources-jar (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (install-file "build/jar/asm-tree-sources.jar" share))))))) (inputs (list java-asm-for-graal-mx)))) (define-public java-asm-analysis-for-graal-mx (package (inherit java-asm-analysis-9) (name "java-asm-analysis-for-graal-mx") (version "9.8") (source (package-source java-asm-for-graal-mx)) (inputs (list java-asm-for-graal-mx java-asm-tree-for-graal-mx)))) (define-public java-asm-commons-for-graal-mx (package (inherit java-asm-commons-9) (name "java-asm-commons-for-graal-mx") (version "9.8") (source (package-source java-asm-for-graal-mx)) (arguments `(#:jar-name "asm-commons.jar" #:source-dir "asm-commons/src/main/java" #:test-dir "asm-commons/src/test" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'build 'create-sources-jar (lambda _ (invoke "jar" "cf" "build/jar/asm-commons-sources.jar" "-C" "asm-commons/src/main/java" "."))) (add-after 'install 'install-sources-jar (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (install-file "build/jar/asm-commons-sources.jar" share))))))) (inputs (list java-asm-for-graal-mx java-asm-analysis-for-graal-mx java-asm-tree-for-graal-mx)))) (define-public java-cglib (package (name "java-cglib") (version "3.3.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/cglib/cglib") (commit (string-append "RELEASE_" (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version))))) (file-name (git-file-name name version)) (sha256 (base32 "1lnscamc6bnhh7jgij5garxagp3zn2jp4cbq0rsn4xr3l0cnd014")))) (build-system ant-build-system) (arguments `(;; FIXME: tests fail because junit runs ;; "net.sf.cglib.transform.AbstractTransformTest", which does not seem ;; to describe a test at all. #:tests? #f #:jar-name "cglib.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "cglib") #t))))) (native-inputs (list java-junit)) (propagated-inputs (list java-asm-8)) (home-page "https://github.com/cglib/cglib/") (synopsis "Java byte code generation library") (description "The byte code generation library CGLIB is a high level API to generate and transform Java byte code.") (license license:asl2.0))) (define-public java-objenesis (package (name "java-objenesis") (version "3.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/easymock/objenesis") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "1brlcn536p4s1v1f3vzxhr38lvyhc33wjrbj2x06kdrd8agy90cr")))) (build-system ant-build-system) (arguments `(#:tests? #f; require junit-5 #:jar-name "objenesis.jar" #:source-dir "main/src/main/java" #:test-dir "main/src/test/")) (native-inputs (list java-junit java-hamcrest-core)) (home-page "http://objenesis.org/") (synopsis "Bypass the constructor when creating an object") (description "Objenesis is a small Java library that serves one purpose: to instantiate a new object of a particular class. It is common to see restrictions in libraries stating that classes must require a default constructor. Objenesis aims to overcome these restrictions by bypassing the constructor on object instantiation.") (license license:asl2.0))) (define-public java-easymock (package (name "java-easymock") (version "3.4") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/easymock/easymock/") (commit (string-append "easymock-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "02vybm8hc0i0n9sp2f2iiqn54zwqhq835f76wc6b2m7819z5a8dq")))) (build-system ant-build-system) (arguments `(#:jar-name "easymock.jar" #:source-dir "core/src/main" #:test-dir "core/src/test" #:phases (modify-phases %standard-phases ;; FIXME: Android support requires the following packages to be ;; available: com.google.dexmaker.stock.ProxyBuilder (add-after 'unpack 'delete-android-support (lambda _ (with-directory-excursion "core/src/main/java/org/easymock/internal" (substitute* "MocksControl.java" (("AndroidSupport.isAndroid\\(\\)") "false") (("return classProxyFactory = new AndroidClassProxyFactory\\(\\);") "")) (delete-file "AndroidClassProxyFactory.java")) #t)) (add-after 'unpack 'delete-broken-tests (lambda _ (with-directory-excursion "core/src/test/java/org/easymock" ;; This test depends on dexmaker. (delete-file "tests2/ClassExtensionHelperTest.java") ;; This is not a test. (delete-file "tests/BaseEasyMockRunnerTest.java") ;; This test should be executed with a different runner... (delete-file "tests2/EasyMockAnnotationsTest.java") ;; ...but deleting it means that we also have to delete these ;; dependent files. (delete-file "tests2/EasyMockRunnerTest.java") (delete-file "tests2/EasyMockRuleTest.java") ;; This test fails because the file "easymock.properties" does ;; not exist. (delete-file "tests2/EasyMockPropertiesTest.java")) #t))))) (inputs (list java-cglib java-objenesis)) (native-inputs (list java-junit java-hamcrest-core)) (home-page "https://easymock.org/") (synopsis "Java library providing mock objects for unit tests") (description "EasyMock is a Java library that provides an easy way to use mock objects in unit testing.") (license license:asl2.0))) (define-public java-easymock-3.2 (package (inherit java-easymock) (name "java-easymock") (version "3.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/easymock/easymock/") (commit (string-append "easymock-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0cn6qqa261mhk9mwxrsz39lkkknfv2h7iprr5zw7wpz9p96dwgv4")))) (arguments (list #:jar-name "easymock.jar" #:source-dir "easymock/src/main" #:test-dir "easymock/src/test" #:phases #~(modify-phases %standard-phases (add-after 'unpack 'delete-android-support (lambda _ (with-directory-excursion "easymock/src/main/java/org/easymock/internal" (substitute* "MocksControl.java" (("AndroidSupport.isAndroid\\(\\)") "false") (("return classProxyFactory = new AndroidClassProxyFactory\\(\\);") "")) (delete-file "AndroidClassProxyFactory.java")))) (add-after 'unpack 'delete-broken-tests (lambda _ (with-directory-excursion "easymock/src/test/java/org/easymock" ;; This test depends on dexmaker. (delete-file "tests2/ClassExtensionHelperTest.java") ;; This is not a test. (delete-file "tests/BaseEasyMockRunnerTest.java") ;; ...but deleting it means that we also have to delete these ;; dependent files. (delete-file "tests2/EasyMockRunnerTest.java") ;; This test fails because the file "easymock.properties" does ;; not exist. (delete-file "tests2/EasyMockPropertiesTest.java"))))))))) (define-public java-easymock-class-extension (package (inherit java-easymock-3.2) (name "java-easymock-class-extension") (build-system ant-build-system) (arguments (list #:jar-name "easymock-class-extensions.jar" #:source-dir "easymock-classextension/src/main/java" #:test-dir "easymock-classextension/src/test")) (inputs (list java-asm-8 java-easymock-3.2 java-cglib java-objenesis)) (native-inputs (list java-junit java-hamcrest-core)) (home-page "https://easymock.org/") (synopsis "Easymock extension to mock classes") (description "This package provides an extension to earlier versions of easymock that allows mocking classes.") (license license:asl2.0))) (define-public java-jmock-1 (package (name "java-jmock") (version "1.2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/jmock-developers/jmock-library") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "0lkga995xd9b9mmzxmcd301hlw83p1h78nibh7djlx7wydscr85z")))) (build-system ant-build-system) (arguments `(#:build-target "jars" #:test-target "run.tests" #:phases (modify-phases %standard-phases (replace 'install (install-jars "build"))))) (home-page "http://jmock.org/") (synopsis "Mock object library for test-driven development") (description "JMock is a library that supports test-driven development of Java code with mock objects. Mock objects help you design and test the interactions between the objects in your programs. The jMock library @itemize @item makes it quick and easy to define mock objects @item lets you precisely specify the interactions between your objects, reducing the brittleness of your tests @item plugs into your favourite test framework @item is easy to extend. @end itemize\n") (license license:bsd-3))) (define-public java-jmock (package (inherit java-jmock-1) (name "java-jmock") (version "2.8.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/jmock-developers/jmock-library") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "12b7l22g3nrjvf2dzcw3z03fpd2chrgp0d8xkvn8w55rwb57pax6")))) (inputs (list java-hamcrest-all java-bsh java-junit)) (native-inputs `(("cglib" ,java-cglib))) (arguments `(#:jar-name "java-jmock.jar" #:source-dir "jmock/src/main/java" #:test-dir "jmock/src/test")))) (define-public java-jmock-junit4 (package (inherit java-jmock) (name "java-jmock-junit4") (arguments `(#:jar-name "java-jmock-junit4.jar" #:source-dir "jmock-junit4/src/main/java" #:test-dir "jmock-junit4/src/test")) (inputs `(("java-hamcrest-all" ,java-hamcrest-all) ("java-bsh" ,java-bsh) ("java-jmock" ,java-jmock) ("java-jumit" ,java-junit))))) (define-public java-jmock-legacy (package (inherit java-jmock) (name "java-jmock-legacy") (arguments `(#:jar-name "java-jmock-legacy.jar" #:source-dir "jmock-legacy/src/main/java" #:test-dir "jmock-legacy/src/test" #:phases (modify-phases %standard-phases (add-before 'check 'copy-tests (lambda _ ;; This file is a dependancy of some tests (let ((file "org/jmock/test/acceptance/PackageProtectedType.java")) (copy-file (string-append "jmock/src/test/java/" file) (string-append "jmock-legacy/src/test/java/" file)) #t)))))) (inputs (list java-hamcrest-all java-objenesis java-cglib java-jmock java-bsh java-junit)) (native-inputs (list java-jmock-junit4)))) (define-public java-hamcrest-all (package (inherit java-hamcrest-core) (name "java-hamcrest-all") (arguments `(#:jdk ,icedtea-8 ,@(substitute-keyword-arguments (package-arguments java-hamcrest-core) ((#:build-target _) "bigjar") ((#:phases phases) `(modify-phases ,phases ;; Some build targets override the classpath, so we need to patch ;; the build.xml to ensure that required dependencies are on the ;; classpath. (add-after 'unpack 'patch-classpath-for-integration (lambda* (#:key inputs #:allow-other-keys) (substitute* "build.xml" ((" build/hamcrest-library-\\$\\{version\\}.jar" line) (string-join (cons line (append (find-files (assoc-ref inputs "java-junit") "\\.jar$") (find-files (assoc-ref inputs "java-jmock") "\\.jar$") (find-files (assoc-ref inputs "java-easymock") "\\.jar$"))) ";")) (("build/hamcrest-core-\\$\\{version\\}\\.jar") (car (find-files (assoc-ref inputs "java-hamcrest-core") "jar$")))) #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((target (string-append (assoc-ref outputs "out") "/share/java/")) (version-suffix ,(string-append "-" (package-version java-hamcrest-core) ".jar")) (install-without-version-suffix (lambda (jar) (copy-file jar (string-append target (basename jar version-suffix) ".jar"))))) (mkdir-p target) (for-each install-without-version-suffix (find-files "build" (lambda (name _) (and (string-suffix? ".jar" name) (not (string-suffix? "-sources.jar" name))))))) #t))))))) (inputs (modify-inputs (package-inputs java-hamcrest-core) (prepend java-junit java-jmock-1 ;; This is necessary because of what seems to be a race condition. ;; This package would sometimes fail to build because hamcrest-core.jar ;; could not be found, even though it is built as part of this package. ;; Adding java-hamcrest-core appears to fix this problem. See ;; https://debbugs.gnu.org/31390 for more information. java-hamcrest-core java-easymock))))) (define-public java-jopt-simple (package (name "java-jopt-simple") (version "5.0.3") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "net/sf/jopt-simple/jopt-simple/" version "/jopt-simple-" version "-sources.jar")) (sha256 (base32 "1v8bzmwmw6qq20gm42xyay6vrd567dra4vqwhgjnqqjz1gs9f8qa")))) (build-system ant-build-system) (arguments `(#:tests? #f ; there are no tests #:jar-name "jopt-simple.jar" #:phases (modify-phases %standard-phases (add-before 'install 'create-pom (generate-pom.xml "pom.xml" "net.sf.jopt-simple" "jopt-simple" ,version)) (replace 'install (install-from-pom "pom.xml"))))) (home-page "https://jopt-simple.github.io/jopt-simple/") (synopsis "Java library for parsing command line options") (description "JOpt Simple is a Java library for parsing command line options, such as those you might pass to an invocation of @code{javac}. In the interest of striving for simplicity, as closely as possible JOpt Simple attempts to honor the command line option syntaxes of POSIX @code{getopt} and GNU @code{getopt_long}. It also aims to make option parser configuration and retrieval of options and their arguments simple and expressive, without being overly clever.") (license license:expat))) ;; Required by jmh (define-public java-jopt-simple-4 (package (inherit java-jopt-simple) (version "4.6") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "net/sf/jopt-simple/jopt-simple/" version "/jopt-simple-" version "-sources.jar")) (sha256 (base32 "0ny82zczxkn201ld0b7rps0ifzjhfs8m1ncdmy1f50145ciszkpd")))) (arguments (substitute-keyword-arguments (package-arguments java-jopt-simple) ((#:phases phases) `(modify-phases ,phases (replace 'create-pom (generate-pom.xml "pom.xml" "net.sf.jopt-simple" "jopt-simple" ,version)))))))) (define-public java-commons-math3 (package (name "java-commons-math3") (version "3.6.1") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/math/source/" "commons-math3-" version "-src.tar.gz")) (sha256 (base32 "19l6yp44qc5g7wg816nbn5z3zq3xxzwimvbm4a8pczgvpi4i85s6")))) (build-system ant-build-system) (arguments `(#:build-target "jar" #:test-target "test" #:make-flags ,#~(let ((hamcrest #$(this-package-native-input "java-hamcrest-core")) (junit #$(this-package-native-input "java-junit"))) (list (string-append "-Djunit.jar=" (car (find-files junit "jar$"))) (string-append "-Dhamcrest.jar=" (car (find-files hamcrest ".*.jar$"))))) #:phases (modify-phases %standard-phases ;; We want to build the jar in the build phase and run the tests ;; later in a separate phase. (add-after 'unpack 'untangle-targets (lambda _ (substitute* "build.xml" (("name=\"jar\" depends=\"test\"") "name=\"jar\" depends=\"compile\"")))) ;; There is no install target. (replace 'install (install-from-pom "pom.xml"))))) (native-inputs (list java-junit java-hamcrest-core)) (home-page "https://commons.apache.org/math/") (synopsis "Apache Commons mathematics library") (description "Commons Math is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language or Commons Lang.") (license license:asl2.0))) ;; Commons Math 3.2 - required by JMH 1.21 (specified in jmh-parent-1.21.pom) (define-public java-commons-math3-for-graal-mx (package (inherit java-commons-math3) (name "java-commons-math3-for-graal-mx") (version "3.2") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/math/source/" "commons-math3-" version "-src.tar.gz")) (sha256 (base32 "041k90pfqqia2ikba1q5qdzqd6qhx07k6d0sqiryk85f6032z687")))) (arguments (substitute-keyword-arguments (package-arguments java-commons-math3) ;; FastMathTest fails on JDK 8+: checks that FastMath implements all ;; StrictMath methods, but Java 8 added addExact, floorDiv, etc. ((#:tests? _ #f) #f))) (propagated-inputs (list apache-commons-parent-pom-28)))) (define-public java-jmh (package (name "java-jmh") (version "1.32") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/openjdk/jmh") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "0i7fa7l3gdqkkgz5ddayp6m46dgbj9rqlz35xffrcbyiz3gpljy0")))) (build-system maven-build-system) (arguments `(#:jdk ,openjdk11 #:exclude (("org.apache.maven.plugins" . ("maven-source-plugin" "maven-archetype-plugin" "maven-shade-plugin" "maven-site-plugin" "maven-javadoc-plugin" "maven-eclipse-plugin" "maven-enforcer-plugin")) ("com.mycila.maven-license-plugin" . ("maven-license-plugin")) ("org.apache.maven.wagon" . ("wagon-ssh"))) #:phases (modify-phases %standard-phases (add-after 'unpack 'remove-unnecessary (lambda _ ;; requires org.apache.maven.archetype:archetype-packaging. ;; Its subprojects also require groovy, kotlin and scala, ;; respectively. (delete-file-recursively "jmh-archetypes"))) (add-after 'fix-pom-files 'fix-surefire-config (lambda _ ;; Fix surefire fork crash with NullPointerException in ;; ForkedBooter.setupBooter. Per Maven Surefire documentation at ;; : ;; "If you're having problems loading classes, try setting ;; useSystemClassLoader=false to see if that helps." (substitute* (find-files "." "pom\\.xml$") (("false") "false false"))))))) (propagated-inputs (list java-jopt-simple-4 java-commons-math3)) (native-inputs (list java-junit java-hamcrest-core junit-bom-5.10 junit-bom-5.10.2 junit-bom-5.11 junit-bom-5.11.0 junit-bom-5.12 maven-parent-pom-44 apache-parent-pom-34 apache-commons-parent-pom-39 java-sisu-inject-parent-pom-0.9 java-eclipse-sisu-inject-0.9 java-eclipse-sisu-plexus-0.9 java-plexus-utils-4)) (home-page "https://openjdk.java.net/projects/code-tools/jmh/") (synopsis "Benchmark harness for the JVM") (description "JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM.") ;; GPLv2 only (license license:gpl2))) ;; JMH 1.21 - required by mx for compiler benchmarks (define-public java-jmh-for-graal-mx (package (inherit java-jmh) (name "java-jmh-for-graal-mx") (version "1.21") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/openjdk/jmh") (commit version))) (file-name (git-file-name "jmh" version)) (sha256 (base32 "1jrbrw7qbnhkzv5m1hh5mlhcxvzyivkqbr3vwnjlswhbrpswy552")))) (propagated-inputs (list java-jopt-simple-4 java-commons-math3-for-graal-mx)))) ;; JMH annotation processor - required by mx for compiler benchmarks (define-public java-jmh-generator-annprocess-for-graal-mx (package (name "java-jmh-generator-annprocess-for-graal-mx") (version "1.21") (source (package-source java-jmh-for-graal-mx)) (build-system maven-build-system) (arguments `(#:exclude (("org.apache.maven.plugins" . ("maven-source-plugin" "maven-archetype-plugin" "maven-shade-plugin" "maven-site-plugin" "maven-javadoc-plugin" "maven-eclipse-plugin")) ("com.mycila.maven-license-plugin" . ("maven-license-plugin")) ("org.apache.maven.wagon" . ("wagon-ssh"))) #:maven-plugins (("maven-enforcer-plugin" ,maven-enforcer-plugin) ,@(default-maven-plugins)) #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "jmh-generator-annprocess"))) (add-after 'chdir 'remove-unnecessary (lambda _ (delete-file-recursively "../jmh-archetypes"))) (add-after 'remove-unnecessary 'fix-pom (lambda _ ;; Update maven plugin versions to match what Guix has ;; and remove plugins we don't have packaged (invoke "sed" "-i" "-e" "s|1.4.1|3.0.0|" "-e" "s|2.6|3.1.0|" ;; Remove maven-source-plugin block (lines 104-117) "-e" "//,/<\\/plugin>/d" ;; Remove maven-javadoc-plugin block (lines 119-135) "-e" "//,/<\\/plugin>/d" ;; Remove maven-eclipse-plugin block (lines 137-145) "-e" "/