aboutsummaryrefslogtreecommitdiff
path: root/nix/libutil/serialise.hh
blob: 6a6f028aa652f984262258ed37ac8b6d680f1a54 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#pragma once

#include "types.hh"


namespace nix {


/* Abstract destination of binary data. */
struct Sink 
{
    virtual ~Sink() { }
    virtual void operator () (const unsigned char * data, size_t len) = 0;
};


/* A buffered abstract sink. */
struct BufferedSink : Sink
{
    size_t bufSize, bufPos;
    unsigned char * buffer;

    BufferedSink(size_t bufSize = 32 * 1024)
        : bufSize(bufSize), bufPos(0), buffer(0) { }
    ~BufferedSink();

    void operator () (const unsigned char * data, size_t len);
    
    void flush();
    
    virtual void write(const unsigned char * data, size_t len) = 0;
};


/* Abstract source of binary data. */
struct Source
{
    virtual ~Source() { }
    
    /* Store exactly ‘len’ bytes in the buffer pointed to by ‘data’.
       It blocks until all the requested data is available, or throws
       an error if it is not going to be available.   */
    void operator () (unsigned char * data, size_t len);

    /* Store up to ‘len’ in the buffer pointed to by ‘data’, and
       return the number of bytes stored.  If blocks until at least
       one byte is available. */
    virtual size_t read(unsigned char * data, size_t len) = 0;
};


/* A buffered abstract source. */
struct BufferedSource : Source
{
    size_t bufSize, bufPosIn, bufPosOut;
    unsigned char * buffer;

    BufferedSource(size_t bufSize = 32 * 1024)
        : bufSize(bufSize), bufPosIn(0), bufPosOut(0), buffer(0) { }
    ~BufferedSource();
    
    size_t read(unsigned char * data, size_t len);
    
    /* Underlying read call, to be overridden. */
    virtual size_t readUnbuffered(unsigned char * data, size_t len) = 0;

    bool hasData();
};


/* A sink that writes data to a file descriptor. */
struct FdSink : BufferedSink
{
    int fd;
    bool warn;
    size_t written;

    FdSink() : fd(-1), warn(false), written(0) { }
    FdSink(int fd) : fd(fd), warn(false), written(0) { }
    ~FdSink();
    
