Subject: [bug#37566] [PATCH] gnu: Add chanl.

From: Guillaume Le Vaillant <[email-masked]>
Date: Tue, 1 Oct 2019 10:55:24 +0200

* gnu/packages/lisp.scm (sbcl-chanl, cl-chanl, ecl-chanl): New variables.
---
 gnu/packages/lisp.scm | 54 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index ba009bb7a6..fd46b967e7 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -7360,3 +7360,57 @@ compression/decompression using bindings to the lzlib C library.")
 
 (define-public ecl-lzlib
   (sbcl-package->ecl-package sbcl-lzlib))
+
+(define-public sbcl-chanl
+  (let ((commit "2362b57550c2c9238cc882d03553aaa1040b7340")
+        (revision "0"))
+    (package
+      (name "sbcl-chanl")
+      (version (git-version "0.4.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/zkat/chanl.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0ag3wz7yrqwp0s5069wwda98z3rrqd25spg8sa8rdqghj084w28w"))))
+      (build-system asdf-build-system/sbcl)
+      (native-inputs
+       `(("fiveam" ,sbcl-fiveam)))
+      (inputs
+       `(("bordeaux-threads" ,sbcl-bordeaux-threads)))
+      (synopsis "Portable channel-based concurrency for Common Lisp")
+      (description "Common Lisp library for channel-based concurrency.  In
+a nutshell, you create various threads sequentially executing tasks you need
+done, and use channel objects to communicate and synchronize the state of these
+threads.")
+      (home-page "https://github.com/zkat/chanl")
+      (license (list license:expat license:bsd-3)))))
+
+(define-public cl-chanl
+  (sbcl-package->cl-source-package sbcl-chanl))
+
+(define-public ecl-chanl
+  (let ((base (sbcl-package->ecl-package sbcl-chanl)))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ;; The CHANL.ACTORS package uses the :ARGUMENTS option of
+         ;; DEFINE-METHOD-COMBINATION, which is not implemented in ECL yet
+         ;; (see https://gitlab.com/embeddable-common-lisp/ecl/issues/305).
+         ;; So let's disable it for now, as it allows compiling the library
+         ;; and using the rest of it.
+         ((#:phases phases '%standard-phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'disable-chanl-actors
+               (lambda _
+                 (substitute* "chanl.asd"
+                   (("\\(:file \"actors\"\\)") ""))
+                 #t))))
+         ;; Disable the tests for now, as the SEND-SEQUENCE test seems to
+         ;; never end.
+         ((#:tests? _ #f) #f))))))
-- 
2.23.0