Gentoo Archives: gentoo-commits

From: Thomas Raschbacher <lordvan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-antivirus/clamav/
Date: Thu, 23 Apr 2020 21:18:14
Message-Id: 1587676674.138be508c2b37f4575ccd26114171e809e51594e.lordvan@gentoo
1 commit: 138be508c2b37f4575ccd26114171e809e51594e
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Thu Apr 23 19:29:09 2020 +0000
4 Commit: Thomas Raschbacher <lordvan <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 23 21:17:54 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=138be508
7
8 app-antivirus/clamav: remove static-libs useflag
9
10 as per policy
11 https://projects.gentoo.org/qa/policy-guide/installed-files.html?highlight=static#pg0302
12 for more context read:
13 https://flameeyes.blog/2011/08/29/useless-flag-static-libs/
14 https://archives.gentoo.org/gentoo-dev/message/2dada80c2b9c85b0e83e6328428bf8ab
15
16 Package-Manager: Portage-2.3.99, Repoman-2.3.22
17 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
18 Closes: https://github.com/gentoo/gentoo/pull/15489
19 Signed-off-by: Thomas Raschbacher <lordvan <AT> gentoo.org>
20
21 app-antivirus/clamav/clamav-0.102.2-r2.ebuild | 214 ++++++++++++++++++++++++++
22 1 file changed, 214 insertions(+)
23
24 diff --git a/app-antivirus/clamav/clamav-0.102.2-r2.ebuild b/app-antivirus/clamav/clamav-0.102.2-r2.ebuild
25 new file mode 100644
26 index 00000000000..35a1db0325c
27 --- /dev/null
28 +++ b/app-antivirus/clamav/clamav-0.102.2-r2.ebuild
29 @@ -0,0 +1,214 @@
30 +# Copyright 1999-2020 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=7
34 +
35 +inherit autotools flag-o-matic systemd
36 +
37 +DESCRIPTION="Clam Anti-Virus Scanner"
38 +HOMEPAGE="https://www.clamav.net/"
39 +SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz"
40 +
41 +LICENSE="GPL-2"
42 +SLOT="0"
43 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
44 +IUSE="bzip2 doc clamdtop clamsubmit iconv ipv6 libclamav-only libressl milter metadata-analysis-api selinux test uclibc xml"
45 +
46 +REQUIRED_USE="libclamav-only? ( !clamdtop !clamsubmit !milter !metadata-analysis-api )"
47 +
48 +RESTRICT="!test? ( test )"
49 +
50 +# Require acct-{user,group}/clamav at build time so that we can set
51 +# the permissions on /var/lib/clamav in src_install rather than in
52 +# pkg_postinst; calling "chown" on the live filesystem scares me.
53 +CDEPEND="acct-group/clamav
54 + acct-user/clamav
55 + dev-libs/libltdl
56 + dev-libs/libmspack
57 + || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
58 + >=sys-libs/zlib-1.2.2:=
59 + bzip2? ( app-arch/bzip2 )
60 + clamdtop? ( sys-libs/ncurses:0 )
61 + clamsubmit? ( net-misc/curl dev-libs/json-c:= )
62 + elibc_musl? ( sys-libs/fts-standalone )
63 + iconv? ( virtual/libiconv )
64 + !libclamav-only? ( net-misc/curl )
65 + !libressl? ( dev-libs/openssl:0= )
66 + libressl? ( dev-libs/libressl:0= )
67 + milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
68 + xml? ( dev-libs/libxml2 )"
69 +
70 +BDEPEND="virtual/pkgconfig"
71 +
72 +DEPEND="${CDEPEND}
73 + metadata-analysis-api? ( dev-libs/json-c:* )
74 + test? ( dev-libs/check )"
75 +RDEPEND="${CDEPEND}
76 + selinux? ( sec-policy/selinux-clamav )"
77 +
78 +PATCHES=(
79 + "${FILESDIR}/${PN}-0.101.2-tinfo.patch" #670729
80 + "${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328
81 + "${FILESDIR}/${PN}-0.102.2-fix-curl-detection.patch" #709616
82 +)
83 +
84 +src_prepare() {
85 + default
86 + eautoconf
87 +}
88 +
89 +src_configure() {
90 + use elibc_musl && append-ldflags -lfts
91 + use ppc64 && append-flags -mminimal-toc
92 + use uclibc && export ac_cv_type_error_t=yes
93 +
94 + # according to configure help it should be
95 + # $(use_enable xml)
96 + # but that does not work
97 + # do not add this, since --disable-xml seems to override
98 + # --without-xml
99 + JSONUSE="--without-libjson"
100 +
101 + if use clamsubmit || use metadata-analysis-api; then
102 + # either of those 2 requires libjson.
103 + # clamsubmit will be built as soon as libjson and curl are found
104 + # but we only install the binary if requested
105 + JSONUSE="--with-libjson=${EPREFIX}/usr"
106 + fi
107 +
108 + local myeconfargs=(
109 + $(use_enable bzip2)
110 + $(use_enable clamdtop)
111 + $(use_enable ipv6)
112 + $(use_enable milter)
113 + $(use_enable test check)
114 + $(use_with xml)
115 + $(use_with iconv)
116 + ${JSONUSE}
117 + $(use_enable libclamav-only)
118 + $(use_with !libclamav-only libcurl)
119 + --with-system-libmspack
120 + --cache-file="${S}"/config.cache
121 + --disable-experimental
122 + --disable-static
123 + --disable-zlib-vcheck
124 + --enable-id-check
125 + --with-dbdir="${EPREFIX}"/var/lib/clamav
126 + # Don't call --with-zlib=/usr (see bug #699296)
127 + --with-zlib
128 + --disable-llvm
129 + )
130 + econf "${myeconfargs[@]}"
131 +}
132 +
133 +src_install() {
134 + default
135 +
136 + rm -rf "${ED}"/var/lib/clamav || die
137 +
138 + if ! use libclamav-only ; then
139 + newinitd "${FILESDIR}"/clamd.initd-r6 clamd
140 + newconfd "${FILESDIR}"/clamd.conf-r1 clamd
141 +
142 + systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
143 + systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
144 + systemd_dounit "${FILESDIR}/clamd.service"
145 + systemd_dounit "${FILESDIR}/freshclamd.service"
146 +
147 + insinto /etc/logrotate.d
148 + newins "${FILESDIR}"/clamav.logrotate clamav
149 +
150 + # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
151 + sed -i -e "s:^\(Example\):\# \1:" \
152 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
153 + -e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
154 + -e "s:.*\(User\) .*:\1 clamav:" \
155 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
156 + -e "s:^\#\(LogTime\).*:\1 yes:" \
157 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
158 + -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
159 + "${ED}"/etc/clamd.conf.sample || die
160 +
161 + sed -i -e "s:^\(Example\):\# \1:" \
162 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
163 + -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
164 + -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
165 + -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
166 + -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
167 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
168 + -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
169 + "${ED}"/etc/freshclam.conf.sample || die
170 +
171 + if use milter ; then
172 + # MilterSocket one to include ' /' because there is a 2nd line for
173 + # inet: which we want to leave
174 + ##dodoc "${FILESDIR}"/clamav-milter.README.gentoo
175 + sed -i -e "s:^\(Example\):\# \1:" \
176 + -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
177 + -e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
178 + -e "s:.*\(User\) .*:\1 clamav:" \
179 + -e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
180 + -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
181 + -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
182 + "${ED}"/etc/clamav-milter.conf.sample || die
183 +
184 + cat >> "${ED}"/etc/conf.d/clamd <<-EOF
185 + MILTER_NICELEVEL=19
186 + START_MILTER=no
187 + EOF
188 +
189 + systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
190 + fi
191 +
192 + local i
193 + for i in clamd freshclam clamav-milter
194 + do
195 + if [[ -f "${ED}"/etc/"${i}".conf.sample ]]; then
196 + mv "${ED}"/etc/"${i}".conf{.sample,} || die
197 + fi
198 + done
199 +
200 + # These both need to be writable by the clamav user.
201 + # TODO: use syslog by default; that's what it's for.
202 + diropts -o clamav -g clamav
203 + keepdir /var/lib/clamav
204 + keepdir /var/log/clamav
205 + fi
206 +
207 + if use doc ; then
208 + local HTML_DOCS=( docs/html/. )
209 + einstalldocs
210 +
211 + if ! use libclamav-only ; then
212 + doman docs/man/*.[1-8]
213 + fi
214 + fi
215 +
216 + find "${ED}" -name '*.la' -delete || die
217 +}
218 +
219 +src_test() {
220 + if use libclamav-only ; then
221 + ewarn "Test target not available when USE=libclamav-only is set, skipping tests ..."
222 + return 0
223 + fi
224 +
225 + emake quick-check
226 +}
227 +
228 +pkg_postinst() {
229 + if use milter ; then
230 + elog "For simple instructions how to setup the clamav-milter read the"
231 + elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
232 + fi
233 +
234 + local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
235 + if [[ ! -f "${databases}" ]] ; then
236 + ewarn "You must run freshclam manually to populate the virus database"
237 + ewarn "before starting clamav for the first time."
238 + fi
239 +
240 + elog "For instructions on how to use clamonacc, see"
241 + elog
242 + elog " https://www.clamav.net/documents/on-access-scanning"
243 +}