Subject: Re: bug#54153: gnu: mblaze: Offer contrib executables.

From: [email-masked], [email-masked]
Date: Thu, 17 Mar 2022 11:31:13 +0900

Ludovic Courtès <[email-masked]> wrote:
> Looks like the patch isn’t actually there.  ↑
> 
> Could you send it?

Oops! Here you go.

>From e389b54cb0347bef0d31185472df7206f2b91aa3 Mon Sep 17 00:00:00 2001
From: "B. Wilson" <[email-masked]>
Date: Fri, 25 Feb 2022 15:31:05 +0900
Subject: [PATCH] gnu: mblaze: Offer contrib executables.
To: [email-masked]

* gnu/packages/mail.scm(mblaze): New contrib output.
---
 gnu/packages/mail.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index b0b9ae9f76..7c7aa07428 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2722,6 +2722,7 @@ (define-public mblaze
        (file-name (git-file-name name version))
        (sha256
         (base32 "0fa8s9dp5ilwmfcwkx72x2b5i0maa5sl97hv2cdknqmc27gv0b1c"))))
+    (outputs '("out" "contrib"))
     (build-system gnu-build-system)
     (native-inputs
      (list perl))
@@ -2730,9 +2731,26 @@ (define-public mblaze
        #:make-flags (list (string-append "CC=" ,(cc-for-target))
                           "PREFIX="
                           (string-append "DESTDIR=" %output))
+       #:modules ((ice-9 ftw)
+                  (guix build utils)
+                  (guix build gnu-build-system))
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (delete 'configure)
+         (add-after 'install 'install-contrib
+           (lambda _
+             (let* ((out (assoc-ref %outputs "contrib"))
+                    (bin (string-append out "/bin"))
+                    (exe? (lambda (file)
+                            (let ((s (stat file)))
+                              (and (eq? 'regular (stat:type s))
+                                   (logtest #o100 (stat:perms s)))))))
+               (mkdir-p bin)
+               (with-directory-excursion "contrib"
+                 (for-each
+                   (lambda (file)
+                     (install-file file bin))
+                   (scandir "." exe?)))))))))
     (home-page "https://github.com/leahneukirchen/mblaze")
     (synopsis "Unix utilities to deal with Maildir")
     (description
-- 
2.34.0