diff mbox series

[bug#52472] gnu: Add libtree

Message ID 87iluijhtr.fsf@gmail.com
State Accepted
Headers show
Series [bug#52472] gnu: Add libtree | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Artyom V. Poptsov Jan. 17, 2022, 7:14 p.m. UTC
Hello,

> I suggest removing '#:tests?

Okay, done.

> Guix doesn't do staged installation

Unfortunately it seems to me that libtree fails when I remove
'(string-append "DESTDIR=" #$output)' from the make flags.

The reason is this code from libtree Makefile:

--8<---------------cut here---------------start------------->8---
install: all
	mkdir -p $(DESTDIR)$(BINDIR)
	cp -p libtree $(DESTDIR)$(BINDIR)
	mkdir -p $(DESTDIR)$(SHAREDIR)/man/man1
	cp -p doc/libtree.1 $(DESTDIR)$(SHAREDIR)/man/man1
--8<---------------cut here---------------end--------------->8---

As you can see it's using 'DESTDIR' as prefix for the installation.

- Artyom

Comments

M Jan. 17, 2022, 7:22 p.m. UTC | #1
Hi,

Artyom V. Poptsov schreef op ma 17-01-2022 om 22:14 [+0300]:
> [...]
> > Guix doesn't do staged installation
> 
> Unfortunately it seems to me that libtree fails when I remove
> '(string-append "DESTDIR=" #$output)' from the make flags.
> 
> The reason is this code from libtree Makefile:
> 
> --8<---------------cut here---------------start------------->8---
> install: all
> 	mkdir -p $(DESTDIR)$(BINDIR)
> 	cp -p libtree $(DESTDIR)$(BINDIR)
> 	mkdir -p $(DESTDIR)$(SHAREDIR)/man/man1
> 	cp -p doc/libtree.1 $(DESTDIR)$(SHAREDIR)/man/man1
> --8<---------------cut here---------------end--------------->8---
> 
> As you can see it's using 'DESTDIR' as prefix for the installation.

SHAREDIR is set to $(PREFIX)/share in the Makefile.

It seems to work for me, the attached package definition builds
and the store item has a man page and a binary.

Greetings,
Maxime.
Artyom V. Poptsov Jan. 28, 2022, 6:30 p.m. UTC | #2
Hello,

sorry for bugging you but are there any problems left with the package
that I should solve?  As far as I understand now the package is fine and
can be merged to Guix.  Am I mistaken?

Thanks!

- Artyom
M Jan. 28, 2022, 6:54 p.m. UTC | #3
Artyom V. Poptsov schreef op vr 28-01-2022 om 21:30 [+0300]:
> Hello,
> 
> sorry for bugging you but are there any problems left with the package
> that I should solve?  As far as I understand now the package is fine and
> can be merged to Guix.  Am I mistaken?

As I wrote in <https://issues.guix.gnu.org/52472#12>, setting DESTDIR
is unnecessary.  I haven't seen a revised patch not setting DESTDIR.
Aside from that, the patch looks reasonable.  However, I didn't look at
all the source code (for hash mismatches etc.).

Greetings,
Maxime.
diff mbox series

Patch

From 1808690c43044fdd9340c75c6d726a5f71dd8c64 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
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 | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 5f471beaaf..a68f35ebf0 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -60,6 +60,8 @@ 
 ;;; Copyright © 2021 Olivier Dion <olivier.dion@polymtl.ca>
 ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2022 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8761,3 +8763,37 @@  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 #: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