summary refs log tree commit diff
diff options
context:
space:
mode:
authorajs124 <ajs124@users.noreply.github.com>2021-02-21 19:16:46 +0100
committerGitHub <noreply@github.com>2021-02-21 19:16:46 +0100
commit60450f6b8dd5566106e1bfb0e9946686f91ed8c6 (patch)
tree98b90aaddb581c222bae66014b33804b0ae785ae
parent92b1ef601c9a5032e877e09c52085978b2b56a9c (diff)
parentc2349bf052456733017396696286627fd061a800 (diff)
downloadnixpkgs-60450f6b8dd5566106e1bfb0e9946686f91ed8c6.tar
nixpkgs-60450f6b8dd5566106e1bfb0e9946686f91ed8c6.tar.gz
nixpkgs-60450f6b8dd5566106e1bfb0e9946686f91ed8c6.tar.bz2
nixpkgs-60450f6b8dd5566106e1bfb0e9946686f91ed8c6.tar.lz
nixpkgs-60450f6b8dd5566106e1bfb0e9946686f91ed8c6.tar.xz
nixpkgs-60450f6b8dd5566106e1bfb0e9946686f91ed8c6.tar.zst
nixpkgs-60450f6b8dd5566106e1bfb0e9946686f91ed8c6.zip
Merge pull request #113663 from helsinki-systems/claws
claws-mail{,-gtk3}: refactor and merge
-rw-r--r--pkgs/applications/networking/mailreaders/claws-mail/default.nix204
-rw-r--r--pkgs/applications/networking/mailreaders/claws-mail/gtk3.nix121
-rw-r--r--pkgs/top-level/all-packages.nix3
3 files changed, 135 insertions, 193 deletions
diff --git a/pkgs/applications/networking/mailreaders/claws-mail/default.nix b/pkgs/applications/networking/mailreaders/claws-mail/default.nix
index 7eaefdd91c4..a9cea58902a 100644
--- a/pkgs/applications/networking/mailreaders/claws-mail/default.nix
+++ b/pkgs/applications/networking/mailreaders/claws-mail/default.nix
@@ -1,52 +1,135 @@
-{ 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";
-  version = "3.17.8";
+let
+  version = if useGtk3 then "3.99.0" else "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 = {
+    sha256 = "0l4f8q11iyj8pi120lrapgq51k5j64xf0jlczkzbm99rym752ch5";
   };
 
-  outputs = [ "out" "dev" ];
+  # The corresponding commit in the gtk3 branch.
+  gtk3src = {
+    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 ];
 
