1{ lib
2, stdenv
3, fetchurl
4, fetchpatch
5, autoreconfHook
6, dejagnu
7, gettext
8, gnum4
9, pkg-config
10, texinfo
11, fribidi
12, gdbm
13, gnutls
14, gss
15, guile_2_2
16, libmysqlclient
17, mailcap
18, nettools
19, pam
20, readline
21, ncurses
22, python3
23, sasl
24, system-sendmail
25, libxcrypt
26, mkpasswd
27
28, pythonSupport ? true
29, guileSupport ? true
30}:
31
32stdenv.mkDerivation rec {
33 pname = "mailutils";
34 version = "3.16";
35
36 src = fetchurl {
37 url = "mirror://gnu/${pname}/${pname}-${version}.tar.xz";
38 hash = "sha256-BB0VjTCMA3YYQ4jpyTbPqEGlHNwl1Nt1mEp3Gj+gAsA=";
39 };
40
41 separateDebugInfo = true;
42
43 postPatch = ''
44 sed -i -e '/chown root:mail/d' \
45 -e 's/chmod [24]755/chmod 0755/' \
46 */Makefile{.in,.am}
47 sed -i 's:/usr/lib/mysql:${libmysqlclient}/lib/mysql:' configure.ac
48 '';
49
50 nativeBuildInputs = [
51 autoreconfHook
52 gettext
53 gnum4
54 pkg-config
55 texinfo
56 ];
57
58 buildInputs = [
59 fribidi
60 gdbm
61 gnutls
62 gss
63 libmysqlclient
64 mailcap
65 ncurses
66 pam
67 readline
68 sasl
69 libxcrypt
70 ] ++ lib.optionals stdenv.isLinux [ nettools ]
71 ++ lib.optionals pythonSupport [ python3 ]
72 ++ lib.optionals guileSupport [ guile_2_2 ];
73
74 patches = [
75 ./fix-build-mb-len-max.patch
76 ./path-to-cat.patch
77 # Fix cross-compilation
78 # https://lists.gnu.org/archive/html/bug-mailutils/2020-11/msg00038.html
79 (fetchpatch {
80 url = "https://lists.gnu.org/archive/html/bug-mailutils/2020-11/txtiNjqcNpqOk.txt";
81 sha256 = "0ghzqb8qx2q8cffbvqzw19mivv7r5f16whplzhm7hdj0j2i6xf6s";
82 })
83 # https://github.com/NixOS/nixpkgs/issues/223967
84 # https://lists.gnu.org/archive/html/bug-mailutils/2023-04/msg00000.html
85 ./don-t-use-descrypt-password-in-the-test-suite.patch
86 ];
87
88 enableParallelBuilding = true;
89 hardeningDisable = [ "format" ];
90
91 configureFlags = [
92 "--with-gssapi"
93 "--with-gsasl"
94 "--with-mysql"
95 "--with-path-sendmail=${system-sendmail}/bin/sendmail"
96 "--with-mail-rc=/etc/mail.rc"
97 "DEFAULT_CUPS_CONFDIR=${mailcap}/etc" # provides mime.types to mimeview
98 ] ++ lib.optional (!pythonSupport) "--without-python"
99 ++ lib.optional (!guileSupport) "--without-guile";
100
101 nativeCheckInputs = [ dejagnu mkpasswd ];
102 doCheck = !stdenv.isDarwin; # ERROR: All 46 tests were run, 46 failed unexpectedly.
103 doInstallCheck = false; # fails
104
105 preCheck = ''
106 # Disable comsat tests that fail without tty in the sandbox.
107 tty -s || echo > comsat/tests/testsuite.at
108 # Remove broken macro
109 sed -i '/AT_TESTED/d' libmu_scm/tests/testsuite.at
110 # Provide libraries for mhn.
111 export LD_LIBRARY_PATH=$(pwd)/lib/.libs
112 '';
113
114 postCheck = ''
115 unset LD_LIBRARY_PATH
116 '';
117
118 meta = with lib; {
119 description = "Rich and powerful protocol-independent mail framework";
120
121 longDescription = ''
122 GNU Mailutils is a rich and powerful protocol-independent mail
123 framework. It contains a series of useful mail libraries, clients, and
124 servers. These are the primary mail utilities for the GNU system. The
125 central library is capable of handling electronic mail in various
126 mailbox formats and protocols, both local and remote. Specifically,
127 this project contains a POP3 server, an IMAP4 server, and a Sieve mail
128 filter. It also provides a POSIX `mailx' client, and a collection of
129 other handy tools.
130
131 The GNU Mailutils libraries supply an ample set of primitives for
132 handling electronic mail in programs written in C, C++, Python or
133 Scheme.
134
135 The utilities provided by Mailutils include imap4d and pop3d mail
136 servers, mail reporting utility comsatd, mail filtering program sieve,
137 and an implementation of MH message handling system.
138 '';
139
140 license = with licenses; [
141 lgpl3Plus /* libraries */
142 gpl3Plus /* tools */
143 ];
144
145 maintainers = with maintainers; [ orivej vrthra ];
146
147 homepage = "https://www.gnu.org/software/mailutils/";
148 changelog = "https://git.savannah.gnu.org/cgit/mailutils.git/tree/NEWS";
149
150 # Some of the dependencies fail to build on {cyg,dar}win.
151 platforms = platforms.gnu ++ platforms.unix;
152 };
153}