guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/07: gnu: exa: Only build with pandoc when supported.


From: guix-commits
Subject: 07/07: gnu: exa: Only build with pandoc when supported.
Date: Wed, 28 Sep 2022 06:53:49 -0400 (EDT)

efraim pushed a commit to branch master
in repository guix.

commit 1590d6d58e4d1dcb482982a88c7eba70c41bc226
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Wed Sep 28 13:47:54 2022 +0300

    gnu: exa: Only build with pandoc when supported.
    
    * gnu/packages/rust-apps.scm (exa)[arguments]: Adjust custom
    'build-manual phase to only build when pandoc is available. Adjust
    custom 'install-extras to only install man pages when they are
    available.
    [native-inputs]: Only include pandoc on systems where it is supported.
---
 gnu/packages/rust-apps.scm | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index bced34bfdb..74581bc1e5 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -403,20 +403,26 @@ Features include:
        #:phases
        (modify-phases %standard-phases
          (add-after 'build 'build-manual
-           (lambda _
-             (map (lambda (page)
-                    (system (string-append
-                             "pandoc --standalone -f markdown -t man man/"
-                             page ".md > " page)))
-                  `("exa.1" "exa_colors.5"))))
+           (lambda* (#:key inputs #:allow-other-keys)
+             (when (assoc-ref inputs "pandoc")
+               (map (lambda (page)
+                      (with-output-to-file page
+                        (lambda _
+                          (invoke "pandoc" "--standalone"
+                                  "-f" "markdown"
+                                  "-t" "man"
+                                  (string-append "man/" page ".md")))))
+                    (list "exa.1" "exa_colors.5")))))
          (add-after 'install 'install-extras
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out   (assoc-ref outputs "out"))
                     (share (string-append out "/share"))
                     (man1  (string-append share "/man/man1"))
                     (man5  (string-append share "/man/man5")))
-               (install-file "exa.1" man1)
-               (install-file "exa_colors.5" man5)
+               (when (file-exists? "exa.1")
+                 (install-file "exa.1" man1))
+               (when (file-exists? "exa_colors.5")
+                 (install-file "exa_colors.5" man5))
                (mkdir-p (string-append out "/etc/bash_completion.d"))
                (mkdir-p (string-append share "/fish/vendor_completions.d"))
                (mkdir-p (string-append share "/zsh/site-functions"))
@@ -429,7 +435,13 @@ Features include:
                           (string-append
                             share "/zsh/site-functions/_exa"))))))))
     (inputs (list libgit2 zlib))
-    (native-inputs (list pkg-config pandoc))
+    (native-inputs
+     (append
+       (list pkg-config)
+       (if (member (%current-system)
+                   (package-transitive-supported-systems pandoc))
+         (list pandoc)
+         '())))
     (home-page "https://the.exa.website/";)
     (synopsis "Modern replacement for ls")
     (description "@code{exa} is a modern replacement for the command-line



reply via email to

[Prev in Thread] Current Thread [Next in Thread]