GNU bug report logs - #28723
Add HDF-Java. [PATCH 1/2] gnu: Add java-slf4-simple.

Previous Next

Package: guix-patches;

Reported by: Thomas Danckaert <post <at> thomasdanckaert.be>

Date: Fri, 6 Oct 2017 16:11:02 UTC

Severity: normal

Tags: patch

Done: Thomas Danckaert <post <at> thomasdanckaert.be>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28723 in the body.
You can then email your comments to 28723 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#28723; Package guix-patches. (Fri, 06 Oct 2017 16:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thomas Danckaert <post <at> thomasdanckaert.be>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 06 Oct 2017 16:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thomas Danckaert <post <at> thomasdanckaert.be>
To: guix-patches <at> gnu.org
Subject: Add HDF-Java. [PATCH 1/2] gnu: Add java-slf4-simple.
Date: Fri, 06 Oct 2017 18:01:53 +0200 (CEST)
[Message part 1 (text/plain, inline)]
Hi Guix,

this patch adds the “Simple” implementation of the SLF4J interface, 
used by HDF-Java's tests.

About this patch: the tests of slf4j-simple require some of 
slf4j-api's test code, which are therefore compiled in a somewhat 
ad-hoc fashion, but it works...

Thomas
[0001-gnu-Add-java-slf4-simple.patch (text/x-patch, inline)]
From d034b46040d51b7e82fb95df3601dc9925fa1502 Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <post <at> thomasdanckaert.be>
Date: Fri, 6 Oct 2017 12:38:34 +0200
Subject: [PATCH 1/2] gnu: Add java-slf4-simple.

* gnu/packages/java.scm (java-slf4j-simple): New variable.
---
 gnu/packages/java.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 4418b67ea..60590b117 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2016, 2017 Roel Janssen <roel <at> gnu.org>
 ;;; Copyright © 2017 Carlo Zancanaro <carlo <at> zancanaro.id.au>
 ;;; Copyright © 2017 Julien Lepiller <julien <at> lepiller.eu>
+;;; Copyright © 2017 Thomas Danckaert <post <at> thomasdanckaert.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4207,6 +4208,40 @@ allowing the end user to plug in the desired logging framework at deployment
 time.")
     (license license:expat)))
 
