Subject: [bug#70340] [PATCH] gnu: Add restool.

From: Christopher Baines <[email-masked]>
Date: Thu, 11 Apr 2024 15:09:17 +0100

* gnu/packages/linux.scm (restool): New variable.

Change-Id: I40fae10c96460a8e7cc86419ed7bb9633aca66e6
---
 gnu/packages/linux.scm | 54 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index c66fd80d38..743b98018e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -10228,6 +10228,60 @@ (define-public renameat2
 calls the Linux-specific @code{renameat2} system call.")
       (license license:expat))))
 
+(define-public restool
+  (let ((revision "0")
+        (commit "46604e41f4c7e54efa62503c6b4629321b21e056"))
+    (package
+      (name "restool")
+      (version (git-version "2.4" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/nxp-qoriq/restool.git")
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "1vp86iprdla7fc95lfvjq8wfzwbm2mdy0dil04jvvdz6kq6yyn4j"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:tests? #f                     ; no tests
+        #:make-flags
+        #~(list (string-append "CC=" #$(cc-for-target))
+                (string-append "prefix=" #$output)
+                (string-append "bindir_completion=" #$output
+                               "/share/bash-completion/completions"))
+        #:phases
+        #~(modify-phases %standard-phases
+            (delete 'configure)
+            (add-after 'install 'wrap-scripts
+              (lambda _
+                (for-each
+                 (lambda (file)
+                   (wrap-program (string-append #$output "/bin/" file)
+                     `("PATH" prefix
+                       (,(string-append #$output "/bin")))))
+                 '("ls-append-dpl" "ls-debug" "ls-main"))))
+            #$@(if (not (or (target-x86-64?) (target-x86-32?)))
+                   #~((add-after 'unpack 'remove-manpage
+                        (lambda _
+                          (substitute* "Makefile"
+                            (("scripts/restool_completion.sh \\$\\(MANPAGE\\)")
+                             "")
+                            (("install -m 0644 -D \\$\\(MANPAGE\\) .*") "")))))
+                   #~()))))
+      (native-inputs
+       (if (or (target-x86-64?) (target-x86-32?))
+           (list pandoc)
+           '()))
+      (synopsis "Manage DPAA2 containers and objects")
+      (description "This package provides restool, a user space application to
+dynamically create and manage DPAA2 containers and objects.")
+      (supported-systems (delete "i586-gnu" %supported-systems))
+      (home-page "https://github.com/nxp-qoriq/restool")
+      (license license:bsd-3))))
+
 (define-public libgpiod
   (package
     (name "libgpiod")

base-commit: 4e7337536ba41e888a601c92fada8a4adca9d2c6
-- 
2.41.0