Subject: [bug#52472] [PATCH] gnu: Add libtree

From: "Artyom V. Poptsov" <[email-masked]>
Date: Mon, 17 Jan 2022 21:09:38 +0300

Hello,

meanwhile the libtree author fixed the tests in 3.0.2:
  https://github.com/haampie/libtree/issues/65

So I've updated the patch to add libtree 3.0.2.

Thanks,

- Artyom
From 6a21b02af62ce27cedd1f3f02d47362b434616f7 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <[email-masked]>
Date: Mon, 13 Dec 2021 23:34:29 +0300
Subject: [PATCH] gnu: Add libtree

* gnu/packages/linux.scm (libtree): New variable.
---
 gnu/packages/linux.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 5f471beaaf..0a1e0d829b 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -60,6 +60,8 @@
 ;;; Copyright © 2021 Olivier Dion <[email-masked]>
 ;;; Copyright © 2021 Solene Rapenne <[email-masked]>
 ;;; Copyright © 2021 Petr Hodina <[email-masked]>
+;;; Copyright © 2022 Artyom V. Poptsov <[email-masked]>
+
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8761,3 +8763,38 @@ older system-wide @file{/sys} interface.")
     (license (list license:lgpl2.1+   ;; libgpiod
                    license:gpl2+      ;; gpio-tools
                    license:lgpl3+)))) ;; C++ bindings
+
+(define-public libtree
+  (package
+    (name "libtree")
+    (version "3.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/haampie/libtree")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "072624anz9g01mp5vfkahfmzy0nb7axg5rwk3n1yrdm4hr3d4zrb"))))
+    (arguments
+     (list #:tests? #t
+           #:make-flags
+           ;; NOTE: Official documentation recommends to build libtree with
+           ;; "-static" flag.
+           #~(list (string-append "CC=" #$(cc-for-target))
+                   "PREFIX=/"
+                   (string-append "DESTDIR=" #$output))
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure)
+               (replace 'build
+                 (lambda* (#:key make-flags #:allow-other-keys)
+                   (apply invoke "make" make-flags))))))
+    (build-system gnu-build-system)
+    (home-page "https://github.com/haampie/libtree")
+    (synopsis "Show output of @command{ldd} as a tree")
+    (description
+     "This tool turns @command{ldd} into a tree and explains how shared
+libraries are found or why they cannot be located.")
+    (license license:expat)))
-- 
2.25.1

-- 
Artyom "avp" Poptsov <[email-masked]>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F