summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorjgart <jgart@dismail.de>2022-11-14 22:49:28 -0600
committerChristopher Baines <mail@cbaines.net>2022-11-19 13:57:15 +0000
commit85f4d87b8154238480dc176b77b8c54dde84e1c4 (patch)
treebdafcea7ed332bb17d5a7e72497d0ac9c270f561 /gnu/packages
parentbad8d9630b0431f34d9ad6f800d3a799a9fde413 (diff)
downloadguix-85f4d87b8154238480dc176b77b8c54dde84e1c4.tar.gz
gnu: Add smem.
* gnu/packages/admin.scm (smem): New variable.

Signed-off-by: Christopher Baines <mail@cbaines.net>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/admin.scm46
1 files changed, 46 insertions, 0 deletions
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index da9654d577..883532e255 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -54,6 +54,7 @@
 ;;; Copyright © 2022 Andreas Rammhold <andreas@rammhold.de>
 ;;; Copyright © 2022 ( <paren@disroot.org>
 ;;; Copyright © 2022 Matthew James Kraai <kraai@ftbfs.org>
+;;; Copyright © 2022 jgart <jgart@dismail.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -719,6 +720,51 @@ console.")
 and processes.")
     (license license:asl2.0)))
 
+(define-public smem
+  (package
+    (name "smem")
+    (version "1.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://selenic.com/repo/smem/archive/"
+                                  version ".tar.bz2"))
+              (file-name
+               (string-append name "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "19ibv1byxf2b68186ysrgrhy5shkc5mc69abark1h18yigp3j34m"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:tests? #f ; There is no test suite.
+           #:make-flags #~(list "smemcap")
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure)
+               (replace 'build
+                 (lambda _
+                   (let* ((system #$(cond ((target-x86?) "X86")
+                                          ((target-arm?) "ARM")
+                                          ((target-powerpc?) "POWER")
+                                          (else "CROSS_FINGERS"))))
+                     (format #t "Building for ~a~%" system)
+                     (invoke #$(cc-for-target) "-o" "smemcap" "smemcap.c"
+                             "-g" "-Wall" "-D" system))))
+               (replace 'install
+                 (lambda _
+                   (let ((bin (string-append #$output "/bin"))
+                         (man1 (string-append #$output "/share/man/man8")))
+                     (install-file "smemcap" bin)
+                     (install-file "smem" bin)
+                     (mkdir-p man1)
+                     (copy-file "smem.8" (string-append man1 "/smem.8"))))))))
+    (native-inputs (list python-minimal-wrapper))
+    (home-page "https://www.selenic.com/smem/")
+    (synopsis "Memory reporting tool")
+    (description
+     "This package provides a command line tool that can give numerous reports
+on memory usage on GNU/Linux systems.")
+    (license license:gpl2+)))
+
 (define-public htop
   (package
     (name "htop")