java-maths.scm 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. (define-module (gnu packages java-maths)
  19. #:use-module ((guix licenses) #:prefix license:)
  20. #:use-module (guix packages)
  21. #:use-module (guix download)
  22. #:use-module (guix git-download)
  23. #:use-module (guix utils)
  24. #:use-module (guix build-system ant)
  25. #:use-module (guix build-system gnu)
  26. #:use-module (gnu packages)
  27. #:use-module (gnu packages gcc)
  28. #:use-module (gnu packages java)
  29. #:use-module (gnu packages maths)
  30. #:use-module (gnu packages ruby))
  31. (define-public java-jblas
  32. (package
  33. (name "java-jblas")
  34. (version "1.2.4")
  35. (source (origin
  36. (method git-fetch)
  37. (uri (git-reference
  38. (url "https://github.com/mikiobraun/jblas")
  39. (commit (string-append "jblas-" version))))
  40. (file-name (git-file-name name version))
  41. (sha256
  42. (base32
  43. "0afh48hq8i8li5z11x415c8slwsfrlib0w1xjfbg186mximqvv3g"))))
  44. (build-system gnu-build-system)
  45. (arguments
  46. `(#:tests? #f ; there are none
  47. #:configure-flags
  48. (list (string-append "--libpath="
  49. (assoc-ref %build-inputs "openblas")
  50. "/lib")
  51. "--build-type=openblas")
  52. #:phases
  53. (modify-phases %standard-phases
  54. (add-after 'unpack 'make-writable
  55. (lambda _
  56. (map make-file-writable
  57. (find-files "." ".*"))
  58. #t))
  59. (add-before 'build 'setenv-JAVA_HOME
  60. (lambda* (#:key inputs #:allow-other-keys)
  61. (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
  62. #t))
  63. (add-after 'build 'build-jar
  64. (lambda* (#:key inputs outputs #:allow-other-keys)
  65. (setenv "M2_HOME" (assoc-ref outputs "out"))
  66. (invoke "ant" "jar" (string-append "-Dversion=" ,version))))
  67. (replace 'install
  68. (lambda* (#:key outputs #:allow-other-keys)
  69. (let ((target (string-append (assoc-ref outputs "out")
  70. "/share/java")))
  71. (mkdir-p target)
  72. (install-file (string-append "jblas-" ,version ".jar") target))
  73. #t)))))
  74. (inputs
  75. (list openblas))
  76. (native-inputs
  77. `(("ant" ,ant)
  78. ("ruby" ,ruby) ; for configure script
  79. ("gfortran" ,gfortran)
  80. ("jdk" ,icedtea "jdk")))
  81. (home-page "http://jblas.org")
  82. (synopsis "Linear algebra for Java")
  83. (description
  84. "jblas is a fast linear algebra library for Java. jblas is based on BLAS
  85. and LAPACK, the de-facto industry standard for matrix computations, and uses
  86. state-of-the-art implementations for all its computational routines, making
  87. jBLAS very fast.")
  88. (license license:bsd-3)))