guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#34780] [PATCH] gnu: openmpi: Add Java support.


From: Ricardo Wurmus
Subject: [bug#34780] [PATCH] gnu: openmpi: Add Java support.
Date: Thu, 7 Mar 2019 12:14:22 +0100

* gnu/packages/mpi.scm (openmpi)[native-inputs]: Add openjdk11.
[outputs]: Add "java".
[arguments]: Add "--enable-mpi-java" to configure flags; add build phases
"set-JAVA_HOME" and "move-java".
---
 gnu/packages/mpi.scm | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index 10de6dee5b..316b2a5cd8 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -35,6 +35,7 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages fabric-management)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages pciutils)
@@ -190,8 +191,9 @@ bind processes, and much more.")
        ("slurm" ,slurm)))              ;for PMI support (launching via "srun")
     (native-inputs
      `(("pkg-config" ,pkg-config)
-       ("perl" ,perl)))
-    (outputs '("out" "debug"))
+       ("perl" ,perl)
+       ("jdk" ,openjdk11 "jdk")))
+    (outputs '("out" "debug" "java"))
     (arguments
      `(#:configure-flags `("--enable-mpi-ext=affinity" ;cr doesn't work
                            "--enable-memchecker"
@@ -200,6 +202,8 @@ bind processes, and much more.")
                            "--with-hwloc=external"
                            "--with-libevent"
 
+                           "--enable-mpi-java"
+
                            ;; InfiniBand support
                            "--enable-openib-control-hdr-padding"
                            "--enable-openib-dynamic-sl"
@@ -224,6 +228,14 @@ bind processes, and much more.")
                                              "/include/infiniband/:"
                                              (getenv "CPLUS_INCLUDE_PATH")))
                       #t))
+                  ;; We could provide the location of the JDK in the configure
+                  ;; flags, but since the configure flags are embedded in the
+                  ;; info binaries that would leave a reference to the JDK in
+                  ;; the "out" output.  To avoid this we set JAVA_HOME.
+                  (add-after 'unpack 'set-JAVA_HOME
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
+                      #t))
                   (add-before 'build 'remove-absolute
                     (lambda _
                       ;; Remove compiler absolute file names (OPAL_FC_ABSOLUTE
@@ -252,6 +264,26 @@ bind processes, and much more.")
                     (lambda* (#:key outputs #:allow-other-keys)
                       (let ((out (assoc-ref outputs "out")))
                         (for-each delete-file (find-files out "config.log"))
+                        #t)))
+                  (add-after 'install 'move-java
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out  (assoc-ref outputs "out"))
+                            (java (assoc-ref outputs "java")))
+                        (for-each (lambda (item)
+                                    (let ((source (string-append out item))
+                                          (target (string-append java item)))
+                                      (mkdir-p (dirname target))
+                                      (rename-file source target)))
+                                  '("/share/man/man1/mpijavac.1"
+                                    "/share/doc/openmpi/javadoc-openmpi"
+                                    "/lib/mpi.jar"
+                                    "/lib/libmpi_java.la"
+                                    "/lib/libmpi_java.so.40.20.0"
+                                    "/lib/libmpi_java.so.40"
+                                    "/lib/libmpi_java.so"
+                                    "/bin/mpijavac.pl"
+                                    "/bin/mpijavac"
+                                    "/include/openmpi/ompi/mpi/java"))
                         #t))))))
     (home-page "http://www.open-mpi.org";)
     (synopsis "MPI-3 implementation")
-- 
2.20.1








reply via email to

[Prev in Thread] Current Thread [Next in Thread]