Gentoo Archives: gentoo-commits

From: Julian Ospald <hasufell@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-antivirus/clamav/
Date: Sun, 04 Oct 2015 19:36:59
Message-Id: 1443985373.4b4813024db621171c6e76bbd91524748b075b25.hasufell@gentoo
1 commit: 4b4813024db621171c6e76bbd91524748b075b25
2 Author: Julian Ospald <hasufell <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 4 19:02:53 2015 +0000
4 Commit: Julian Ospald <hasufell <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 4 19:02:53 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b481302
7
8 app-antivirus/clamav: add libressl support
9
10 app-antivirus/clamav/clamav-0.98.7-r1.ebuild | 140 +++++++++++++++++++++++++++
11 1 file changed, 140 insertions(+)
12
13 diff --git a/app-antivirus/clamav/clamav-0.98.7-r1.ebuild b/app-antivirus/clamav/clamav-0.98.7-r1.ebuild
14 new file mode 100644
15 index 0000000..565b0c5
16 --- /dev/null
17 +++ b/app-antivirus/clamav/clamav-0.98.7-r1.ebuild
18 @@ -0,0 +1,140 @@
19 +# Copyright 1999-2015 Gentoo Foundation
20 +# Distributed under the terms of the GNU General Public License v2
21 +# $Id$
22 +
23 +EAPI=5
24 +
25 +inherit eutils flag-o-matic user systemd
26 +
27 +DESCRIPTION="Clam Anti-Virus Scanner"
28 +HOMEPAGE="http://www.clamav.net/"
29 +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
30 +
31 +LICENSE="GPL-2"
32 +SLOT="0"
33 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
34 +IUSE="bzip2 clamdtop iconv ipv6 libressl milter metadata-analysis-api selinux static-libs uclibc"
35 +
36 +CDEPEND="bzip2? ( app-arch/bzip2 )
37 + clamdtop? ( sys-libs/ncurses:0 )
38 + iconv? ( virtual/libiconv )
39 + metadata-analysis-api? ( dev-libs/json-c )
40 + milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
41 + dev-libs/libtommath
42 + >=sys-libs/zlib-1.2.2
43 + !libressl? ( dev-libs/openssl:0 )
44 + libressl? ( dev-libs/libressl )
45 + sys-devel/libtool"
46 +# openssl is now *required* see this link as to why
47 +# http://blog.clamav.net/2014/02/introducing-openssl-as-dependency-to.html
48 +DEPEND="${CDEPEND}
49 + virtual/pkgconfig"
50 +RDEPEND="${CDEPEND}
51 + selinux? ( sec-policy/selinux-clamav )"
52 +
53 +DOCS=( AUTHORS BUGS ChangeLog FAQ INSTALL NEWS README UPGRADE )
54 +
55 +pkg_setup() {
56 + enewgroup clamav
57 + enewuser clamav -1 -1 /dev/null clamav
58 +}
59 +
60 +src_prepare() {
61 + use ppc64 && append-flags -mminimal-toc
62 + use uclibc && export ac_cv_type_error_t=yes
63 +}
64 +
65 +src_configure() {
66 + econf \
67 + --disable-experimental \
68 + --disable-fanotify \
69 + --enable-id-check \
70 + --with-dbdir="${EPREFIX}"/var/lib/clamav \
71 + --with-system-tommath \
72 + --with-zlib="${EPREFIX}"/usr \
73 + $(use_enable bzip2) \
74 + $(use_enable clamdtop) \
75 + $(use_enable ipv6) \
76 + $(use_enable milter) \
77 + $(use_enable static-libs static) \
78 + $(use_with iconv) \
79 + $(use_with metadata-analysis-api libjson /usr)
80 +}
81 +
82 +src_install() {
83 + default
84 +
85 + rm -rf "${ED}"/var/lib/clamav
86 + newinitd "${FILESDIR}"/clamd.initd-r6 clamd
87 + newconfd "${FILESDIR}"/clamd.conf-r1 clamd
88 +
89 + systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
90 + systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
91 + systemd_dounit "${FILESDIR}/clamd.service"
92 + systemd_dounit "${FILESDIR}/freshclamd.service"
93 +
94 + keepdir /var/lib/clamav
95 + fowners clamav:clamav /var/lib/clamav
96 + keepdir /var/log/clamav
97 + fowners clamav:clamav /var/log/clamav
98 +
99 + dodir /etc/logrotate.d
100 + insinto /etc/logrotate.d
101 + newins "${FILESDIR}"/clamav.logrotate clamav
102 +
103 + # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
104 + sed -i -e "s:^\(Example\):\# \1:" \
105 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
106 + -e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
107 + -e "s:.*\(User\) .*:\1 clamav:" \
108 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
109 + -e "s:^\#\(LogTime\).*:\1 yes:" \
110 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
111 + "${ED}"/etc/clamd.conf.sample || die
112 + sed -i -e "s:^\(Example\):\# \1:" \
113 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
114 + -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
115 + -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
116 + -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
117 + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
118 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
119 + "${ED}"/etc/freshclam.conf.sample || die
120 +
121 + if use milter ; then
122 + # MilterSocket one to include ' /' because there is a 2nd line for
123 + # inet: which we want to leave
124 + dodoc "${FILESDIR}"/clamav-milter.README.gentoo
125 + sed -i -e "s:^\(Example\):\# \1:" \
126 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
127 + -e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
128 + -e "s:.*\(User\) .*:\1 clamav:" \
129 + -e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
130 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
131 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
132 + "${ED}"/etc/clamav-milter.conf.sample || die
133 + cat >> "${ED}"/etc/conf.d/clamd <<-EOF
134 + MILTER_NICELEVEL=19
135 + START_MILTER=no
136 + EOF
137 +
138 + systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
139 + fi
140 +
141 + for i in clamd freshclam clamav-milter
142 + do
143 + [[ -f "${D}"/etc/"${i}".conf.sample ]] && mv "${D}"/etc/"${i}".conf{.sample,}
144 + done
145 +
146 + prune_libtool_files --all
147 +}
148 +
149 +pkg_postinst() {
150 + if use milter ; then
151 + elog "For simple instructions how to setup the clamav-milter read the"
152 + elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
153 + fi
154 + if test -z $(find "${ROOT}"var/lib/clamav -maxdepth 1 -name 'main.c*' -print -quit) ; then
155 + ewarn "You must run freshclam manually to populate the virus database files"
156 + ewarn "before starting clamav for the first time.\n"
157 + fi
158 +}