Lines 1-255
Link Here
|
1 |
# Copyright 1999-2009 Gentoo Foundation |
1 |
# Copyright 1999-2009 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/mail-filter/spamassassin/spamassassin-3.2.5-r1.ebuild,v 1.1 2009/10/27 07:22:18 loki_val Exp $ |
3 |
# $Header: $ |
|
|
4 |
|
5 |
EAPI="2" |
4 |
|
6 |
|
5 |
inherit perl-module eutils |
7 |
inherit perl-module eutils |
6 |
|
8 |
|
7 |
MY_P=Mail-SpamAssassin-${PV//_/-} |
9 |
MY_P=Mail-SpamAssassin-${PV//_/-} |
8 |
S=${WORKDIR}/${MY_P} |
10 |
S=${WORKDIR}/${MY_P} |
|
|
11 |
|
9 |
DESCRIPTION="SpamAssassin is an extensible email filter which is used to identify spam." |
12 |
DESCRIPTION="SpamAssassin is an extensible email filter which is used to identify spam." |
10 |
HOMEPAGE="http://spamassassin.apache.org/" |
13 |
HOMEPAGE="http://spamassassin.apache.org/" |
11 |
SRC_URI="http://archive.apache.org/dist/spamassassin/source/${MY_P}.tar.bz2 mirror://gentoo/${MY_P}.tar.bz2" |
14 |
SRC_URI="http://archive.apache.org/dist/spamassassin/source/${MY_P}.tar.bz2" |
12 |
|
|
|
13 |
SRC_TEST="do" |
15 |
SRC_TEST="do" |
|
|
16 |
|
14 |
LICENSE="Apache-2.0" |
17 |
LICENSE="Apache-2.0" |
15 |
SLOT="0" |
18 |
SLOT="0" |
16 |
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
19 |
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
17 |
IUSE="berkdb qmail ssl doc ldap mysql postgres sqlite tools ipv6" |
20 |
IUSE="berkdb qmail ssl doc ldap mysql postgres sqlite tools ipv6" |
18 |
|
21 |
|
19 |
DEPEND=">=dev-lang/perl-5.8.2-r1 |
22 |
DEPEND=">=dev-lang/perl-5.8.2-r1 |
20 |
virtual/perl-MIME-Base64 |
23 |
virtual/perl-MIME-Base64 |
21 |
>=virtual/perl-PodParser-1.32 |
24 |
>=virtual/perl-PodParser-1.32 |
22 |
virtual/perl-Storable |
25 |
virtual/perl-Storable |
23 |
virtual/perl-Time-HiRes |
26 |
virtual/perl-Time-HiRes |
24 |
>=dev-perl/HTML-Parser-3.43 |
27 |
>=dev-perl/HTML-Parser-3.43 |
25 |
>=dev-perl/Net-DNS-0.53 |
28 |
>=dev-perl/Net-DNS-0.53 |
26 |
dev-perl/Digest-SHA1 |
29 |
dev-perl/Digest-SHA1 |
27 |
dev-perl/libwww-perl |
30 |
dev-perl/libwww-perl |
28 |
>=virtual/perl-Archive-Tar-1.26 |
31 |
>=virtual/perl-Archive-Tar-1.26 |
29 |
app-crypt/gnupg |
32 |
app-crypt/gnupg |
30 |
>=virtual/perl-IO-Zlib-1.04 |
33 |
>=virtual/perl-IO-Zlib-1.04 |
31 |
>=dev-util/re2c-0.12.0 |
34 |
>=dev-util/re2c-0.12.0 |
32 |
ssl? ( |
35 |
ssl? ( |
33 |
dev-perl/IO-Socket-SSL |
36 |
dev-perl/IO-Socket-SSL |
34 |
dev-libs/openssl |
37 |
dev-libs/openssl |
35 |
) |
38 |
) |
36 |
berkdb? ( |
39 |
berkdb? ( |
37 |
virtual/perl-DB_File |
40 |
virtual/perl-DB_File |
38 |
) |
41 |
) |
39 |
ldap? ( dev-perl/perl-ldap ) |
42 |
ldap? ( dev-perl/perl-ldap ) |
40 |
mysql? ( |
43 |
mysql? ( |
41 |
dev-perl/DBI |
44 |
dev-perl/DBI |
42 |
dev-perl/DBD-mysql |
45 |
dev-perl/DBD-mysql |
43 |
) |
46 |
) |
44 |
postgres? ( |
47 |
postgres? ( |
45 |
dev-perl/DBI |
48 |
dev-perl/DBI |
46 |
dev-perl/DBD-Pg |
49 |
dev-perl/DBD-Pg |
47 |
) |
50 |
) |
48 |
sqlite? ( |
51 |
sqlite? ( |
49 |
dev-perl/DBI |
52 |
dev-perl/DBI |
50 |
dev-perl/DBD-SQLite |
53 |
dev-perl/DBD-SQLite |
51 |
) |
54 |
) |
52 |
|
55 |
|
53 |
ipv6? ( |
56 |
ipv6? ( |
54 |
dev-perl/IO-Socket-INET6 |
57 |
dev-perl/IO-Socket-INET6 |
55 |
)" |
58 |
)" |
|
|
59 |
RDEPEND="${DEPEND}" |
56 |
|
60 |
|
57 |
PATCHES=( "${FILESDIR}/${PN}-3.2.5-DESTDIR.patch" ) |
61 |
PATCHES=( "${FILESDIR}/${PN}-3.2.5-DESTDIR.patch" ) |
58 |
|
62 |
|
|
|
63 |
src_configure() { |
64 |
# - Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again |
65 |
# (just to be sure, nobody knows how it could happen in the first place). |
66 |
myconf="SYSCONFDIR=/etc DATADIR=/usr/share/spamassassin" |
67 |
|
68 |
# If ssl is enabled, spamc can be built with ssl support |
69 |
if use ssl; then |
70 |
myconf="${myconf} ENABLE_SSL=yes" |
71 |
else |
72 |
myconf="${myconf} ENABLE_SSL=no" |
73 |
fi |
74 |
|
75 |
# Set the path to the Perl executable explictly. This will be used to |
76 |
# create the initial sharpbang line in the scripts and might cause |
77 |
# a versioned app name end in there, see |
78 |
# <http://bugs.gentoo.org/show_bug.cgi?id=62276> |
79 |
myconf="${myconf} PERL_BIN=/usr/bin/perl" |
80 |
|
81 |
# If you are going to enable taint mode, make sure that the bug where |
82 |
# spamd doesn't start when the PATH contains . is addressed, and make |
83 |
# sure you deal with versions of razor <2.36-r1 not being taint-safe. |
84 |
# <http://bugzilla.spamassassin.org/show_bug.cgi?id=2511> and |
85 |
# <http://spamassassin.org/released/Razor2.patch>. |
86 |
myconf="${myconf} PERL_TAINT=no" |
87 |
|
88 |
# No settings needed for 'make all'. |
89 |
mymake="" |
90 |
|
91 |
# Neither for 'make install'. |
92 |
myinst="" |
93 |
|
94 |
# Add Gentoo tag to make it easier for the upstream devs to spot |
95 |
# possible modifications or patches. |
96 |
version_tag="g${PV:6}${PR}" |
97 |
version_str="${PV//_/-}-${version_tag}" |
98 |
|
99 |
# Create the Gentoo config file before Makefile.PL is called so it |
100 |
# is copied later on. |
101 |
echo "version_tag ${version_tag}" > rules/11_gentoo.cf |
102 |
|
103 |
# Setting the following env var ensures that no questions are asked. |
104 |
export PERL_MM_USE_DEFAULT=1 |
105 |
perl-module_src_prep |
106 |
} |
107 |
|
59 |
src_compile() { |
108 |
src_compile() { |
60 |
# - Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again |
109 |
# Run the autoconf stuff now, just to make the build sequence look more |
61 |
# (just to be sure, nobody knows how it could happen in the first place). |
110 |
# familiar to the user :) Plus feeding the VERSION_STRING skips some |
62 |
myconf="SYSCONFDIR=/etc DATADIR=/usr/share/spamassassin" |
111 |
# calls to Perl. |
63 |
|
112 |
make spamc/Makefile VERSION_STRING="${version_str}" |
64 |
# If ssl is enabled, spamc can be built with ssl support |
113 |
|
65 |
if use ssl; then |
114 |
# Now compile all the stuff selected. |
66 |
myconf="${myconf} ENABLE_SSL=yes" |
115 |
perl-module_src_compile |
67 |
else |
116 |
if use qmail; then |
68 |
myconf="${myconf} ENABLE_SSL=no" |
117 |
make spamc/qmail-spamc || die building qmail-spamc failed |
69 |
fi |
118 |
fi |
70 |
|
|
|
71 |
# Set the path to the Perl executable explictly. This will be used to |
72 |
# create the initial sharpbang line in the scripts and might cause |
73 |
# a versioned app name end in there, see |
74 |
# <http://bugs.gentoo.org/show_bug.cgi?id=62276> |
75 |
myconf="${myconf} PERL_BIN=/usr/bin/perl" |
76 |
|
77 |
# If you are going to enable taint mode, make sure that the bug where |
78 |
# spamd doesn't start when the PATH contains . is addressed, and make |
79 |
# sure you deal with versions of razor <2.36-r1 not being taint-safe. |
80 |
# <http://bugzilla.spamassassin.org/show_bug.cgi?id=2511> and |
81 |
# <http://spamassassin.org/released/Razor2.patch>. |
82 |
myconf="${myconf} PERL_TAINT=no" |
83 |
|
84 |
# No settings needed for 'make all'. |
85 |
mymake="" |
86 |
|
87 |
# Neither for 'make install'. |
88 |
myinst="" |
89 |
|
90 |
# Add Gentoo tag to make it easier for the upstream devs to spot |
91 |
# possible modifications or patches. |
92 |
version_tag="g${PV:6}${PR}" |
93 |
version_str="${PV//_/-}-${version_tag}" |
94 |
|
95 |
# Create the Gentoo config file before Makefile.PL is called so it |
96 |
# is copied later on. |
97 |
echo "version_tag ${version_tag}" > rules/11_gentoo.cf |
98 |
|
99 |
# Setting the following env var ensures that no questions are asked. |
100 |
export PERL_MM_USE_DEFAULT=1 |
101 |
perl-module_src_prep |
102 |
# Run the autoconf stuff now, just to make the build sequence look more |
103 |
# familiar to the user :) Plus feeding the VERSION_STRING skips some |
104 |
# calls to Perl. |
105 |
make spamc/Makefile VERSION_STRING="${version_str}" |
106 |
|
107 |
# Now compile all the stuff selected. |
108 |
perl-module_src_compile |
109 |
if use qmail; then |
110 |
make spamc/qmail-spamc || die building qmail-spamc failed |
111 |
fi |
112 |
|
119 |
|
113 |
# Remove the MANIFEST files as they aren't docu files |
120 |
# Remove the MANIFEST files as they aren't docu files |
114 |
rm -f MANIFEST* |
121 |
rm -f MANIFEST* |
115 |
|
122 |
|
116 |
use doc && make text_html_doc |
123 |
use doc && make text_html_doc |
117 |
} |
124 |
} |
118 |
|
125 |
|
|
|
126 |
|
119 |
src_test() { |
127 |
src_test() { |
120 |
perl-module_src_test |
128 |
perl-module_src_test |
121 |
} |
129 |
} |
122 |
|
130 |
|
123 |
src_install () { |
131 |
src_install () { |
124 |
perl-module_src_install |
132 |
perl-module_src_install |
|
|
133 |
|
134 |
# Create the stub dir used by sa-update and friends |
135 |
dodir /var/lib/spamassassin |
125 |
|
136 |
|
126 |
# Create the stub dir used by sa-update and friends |
137 |
# Move spamd to sbin where it belongs. |
127 |
dodir /var/lib/spamassassin |
138 |
dodir /usr/sbin |
|
|
139 |
mv "${D}"/usr/bin/spamd "${D}"/usr/sbin/spamd || die |
140 |
|
141 |
use qmail && dobin spamc/qmail-spamc |
142 |
|
143 |
dosym /etc/mail/spamassassin /etc/spamassassin |
144 |
|
145 |
# Disable plugin by default |
146 |
sed -i -e 's/^loadplugin/\#loadplugin/g' "${D}"/etc/mail/spamassassin/init.pre |
147 |
|
148 |
# Add the init and config scripts. |
149 |
newinitd "${FILESDIR}"/3.0.0-spamd.init spamd || die |
150 |
newconfd "${FILESDIR}"/3.0.0-spamd.conf spamd || die |
151 |
|
152 |
if use doc; then |
153 |
dodoc NOTICE TRADEMARK CREDITS INSTALL INSTALL.VMS UPGRADE USAGE \ |
154 |
sql/README.bayes sql/README.awl procmailrc.example sample-nonspam.txt \ |
155 |
sample-spam.txt spamassassin.spec spamd/PROTOCOL spamd/README.vpopmail \ |
156 |
spamd-apache2/README.apache || die |
157 |
|
158 |
|
159 |
# Rename some docu files so they don't clash with others |
160 |
newdoc spamd/README README.spamd || die |
161 |
newdoc sql/README README.sql || die |
162 |
newdoc ldap/README README.ldap || die |
163 |
use qmail && newdoc spamc/README.qmail README.qmail || die |
164 |
|
165 |
dohtml doc/*.html || die |
166 |
docinto sql |
167 |
dodoc sql/*.sql || die |
168 |
fi |
169 |
|
170 |
# Install provided tools. See bug 108168 |
171 |
if use tools; then |
172 |
docinto tools |
173 |
dodoc tools/* || die |
174 |
fi |
175 |
|
176 |
cp "${FILESDIR}"/secrets.cf "${D}"/etc/mail/spamassassin/secrets.cf.example || die |
177 |
fperms 0400 /etc/mail/spamassassin/secrets.cf.example |
178 |
|
179 |
cat <<-EOF > "${T}/local.cf.example" |
180 |
# Sensitive data, such as database connection info, should be stored in |
181 |
# /etc/mail/spamassassin/secrets.cf with appropriate permissions |
182 |
EOF |
128 |
|
183 |
|
129 |
# Move spamd to sbin where it belongs. |
184 |
insinto /etc/mail/spamassassin/ |
130 |
dodir /usr/sbin |
185 |
doins "${T}/local.cf.example" || die |
131 |
mv "${D}"/usr/bin/spamd "${D}"/usr/sbin/spamd || die |
|
|
132 |
|
133 |
use qmail && dobin spamc/qmail-spamc |
134 |
|
135 |
dosym /etc/mail/spamassassin /etc/spamassassin |
136 |
|
137 |
# Disable plugin by default |
138 |
sed -i -e 's/^loadplugin/\#loadplugin/g' "${D}"/etc/mail/spamassassin/init.pre |
139 |
|
140 |
# Add the init and config scripts. |
141 |
newinitd "${FILESDIR}"/3.0.0-spamd.init spamd |
142 |
newconfd "${FILESDIR}"/3.0.0-spamd.conf spamd |
143 |
|
144 |
if use doc; then |
145 |
dodoc NOTICE TRADEMARK CREDITS INSTALL INSTALL.VMS UPGRADE USAGE \ |
146 |
sql/README.bayes sql/README.awl procmailrc.example sample-nonspam.txt \ |
147 |
sample-spam.txt spamassassin.spec spamd/PROTOCOL spamd/README.vpopmail \ |
148 |
spamd-apache2/README.apache |
149 |
|
150 |
# Rename some docu files so they don't clash with others |
151 |
newdoc spamd/README README.spamd |
152 |
newdoc sql/README README.sql |
153 |
newdoc ldap/README README.ldap |
154 |
use qmail && newdoc spamc/README.qmail README.qmail |
155 |
|
156 |
dohtml doc/*.html |
157 |
docinto sql |
158 |
dodoc sql/*.sql |
159 |
fi |
160 |
|
161 |
# Install provided tools. See bug 108168 |
162 |
if use tools; then |
163 |
docinto tools |
164 |
dodoc tools/* |
165 |
fi |
166 |
|
167 |
cp "${FILESDIR}"/secrets.cf "${D}"/etc/mail/spamassassin/secrets.cf.example |
168 |
fperms 0400 /etc/mail/spamassassin/secrets.cf.example |
169 |
echo "">>${D}/etc/mail/spamassassin/local.cf.example |
170 |
echo "# Sensitive data, such as database connection info, should">>${D}/etc/mail/spamassassin/local.cf.example |
171 |
echo "# be stored in /etc/mail/spamassassin/secrets.cf with">>${D}/etc/mail/spamassassin/local.cf.example |
172 |
echo "# appropriate permissions">>${D}/etc/mail/spamassassin/local.cf.example |
173 |
} |
186 |
} |
174 |
|
187 |
|
175 |
pkg_postinst() { |
188 |
pkg_postinst() { |
176 |
perl-module_pkg_postinst |
189 |
perl-module_pkg_postinst |
177 |
|
190 |
echo |
178 |
if ! has_version "perl-core/DB_File"; then |
191 |
elog "If you plan on using the -u flag to spamd, please read the notes" |
179 |
einfo "The Bayes backend requires the Berkeley DB to store its data. You" |
192 |
elog "in /etc/conf.d/spamd regarding the location of the pid file." |
180 |
einfo "need to emerge perl-core/DB_File or USE=berkdb to make it available." |
193 |
elog "If you build ${PN} with optional dependancy support," |
181 |
fi |
194 |
elog "you can enable them in /etc/mail/spamassassin/init.pre" |
182 |
|
195 |
echo |
183 |
if has_version "mail-filter/razor"; then |
|
|
184 |
if ! has_version ">=mail-filter/razor-2.61"; then |
185 |
ewarn "You have $(best_version mail-filter/razor) installed but SpamAssassin" |
186 |
if has_version "<mail-filter/razor-2.40"; then |
187 |
ewarn "requires at least version 2.40, version 2.61 or later is recommended." |
188 |
else |
189 |
ewarn "recommends at least version 2.61." |
190 |
fi |
191 |
fi |
192 |
fi |
193 |
|
194 |
if use doc; then |
195 |
einfo |
196 |
einfo "Please read the file INSTALL in" |
197 |
einfo " /usr/share/doc/${PF}/" |
198 |
einfo "to find out which optional modules you need to install to enable" |
199 |
einfo "additional features which depend on them." |
200 |
einfo |
201 |
einfo "If upgraded from 2.x, please read the file UPGRADE in" |
202 |
einfo " /usr/share/doc/${PF}/" |
203 |
einfo |
204 |
fi |
205 |
|
206 |
ewarn |
207 |
ewarn "spamd is not designed to listen to an untrusted network" |
208 |
ewarn "and is vulnerable to DoS attacks (and eternal doom) if" |
209 |
ewarn "configured to do so" |
210 |
ewarn |
211 |
elog "If you plan on using the -u flag to spamd, please read the notes" |
212 |
elog "in /etc/conf.d/spamd regarding the location of the pid file." |
213 |
|
214 |
einfo |
215 |
einfo "If you build ${PN} with optional dependancy support," |
216 |
einfo "you can enable them in /etc/mail/spamassassin/init.pre" |
217 |
einfo |
218 |
|
219 |
if has_version '>=dev-lang/perl-5.8.8'; then |
220 |
elog "A note from the SA developers:" |
221 |
elog "Perl 5.8 now uses Unicode internally by default, which causes trouble for" |
222 |
elog "SpamAssassin (and almost all other reasonably complex pieces of perl" |
223 |
elog "code!)." |
224 |
elog "" |
225 |
elog "We've worked around this in most places, as far as we know, but there may" |
226 |
elog "still be some issues. In addition, there is a speed hit, which it would" |
227 |
elog "be nice to avoid." |
228 |
elog "" |
229 |
elog "Setting the LANG environment variable before any invocation of" |
230 |
elog "SpamAssassin sometimes seems to help fix it, like so:" |
231 |
elog "" |
232 |
elog " export LANG=en_US" |
233 |
elog "" |
234 |
elog "Notably, the LANG setting must not include \"utf8\". However, some folks" |
235 |
elog "have reported that this makes no difference. ;)" |
236 |
fi |
237 |
einfo |
238 |
if ! has_version 'dev-perl/Mail-SPF-Query'; then |
239 |
elog "For spf support, please emerge dev-perl/Mail-SPF-Query" |
240 |
fi |
241 |
if ! has_version 'mail-filter/dcc'; then |
242 |
elog "For dcc support, please emerge mail-filter/dcc" |
243 |
fi |
244 |
if ! has_version 'dev-python/pyzor'; then |
245 |
elog "For pyzor support, please emerge dev-python/pyzor" |
246 |
fi |
247 |
if ! has_version 'mail-filter/razor'; then |
248 |
elog "For razor support, please emerge mail-filter/razor" |
249 |
fi |
250 |
einfo |
251 |
elog "For addtional functionality, you may wish to emerge:" |
252 |
elog "dev-perl/IP-Country dev-perl/Net-Ident " |
253 |
elog "dev-perl/Mail-DKIM" |
254 |
|
255 |
} |
196 |
} |