Subject: Claws-Mail

From: Raghav Gururajan <[email-masked]>
Date: Wed, 30 Sep 2020 06:17:59 -0400

Hi Danny!

Based on your feedback, I have split the changes. Please find the 
attached patches.

Regards,
RG.
>From d6888dfabb15f4485d13de09e58c487e22ed3038 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 30 Sep 2020 05:31:43 -0400
Subject: [PATCH 1/5] gnu: claws-mail: Make some cosmetic changes.

* gnu/packages/mail.scm (claws-mail): Make some cosmetic changes.
---
 gnu/packages/mail.scm | 105 ++++++++++++++++++++++--------------------
 1 file changed, 56 insertions(+), 49 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 70e2fcd76b..9da842bc1d 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1317,58 +1317,65 @@ compresses it.")
   (package
     (name "claws-mail")
     (version "3.17.6")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://www.claws-mail.org/releases/claws-mail-" version
-                    ".tar.xz"))
-              (sha256
-               (base32
-                "1s05qw0r0gqwvvkxvrrwbjkbi61dvilixiwrpgcq21qc9csc9r0m"))))
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append
+         "https://www.claws-mail.org/releases/claws-mail-"
+         version ".tar.xz"))
+       (sha256
+        (base32 "1s05qw0r0gqwvvkxvrrwbjkbi61dvilixiwrpgcq21qc9csc9r0m"))))
     (build-system gnu-build-system)
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("bogofilter" ,bogofilter)
-              ("curl" ,curl)
-              ("dbus-glib" ,dbus-glib)
-              ("enchant" ,enchant)
-              ("expat" ,expat)
-              ("ghostscript" ,ghostscript)
-              ("hicolor-icon-theme" ,hicolor-icon-theme)
-              ("gnupg" ,gnupg)
-              ("gnutls" ,gnutls)
-              ("gpgme" ,gpgme)
-              ("gtk" ,gtk+-2)
-              ("libarchive" ,libarchive)
-              ("libcanberra" ,libcanberra)
-              ("libetpan" ,libetpan)
-              ("libical" ,libical)
-              ("libnotify" ,libnotify)
-              ("libsm" ,libsm)
-              ("libxml2" ,libxml2)
-              ("perl" ,perl)
-              ("python-2" ,python-2)
-              ("mime-info" ,shared-mime-info)
-              ("startup-notification" ,startup-notification)))
     (arguments
-      '(#:configure-flags
-        '("--enable-gnutls" "--enable-pgpmime-plugin" "--enable-enchant"
-          "--enable-ldap")
-        #:make-flags
-        ;; Disable updating icon cache since it's done by the profile hook.
-        ;; Conflict with other packages in the profile would be inevitable
-        ;; otherwise.
-        '("gtk_update_icon_cache=true")
-        #:phases (modify-phases %standard-phases
-                   (add-before 'build 'patch-mime
-                     (lambda* (#:key inputs #:allow-other-keys)
-                       (substitute* "src/procmime.c"
-                         (("/usr/share/mime/globs")
-                          (string-append (assoc-ref inputs "mime-info")
-                                         "/share/mime/globs"))))))))
+     `(#:configure-flags
+       (list
+        "--enable-gnutls"
+        "--enable-pgpmime-plugin"
+        "--enable-enchant"
+        "--enable-ldap")
+       #:make-flags
+       ;; Disable updating icon cache since it's done by the profile hook.
+       ;; Conflict with other packages in the profile would be inevitable
+       ;; otherwise.
+       (list
+        "gtk_update_icon_cache=true")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'patch-mime
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "src/procmime.c"
+               (("/usr/share/mime/globs")
+                (string-append (assoc-ref inputs "mime-info")
+                               "/share/mime/globs"))))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("bogofilter" ,bogofilter)
+       ("curl" ,curl)
+       ("dbus-glib" ,dbus-glib)
+       ("enchant" ,enchant)
+       ("expat" ,expat)
+       ("ghostscript" ,ghostscript)
+       ("hicolor-icon-theme" ,hicolor-icon-theme)
+       ("gnupg" ,gnupg)
+       ("gnutls" ,gnutls)
+       ("gpgme" ,gpgme)
+       ("gtk" ,gtk+-2)
+       ("libarchive" ,libarchive)
+       ("libcanberra" ,libcanberra)
+       ("libetpan" ,libetpan)
+       ("libical" ,libical)
+       ("libnotify" ,libnotify)
+       ("libsm" ,libsm)
+       ("libxml2" ,libxml2)
+       ("perl" ,perl)
+       ("python-2" ,python-2)
+       ("mime-info" ,shared-mime-info)
+       ("startup-notification" ,startup-notification)))
     (synopsis "GTK-based Email client")
-    (description
-     "Claws-Mail is an email client (and news reader) based on GTK+.  The
-appearance and interface are designed to be familiar to new users coming from
+    (description "Claws-Mail is an email client (and news reader) based on GTK+.
+The appearance and interface are designed to be familiar to new users coming from
 other popular email clients, as well as experienced users.  Almost all commands
 are accessible with the keyboard.  Plus, Claws-Mail is extensible via addons
 which can add many functionalities to the base client.")
-- 
2.28.0

>From 6a4fa215f4313f020fb1c98bcb5a679ade685e79 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 30 Sep 2020 05:34:21 -0400
Subject: [PATCH 2/5] gnu: claws-mail: Change build-system.

* gnu/packages/mail.scm (claws-mail) [build-system]: Change from
gnu to glib-or-gtk.
---
 gnu/packages/mail.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 9da842bc1d..d0ad0e41d3 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -141,6 +141,7 @@
   #:use-module (guix git-download)
   #:use-module (guix svn-download)
   #:use-module (guix utils)
+  #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system guile)
   #:use-module (guix build-system perl)
@@ -1326,7 +1327,7 @@ compresses it.")
          version ".tar.xz"))
        (sha256
         (base32 "1s05qw0r0gqwvvkxvrrwbjkbi61dvilixiwrpgcq21qc9csc9r0m"))))
-    (build-system gnu-build-system)
+    (build-system glib-or-gtk-build-system)
     (arguments
      `(#:configure-flags
        (list
-- 
2.28.0

>From 5e1c842fd4b4537cd83b4abf96f45a850ead8aa7 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 30 Sep 2020 05:52:34 -0400
Subject: [PATCH 3/5] gnu: claws-mail: Update to 3.17.7.

* gnu/packages/mail.scm (claws-mail) [version]: Update to 3.17.7.
[source]<origin>[sha256]: Modify base32.
[arguments]<#:configure-flags>: Remove all configure flags.
[arguments]<#:phases>['patch-mime]: Remove phase.
['patch-fhs-dirs]: New phase.
[inputs]: Add bash, cairo, compface, dbus, fontconfig, gdk-pibuf,
glib, gobject-introspection, gumbo-parser, libgdata, librsvg,
libsoup, mailutils, nettle, openldap, poppler, python,
python2-pygtk and webkitgtk. Remove hicolor-icon-theme, libsm and
libxml2.
---
 gnu/packages/mail.scm | 64 +++++++++++++++++++++++++++++--------------
 1 file changed, 44 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index d0ad0e41d3..febf207710 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -75,6 +75,7 @@
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages enchant)
+  #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gdb)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
@@ -102,10 +103,12 @@
   #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages openldap)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages pcre)
+  #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages perl-web)
@@ -1317,25 +1320,19 @@ compresses it.")
 (define-public claws-mail
   (package
     (name "claws-mail")
-    (version "3.17.6")
+    (version "3.17.7")
     (source
      (origin
        (method url-fetch)
        (uri
         (string-append
          "https://www.claws-mail.org/releases/claws-mail-"
-         version ".tar.xz"))
+         version ".tar.gz"))
        (sha256
-        (base32 "1s05qw0r0gqwvvkxvrrwbjkbi61dvilixiwrpgcq21qc9csc9r0m"))))
+        (base32 "0zqjfjy8qj6j6a6r0xs97si7hkcsb7jvxx4k2kkdxypqmdkwrn2q"))))
     (build-system glib-or-gtk-build-system)
     (arguments
-     `(#:configure-flags
-       (list
-        "--enable-gnutls"
-        "--enable-pgpmime-plugin"
-        "--enable-enchant"
-        "--enable-ldap")
-       #:make-flags
+     `(#:make-flags
        ;; Disable updating icon cache since it's done by the profile hook.
        ;; Conflict with other packages in the profile would be inevitable
        ;; otherwise.
@@ -1343,37 +1340,64 @@ compresses it.")
         "gtk_update_icon_cache=true")
        #:phases
        (modify-phases %standard-phases
-         (add-before 'build 'patch-mime
+         (add-after 'unpack 'patch-fhs-dirs
            (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "src/procmime.c"
-               (("/usr/share/mime/globs")
-                (string-append (assoc-ref inputs "mime-info")
-                               "/share/mime/globs"))))))))
+             (let*
+                 ((sh (string-append (assoc-ref inputs "bash")
+                                     "/bin/sh"))
+                  (inc (string-append (assoc-ref inputs "mailutils")
+                                      "/bin/mu-mh/inc"))
+                  (send (string-append (assoc-ref inputs "mailutils")
+                                       "/bin/mu-mh/send"))
+                  (globs (string-append (assoc-ref inputs "shared-mime-info")
+                                        "/share/mime/globs")))
+               (with-directory-excursion "src"
+                 (substitute* '("action.c" "common/defs.h" "etpan/imap-thread.c")
+                   (("/bin/sh") sh)
+                   (("/usr/bin/mh/inc") inc)
+                   (("/usr/sbin/sendmail") send)
+                   (("/usr/share/mime/globs") globs)))
+               #t))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
-     `(("bogofilter" ,bogofilter)
+     `(("bash" ,bash)
+       ("bogofilter" ,bogofilter)
+       ("cairo" ,cairo)
        ("curl" ,curl)
        ("dbus-glib" ,dbus-glib)
+       ("dbus" ,dbus)
        ("enchant" ,enchant)
        ("expat" ,expat)
+       ("fontconfig" ,fontconfig)
+       ("gdk-pxbuf" ,gdk-pixbuf+svg)
        ("ghostscript" ,ghostscript)
-       ("hicolor-icon-theme" ,hicolor-icon-theme)
+       ("glib" ,glib)
        ("gnupg" ,gnupg)
        ("gnutls" ,gnutls)
+       ("gobject-introspection" ,gobject-introspection)
        ("gpgme" ,gpgme)
        ("gtk" ,gtk+-2)
+       ("gumbo-parser" ,gumbo-parser)
        ("libarchive" ,libarchive)
        ("libcanberra" ,libcanberra)
        ("libetpan" ,libetpan)
+       ("libgdata" ,libgdata)
        ("libical" ,libical)
        ("libnotify" ,libnotify)
-       ("libsm" ,libsm)
-       ("libxml2" ,libxml2)
+       ("librsvg" ,librsvg)
+       ("libsoup" ,libsoup)
+       ("mailutils" ,mailutils)
+       ("nettle" ,nettle)
+       ("openldap" ,openldap)
        ("perl" ,perl)
+       ("poppler" ,poppler)
+       ("python" ,python)
        ("python-2" ,python-2)
+       ("python2-pygtk" ,python2-pygtk)
        ("mime-info" ,shared-mime-info)
-       ("startup-notification" ,startup-notification)))
+       ("startup-notification" ,startup-notification)
+       ("webkitgtk" ,webkitgtk)))
     (synopsis "GTK-based Email client")
     (description "Claws-Mail is an email client (and news reader) based on GTK+.
 The appearance and interface are designed to be familiar to new users coming from
-- 
2.28.0

>From 13b08ee79c56eb39a044fe8492217a822053418b Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 30 Sep 2020 06:04:01 -0400
Subject: [PATCH 4/5] gnu: claws-mail: Update license.

* gnu/packages/mail.scm (claws-mail) [license]: Remove comment.
---
 gnu/packages/mail.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index febf207710..4a185235b1 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1405,7 +1405,7 @@ other popular email clients, as well as experienced users.  Almost all commands
 are accessible with the keyboard.  Plus, Claws-Mail is extensible via addons
 which can add many functionalities to the base client.")
     (home-page "https://www.claws-mail.org/")
-    (license license:gpl3+))) ; most files are actually public domain or x11
+    (license license:gpl3+)))
 
 (define-public msmtp
   (package
-- 
2.28.0

>From 6c74dfc8d76d9ae447698c98eef4dbed7cee290e Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Wed, 30 Sep 2020 06:10:56 -0400
Subject: [PATCH 5/5] gnu: claws-mail: Update synopsis and description.

* gnu/packages/mail.scm (claws-mail) [synopsis]: Modify.
[description]: Modify.
---
 gnu/packages/mail.scm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 4a185235b1..ca0ec9d8de 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1398,12 +1398,10 @@ compresses it.")
        ("mime-info" ,shared-mime-info)
        ("startup-notification" ,startup-notification)
        ("webkitgtk" ,webkitgtk)))
-    (synopsis "GTK-based Email client")
-    (description "Claws-Mail is an email client (and news reader) based on GTK+.
-The appearance and interface are designed to be familiar to new users coming from
-other popular email clients, as well as experienced users.  Almost all commands
-are accessible with the keyboard.  Plus, Claws-Mail is extensible via addons
-which can add many functionalities to the base client.")
+    (synopsis "A GTK+ lightweight and fast e-mail client")
+    (description "Claws-Mail is a lightweight and highly configurable email
+client and news reader based on the GTK+ GUI toolkit.  It runs on the X Window
+System.")
     (home-page "https://www.claws-mail.org/")
     (license license:gpl3+)))
 
-- 
2.28.0