    void write(const unsigned char * data, size_t len);
};


/* A source that reads data from a file descriptor. */
struct FdSource : BufferedSource
{
    int fd;
    FdSource() : fd(-1) { }
    FdSource(int fd) : fd(fd) { }
    size_t readUnbuffered(unsigned char * data, size_t len);
};


/* A sink that writes data to a string. */
struct StringSink : Sink
{
    string s;
    void operator () (const unsigned char * data, size_t len);
};


/* A source that reads data from a string. */
struct StringSource : Source
{
    const string & s;
    size_t pos;
    StringSource(const string & _s) : s(_s), pos(0) { }
    size_t read(unsigned char * data, size_t len);    
};


void writePadding(size_t len, Sink & sink);
void writeInt(unsigned int n, Sink & sink);
void writeLongLong(unsigned long long n, Sink & sink);
void writeString(const unsigned char * buf, size_t len, Sink & sink);
void writeString(const string & s, Sink & sink);
template<class T> void writeStrings(const T & ss, Sink & sink);

void readPadding(size_t len, Source & source);
unsigned int readInt(Source & source);
unsigned long long readLongLong(Source & source);
size_t readString(unsigned char * buf, size_t max, Source & source);
string readString(Source & source);
template<class T> T readStrings(Source & source);


MakeError(SerialisationError, Error)


}
ing-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"))) (substitute* '("openjdk.src/jdk/src/solaris/native/java/net/PlainSocketImpl.c" "openjdk.src/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c") (("#include <sys/sysctl.h>") "#include <linux/sysctl.h>")) ;; 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 `(("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 icedtea-7 "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"))) `("CFLAGS=-fcommon" "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 <sys/sysctl.h>") "#include <linux/sysctl.h>")))) (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 (gexp-input icedtea-8) (gexp-input icedtea-8 "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") (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)))) '()) ,@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 libelf 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") (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 _ '()) `(,(gexp-input openjdk9) ,(gexp-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 #:modules `((guix build gnu-build-system) (guix build utils) (ice-9 match) (ice-9 popen) (srfi srfi-1) (srfi srfi-26)) #:disallowed-references (list (gexp-input openjdk10) (gexp-input openjdk10 "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") ;; 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)))) '()) ,@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)))) '()) ,@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)))) (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) ((#: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")))))))))) ;;; Convenience alias to point to the latest version of OpenJDK. (define-public openjdk openjdk21) ;; 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.10b1207.6") (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 "034c00dr5qmyxvw3xpnpbhlmz3w8pkp52zm7wypjprczd90ylfrc")) (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.2b397.7") (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 "0xwldx2k9cx0b6xdh8ic0v87cr89khwr8hxnnrpwdsia1i8gkpga")) (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.13") (source (origin (method url-fetch) (uri (string-append "mirror://apache/ant/source/apache-ant-" version "-src.tar.gz")) (sha256 (base32 "01l4g9b1xnnq450ljvhrlvcf8wzzmr45wmhkybrx0hcdi166y06s")) (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 <javac ...> 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 `(#:configure-flags (list "--enable-debuginfo" "--disable-static" ,@(if (target-64bit?) `("--enable-64bit") '())))) (synopsis "ANTLR C Library") (description "LIBANTLR3C provides run-time C libraries for ANTLR3 (ANother Tool for Language Recognition v3).") (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 `(#:tests? #f ; No tests. #:phases (modify-phases %standard-phases (delete 'configure) (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")) #t))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (share (string-append out "/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))) #t)))))) (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.4") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/javacc/javacc") (commit version))) (file-name (git-file-name "javacc" version)) (sha256 (base32 "18kkak3gda93gr25jrgy6q00g0jr8i24ri2wk4kybz1v234fxx9i")) (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.*$") "<include name=\"**/*.properties\"/> <include name=\"**/*.props\"/>")))) (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 (("<build-info.*") "") (("\\$\\{revision.number\\}") ,(number->string revision)) (("\\$\\{version.number\\}") ,base-version)) ;; Remove dependency on classycle (substitute* "../build_resources/ant/build-common.xml" (("<taskdef name=\"dependency-checker.*") "") (("classname=\"classycle.*") "") (("classpath=\"\\$\\{lib\\}/classycle.*") "")) #t)) ;; A few tests fail because of the lack of a proper /etc/groups and ;; /etc/passwd file in the build container. (add-after 'unpack 'disable-broken-tests (lambda _ (substitute* "sourceTest/java/ch/systemsx/cisd/base/AllTests.java" (("Unix.isOperational\\(\\)") "false")) #t)) ;; These decorators are almost useless and pull in an unpackaged ;; dependency. (add-after 'unpack 'remove-useless-decorators (lambda _ (substitute* "source/java/ch/systemsx/cisd/base/unix/Unix.java" (("@Private") "") (("import ch.rinn.restrictions.Private;") "")) (substitute* "sourceTest/java/ch/systemsx/cisd/base/unix/UnixTests.java" (("@Friend.*") "") (("import ch.rinn.restrictions.Friend;") "")) #t)) (add-before 'configure 'build-native-code (lambda* (#:key inputs #:allow-other-keys) (let ((jdk (assoc-ref inputs "jdk")) (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" (invoke "gcc" "-shared" "-O3" "-fPIC" "unix.c" (string-append "-I" jdk "/include") (string-append "-I" jdk "/include/linux") "-o" "libunix.so") (invoke "gcc" "-shared" "-O3" "-fPIC" "-DMACHINE_BYTE_ORDER=1" "copyCommon.c" "copyByteChar.c" "copyByteDouble.c" "copyByteFloat.c" "copyByteInt.c" "copyByteLong.c" "copyByteShort.c" (string-append "-I" jdk "/include") (string-append "-I" jdk "/include/linux") "-o" "libnativedata.so")) (install-file "source/c/libunix.so" (string-append "libs/native/unix/" dir)) (install-file "source/c/libnativedata.so" (string-append "libs/native/nativedata/" dir)) #t))) ;; In the "check" phase we only build the test executable. (add-after 'check 'run-tests (lambda _ (invoke "java" "-jar" "targets/dist/sis-base-test.jar") (delete-file "targets/dist/sis-base-test.jar") #t)) (replace 'install (install-jars "targets/dist"))))) (native-inputs `(("jdk" ,icedtea-8) ("java-commons-lang" ,java-commons-lang) ("java-commons-io" ,java-commons-io) ("java-testng" ,java-testng) ("build-resources" ,(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 "/build_resources/")) (revision revision))) (sha256 (base32 "0b6335gkm4x895rac6kfg9d3rpq0sy19ph4zpg2gyw6asfsisjhk")))))) (home-page "https://svnsis.ethz.ch") (synopsis "Utility classes for libraries from ETH Zurich") (description "This library supplies some utility classes needed for libraries from the SIS division at ETH Zurich like jHDF5.") ;; 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-cisd-args4j (let ((revision 39162) (base-version "9.11.2")) (package (name "java-cisd-args4j") (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/" "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 (("<build-info.*") "") (("\\$\\{revision.number\\}") ,(number->string revision)) (("\\$\\{version.number\\}") ,base-version) ;; Don't use custom ant tasks. (("recursive-jar") "jar") (("<project-classpath.*") "")))) (replace 'install (install-jars "targets/dist"))))) (inputs (list java-cisd-base)) (native-inputs `(("ecj" ,java-ecj) ("build-resources" ,(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 "/build_resources/")) (revision revision))) (sha256 (base32 "056cam4k8pll7ass31sy6gwn8g8719njc41yf4l02b0342nilkyf")) (modules '((guix build utils))) ;; Delete bundled pre-built jars. (snippet '(begin (delete-file-recursively "lib/") #t)))))) (home-page "https://svnsis.ethz.ch") (synopsis "Command line parser library") (description "This package provides a parser for command line arguments.") (license license:asl2.0)))) (define-public java-cisd-jhdf5 (let ((revision 39162) (base-version "14.12.6")) (package (name "java-cisd-jhdf5") (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/" "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" (("<taskdef name=\"dependency-checker.*") "") (("classname=\"classycle.*") "") (("classpath=\"\\$\\{lib\\}/classycle.*") "")) ;; Remove dependency on svn (substitute* "build/build.xml" (("<build-info.*") "") (("\\$\\{revision.number\\}") ,(number->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" ,@(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-M9 (package (inherit java-qdox) (version "2.0-M9"); required by plexus-java (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 "1s2jnmx2dkwnaha12lcj26aynywgwa8sslc47z82wx8xai13y4fg")))) (arguments (substitute-keyword-arguments (package-arguments java-qdox) ((#:phases phases) `(modify-phases ,phases (replace 'create-pom (generate-pom.xml "pom.xml" "com.thoughtworks.qdox" "qdox" ,version #:name "QDox")))))))) (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" (("<path id=\"path.build\">") (string-append "<path id=\"path.build\"><fileset dir=\"" (assoc-ref inputs "java-asm-bootstrap") "/lib/m2\" includes=\"**/*.jar\"/>")) (("<zipfileset src=\"lib/asm-4.0.jar\"/>") "") (("lib/asm-commons-4.0.jar") (car (find-files (assoc-ref inputs "java-asm-bootstrap") "asm-6.0.jar"))) (("<include name=\"org/objectweb/asm/commons/Remap\\*\\.class\"/>") (string-append "<include name=\"org/objectweb/asm/" "commons/Remap*.class\"/>" "<include name=\"org/objectweb/asm/*.class\"/>" "<include name=\"org/objectweb/asm/" "signature/*.class\"/>" "<include name=\"org/objectweb/asm/" "commons/SignatureRemapper.class\"/>"))) #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<Method>() { @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))) (define-public java-plexus-utils (package (name "java-plexus-utils") (version "3.3.0") (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 "0d0fq21rzjy0j55kcp8w9k1rbq9rwr0r7cc8239p9jbz54vihp0g")))) (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" #:source-dir "src/main" #: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-5.1)) (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-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-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-plexus-io (package (name "java-plexus-io") (version "3.2.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 "1r3wqfpbxq8vp4p914i8p88r0994rmcjw02hz14n11cfb6gsyvlr")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-io.jar" #:source-dir "src/main/java" #:test-dir "src/test" #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "src/main/resources" "build/classes") (mkdir-p "build/test-classes") (copy-recursively "src/test/resources" "build/test-classes") #t)) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-plexus-utils java-commons-io plexus-parent-pom-5.1)) (inputs (list java-jsr305)) (native-inputs `(("junit" ,java-junit) ("hamcrest" ,java-hamcrest-core) ("guava" ,java-guava) ("classworlds" ,java-plexus-classworlds) ("xbean" ,java-geronimo-xbean-reflect) ("container-default" ,java-plexus-container-default-bootstrap))) (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.2.2") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/plexus-archiver" "/archive/plexus-archiver-" version ".tar.gz")) (sha256 (base32 "144n971r3lfrx3l12nf2scm80x4xdvgbkk4bjpa4vcvvdrll6qys")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-archiver.jar" #:source-dir "src/main/java" #:test-dir "src/test" #:test-exclude (list "**/Abstract*.java" "**/Base*.java") #:phases (modify-phases %standard-phases (add-before 'check 'remove-failing (lambda _ ;; Requires an older version of plexus container (delete-file "src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java") #t)) (add-before 'check 'fix-test-building (lambda _ (substitute* "build.xml" (("srcdir=\"src/test\"") "srcdir=\"src/test/java\"")) #t)) (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "src/main/resources" "build/classes") (mkdir-p "build/test-classes") (copy-recursively "src/test/resources" "build/test-classes") #t)) (replace 'install (install-from-pom "pom.xml"))))) (propagated-inputs (list java-plexus-utils java-plexus-io java-iq80-snappy java-commons-compress plexus-parent-pom-6.1)) (inputs `(("java-jsr305" ,java-jsr305) ("java-plexus-container-default" ,java-plexus-container-default-bootstrap))) (native-inputs `(("java-hamcrest-core" ,java-hamcrest-core) ("junit" ,java-junit) ("classworld" ,java-plexus-classworlds) ("xbean" ,java-geronimo-xbean-reflect) ("xz" ,java-xz) ("guava" ,java-guava))) (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" #: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 { 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 `(("java-plexus-container-default" ,java-plexus-container-default) ("java-plexu-component-annotations" ,java-plexus-component-annotations) ("java-plexus-utils" ,java-plexus-utils) ("java-plexus-cli" ,java-plexus-cli) ("java-plexus-classworlds" ,java-plexus-classworlds) ("maven-plugin-api" ,maven-plugin-api) ("maven-plugin-annotations" ,maven-plugin-annotations) ("maven-core-bootstrap" ,maven-core-bootstrap) ("maven-model" ,maven-model) ("java-commons-cli" ,java-commons-cli) ("java-qdox" ,java-qdox) ("java-jdom2" ,java-jdom2) ("java-asm-8" ,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-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")))))) (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". (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" #: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-M9 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-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 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 "<component-set>\n <components>\n <component>\n <role>org.sonatype.plexus.components.sec.dispatcher.SecDispatcher</role>\n <role-hint>default</role-hint>\n <implementation>org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher</implementation>\n <description></description>\n <requirements>\n <requirement>\n <role>org.sonatype.plexus.components.cipher.PlexusCipher</role>\n <field-name>_cipher</field-name>\n </requirement>\n <requirement>\n <role>org.sonatype.plexus.components.sec.dispatcher.PasswordDecryptor</role>\n <field-name>_decryptors</field-name>\n </requirement>\n </requirements>\n <configuration>\n <_configuration-file>~/.settings-security.xml</_configuration-file>\n </configuration>\n </component>\n </components>\n </component-set>\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")) (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 "<component-set>\n <components>\n <component>\n <role>org.sonatype.plexus.build.incremental.BuildContext</role>\n <role-hint>default</role-hint>\n <implementation>org.sonatype.plexus.build.incremental.DefaultBuildContext</implementation>\n <description>Filesystem based non-incremental build context implementation\n which behaves as if all files were just created.</description>\n </component>\n </components>\n </component-set>\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.4") (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 "0c00m638skr5md1p6y1c2xn11kj5w6sjapyvwp9mh70rw0