052efad359540d09c1ccbea7f5b32d88603d6a30
[gentoo.git] / net-mail / mailutils / mailutils-3.8.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python2_7 python3_{6,7} )
6
7 inherit autotools elisp-common eutils flag-o-matic python-single-r1 toolchain-funcs
8
9 DESCRIPTION="A useful collection of mail servers, clients, and filters"
10 HOMEPAGE="https://www.gnu.org/software/mailutils/mailutils.html"
11 SRC_URI="mirror://gnu/mailutils/${P}.tar.xz"
12
13 LICENSE="GPL-2 LGPL-2.1"
14 SLOT="0"
15 KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ia64 ~ppc ppc64 ~s390 ~sparc x86 ~ppc-macos ~x64-macos ~x86-macos"
16 IUSE="berkdb bidi +clients emacs gdbm sasl guile ipv6 kerberos kyotocabinet \
17         ldap mysql nls pam postgres python servers split-usr ssl static-libs +threads tcpd \
18         tokyocabinet"
19
20 RDEPEND="!mail-client/nmh
21         !mail-filter/libsieve
22         !mail-client/mailx
23         !mail-client/nail
24         sys-libs/ncurses:=
25         sys-libs/readline:=
26         dev-libs/libltdl:0
27         virtual/mta
28         berkdb? ( sys-libs/db:= )
29         bidi? ( dev-libs/fribidi )
30         emacs? ( >=app-editors/emacs-23.1:* )
31         gdbm? ( sys-libs/gdbm )
32         guile? ( dev-scheme/guile:12/2.2-1 )
33         kerberos? ( virtual/krb5 )
34         kyotocabinet? ( dev-db/kyotocabinet )
35         ldap? ( net-nds/openldap )
36         mysql? ( dev-db/mysql-connector-c )
37         nls? ( sys-devel/gettext )
38         pam? ( sys-libs/pam )
39         postgres? ( dev-db/postgresql:= )
40         python? ( ${PYTHON_DEPS} )
41         sasl? ( virtual/gsasl )
42         servers? ( virtual/libiconv dev-libs/libunistring )
43         ssl? ( net-libs/gnutls:= )
44         tcpd? ( sys-apps/tcp-wrappers )
45         tokyocabinet? ( dev-db/tokyocabinet )"
46
47 DEPEND="${RDEPEND}
48         virtual/pkgconfig"
49
50 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )
51         servers? ( tcpd ldap )"
52
53 DOCS=( ABOUT-NLS AUTHORS COPYING COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO )
54 PATCHES=(
55         "${FILESDIR}"/${PN}-3.5-add-include.patch
56         "${FILESDIR}"/${PN}-3.6-underlinking.patch
57         "${FILESDIR}"/${PN}-3.8-fix-tests.patch
58         "${FILESDIR}"/${PN}-3.8-fno-common.patch
59 )
60
61 pkg_setup() {
62         use python && python-single-r1_pkg_setup
63 }
64
65 src_prepare() {
66         default
67         if use mysql; then
68                 sed -i -e /^INCLUDES/"s:$:$(mysql_config --include):" \
69                         sql/Makefile.am || die
70         fi
71         eautoreconf
72 }
73
74 src_configure() {
75         append-flags -fno-strict-aliasing
76
77         # maildir is the Gentoo default
78         econf MU_DEFAULT_SCHEME=maildir \
79                 CURSES_LIBS="$($(tc-getPKG_CONFIG) --libs ncurses)" \
80                 $(use_with berkdb berkeley-db) \
81                 $(use_with bidi fribidi) \
82                 $(use_enable ipv6) \
83                 $(use_with gdbm) \
84                 $(use_with sasl gsasl) \
85                 $(use_with guile) \
86                 $(use_with kerberos gssapi) \
87                 $(use_with ldap) \
88                 $(use_with mysql) \
89                 $(use_enable nls) \
90                 $(use_enable pam) \
91                 $(use_with postgres) \
92                 $(use_enable python) \
93                 $(use_with ssl gnutls) \
94                 $(use_enable static-libs static) \
95                 $(use_enable threads pthread) \
96                 $(use_with tokyocabinet) \
97                 $(use_with kyotocabinet) \
98                 $(use_with tcpd tcp-wrappers) \
99                 $(use_enable servers build-servers) \
100                 $(use_with servers unistring ) \
101                 $(use_enable clients build-clients) \
102                 EMACS=$(usex emacs emacs no) \
103                 --with-lispdir="${EPREFIX}${SITELISP}/${PN}" \
104                 --with-mail-spool=/var/spool/mail \
105                 --with-readline \
106                 --enable-sendmail \
107                 --disable-debug
108 }
109
110 src_install() {
111         default
112
113         insinto /etc
114         # bug 613112
115         newins "${FILESDIR}/mailutils.rc" mailutils.conf
116         keepdir /etc/mailutils.d/
117         insinto /etc/mailutils.d
118         doins "${FILESDIR}/mail"
119
120         if use python; then
121                 python_optimize
122                 if use static-libs; then
123                         rm -r "${D}$(python_get_sitedir)/mailutils"/*.{a,la} || die
124                 fi
125         fi
126
127         if use servers; then
128                 newinitd "${FILESDIR}"/imap4d.initd imap4d
129                 newinitd "${FILESDIR}"/pop3d.initd pop3d
130                 newinitd "${FILESDIR}"/comsatd.initd comsatd
131         fi
132
133         # compatibility link
134         if use clients && use split-usr; then
135                 dosym ../usr/bin/mail /bin/mail
136         fi
137
138         if ! use static-libs; then
139                 find "${D}" -name "*.la" -delete || die
140         fi
141 }