Subject: [bug#50833] [PATCH v3] gnu: Add bower.

From: jgart <[email-masked]>
Date: Sun, 21 Aug 2022 01:53:37 -0500

* gnu/packages/mail.scm (bower): New variable.

Hi Maxim,

Here's a version 3 patch set.

I bumped bower to version 1.0 which was released a few days ago.

lynx is no longer configured by default in the bower sources.

all best,

jgart
---
 gnu/packages/mail.scm | 72 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index b4b3162fff..dd307520df 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -49,6 +49,7 @@
 ;;; Copyright © 2022 Thiago Jung Bauermann <[email-masked]>
 ;;; Copyright © 2022 Guillaume Le Vaillant <[email-masked]>
 ;;; Copyright © 2022 muradm <[email-masked]>
+;;; Copyright © 2022 jgart <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -125,6 +126,7 @@ (define-module (gnu packages mail)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages mercury)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
@@ -1506,6 +1508,76 @@ (define-public python-notmuch2
     (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
     (license license:gpl3+)))
 
+(define-public bower
+  (package
+    (name "bower")
+    (version "1.0")
+    (home-page "https://github.com/wangp/bower")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0vcsbxlsvr2wv3c7sfr3yj21kbqy259skpxg00vf5bdkbc8qknq4"))))
+    (build-system gnu-build-system)
+    (arguments
+      (list
+        #:make-flags
+        #~(list
+           "bower"
+           "man"
+           (string-append "CC=" #+(cc-for-target))
+           (string-append "prefix=" #$output))
+        #:phases
+        #~(modify-phases %standard-phases
+            (delete 'configure)
+            (add-after 'unpack 'patch-executables
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "src/detect_mime_type.m"
+                  (("\"file")
+                   (string-append "\"" (search-input-file inputs "/bin/file"))))
+                (substitute* "src/compose.m"
+                  (("\"base64")
+                   (string-append "\"" (search-input-file inputs "/bin/base64"))))
+                (substitute* "src/prog_config.m"
+                  (("\\(\"false")
+                   (string-append "(\"" (search-input-file inputs "/bin/false")))
+                  (("\\(\"notmuch\"")
+                   (string-append "(\"" (search-input-file inputs "/bin/notmuch") "\""))
+                  (("/usr/bin/sendmail")
+                   (search-input-file inputs "/sbin/sendmail")))))
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "tests"
+                    (invoke "make")))))
+            (replace 'install
+              (lambda* _
+                (let ((bin (string-append #$output "/bin"))
+                      (man (string-append #$output "/share/man/man1")))
+                  (install-file "bower" bin)
+                  (install-file "bower.1" man)))))))
+    (native-inputs
+     (list diffutils
+           gawk
+           mercury
+           pandoc
+           util-linux))
+    (inputs
+     (list gpgme
+           coreutils
+           notmuch
+           sendmail
+           ncurses))
+    (synopsis "Terminal client for the notmuch email system")
+    (description "@code{bower} is a curses frontend for the notmuch email
+system.  It is written in @{mercury}.")
+    (license license:gpl3+)))
+
 (define-public muchsync
   (package
     (name "muchsync")
-- 
2.37.2