Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / java-maths.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages java-maths)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module (guix utils)
25 #:use-module (guix build-system ant)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages gcc)
29 #:use-module (gnu packages java)
30 #:use-module (gnu packages maths)
31 #:use-module (gnu packages ruby))
32
33 (define-public java-jblas
34 (package
35 (name "java-jblas")
36 (version "1.2.4")
37 (source (origin
38 (method git-fetch)
39 (uri (git-reference
40 (url "https://github.com/mikiobraun/jblas.git")
41 (commit (string-append "jblas-" version))))
42 (sha256
43 (base32
44 "0afh48hq8i8li5z11x415c8slwsfrlib0w1xjfbg186mximqvv3g"))))
45 (build-system gnu-build-system)
46 (arguments
47 `(#:tests? #f ; there are none
48 #:configure-flags
49 (list (string-append "--libpath="
50 (assoc-ref %build-inputs "openblas")
51 "/lib")
52 "--build-type=openblas")
53 #:phases
54 (modify-phases %standard-phases
55 (add-after 'unpack 'make-writable
56 (lambda _
57 (map make-file-writable
58 (find-files "." ".*"))
59 #t))
60 (add-before 'build 'setenv-JAVA_HOME
61 (lambda* (#:key inputs #:allow-other-keys)
62 (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
63 #t))
64 (add-after 'build 'build-jar
65 (lambda* (#:key inputs outputs #:allow-other-keys)
66 (setenv "M2_HOME" (assoc-ref outputs "out"))
67 (invoke "ant" "jar" (string-append "-Dversion=" ,version))))
68 (replace 'install
69 (lambda* (#:key outputs #:allow-other-keys)
70 (let ((target (string-append (assoc-ref outputs "out")
71 "/share/java")))
72 (mkdir-p target)
73 (install-file (string-append "jblas-" ,version ".jar") target))
74 #t)))))
75 (inputs
76 `(("openblas" ,openblas)))
77 (native-inputs
78 `(("ant" ,ant)
79 ("ruby" ,ruby) ; for configure script
80 ("gfortran" ,gfortran)
81 ("jdk" ,icedtea "jdk")))
82 (home-page "http://jblas.org")
83 (synopsis "Linear algebra for Java")
84 (description
85 "jblas is a fast linear algebra library for Java. jblas is based on BLAS
86 and LAPACK, the de-facto industry standard for matrix computations, and uses
87 state-of-the-art implementations for all its computational routines, making
88 jBLAS very fast.")
89 (license license:bsd-3)))