-  patches = [
-    ./mime.patch
+  features = [
+    { flags = [ "acpi_notifier-plugin" ]; enabled = enablePluginAcpiNotifier; }
+    { flags = [ "address_keeper-plugin" ]; enabled = enablePluginAddressKeeper; }
+    { flags = [ "archive-plugin" ]; enabled = enablePluginArchive; deps = [ libarchive ]; }
+    { flags = [ "att_remover-plugin" ]; enabled = enablePluginAttRemover; }
+    { flags = [ "attachwarner-plugin" ]; enabled = enablePluginAttachWarner; }
+    { flags = [ "bogofilter-plugin" ]; enabled = enablePluginBogofilter; }
+    { flags = [ "bsfilter-plugin" ]; enabled = enablePluginBsfilter; }
+    { flags = [ "clamd-plugin" ]; enabled = enablePluginClamd; }
+    { flags = [ "dbus" ]; enabled = enableDbus; deps = [ dbus dbus-glib ]; }
+    { flags = [ "dillo-plugin" ]; enabled = enablePluginDillo; }
+    { flags = [ "enchant" ]; enabled = enableEnchant; deps = [ enchant ]; }
+    { flags = [ "fetchinfo-plugin" ]; enabled = enablePluginFetchInfo; }
+    { flags = [ "gnutls" ]; enabled = enableGnuTLS; deps = [ gnutls ]; }
+    { flags = [ "ldap" ]; enabled = enableLdap; deps = [ openldap ]; }
+    { flags = [ "libetpan" ]; enabled = enableLibetpan; deps = [ libetpan ]; }
+    { flags = [ "libravatar-plugin" ]; enabled = enablePluginLibravatar; }
+    { flags = [ "libsm" ]; enabled = enableLibSM; deps = [ libSM ]; }
+    { flags = [ "litehtml_viewer-plugin" ]; enabled = enablePluginLitehtmlViewer; deps = [ gumbo ]; }
+    { flags = [ "mailmbox-plugin" ]; enabled = enablePluginMailmbox; }
+    { flags = [ "managesieve-plugin" ]; enabled = enablePluginManageSieve; }
+    { flags = [ "networkmanager" ]; enabled = enableNetworkManager; deps = [ networkmanager ]; }
+    { flags = [ "newmail-plugin" ]; enabled = enablePluginNewMail; }
+    { flags = [ "notification-plugin" ]; enabled = enablePluginNotification; deps = [ libnotify ] ++ [(if useGtk3 then libcanberra-gtk3 else libcanberra-gtk2)]; }
+    { flags = [ "pdf_viewer-plugin" ]; enabled = enablePluginPdfViewer; deps = [ poppler ]; }
+    { flags = [ "perl-plugin" ]; enabled = enablePluginPerl; deps = [ perl ]; }
+    { flags = [ "pgpcore-plugin" "pgpinline-plugin" "pgpmime-plugin" ]; enabled = enablePluginPgp; deps = [ gnupg gpgme ]; }
+    { flags = [ "python-plugin" ]; enabled = enablePluginPython; }
+    { flags = [ "rssyl-plugin" ]; enabled = enablePluginRssyl; deps = [ libxml2 ]; }
+    { flags = [ "smime-plugin" ]; enabled = enablePluginSmime; }
+    { flags = [ "spam_report-plugin" ]; enabled = enablePluginSpamReport; }
+    { flags = [ "spamassassin-plugin" ]; enabled = enablePluginSpamassassin; }
+    { flags = [ "svg" ]; enabled = enableSvg; deps = [ librsvg ]; }
+    { flags = [ "tnef_parse-plugin" ]; enabled = enablePluginTnefParse; deps = [ libytnef ]; }
+    { flags = [ "valgrind" ]; enabled = enableValgrind; deps = [ valgrind ]; }
+    { flags = [ "vcalendar-plugin" ]; enabled = enablePluginVcalendar; deps = [ libical ]; }
   ];
+in stdenv.mkDerivation rec {
+  pname = "claws-mail";
+  inherit version;
+
+  src = fetchgit ({
+    rev = version;
+    url = "git://git.claws-mail.org/claws.git";
+  } // (if useGtk3 then gtk3src else gtk2src));
+
+  outputs = [ "out" "dev" ];
+
+  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 = ''
@@ -54,51 +137,30 @@ stdenv.mkDerivation rec {
         --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)]
+    ++ concatMap (f: optionals f.enabled f.deps) (filter (f: f ? deps) features)
+  ;
 
   configureFlags =
-    optional (!enableLdap) "--disable-ldap"
-    ++ optional (!enableNetworkManager) "--disable-networkmanager"
-    ++ optionals (!enablePgp) [
-      "--disable-pgpcore-plugin"
-      "--disable-pgpinline-plugin"
-      "--disable-pgpmime-plugin"
-    ]
-    ++ 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";
+    [
+      "--disable-manual"   # Missing docbook-tools, e.g., docbook2html
+      "--disable-compface" # Missing compface library
+      "--disable-jpilot"   # Missing jpilot library
 
-  enableParallelBuilding = true;
+      "--disable-gdata-plugin" # Complains about missing libgdata, even when provided
+      "--disable-fancy-plugin" # Missing libwebkit-1.0 library
+    ] ++
+    (map (feature: map (flag: strings.enableFeature feature.enabled flag) feature.flags) features);
 
-  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")
   '';
 
@@ -112,6 +174,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 ajs124 ];
   };
 }