+(define-public java-slf4j-simple
+  (package
+    (name "java-slf4j-simple")
+    (version "1.7.25")
+    (source (package-source java-slf4j-api))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "slf4j-simple.jar"
+       #:source-dir "slf4j-simple/src/main"
+       #:test-dir "slf4j-simple/src/test"
+       #:phases
+       (modify-phases %standard-phases
+         ;; The tests need some test classes from slf4j-api
+         (add-before 'check 'build-slf4j-api-test-helpers
+           (lambda _
+             ;; Add current dir to CLASSPATH ...
+             (setenv "CLASSPATH"
+                     (string-append (getcwd) ":" (getenv "CLASSPATH")))
+             ;; ... and build test helper classes here:
+             (zero?
+              (apply system*
+                     `("javac" "-d" "."
+                       ,@(find-files "slf4j-api/src/test" ".*\\.java")))))))))
+    (inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)
+       ("java-slf4j-api" ,java-slf4j-api)))
+    (home-page "https://www.slf4j.org/")
+    (synopsis "Simple implementation of simple logging facade for Java")
+    (description "SLF4J binding for the Simple implementation, which outputs
+all events to System.err.  Only messages of level INFO and higher are
+printed.")
+    (license license:expat)))
+
 (define-public antlr2
   (package
     (name "antlr2")
-- 
2.14.1


Information forwarded to guix-patches <at> gnu.org:
bug#28723; Package guix-patches. (Fri, 06 Oct 2017 16:22:02 GMT) Full text and rfc822 format available.

Message #8 received at 28723 <at> debbugs.gnu.org (full text, mbox):

From: Thomas Danckaert <post <at> thomasdanckaert.be>
To: 28723 <at> debbugs.gnu.org
Subject: [PATCH 2/2] gnu: Add hdf-java.
Date: Fri, 06 Oct 2017 18:20:42 +0200 (CEST)
[Message part 1 (text/plain, inline)]
Hi Guix,

this patch adds hdf-java.

It's quite ugly, but it seems the autotools build for this package is 
barely working and really needs a lot of patching...  (Actually, 
using CMake is recommended, but then we would have to build the HDF4 
and HDF5 packages with CMake as well).

cheers,

Thomas
[0002-gnu-Add-hdf-java.patch (text/x-patch, inline)]
From 619b38cc889bc41e0128f038aa78e54f71fb7dab Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <thomas.danckaert <at> gmail.com>
Date: Wed, 4 Oct 2017 17:17:03 +0200
Subject: [PATCH 2/2] gnu: Add hdf-java.

* gnu/packages/maths.scm (hdf-java): New variable.
---
 gnu/packages/maths.scm | 122 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 121 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 9aa037838..4e95fea59 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -14,7 +14,7 @@
 ;;; Copyright © 2016 Kei Kebreau <kkebreau <at> posteo.net>
 ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2016 Leo Famulari <leo <at> famulari.name>
-;;; Copyright © 2016 Thomas Danckaert <post <at> thomasdanckaert.be>
+;;; Copyright © 2016, 2017 Thomas Danckaert <post <at> thomasdanckaert.be>
 ;;; Copyright © 2017 Paul Garlick <pgarlick <at> tourbillion-technology.com>
 ;;; Copyright © 2017 ng0 <contact.ng0 <at> cryptolab.net>
 ;;; Copyright © 2017 Ben Woodcroft <donttrustben <at> gmail.com>
@@ -69,6 +69,7 @@
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages less)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages logging)
@@ -742,6 +743,125 @@ extremely large and complex data collections.")
     (license (license:x11-style
               "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
 
+(define-public hdf-java
+  (package
+   (name "hdf-java")
+   (version "3.3.2")
+   (source
+    (origin
+      (method url-fetch)
+      (uri (string-append
+            "http://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
+            version "/src/CMake-hdfjava-" version ".tar.gz"))
+      (sha256
+       (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
+      (modules '((guix build utils)))
+      (snippet ; Make sure we don't use the bundled sources and binaries.
+       `(begin
+          (for-each delete-file
+                    (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
+                          "HDF4.tar.gz" "HDF5.tar.gz"))
+          (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))))))
+   (build-system gnu-build-system)
+   (native-inputs
+    `(("jdk" ,icedtea "jdk")
+      ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
+      ;; For tests:
+      ("hamcrest-core" ,java-hamcrest-core)
+      ("junit" ,java-junit)
+      ("slf4j-simple" ,java-slf4j-simple)))
+   (inputs
+    `(("hdf4" ,hdf4)
+      ("hdf5" ,hdf5)
+      ("zlib" ,zlib)
+      ("libjpeg" ,libjpeg)
+      ("slf4j-api" ,java-slf4j-api)))
+   (arguments
+    `(#:configure-flags
+      (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
+            (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
+                           (assoc-ref %build-inputs "jdk") "/lib" )
+            (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
+            (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
+
+      #:make-flags
+      (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
+            (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
+            (string-append "ZLIB=" (assoc-ref %build-inputs "zlib") "/lib/libz.so")
+            (string-append "JPEGLIB="
+                           (assoc-ref %build-inputs "libjpeg") "/lib/libjpeg.so")
+            "LLEXT=so")
+
+      #:phases
+      (modify-phases %standard-phases
+        (add-before 'configure 'chdir-to-source
+          (lambda _ (chdir ,(string-append "hdfjava-" version))))
+        (add-before 'configure 'patch-build
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (substitute* "configure"
+              (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
+              (("/bin/cat") (which "cat")))
+            ;; Set classpath for compilation
+            (substitute* '("hdf/hdf5lib/Makefile.in"
+                           "hdf/hdf5lib/exceptions/Makefile.in"
+                           "hdf/hdflib/Makefile.in")
+              (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
+               (string-append (assoc-ref inputs "slf4j-api")
+                              "/share/java/slf4j-api.jar")))
+            ;; Replace outdated config.sub and config.guess:
+            (with-directory-excursion "config"
+              (for-each (lambda (file)
+                          (copy-file
+                           (string-append (assoc-ref inputs "automake")
+                                          "/share/automake-1.15/" file) file))
+                        '("config.sub" "config.guess")))
+            (mkdir-p (string-append (assoc-ref outputs "out")))
+            ;; Set classpath for tests
+            (let* ((build-dir (getcwd))
+                   (lib (string-append build-dir "/lib"))
+                   (jhdf (string-append lib "/jhdf.jar"))
+                   (jhdf5 (string-append lib "/jhdf5.jar"))
+                   (testjars
+                    (map (lambda (i)
+                           (string-append (assoc-ref inputs i)
+                                          "/share/java/" i ".jar"))
+                         '("junit" "hamcrest-core" "slf4j-api" "slf4j-simple")))
+                   (class-path
+                    (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
+
+              (substitute* '("test/hdf5lib/Makefile.in"
+                             "test/hdf5lib/junit.sh.in"
+                             "examples/runExample.sh.in")
+                (("/usr/bin/test")
+                 (string-append (assoc-ref inputs "coreutils")
+                                "/bin/test"))
+                (("/usr/bin/uname")
+                 (string-append (assoc-ref inputs "coreutils")
+                                "/bin/uname"))
+                (("CLASSPATH=[^\n]*")
+                 (string-append "CLASSPATH=" class-path)))
+              (setenv "CLASSPATH" class-path))
+            #t))
+        (add-before 'check 'build-examples
+          (lambda _
+            (apply system* `("javac"
+                             ,@(find-files "examples" ".*\\.java")))
+            #t)))
+
+      #:parallel-build? #f
+
+      #:parallel-tests? #f ))
+   (home-page "https://support.hdfgroup.org/products/java")
+   (synopsis "Java interface for the HDF4 and HDF5 libraries")
+   (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
+the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
+implemented in C.")
+
+   ;; BSD-style license:
+   (license (license:x11-style
+             "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
+/current/src/unpacked/COPYING"))))
+
 (define-public hdf-eos2
   (package
     (name "hdf-eos2")
-- 
2.14.1


Information forwarded to guix-patches <at> gnu.org:
bug#28723; Package guix-patches. (Mon, 09 Oct 2017 19:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 28723 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Thomas Danckaert <post <at> thomasdanckaert.be>
Cc: 28723 <at> debbugs.gnu.org
Subject: Re: [bug#28723] Add HDF-Java. [PATCH 1/2] gnu: Add java-slf4-simple.
Date: Mon, 9 Oct 2017 15:25:09 -0400
[Message part 1 (text/plain, inline)]
On Fri, Oct 06, 2017 at 06:01:53PM +0200, Thomas Danckaert wrote:
> Hi Guix,
> 
> this patch adds the “Simple” implementation of the SLF4J interface, used by
> HDF-Java's tests.
> 
> About this patch: the tests of slf4j-simple require some of slf4j-api's test
> code, which are therefore compiled in a somewhat ad-hoc fashion, but it
> works...
> 
> Thomas

> From d034b46040d51b7e82fb95df3601dc9925fa1502 Mon Sep 17 00:00:00 2001
> From: Thomas Danckaert <post <at> thomasdanckaert.be>
> Date: Fri, 6 Oct 2017 12:38:34 +0200
> Subject: [PATCH 1/2] gnu: Add java-slf4-simple.
> 
> * gnu/packages/java.scm (java-slf4j-simple): New variable.

Okay, looks good to me!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#28723; Package guix-patches. (Mon, 09 Oct 2017 19:37:03 GMT) Full text and rfc822 format available.

Message #14 received at 28723 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Thomas Danckaert <post <at> thomasdanckaert.be>
Cc: 28723 <at> debbugs.gnu.org
Subject: Re: [bug#28723] [PATCH 2/2] gnu: Add hdf-java.
Date: Mon, 9 Oct 2017 15:27:02 -0400
[Message part 1 (text/plain, inline)]
On Fri, Oct 06, 2017 at 06:20:42PM +0200, Thomas Danckaert wrote:
> Hi Guix,
> 
> this patch adds hdf-java.
> 
> It's quite ugly, but it seems the autotools build for this package is barely
> working and really needs a lot of patching...  (Actually, using CMake is
> recommended, but then we would have to build the HDF4 and HDF5 packages with
> CMake as well).
> 
> cheers,
> 
> Thomas

> From 619b38cc889bc41e0128f038aa78e54f71fb7dab Mon Sep 17 00:00:00 2001
> From: Thomas Danckaert <thomas.danckaert <at> gmail.com>
> Date: Wed, 4 Oct 2017 17:17:03 +0200
> Subject: [PATCH 2/2] gnu: Add hdf-java.
> 
> * gnu/packages/maths.scm (hdf-java): New variable.

Overall, LGTM...

> +        (add-before 'check 'build-examples
> +          (lambda _
> +            (apply system* `("javac"
> +                             ,@(find-files "examples" ".*\\.java")))
> +            #t)))

Do we have to explicity return #t here? Does the javac call not return
a value that we can pass to (zero? ...)?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#28723; Package guix-patches. (Tue, 10 Oct 2017 06:49:02 GMT) Full text and rfc822 format available.

Message #17 received at 28723 <at> debbugs.gnu.org (full text, mbox):

From: Thomas Danckaert <post <at> thomasdanckaert.be>
To: leo <at> famulari.name
Cc: 28723 <at> debbugs.gnu.org
Subject: Re: [bug#28723] [PATCH 2/2] gnu: Add hdf-java.
Date: Tue, 10 Oct 2017 08:48:42 +0200 (CEST)
From: Leo Famulari <leo <at> famulari.name>
Subject: Re: [bug#28723] [PATCH 2/2] gnu: Add hdf-java.
Date: Mon, 9 Oct 2017 15:27:02 -0400

>> +        (add-before 'check 'build-examples
>> +          (lambda _
>> +            (apply system* `("javac"
>> +                             ,@(find-files "examples" ".*\\.java")))
>> +            #t)))
> 
> Do we have to explicity return #t here? Does the javac call not return
> a value that we can pass to (zero? ...)?

Yes, I'm pretty sure this can be improved.  Good catch!

Thanks for taking a look.

Thomas




Information forwarded to guix-patches <at> gnu.org:
bug#28723; Package guix-patches. (Tue, 10 Oct 2017 08:19:01 GMT) Full text and rfc822 format available.

Message #20 received at 28723 <at> debbugs.gnu.org (full text, mbox):

From: julien lepiller <julien <at> lepiller.eu>
To: 28723 <at> debbugs.gnu.org
Subject: Re: [bug#28723] Add HDF-Java. [PATCH 1/2] gnu: Add java-slf4-simple.
Date: Tue, 10 Oct 2017 10:18:44 +0200
Le 2017-10-09 21:25, Leo Famulari a écrit :
> On Fri, Oct 06, 2017 at 06:01:53PM +0200, Thomas Danckaert wrote:
>> Hi Guix,
>> 
>> this patch adds the “Simple” implementation of the SLF4J interface, 
>> used by
>> HDF-Java's tests.
>> 
>> About this patch: the tests of slf4j-simple require some of 
>> slf4j-api's test
>> code, which are therefore compiled in a somewhat ad-hoc fashion, but 
>> it
>> works...
>> 
>> Thomas
> 
>> From d034b46040d51b7e82fb95df3601dc9925fa1502 Mon Sep 17 00:00:00 2001
>> From: Thomas Danckaert <post <at> thomasdanckaert.be>
>> Date: Fri, 6 Oct 2017 12:38:34 +0200
>> Subject: [PATCH 1/2] gnu: Add java-slf4-simple.
>> 
>> * gnu/packages/java.scm (java-slf4j-simple): New variable.
> 
> Okay, looks good to me!

I don't know whether it's better, but I had to build slf4j-simple for 
maven. Here is what I have:

(define java-slf4j-api-tests
  (package
    (inherit java-slf4j-api)
    (name "java-slf4j-api-tests")
    (arguments
     `(#:jar-name "slf4j-api-tests.jar"
       #:source-dir "slf4j-api/src/test/java"
       #:tests? #f))
    (inputs
     `(("slf4j" ,java-slf4j-api)
       ,@(package-inputs java-slf4j-api)
       ,@(package-native-inputs java-slf4j-api)))
    (native-inputs '())))

(define-public java-slf4j-simple
  (package
    (inherit java-slf4j-api)
    (name "java-slf4j-simple")
    (arguments
     `(#:jar-name "slf4j-simple.jar"
       #:source-dir "slf4j-simple/src/main/java"
       #:test-dir "slf4j-simple/src/test"))
    (inputs
     `(("slf4j" ,java-slf4j-api)
       ,@(package-inputs java-slf4j-api)))
    (native-inputs
     `(("tests" ,java-slf4j-api-tests)
       ,@(package-native-inputs java-slf4j-api)))))

The idea is that maybe other packages in the slf4j archive will need 
these tests, so I built a package for them.

Otherwise your version LGTM too. Why do you need to build in the current 
directory and not in build/test-classes? If you build in 
build/test-classes, I think you don't need to set CLASSPATH in the 
build-slf4j-api-test-helpers phase.




Reply sent to Thomas Danckaert <post <at> thomasdanckaert.be>:
You have taken responsibility. (Tue, 10 Oct 2017 08:32:02 GMT) Full text and rfc822 format available.

Notification sent to Thomas Danckaert <post <at> thomasdanckaert.be>:
bug acknowledged by developer. (Tue, 10 Oct 2017 08:32:03 GMT) Full text and rfc822 format available.

Message #25 received at 28723-done <at> debbugs.gnu.org (full text, mbox):

From: Thomas Danckaert <post <at> thomasdanckaert.be>
To: 28723-done <at> debbugs.gnu.org
Date: Tue, 10 Oct 2017 10:31:43 +0200 (CEST)



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 Nov 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.