summary refs log tree commit diff
path: root/gnu/packages/cran.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2023-06-02 11:31:40 +0200
committerRicardo Wurmus <rekado@elephly.net>2023-06-02 11:34:17 +0200
commitbb27e3b8b13b4dbbb698b3ff5a4f6cf5793e9d5c (patch)
tree37ff0b5af43cf918a72d3b40268f7277f0246477 /gnu/packages/cran.scm
parent341b4b2a97ad9937da319eaaba94c7aad2a10c19 (diff)
downloadguix-bb27e3b8b13b4dbbb698b3ff5a4f6cf5793e9d5c.tar.gz
gnu: r-dismo: Replace bundled jars.
Fixes <https://issues.guix.gnu.org/63783>.

* gnu/packages/cran.scm (r-dismo)[source]: Delete bundled jars.
[inputs]: Add java-maxent.
[native-inputs]: Add JDK and zip.
[arguments]: Add phases 'build-jars and 'strip-jar-timestamps.
Diffstat (limited to 'gnu/packages/cran.scm')
-rw-r--r--gnu/packages/cran.scm31
1 files changed, 30 insertions, 1 deletions
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index 67276f1b05..688621343e 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -37368,11 +37368,40 @@ to archive and assign DOIs to data, software, figures, and more.")
        (uri (cran-uri "dismo" version))
        (sha256
         (base32
-         "1msc75xnc9lbnn8pivd5j4jvb1b9p3xgybfm2ak2mpb2aplz5837"))))
+         "1msc75xnc9lbnn8pivd5j4jvb1b9p3xgybfm2ak2mpb2aplz5837"))
+       (snippet
+        '(for-each delete-file
+                   (list "inst/java/dismo.jar"
+                         "inst/java/maxent.jar")))))
     (properties `((upstream-name . "dismo")))
     (build-system r-build-system)
+    (arguments
+     (list
+      #:modules '((guix build utils)
+                  (guix build r-build-system)
+                  ((guix build ant-build-system) #:prefix java:))
+      #:imported-modules
+      (cons '(guix build ant-build-system)
+            %r-build-system-modules)
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'build-jars
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((maxent (search-input-file inputs
+                                               "/share/java/maxent/maxent.jar")))
+                (install-file maxent "inst/java/")
+                (with-directory-excursion "java"
+                  (invoke "javac" "-cp" maxent "mebridge.java")
+                  (invoke "jar" "cvf" "../inst/java/dismo.jar"
+                          "mebridge.class")))))
+          (add-after 'install 'strip-jar-timestamps
+            (assoc-ref java:%standard-phases 'strip-jar-timestamps)))))
+    (inputs
+     (list java-maxent))
     (propagated-inputs
      (list r-raster r-rcpp r-sp r-terra))
+    (native-inputs
+     (list `(,icedtea-8 "jdk") zip))
     (home-page "https://rspatial.org/raster/sdm/")
     (synopsis "Species distribution modeling")
     (description