diff mbox series

[bug#52472] gnu: Add libtree

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

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Artyom V. Poptsov Dec. 18, 2021, 8:02 a.m. UTC
I've updated libtree to v3.0.1.

- Artyom

Comments

Mathieu Othacehe Dec. 19, 2021, 9:48 a.m. UTC | #1
Hey Artyom,

>  ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
> +;;; Copyright © 2021 Artyom V. Poptsov <poptsov.artyom@gmail.com>
> +

No need for an extra new-line here.

> +           (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"))))))

You can now write:

--8<---------------cut here---------------start------------->8---
       ,#~(modify-phases %standard-phases
            (delete 'check)
            (delete 'configure)
            (add-before 'build 'patch
              (lambda* (#:key outputs #:allow-other-keys)
                (substitute* "Makefile"
                  (("\\$\\(DESTDIR\\)\\$\\(BINDIR\\)")
                   (string-append #$output "/bin/"))
                  (("\\$\\(DESTDIR\\)\\$\\(SHAREDIR\\)")
                   (string-append #$output "/share/")))))
--8<---------------cut here---------------end--------------->8---

> +         (replace 'build
> +           (lambda _
> +             (setenv "CC" "gcc")

That would break cross-compilation. You should use something like:

--8<---------------cut here---------------start------------->8---
(string-append "CC=" ,(cc-for-target)).
--8<---------------cut here---------------end--------------->8---

> +             (setenv "LDFLAGS" "-static")

Why are we building a static version of the program?

There's also this linter warning:

gnu/packages/linux.scm:8649:14: libtree@3.0.1: synopsis should start with an upper-case letter or digit

Thanks,

Mathieu
Julien Lepiller Dec. 19, 2021, 12:50 p.m. UTC | #2
Sorry if this is overwhelming, but also:

Le 19 décembre 2021 04:48:28 GMT-05:00, Mathieu Othacehe <othacehe@gnu.org> a écrit :
>
>Hey Artyom,
>
>>  ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
>> +;;; Copyright © 2021 Artyom V. Poptsov <poptsov.artyom@gmail.com>
>> +
>
>No need for an extra new-line here.
>
>> +           (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"))))))
>
>You can now write:
>
>--8<---------------cut here---------------start------------->8---
>       ,#~(modify-phases %standard-phases
>            (delete 'check)
>            (delete 'configure)
>            (add-before 'build 'patch
>              (lambda* (#:key outputs #:allow-other-keys)
>                (substitute* "Makefile"
>                  (("\\$\\(DESTDIR\\)\\$\\(BINDIR\\)")
>                   (string-append #$output "/bin/"))
>                  (("\\$\\(DESTDIR\\)\\$\\(SHAREDIR\\)")
>                   (string-append #$output "/share/")))))
>--8<---------------cut here---------------end--------------->8---
>

Don't remove the check phase. Use #:tests? #f instead and add a comment explaining why. If the tests fail, we should fix them, not put them under the rug ;)

Maybe it would be easier to pass BINDIR, SHAREDIR and CC with #:make-flags?

>> +         (replace 'build
>> +           (lambda _
>> +             (setenv "CC" "gcc")
>
>That would break cross-compilation. You should use something like:
>
>--8<---------------cut here---------------start------------->8---
>(string-append "CC=" ,(cc-for-target)).
>--8<---------------cut here---------------end--------------->8---
>
>> +             (setenv "LDFLAGS" "-static")
>
>Why are we building a static version of the program?
>
>There's also this linter warning:
>
>gnu/packages/linux.scm:8649:14: libtree@3.0.1: synopsis should start with an upper-case letter or digit
>
>Thanks,
>
>Mathieu
>

Could you send a new patch with these changes? Don't hesitate to ask if you're a bit lost or need help on some points :)
diff mbox series

Patch

From 4deebbcc8be0352121b7cf42e6a39949601faa0f 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 | 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 <josselin.poiret@protonmail.ch>
 ;;; Copyright © 2021 Olivier Dion <olivier.dion@polymtl.ca>
 ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
+;;; Copyright © 2021 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+
 ;;;
 ;;; 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