From 2f0d041816b9bfe06b6b59815e497b9eac987fd3 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 23 Feb 2018 10:10:12 +0100 Subject: [PATCH] gnu: Add java-cisd-jhdf5. * gnu/packages/java.scm (java-cisd-jhdf5): New variable. --- gnu/packages/java.scm | 176 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 7ad0c41268..298874f757 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -59,6 +59,7 @@ (define-module (gnu packages java) #:use-module (gnu packages image) #:use-module (gnu packages libffi) #:use-module (gnu packages linux) ;alsa + #:use-module (gnu packages maths) #:use-module (gnu packages web) #:use-module (gnu packages wget) #:use-module (gnu packages pkg-config) @@ -2347,6 +2348,181 @@ (define-public java-cisd-args4j (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") + #t)))) + (build-system ant-build-system) + (arguments + `(#:make-flags '("-file" "build/build.xml") + #:build-target "jar-all" + #:test-target "jar-test" + #:jdk ,icedtea-8 + #:phases + (modify-phases %standard-phases + ;; 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=\"")) + #t)) + (add-after 'unpack 'unpack-build-resources + (lambda* (#:key inputs #:allow-other-keys) + (copy-recursively (assoc-ref inputs "build-resources") + "../build_resources") + (delete-file-recursively "../build_resources/lib/") + (mkdir-p "../build_resources/lib") + ;; Remove dependency on classycle + (substitute* "../build_resources/ant/build-common.xml" + (("string revision)) + (("\\$\\{version.number\\}") ,base-version)) + #t)) + (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") + (string-append (assoc-ref inputs "java-testng") + "/share/java/java-testng.jar"))) + (substitute* "build/build.xml" + (("\\$\\{lib\\}/sis-base/sis-base.jar") + (string-append (assoc-ref inputs "java-cisd-base") + "/share/java/sis-base.jar")) + (("\\$\\{lib\\}/cisd-args4j/cisd-args4j.jar") + (string-append (assoc-ref inputs "java-cisd-args4j") + "/share/java/cisd-args4j.jar")) + (("\\$\\{lib\\}/commons-lang/commons-lang.jar") + (string-append (assoc-ref inputs "java-commons-lang") + "/share/java/commons-lang-" + ,(package-version java-commons-lang) ".jar")) + (("\\$\\{lib\\}/commons-io/commons-io.jar") + (string-append (assoc-ref inputs "java-commons-io") + "/share/java/commons-io-" + ,(package-version java-commons-io) + "-SNAPSHOT.jar")) + (("\\$\\{lib\\}/testng/testng-jdk15.jar") + (string-append (assoc-ref inputs "java-testng") + "/share/java/java-testng.jar")) + (("\\$\\{lib\\}/junit4/junit.jar") + (string-append (assoc-ref inputs "java-junit") + "/share/java/junit.jar")) + (("\\$\\{lib\\}/jmock/hamcrest/hamcrest-core.jar") + (string-append (assoc-ref inputs "java-hamcrest-core") + "/share/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 \\}\\)") + ""))) + #t)) + (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)) + #t))) + ;; 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") + #t)) + (replace 'install + (install-jars "targets/dist"))))) + (inputs + `(("java-cisd-base" ,java-cisd-base) + ("java-cisd-args4j" ,java-cisd-args4j) + ("java-commons-lang" ,java-commons-lang) + ("java-commons-io" ,java-commons-io) + ("hdf5" ,hdf5) + ("zlib" ,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")