Skip to content

Commit

Permalink
claws-mail{,-gtk3}: refactor
Browse files Browse the repository at this point in the history
Update Claws Mail to its latest version and perform a major refactoring.

Previously, the configurable arguments were neither complete nor named
according to the configure.ac file. Likewise, the values did not
correspond to the defaults, but rather to a personal preference.

This has now been changed to enable the arguments which are enabled in
the configure.ac file. Also the variable names have been adjusted. For
compatibility the old parameters also exist.

Next to the claws-mail package is the "experimental" claws-mail-gtk3
package for the non official gtk3 git branch. This package started as an
almost one-to-one copy of the claws-mail derivation which small
modifications. This package was of course not updated.

This has also been changed so that both packages are built from the same
derivative.
  • Loading branch information
oxzi authored and ajs124 committed Feb 19, 2021
1 parent f5b5016 commit 553ad19
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 191 deletions.
220 changes: 151 additions & 69 deletions pkgs/applications/networking/mailreaders/claws-mail/default.nix
Original file line number Diff line number Diff line change
@@ -1,104 +1,186 @@
{ lib, config, fetchurl, stdenv, wrapGAppsHook, autoreconfHook
, curl, dbus, dbus-glib, enchant, gtk2, gnutls, gnupg, gpgme, gumbo
, libarchive, libcanberra-gtk2, libetpan, libnotify, libsoup, libxml2, networkmanager
, openldap, perl, pkg-config, poppler, python, shared-mime-info
, glib-networking, gsettings-desktop-schemas, libSM, libytnef, libical
# Build options
# TODO: A flag to build the manual.
# TODO: Plugins that complain about their missing dependencies, even when
# provided:
# gdata requires libgdata
# geolocation requires libchamplain
, enableLdap ? false
, enableNetworkManager ? config.networking.networkmanager.enable or false
{ stdenv, lib, fetchgit, wrapGAppsHook, autoreconfHook, bison, flex
, curl, gtk2, gtk3, pkg-config, python2, python3, shared-mime-info
, glib-networking, gsettings-desktop-schemas

# Use the experimental gtk3 branch.
, useGtk3 ? false

# Package compatibility: old parameters whose name were not directly derived
, enablePgp ? true
, enablePluginArchive ? false
, enablePluginLitehtmlViewer ? false
, enablePluginNotificationDialogs ? true
, enablePluginNotificationSounds ? true
, enablePluginPdf ? false
, enablePluginPython ? false
, enablePluginRavatar ? false
, enablePluginRssyl ? false
, enablePluginSmime ? false
, enablePluginSpamassassin ? false
, enablePluginSpamReport ? false
, enablePluginVcalendar ? false
, enableSpellcheck ? false
, enablePluginPdf ? true
, enablePluginRavatar ? true
, enableSpellcheck ? true

# Arguments to include external libraries
, enableLibSM ? true, libSM
, enableGnuTLS ? true, gnutls
, enableEnchant ? enableSpellcheck, enchant
, enableDbus ? true, dbus, dbus-glib
, enableLdap ? true, openldap
, enableNetworkManager ? true, networkmanager
, enableLibetpan ? true, libetpan
, enableValgrind ? true, valgrind
, enableSvg ? true, librsvg

# Configure claws-mail's plugins
, enablePluginAcpiNotifier ? true
, enablePluginAddressKeeper ? true
, enablePluginArchive ? true, libarchive
, enablePluginAttRemover ? true
, enablePluginAttachWarner ? true
, enablePluginBogofilter ? true
, enablePluginBsfilter ? true
, enablePluginClamd ? true
, enablePluginDillo ? true
, enablePluginFetchInfo ? true
, enablePluginLibravatar ? enablePluginRavatar
, enablePluginLitehtmlViewer ? true, gumbo
, enablePluginMailmbox ? true
, enablePluginManageSieve ? true
, enablePluginNewMail ? true
, enablePluginNotification ? (enablePluginNotificationDialogs || enablePluginNotificationSounds), libcanberra-gtk2, libcanberra-gtk3, libnotify
, enablePluginPdfViewer ? enablePluginPdf, poppler
, enablePluginPerl ? true, perl
, enablePluginPython ? true
, enablePluginPgp ? enablePgp, gnupg, gpgme
, enablePluginRssyl ? true, libxml2
, enablePluginSmime ? true
, enablePluginSpamassassin ? true
, enablePluginSpamReport ? true
, enablePluginTnefParse ? true, libytnef
, enablePluginVcalendar ? true, libical
}:

with lib;

stdenv.mkDerivation rec {
pname = "claws-mail";
let
version = "3.17.8";

src = fetchurl {
url = "https://www.claws-mail.org/download.php?file=releases/claws-mail-${version}.tar.xz";
sha256 = "sha256-zbeygUmV1vSpw7HwvBRn7Vw88qXg2hcwqqJaisyv3a8=";
# The official release uses gtk2 and contains the version tag.
gtk2src = {
rev = version;
sha256 = "0l4f8q11iyj8pi120lrapgq51k5j64xf0jlczkzbm99rym752ch5";
};

# The corresponding commit in the gtk3 branch.
gtk3src = {
rev = "3.99.0";
sha256 = "176h1swh1zx6dqyzfz470x4a1xicnv0zhy8ir47k7p23g6y17i2k";
};

python = if useGtk3 then python3 else python2;
pythonPkgs = if useGtk3
then
with python.pkgs; [ python wrapPython pygobject3 ]
else
with python.pkgs; [ python wrapPython pygtk pygobject2 ];
in stdenv.mkDerivation rec {
pname = "claws-mail";
inherit version;

src = fetchgit ({
url = "git://git.claws-mail.org/claws.git";
} // (if useGtk3 then gtk3src else gtk2src));

outputs = [ "out" "dev" ];

patches = [
./mime.patch
];
patches = [ ./mime.patch ];

preConfigure = ''
# autotools check tries to dlopen libpython as a requirement for the python plugin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${python}/lib
# generate version without .git
[ -e version ] || echo "echo ${version}" > version
'';

postPatch = ''
substituteInPlace src/procmime.c \
--subst-var-by MIMEROOTDIR ${shared-mime-info}/share
'';

nativeBuildInputs = [ autoreconfHook pkg-config wrapGAppsHook python.pkgs.wrapPython ];
propagatedBuildInputs = with python.pkgs; [ python ] ++ optionals enablePluginPython [ pygtk pygobject2 ];
nativeBuildInputs = [ autoreconfHook pkg-config bison flex wrapGAppsHook ];
propagatedBuildInputs = pythonPkgs;

buildInputs =
[ curl dbus dbus-glib gtk2 gnutls gsettings-desktop-schemas
libetpan perl glib-networking libSM libytnef
]
++ optional enableSpellcheck enchant
++ optionals (enablePgp || enablePluginSmime) [ gnupg gpgme ]
++ optional enablePluginArchive libarchive
++ optional enablePluginNotificationSounds libcanberra-gtk2
++ optional enablePluginNotificationDialogs libnotify
++ optional enablePluginLitehtmlViewer gumbo
++ optional enablePluginRssyl libxml2
++ optional enableNetworkManager networkmanager
++ optional enableLdap openldap
++ optional enablePluginPdf poppler
++ optional enablePluginVcalendar libical;
[ curl gsettings-desktop-schemas glib-networking ]
++ [(if useGtk3 then gtk3 else gtk2)]
++ optional enableLibSM libSM
++ optional enableGnuTLS gnutls
++ optional enableEnchant enchant
++ optionals enableDbus [ dbus dbus-glib ]
++ optional enableLdap openldap
++ optional enableNetworkManager networkmanager
++ optional enableLibetpan libetpan
++ optional enableValgrind valgrind
++ optional enableSvg librsvg
++ optional enablePluginArchive libarchive
++ optional enablePluginLitehtmlViewer gumbo
++ optionals enablePluginNotification [ libnotify ] ++ [(if useGtk3 then libcanberra-gtk3 else libcanberra-gtk2)]
++ optional enablePluginPerl perl
++ optional enablePluginPdfViewer poppler
++ optional enablePluginRssyl libxml2
++ optionals enablePluginPgp [ gnupg gpgme ]
++ optional enablePluginTnefParse libytnef
++ optional enablePluginVcalendar libical
;

configureFlags =
optional (!enableLdap) "--disable-ldap"
++ optional (!enableNetworkManager) "--disable-networkmanager"
++ optionals (!enablePgp) [
"--disable-pgpcore-plugin"
"--disable-pgpinline-plugin"
"--disable-pgpmime-plugin"
[
"--disable-manual" # Missing docbook-tools, e.g., docbook2html
"--disable-compface" # Missing compface library
"--disable-jpilot" # Missing jpilot library

"--disable-gdata-plugin" # Complains about missing libgdata, even when provided
"--disable-fancy-plugin" # Missing libwebkit-1.0 library
]
++ optional (!enablePluginArchive) "--disable-archive-plugin"
++ optional (!enablePluginLitehtmlViewer) "--disable-litehtml_viewer-plugin"
++ optional (!enablePluginPdf) "--disable-pdf_viewer-plugin"
++ optional (!enablePluginPython) "--disable-python-plugin"
++ optional (!enablePluginRavatar) "--disable-libravatar-plugin"
++ optional (!enablePluginRssyl) "--disable-rssyl-plugin"
++ optional (!enablePluginSmime) "--disable-smime-plugin"
++ optional (!enablePluginSpamassassin) "--disable-spamassassin-plugin"
++ optional (!enablePluginSpamReport) "--disable-spam_report-plugin"
++ optional (!enablePluginVcalendar) "--disable-vcalendar-plugin"
++ optional (!enableSpellcheck) "--disable-enchant";
++
(map (e: strings.enableFeature (lists.head e) (lists.last e)) [
[ enableLibSM "libsm" ]
[ enableGnuTLS "gnutls" ]
[ enableEnchant "enchant" ]
[ enableDbus "dbus" ]
[ enableLdap "ldap" ]
[ enableNetworkManager "networkmanager" ]
[ enableLibetpan "libetpan" ]
[ enableValgrind "valgrind" ]
[ enableSvg "svg" ]

enableParallelBuilding = true;
[ enablePluginAcpiNotifier "acpi_notifier-plugin" ]
[ enablePluginAddressKeeper "address_keeper-plugin" ]
[ enablePluginArchive "archive-plugin" ]
[ enablePluginAttRemover "att_remover-plugin" ]
[ enablePluginAttachWarner "attachwarner-plugin" ]
[ enablePluginBogofilter "bogofilter-plugin" ]
[ enablePluginBsfilter "bsfilter-plugin" ]
[ enablePluginClamd "clamd-plugin" ]
[ enablePluginDillo "dillo-plugin" ]
[ enablePluginFetchInfo "fetchinfo-plugin" ]
[ enablePluginLibravatar "libravatar-plugin" ]
[ enablePluginLitehtmlViewer "litehtml_viewer-plugin" ]
[ enablePluginMailmbox "mailmbox-plugin" ]
[ enablePluginManageSieve "managesieve-plugin" ]
[ enablePluginNewMail "newmail-plugin" ]
[ enablePluginNotification "notification-plugin" ]
[ enablePluginPdfViewer "pdf_viewer-plugin" ]
[ enablePluginPerl "perl-plugin" ]
[ enablePluginPython "python-plugin" ]
[ enablePluginPgp "pgpcore-plugin" ]
[ enablePluginPgp "pgpmime-plugin" ]
[ enablePluginPgp "pgpinline-plugin" ]
[ enablePluginRssyl "rssyl-plugin" ]
[ enablePluginSmime "smime-plugin" ]
[ enablePluginSpamassassin "spamassassin-plugin" ]
[ enablePluginSpamReport "spam_report-plugin" ]
[ enablePluginTnefParse "tnef_parse-plugin" ]
[ enablePluginVcalendar "vcalendar-plugin" ]
]);

pythonPath = with python.pkgs; [ pygobject2 pygtk ];
enableParallelBuilding = true;

preFixup = ''
buildPythonPath "$out $pythonPath"
buildPythonPath "$out $pythonPkgs"
gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "${shared-mime-info}/share" --prefix PYTHONPATH : "$program_PYTHONPATH")
'';

Expand All @@ -112,6 +194,6 @@ stdenv.mkDerivation rec {
homepage = "https://www.claws-mail.org/";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ fpletz globin orivej ];
maintainers = with maintainers; [ fpletz globin orivej oxzi ];
};
}
121 changes: 0 additions & 121 deletions pkgs/applications/networking/mailreaders/claws-mail/gtk3.nix

This file was deleted.

3 changes: 2 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21527,8 +21527,9 @@ in
claws-mail = callPackage ../applications/networking/mailreaders/claws-mail {
inherit (xorg) libSM;
};
claws-mail-gtk3 = callPackage ../applications/networking/mailreaders/claws-mail/gtk3.nix {
claws-mail-gtk3 = callPackage ../applications/networking/mailreaders/claws-mail {
inherit (xorg) libSM;
useGtk3 = true;
};

clfswm = callPackage ../applications/window-managers/clfswm { };
Expand Down

0 comments on commit 553ad19

Please sign in to comment.