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

From: [email-masked] (Artyom V. Poptsov)
Date: Sat, 18 Dec 2021 11:02:55 +0300

I've updated libtree to v3.0.1.

- Artyom
From 4deebbcc8be0352121b7cf42e6a39949601faa0f 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 | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 055a37cb79..7503b10800 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -59,6 +59,8 @@
 ;;; Copyright © 2021 Josselin Poiret <[email-masked]>
 ;;; Copyright © 2021 Olivier Dion <[email-masked]>
 ;;; Copyright © 2021 Solene Rapenne <[email-masked]>
+;;; Copyright © 2021 Artyom V. Poptsov <[email-masked]>
+
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8754,3 +8756,41 @@ 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.1")
+    (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 "1j56j1k4rlm0wi6jvdmk7j7nf4wrmc5gyhgp6vjf180hpgwlqz92"))))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'check)
+         (delete 'configure)
+         (add-before 'build 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "Makefile"
+               (("\\$\\(DESTDIR\\)\\$\\(BINDIR\\)")
+                (format #f "~a/bin/" (assoc-ref outputs "out")))
+               (("\\$\\(DESTDIR\\)\\$\\(SHAREDIR\\)")
+                (format #f "~a/share/" (assoc-ref outputs "out"))))))
+         (replace 'build
+           (lambda _
+             (setenv "CC" "gcc")
+             (setenv "LDFLAGS" "-static")
+             (invoke "make"))))))
+    (build-system gnu-build-system)
+    (home-page "https://github.com/haampie/libtree")
+    (synopsis "@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