Use https by default
[gentoo.git] / mail-mta / netqmail / netqmail-1.06-r2.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 GENQMAIL_PV=20080406
8 QMAIL_SPP_PV=0.42
9
10 QMAIL_TLS_PV=20070417
11 QMAIL_TLS_F=${PN}-1.05-tls-smtpauth-${QMAIL_TLS_PV}.patch
12 QMAIL_TLS_CVE=vu555316.patch
13
14 QMAIL_BIGTODO_PV=103
15 QMAIL_BIGTODO_F=big-todo.${QMAIL_BIGTODO_PV}.patch
16
17 QMAIL_LARGE_DNS='qmail-103.patch'
18
19 inherit eutils qmail
20
21 DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent"
22 HOMEPAGE="
23         http://netqmail.org
24         http://cr.yp.to/qmail.html
25         http://qmail.org
26 "
27 SRC_URI="mirror://qmail/${P}.tar.gz
28         https://dev.gentoo.org/~hollow/distfiles/${GENQMAIL_F}
29         http://www.ckdhr.com/ckd/${QMAIL_LARGE_DNS}
30         http://inoa.net/qmail-tls/${QMAIL_TLS_CVE}
31         !vanilla? (
32                 highvolume? ( mirror://qmail/${QMAIL_BIGTODO_F} )
33                 qmail-spp? ( mirror://sourceforge/qmail-spp/${QMAIL_SPP_F} )
34                 ssl? ( http://shupp.org/patches/${QMAIL_TLS_F} )
35         )
36 "
37
38 LICENSE="public-domain"
39 SLOT="0"
40 KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86"
41 IUSE="authcram gencertdaily highvolume qmail-spp ssl vanilla"
42 REQUIRED_USE='vanilla? ( !ssl !qmail-spp !highvolume )'
43 RESTRICT="test"
44
45 DEPEND="
46         !mail-mta/qmail
47         net-mail/queue-repair
48         ssl? ( dev-libs/openssl )
49         sys-apps/groff
50 "
51 RDEPEND="
52         !mail-mta/courier
53         !mail-mta/esmtp
54         !mail-mta/exim
55         !mail-mta/mini-qmail
56         !mail-mta/msmtp[mta]
57         !mail-mta/nullmailer
58         !mail-mta/postfix
59         !mail-mta/qmail-ldap
60         !mail-mta/sendmail
61         !<mail-mta/ssmtp-2.64-r2
62         !>=mail-mta/ssmtp-2.64-r2[mta]
63         >=sys-apps/ucspi-tcp-0.88-r17
64         ssl? ( >=sys-apps/ucspi-ssl-0.70-r1 )
65         virtual/daemontools
66         >=net-mail/dot-forward-0.71-r3
67         virtual/checkpassword
68         authcram? ( >=net-mail/cmd5checkpw-0.30 )
69         ${DEPEND}
70 "
71
72 pkg_setup() {
73         if [[ -n "${QMAIL_PATCH_DIR}" ]]; then
74                 eerror
75                 eerror "The QMAIL_PATCH_DIR variable for custom patches"
76                 eerror "has been removed from ${PN}. If you need custom patches"
77                 eerror "you should create a copy of this ebuild in an overlay."
78                 eerror
79                 die "QMAIL_PATCH_DIR is not supported anymore"
80         fi
81
82         qmail_create_users
83 }
84
85 src_unpack() {
86         genqmail_src_unpack
87         use qmail-spp && qmail_spp_src_unpack
88
89         unpack ${P}.tar.gz
90 }
91
92 src_prepare() {
93         epatch "${FILESDIR}"/${PV}-exit.patch
94         epatch "${FILESDIR}"/${PV}-readwrite.patch
95         epatch "${DISTDIR}"/${QMAIL_LARGE_DNS}
96         epatch "${FILESDIR}"/${PV}-fbsd-utmpx.patch
97
98         ht_fix_file Makefile*
99
100         if ! use vanilla; then
101                 # This patch contains relative paths and needs to be cleaned up.
102                 sed 's~^--- ../../~--- ~g' \
103                         <"${DISTDIR}"/${QMAIL_TLS_F} \
104                         >"${T}"/${QMAIL_TLS_F}
105                 use ssl        && epatch "${T}"/${QMAIL_TLS_F}
106                 use ssl        && epatch "${DISTDIR}"/${QMAIL_TLS_CVE}
107                 use highvolume && epatch "${DISTDIR}"/${QMAIL_BIGTODO_F}
108
109                 if use qmail-spp; then
110                         if use ssl; then
111                                 epatch "${QMAIL_SPP_S}"/qmail-spp-smtpauth-tls-20060105.diff
112                         else
113                                 epatch "${QMAIL_SPP_S}"/netqmail-spp.diff
114                         fi
115                         cd "${WORKDIR}"
116                         epatch "${FILESDIR}"/genqmail-20080406-ldflags.patch
117                         cd -
118                 fi
119         fi
120
121         qmail_src_postunpack
122
123         # Fix bug #33818 but for netqmail (Bug 137015)
124         if ! use authcram; then
125                 einfo "Disabled CRAM_MD5 support"
126                 sed -e 's,^#define CRAM_MD5$,/*&*/,' -i "${S}"/qmail-smtpd.c
127         else
128                 einfo "Enabled CRAM_MD5 support"
129         fi
130 }
131
132 src_compile() {
133         qmail_src_compile
134         use qmail-spp && qmail_spp_src_compile
135 }
136
137 src_install() {
138         qmail_src_install
139 }
140
141 pkg_postinst() {
142         qmail_queue_setup
143         qmail_rootmail_fixup
144         qmail_tcprules_build
145
146         qmail_config_notice
147         qmail_supervise_config_notice
148         elog
149         elog "If you are looking for documentation, check those links:"
150         elog "https://www.gentoo.org/doc/en/qmail-howto.xml"
151         elog "  -- qmail/vpopmail Virtual Mail Hosting System Guide"
152         elog "http://www.lifewithqmail.com/"
153         elog "  -- Life with qmail"
154         elog
155 }
156
157 pkg_preinst() {
158         qmail_tcprules_fixup
159 }
160
161 pkg_config() {
162         # avoid some weird locale problems
163         export LC_ALL=C
164
165         qmail_config_fast
166         qmail_tcprules_config
167         qmail_tcprules_build
168
169         use ssl && qmail_ssl_generate
170 }