Subject: [PATCH v2 09/12] gnu: Add cl-magicl

From: Michal Atlas <[email-masked]>
Date: Fri, 24 Nov 2023 17:07:14 +0000

* gnu/packages/quantum.scm: New file.
* gnu/packages/quantum.scm: (sbcl-magicl, cl-magicl): New variables..

This package requires commencement, which already depends on
lisp-xyz in a way that breaks if they're mutually used,
this library is mainly the dependency of QVM (Quil Quantum Virtual Machine),
so I moved it into this separate file.

Change-Id: I4f1d5e6afe3a764c90953d2ee9b21bf3a1f90b26
---
 gnu/packages/quantum.scm | 54 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 gnu/packages/quantum.scm

diff --git a/gnu/packages/quantum.scm b/gnu/packages/quantum.scm
new file mode 100644
index 0000000000..3663e386ea
--- /dev/null
+++ b/gnu/packages/quantum.scm
@@ -0,0 +1,54 @@
+(define-module (gnu packages quantum)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages commencement)
+  #:use-module (gnu packages lisp-check)
+  #:use-module (gnu packages lisp-xyz)
+  #:use-module (gnu packages maths)
+  #:use-module (guix build-system asdf)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module (guix packages))
+
+(define-public sbcl-magicl
+  (package
+    (name "sbcl-magicl")
+    (version "0.9.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/quil-lang/magicl")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0x9p55qin399jhr5md88nij8fv78b64xjhww7ys364pkjnx8ak9v"))))
+    (build-system asdf-build-system/sbcl)
+    (inputs (list sbcl-alexandria
+                  sbcl-abstract-classes
+                  sbcl-policy-cond
+                  sbcl-interface
+                  sbcl-static-vectors
+                  sbcl-trivial-garbage
+                  lapack
+                  gfortran-toolchain
+                  sbcl-fiasco))
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'fix-paths
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (let ((lapack (assoc-ref inputs "lapack")))
+                         (substitute* "src/extensions/blas/load-libs.lisp"
+                           (("libblas.so")
+                            (string-append lapack "/lib/libblas.so")))
+                         (substitute* "src/extensions/lapack/load-libs.lisp"
+                           (("liblapack.so")
+                            (string-append lapack "/lib/liblapack.so")))))))))
+    (synopsis "Matrix Algebra proGrams In Common Lisp")
+    (description "Matrix Algebra proGrams In Common Lisp by Rigetti Computing.
+(née FLAIL: Finally, Linear Algebra In Lisp!)")
+    (home-page "https://github.com/quil-lang/magicl")
+    (license license:asl2.0)))
+
+(define-public cl-magicl
+  (sbcl-package->cl-source-package sbcl-magicl))
-- 
2.41.0