diff mbox series

[bug#73839,v3,1/5] gnu: Add cl-posix-shm.

Message ID 9de791b66a21303bf55d7cadcde5945bba79827b.1730150632.git.sharlatanus@gmail.com
State New
Headers show
Series gnu: Add cl-wayflan. | expand

Commit Message

Sharlatan Hellseher Oct. 28, 2024, 9:28 p.m. UTC
From: Grigory Shepelev <shegeley@gmail.com>

* gnu/packages/lisp-xyz.scm (cl-posix-shm, ecl-posix-shm, sbcl-shm): New
variables.

Change-Id: I5ac9a3751977bf98d817acd8b98d1a2ad9d393f7
Co-authored-by: Sharlatan Hellseher <sharlatanus@gmail.com>
---
 gnu/packages/lisp-xyz.scm | 75 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index d93c67ca5d..429541e377 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -30217,6 +30217,81 @@  (define-public cl-trivial-raw-io
 (define-public ecl-trivial-raw-io
   (sbcl-package->ecl-package sbcl-trivial-raw-io))
 
+(define-public sbcl-posix-shm
+  (package
+    (name "sbcl-posix-shm")
+    (version "0.0.7")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://git.sr.ht/~shunter/posix-shm")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name "posix-shm" version))
+       (sha256
+        (base32 "1lk8sach64zgj81988q3z8i153gi3dkda3fkb11cxgsmymawddk9"))))
+    (build-system asdf-build-system/sbcl)
+    (arguments
+     (list
+      #:asd-systems ''("posix-shm" "posix-shm/ffi" "posix-shm/test")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "ffi/ffi.lisp"
+                (("libc.so.6")
+                 (search-input-file inputs "/lib/libc.so.6"))
+                (("librt.so.1")
+                 (search-input-file inputs "/lib/librt.so.1"))))))))
+    (native-inputs
+     (list sbcl-osicat
+           sbcl-parachute))
+    (inputs
+     (list sbcl-cffi
+           sbcl-alexandria
+           sbcl-trivial-features))
+    (home-page "https://git.sr.ht/~shunter/posix-shm")
+    (synopsis "Common Lisp bindings and wrapper for the POSIX shared memory API")
+    (description
+     "This library provides two strata to access the POSIX shm API:
+
+@itemize
+@item the package @code{posix-shm/ffi}, a collection of slim bindings to the
+POSIX API
+
+@item the package @code{posix-shm}, a lispy wrapper around the FFI that
+integrates more closely to the features of Common Lisp, and provides a handful
+of utilities and macros
+@end itemize
+
+Features include:
+
+@itemize
+@item open, close, create, resize, change ownership of, change permissions of,
+and memory map to shared memory objects
+@item @code{open-shm} appears more like @code{open} from the standard library
+@item @code{open-shm*}, for creating anonymous shm objects
+@item @code{with-open-shm}, @code{with-mmap} and similar @code{with-} macros
+for safely accessing resources with dynamic extent
+@end itemize")
+    (license license:bsd-3)))
+
+(define-public cl-posix-shm
+  (sbcl-package->cl-source-package sbcl-posix-shm))
+
+(define-public ecl-posix-shm
+  (let ((pkg (sbcl-package->ecl-package sbcl-posix-shm)))
+    (package
+      (inherit pkg)
+      ;; XXX: An error occurred during initialization: Attempt to redefine
+      ;; function FTRUNCATE in locked package..
+      (arguments
+       (substitute-keyword-arguments (package-arguments pkg)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (delete 'build)
+             (delete 'check))))))))
+
 (define-public sbcl-trivial-rfc-1123
   (let ((commit "9ef59c3fdec08b0e3c9ed02d39533887b6d1b8e3")
         (revision "0"))