Subject: [PATCH 02/12] gnu: Add memento.

From: David Elsing <[email-masked]>
Date: Wed, 26 Jun 2024 19:26:55 +0000

* gnu/packages/c.scm (memento): New variable.
---
 gnu/packages/c.scm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index d13b62b5e2..27be60aa98 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -1678,3 +1678,44 @@ (define-public pcg-c
 Linear Congruential Generator (LCG) with a permutation function to increase
 output randomness while retaining speed, simplicity, and conciseness.")
       (license (list license:expat license:asl2.0))))) ; dual licensed
+
+(define-public memento
+  (let ((commit "46f8beaad330b9b9e1dc1678cf41f78c1b902d11")
+        (revision "0"))
+    (package
+      (name "memento")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/ArtifexSoftware/memento")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1gmvbybm9s07g3n7k0zswv88s4bkk7yd66ydaljqwvf6w7d9dzg4"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            ;; There are no build system files
+            (delete 'configure)
+            (replace 'build
+              (lambda _
+                (invoke #$(cc-for-target) "memento.c" "-O2" "-g" "-shared"
+                        "-o" "libmemento.so")))
+            (replace 'install
+              (lambda _
+                (install-file "libmemento.so" (string-append #$output "/lib"))
+                (install-file "memento.h" (string-append #$output "/include"))
+                (install-file "docs/README.md"
+                              (string-append #$output "/share/doc/"
+                                             #$name "-" #$version)))))
+        #:tests? #f))
+      (home-page "https://github.com/ArtifexSoftware/memento")
+      (synopsis "Memory debugging library for C and C++ programs")
+      (description "Memento is a debugging library, which intercepts calls to
+malloc, free, realloc etc. to detect memory leaks and errors.")
+      (license license:isc))))
-- 
2.45.1