diff --git a/pkgs/applications/networking/mailreaders/claws-mail/gtk3.nix b/pkgs/applications/networking/mailreaders/claws-mail/gtk3.nix
deleted file mode 100644
index d5223092446..00000000000
--- a/pkgs/applications/networking/mailreaders/claws-mail/gtk3.nix
+++ /dev/null
@@ -1,121 +0,0 @@
-{ lib, config, fetchgit, stdenv, wrapGAppsHook, autoreconfHook, bison, flex
-, curl, dbus, dbus-glib, enchant, gtk3, gnutls, gnupg, gpgme
-, libarchive, libcanberra-gtk3, libetpan, libnotify, libsoup, libxml2, networkmanager
-, openldap, perl, pkg-config, poppler, python, shared-mime-info, webkitgtk
-, 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
-, enablePgp ? true
-, enablePluginArchive ? false
-, enablePluginFancy ? true
-, enablePluginNotificationDialogs ? true
-, enablePluginNotificationSounds ? true
-, enablePluginPdf ? false
-, enablePluginPython ? false
-, enablePluginRavatar ? false
-, enablePluginRssyl ? false
-, enablePluginSmime ? false
-, enablePluginSpamassassin ? false
-, enablePluginSpamReport ? false
-, enablePluginVcalendar ? false
-, enableSpellcheck ? false
-}:
-
-with lib;
-
-stdenv.mkDerivation rec {
-  pname = "claws-mail-gtk3";
-  version = "3.99.0";
-
-  src = fetchgit {
-    url = "git://git.claws-mail.org/claws.git";
-    rev = version;
-    sha256 = "176h1swh1zx6dqyzfz470x4a1xicnv0zhy8ir47k7p23g6y17i2k";
-  };
-
-  outputs = [ "out" "dev" ];
-
-  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 bison flex pkg-config wrapGAppsHook python.pkgs.wrapPython ];
-  propagatedBuildInputs = with python.pkgs; [ python ] ++ optionals enablePluginPython [ pygtk pygobject2 ];
-
-  buildInputs =
-    [ curl dbus dbus-glib gtk3 gnutls gsettings-desktop-schemas
-      libetpan perl glib-networking libSM libytnef
-    ]
-    ++ optional enableSpellcheck enchant
-    ++ optionals (enablePgp || enablePluginSmime) [ gnupg gpgme ]
-    ++ optional enablePluginArchive libarchive
-    ++ optional enablePluginNotificationSounds libcanberra-gtk3
-    ++ optional enablePluginNotificationDialogs libnotify
-    ++ optional enablePluginFancy libsoup
-    ++ optional enablePluginRssyl libxml2
-    ++ optional enableNetworkManager networkmanager
-    ++ optional enableLdap openldap
-    ++ optional enablePluginPdf poppler
-    ++ optional enablePluginFancy webkitgtk
-    ++ optional enablePluginVcalendar libical;
-
-  configureFlags =
-    optional (!enableLdap) "--disable-ldap"
-    ++ optional (!enableNetworkManager) "--disable-networkmanager"
-    ++ optionals (!enablePgp) [
-      "--disable-pgpcore-plugin"
-      "--disable-pgpinline-plugin"
-      "--disable-pgpmime-plugin"
-    ]
-    ++ optional (!enablePluginArchive) "--disable-archive-plugin"
-    ++ optional (!enablePluginFancy) "--disable-fancy-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";
-
-  enableParallelBuilding = true;
-
-  pythonPath = with python.pkgs; [ pygobject2 pygtk ];
-
-  preFixup = ''
-    buildPythonPath "$out $pythonPath"
-    gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "${shared-mime-info}/share" --prefix PYTHONPATH : "$program_PYTHONPATH")
-  '';
-
-  postInstall = ''
-    mkdir -p $out/share/applications
-    cp claws-mail.desktop $out/share/applications
-  '';
-
-  NIX_CFLAGS_COMPILE = [ "-Wno-deprecated-declarations" ];
-
-  meta = {
-    description = "The user-friendly, lightweight, and fast email client";
-    homepage = "https://www.claws-mail.org/";
-    license = licenses.gpl3;
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ fpletz globin orivej ];
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 8403e1a925b..6e511e1e24f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -21558,8 +21558,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 { };