net-mail/smtptools: Fix building with CFLAGS=-fno-common
[gentoo.git] / net-mail / fetchmail / fetchmail-6.4.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7,8} )
7 PYTHON_REQ_USE="tk"
8
9 inherit python-single-r1 systemd toolchain-funcs autotools
10
11 DESCRIPTION="the legendary remote-mail retrieval and forwarding utility"
12 HOMEPAGE="http://www.fetchmail.info/"
13 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz"
14
15 LICENSE="GPL-2 public-domain"
16 SLOT="0"
17 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
18 IUSE="ssl nls kerberos tk socks libressl"
19 REQUIRED_USE="tk? ( ${PYTHON_REQUIRED_USE} )"
20
21 RDEPEND="acct-user/fetchmail
22         ssl? (
23                 !libressl? ( >=dev-libs/openssl-1.0.2:= )
24                 libressl?  ( dev-libs/libressl:= )
25         )
26         kerberos? (
27                 virtual/krb5
28                 !libressl? ( >=dev-libs/openssl-1.0.2:= )
29                 libressl?  ( dev-libs/libressl:= )
30         )
31         nls? ( virtual/libintl )
32         !elibc_glibc? ( sys-libs/e2fsprogs-libs )
33         socks? ( net-proxy/dante )
34         tk? (
35                 ${PYTHON_DEPS}
36                 $(python_gen_cond_dep '
37                         dev-python/future[${PYTHON_MULTI_USEDEP}]
38                 ')
39         )"
40 DEPEND="${RDEPEND}
41         app-arch/xz-utils
42         sys-devel/flex
43         nls? ( sys-devel/gettext )"
44
45 DOCS="FAQ FEATURES NEWS NOTES README README.NTLM README.SSL* TODO"
46 HTML_DOCS="*.html"
47 PATCHES=(
48         "${FILESDIR}"/${PN}-6.3.26-python-optional.patch
49 )
50 S=${WORKDIR}/${P/_/.}
51
52 pkg_setup() {
53         use tk && python-single-r1_pkg_setup
54 }
55
56 src_prepare() {
57         default
58         # don't compile during src_install
59         use tk && : > "${S}"/py-compile
60         eautoreconf
61 }
62
63 src_configure() {
64         use tk || export PYTHON=:
65
66         econf \
67                 --enable-RPA \
68                 --enable-NTLM \
69                 --enable-SDPS \
70                 $(use_enable nls) \
71                 $(use_with ssl ssl "${EPREFIX}/usr") \
72                 $(use kerberos && echo "--with-ssl=${EPREFIX}/usr") \
73                 $(use_with kerberos gssapi) \
74                 $(use_with kerberos kerberos5) \
75                 --without-hesiod \
76                 $(use_with socks)
77 }
78
79 src_compile() {
80         emake AR="$(tc-getAR)"
81 }
82
83 src_install() {
84         default
85
86         newinitd "${FILESDIR}"/fetchmail.initd fetchmail
87         newconfd "${FILESDIR}"/fetchmail.confd fetchmail
88
89         systemd_dounit  "${FILESDIR}"/${PN}.service
90         systemd_newunit "${FILESDIR}"/${PN}_at.service "${PN}@.service"
91         systemd_dotmpfilesd "${FILESDIR}"/${PN}.conf
92
93         docinto contrib
94         local f
95         for f in contrib/* ; do
96                 [ -f "${f}" ] && dodoc "${f}"
97         done
98
99         use tk && python_optimize
100 }
101
102 pkg_postinst() {
103         if [[ -z ${REPLACING_VERSIONS} ]]; then
104                 elog "Please see /etc/conf.d/fetchmail if you want to adjust"
105                 elog "the polling delay used by the fetchmail init script."
106         fi
107 }