repo/gentoo:master commit in: app-antivirus/clamav/
"Matt Jolly" <[email protected]> Wed, 05 Aug 2026 11:26:22 +0000 (UTC)
| Newsgroups | gmane.linux.gentoo.cvs |
|---|---|
| Message-ID | <1785929176.df1dc2ea300bfa9f1fd1c31ef87be6f43a95ea8c.kangie@gentoo> |
commit: df1dc2ea300bfa9f1fd1c31ef87be6f43a95ea8c
Author: Matt Jolly <kangie <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 5 11:14:10 2026 +0000
Commit: Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Wed Aug 5 11:26:16 2026 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df1dc2ea
app-antivirus/clamav: add 1.4.5, 1.5.3
Bug: https://bugs.gentoo.org/978443
Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>
app-antivirus/clamav/Manifest | 4 +
app-antivirus/clamav/clamav-1.4.5.ebuild | 285 +++++++++++++++++++++++++++++++
app-antivirus/clamav/clamav-1.5.3.ebuild | 285 +++++++++++++++++++++++++++++++
3 files changed, 574 insertions(+)
diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest
index 5deb8071a5ae..aca5002cd3a7 100644
--- a/app-antivirus/clamav/Manifest
+++ b/app-antivirus/clamav/Manifest
@@ -67,9 +67,13 @@ DIST clamav-1.4.2.tar.gz 13427816 BLAKE2B 22c1cb99da3187fa127b01d1dec7a0857b3aee
DIST clamav-1.4.3.tar.gz 13431353 BLAKE2B bb775323df020949dfd793e5f145686eaa417a6f10894b1c4ff535ca547d4e943bdf519e63519c31957a19ead18dc560db799f36a7bf07a7b5e44a107acd1877 SHA512 af5f3e60b0098a9bea1cc4283e7fa230f3a3d1d2f760f92eb7a67497a7b21a7526d73ceb4e9f3130f698552f63b47923da03c8e188cd2f5a4c8aa35e93a7625a
DIST clamav-1.4.4-crates.tar.xz 14236120 BLAKE2B 75ded8840297edfe38f02ca865c54a04052725ca0ff83c9c910432e438dfcdde9998e48b86109faf6906c0044e7876a447bfea46ac68b118f43b3c1ac9ae16ac SHA512 58b0de2dd0bbb9097765f1964faf15d96fe78a16ba437b54c7cfb5f347bf89617b1810dafef35e56bae065e94755234eee5bdcd782f25336963dca9a6bcb3fe5
DIST clamav-1.4.4.tar.gz 13434833 BLAKE2B 1796aa752026145e3a7602f2f8c046c127908d857e1e1478c0b3b23eb585c9f0ec6ea89a0ab903f95b5b41cd9c99e4cf992a498302aed4bfb4ac085b6db42463 SHA512 d3777b19996f87591432e03f53dfdee16923642ce0e8e047a181536a61bf548c4010471a2686b450b04c9573d0bb2b937a8c950a2a2a8c31f2c3188e51447781
+DIST clamav-1.4.5-crates.tar.xz 14239924 BLAKE2B cff1a8a89fe1ebfc11522172447d7c1038d12b16e7d324f8d9e280d3b38cf18b6213ec4a43289f3187edffc902b6cf789a805eb0524ca102d7899f1c5dcdff03 SHA512 b373dceea0daf9f37b17bbf02dbf09d383ddc842d9cdf3252158607eca332e040e38c52d6e0ac6b74d80c468b646ea8de7781983a6aaedac4f8cba670f913918
+DIST clamav-1.4.5.tar.gz 13480089 BLAKE2B 394443d39065814554712b45e4a81d115e531ef9757384ad6c30655aa283a457535faa9e2d4994b631cbbaf75caf6d7f6b3d4875005fcc67208fcf48ffa66955 SHA512 4a7b7668ce76b0ba24df789cbbc49b9232add86c7250982621c23565abc87daede41aaba6ed34d1d1276916fe4dd7077e1520c6acea6b87f36234aa168480772
DIST clamav-1.5.1.tar.gz 13988704 BLAKE2B 49ba4e89ec4d3d76bbe8daa3bc5131d068b5b336a9b910fdea09fdefa44e886d1254140ed0ae621786b2db5f80fbd27bb66ea6b3dde643fbabce1a0160e5303d SHA512 aecf30cd4629716bb2f09d433a21a2905d3e60bbc7c5fc8b7c69e064b6523b4683d7631542f1a66692810bfeaf0adc549ff2ea891b37139f99488e370dc2a211
DIST clamav-1.5.2-crates.tar.xz 18027960 BLAKE2B 371b9a5a9408cc45d8cf5cb475fff721a10ff00248e4abea52c8dcc06838cfda718b6d5c0b83b6c10042d57a51dd73458919f2f584b6922c3a5baa1c3738e5f4 SHA512 f6cc78722d17d9b208f89f92b3b6e7840b2e801796df564ca774048e3b9d587725de0b1f5d686a0f496b367dd82968c55d513651c342fd43aa2d253c8c5df40f
DIST clamav-1.5.2.tar.gz 13988755 BLAKE2B e7b282aa85f0d2eeee619218e8d8a5eb2cca9000676ec6bdb8ff6f6e2832e8b5f121369a5d4d652053b55389d863c29b88691612b66d0b045d18817397b6f0a2 SHA512 bbf277340ac9b18aebe82f4fef67f79aaa5b058e56490f0fb58e1bb5fb8fcd057b312e7d4e502ba5710e92311e155177c571eb70acff83771c635cf2bc28da4f
+DIST clamav-1.5.3-crates.tar.xz 17931012 BLAKE2B 17f03353f85c23dea1f748d95632d5100459803388d6ff139585ce29a42b066c11263373fd43a611004959d071bf90900b9411ca9b146e9663d72b6054bf28f0 SHA512 8f4c6c968e8092fd9985c5a1811f92a4a459f31a1def512de15caf04b90719db3c8c485f861d4726dce7c59a6ec1d5ef5d1be574a6e66b2590a00733298382f5
+DIST clamav-1.5.3.tar.gz 14034215 BLAKE2B 36924c261cda876fc0e4460713be4f9a15c7136e7a0f71ad50e14deebe50611a08b73b140043a0b48b5b3a63dbf8bab13b376e0f2c5ca7b687ba6fd2864be6ce SHA512 6190d25976c89fbff76923fb795cd013037667c8e4c0ccaf69f1054756c013f5ef490e3b7acc53f5ee4cf6b6e7e2262b197961f744dafcd425539165f762704c
DIST clamav-signature-util-7cfeb7f630ce472239f5b0a794b62df7f592acc7.gh.tar.gz 92545 BLAKE2B b3663142d7321ac665dca8a505060301c74b7f6f1f316b1a043340231687e750997b77e78c0b77ba913db1fc5d6a1a1aefd2b72b6e1fff3a77940159aa2da33c SHA512 449120d22fb0e7d1a28dff410ade017d86e21ab7044a759e0693e1cd60db37b49798f1fc74252f87b5ae7f66afb80365a89cfffe165ee7437695b71737f2c3fb
DIST clang-sys-1.4.0.crate 38679 BLAKE2B d15bdae2142ed26b4f6bd037bd2062e8c4b7b87fc5b749b872a95ff1952d000066c255aa0984e5f9c4a5c88066db4a20cfd048db4ba5a59b331d5ffa5e9a281d SHA512 062189bb0a341e2e85de4987f4b564c1fc69e4005c9c42cfedb61dee5f48db9126a8114d1d97be1b9c21b8c885243751232fbe8cf532e1d2be593308fe45216a
DIST clang-sys-1.7.0.crate 42088 BLAKE2B d1ed314a910c1b676eb780fc1c96f5ac391217ec135480d0a91b11d6f447ad06484b48966ae99115e35d921a506caf6aa7ffbc4ed86aa64367dca321678cfd7d SHA512 e544984d5bd76824ea2093f43f98b59a99e1ca8a5de40e49164b870ed4a91a530f3492faf0678190b91e74aa5d122bdbb32c649998d0ce24912dfb0b83ed6b81
diff --git a/app-antivirus/clamav/clamav-1.4.5.ebuild b/app-antivirus/clamav/clamav-1.4.5.ebuild
new file mode 100644
index 000000000000..c6af848a2b04
--- /dev/null
+++ b/app-antivirus/clamav/clamav-1.4.5.ebuild
@@ -0,0 +1,285 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{11..14} )
+RUST_MIN_VER="1.87.0"
+
+# Get the commit from the CLAM-2329-new-from-slice branch
+declare -A GIT_CRATES=(
+ [onenote_parser]='https://github.com/Cisco-Talos/onenote.rs;8b450447e58143004b68dd21c11b710fdb79be92;onenote.rs-%commit%'
+)
+
+inherit cargo cmake eapi9-ver flag-o-matic python-any-r1 systemd tmpfiles
+
+MY_P=${P//_/-}
+
+DESCRIPTION="Clam Anti-Virus Scanner"
+HOMEPAGE="https://www.clamav.net/"
+SRC_URI="https://github.com/Cisco-Talos/clamav/archive/refs/tags/${MY_P}.tar.gz
+ https://deps.gentoo.zip/app-antivirus/clamav/${P}-crates.tar.xz
+ ${CARGO_CRATE_URIS}" # For the GIT_CRATES - use a crate tarball for everything else please.
+S=${WORKDIR}/clamav-${MY_P}
+
+LICENSE="Apache-2.0 BSD GPL-2 ISC MIT MPL-2.0 Unicode-DFS-2016 ZLIB"
+# 0/sts (short term support) if not an LTS release (typically odd and even minor versions respectively)
+if [[ $(( $(ver_cut 2) % 2 )) -eq 0 ]] ; then
+ SLOT="0/lts"
+else
+ SLOT="0/sts"
+fi
+
+if [[ ${PV} != *_rc* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
+fi
+
+IUSE="doc clamonacc +clamapp experimental libclamav-only milter rar selinux +system-mspack systemd test"
+
+REQUIRED_USE="libclamav-only? ( !clamonacc !clamapp !milter )
+ clamonacc? ( clamapp )
+ milter? ( clamapp )
+ test? ( !libclamav-only )"
+
+RESTRICT="!test? ( test )"
+
+# Require acct-{user,group}/clamav at build time so that we can set
+# the permissions on /var/lib/clamav in src_install rather than in
+# pkg_postinst; calling "chown" on the live filesystem scares me.
+COMMON_DEPEND="
+ acct-group/clamav
+ acct-user/clamav
+ app-arch/bzip2
+ dev-libs/check:=
+ dev-libs/json-c:=
+ dev-libs/libltdl
+ dev-libs/libpcre2:=
+ dev-libs/libxml2:=
+ dev-libs/openssl:=
+ >=virtual/zlib-1.2.2:=
+ virtual/libiconv
+ !libclamav-only? ( net-misc/curl )
+ clamapp? ( sys-libs/ncurses:= net-misc/curl )
+ elibc_musl? ( sys-libs/fts-standalone )
+ milter? ( mail-filter/libmilter:= )
+ rar? ( app-arch/unrar )
+ system-mspack? ( dev-libs/libmspack )
+ test? ( dev-python/pytest )
+"
+
+BDEPEND="
+ virtual/pkgconfig
+ doc? ( app-text/doxygen )
+ test? (
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep 'dev-python/pytest[${PYTHON_USEDEP}]')
+ )
+"
+
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-libs/check )"
+
+RDEPEND="${COMMON_DEPEND}
+ selinux? ( sec-policy/selinux-clamav )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.4.1-pointer-types.patch"
+)
+
+python_check_deps() {
+ python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+ rust_pkg_setup
+ use test && python-any-r1_pkg_setup
+}
+
+src_prepare() {
+ cmake_src_prepare
+}
+
+src_configure() {
+ use elibc_musl && append-ldflags -lfts
+ use ppc64 && append-flags -mminimal-toc
+
+ local mycmakeargs=(
+ -DAPP_CONFIG_DIRECTORY="${EPREFIX}"/etc/clamav
+ -DBYTECODE_RUNTIME="interpreter" # https://github.com/Cisco-Talos/clamav/issues/581 (does not support modern llvm)
+ -DCLAMAV_GROUP="clamav"
+ -DCLAMAV_USER="clamav"
+ -DDATABASE_DIRECTORY="${EPREFIX}"/var/lib/clamav
+ -DENABLE_APP=$(usex clamapp ON OFF)
+ -DENABLE_CLAMONACC=$(usex clamonacc ON OFF)
+ -DENABLE_DOXYGEN=$(usex doc)
+ -DENABLE_EXPERIMENTAL=$(usex experimental ON OFF)
+ -DENABLE_EXTERNAL_MSPACK=$(usex system-mspack ON OFF)
+ -DENABLE_JSON_SHARED=ON
+ -DENABLE_MAN_PAGES=ON
+ -DENABLE_MILTER=$(usex milter ON OFF)
+ -DENABLE_SHARED_LIB=ON
+ -DENABLE_STATIC_LIB=OFF
+ -DENABLE_SYSTEMD=$(usex systemd ON OFF)
+ -DENABLE_TESTS=$(usex test ON OFF)
+ -DENABLE_UNRAR=$(usex rar ON OFF)
+ -DOPTIMIZE=ON
+ )
+
+ if use test ; then
+ # https://bugs.gentoo.org/818673
+ # Used to enable some more tests but doesn't behave well in
+ # sandbox necessarily(?) + needs certain debug symbols present
+ # in e.g. glibc.
+ mycmakeargs+=(
+ -DCMAKE_DISABLE_FIND_PACKAGE_Valgrind=ON
+ -DPYTHON_FIND_VERSION="${EPYTHON#python}"
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # init scripts
+ newinitd "${FILESDIR}/clamd.initd" clamd
+ newinitd "${FILESDIR}/freshclam.initd" freshclam
+ if use clamonacc; then
+ newinitd "${FILESDIR}/clamonacc.initd.2" clamonacc
+ newconfd "${FILESDIR}/clamonacc.confd" clamonacc
+ fi
+ use milter && \
+ newinitd "${FILESDIR}/clamav-milter.initd" clamav-milter
+
+ if ! use libclamav-only ; then
+ if use systemd ; then
+ # OpenRC services ensure their own permissions, so we can avoid
+ # a dependency on sys-apps/systemd-utils[tmpfiles] here, though
+ # we can change our minds and use it if we want to.
+ dotmpfiles "${FILESDIR}/tmpfiles.d/clamav-r1.conf"
+ fi
+
+ if use clamapp ; then
+ # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
+ local clamd_sed_args=(
+ -e "s:^\(Example\):\# \1:"
+ -e "s:^#\(PidFile\) .*:\1 ${EPREFIX}/run/clamd.pid:"
+ -e "s/^#\(User .*\)/\1/"
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:"
+ -e "s:^\#\(LogTime\).*:\1 yes:"
+ -e "s/^#\(DatabaseDirectory .*\)/\1/"
+ )
+
+ # 966587 - the systemd unit uses a different socket path
+ if use systemd; then
+ clamd_sed_args+=(
+ -e "s:^#\(LocalSocket \)/run.*:\1${EPREFIX}/run/clamav/clamd.ctl:"
+ )
+ else
+ clamd_sed_args+=(
+ # There's one in /tmp that we don't want to default-enable
+ -e "s:^#\(LocalSocket /run.*\):\1:"
+ )
+ fi
+
+ sed "${clamd_sed_args[@]}" \
+ "${ED}"/etc/clamav/clamd.conf.sample > \
+ "${ED}"/etc/clamav/clamd.conf || die
+
+ local freshclam_sed_args=(
+ -e "s:^\(Example\):\# \1:"
+ -e "s:^#\(PidFile\) .*:\1 ${EPREFIX}/run/freshclam.pid:"
+ -e "s/^#\(DatabaseOwner .*\)/\1/"
+ -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:"
+ -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamav/clamd.conf:"
+ -e "s:^\#\(ScriptedUpdates\).*:\1 yes:"
+ -e "s/^#\(DatabaseDirectory .*\)/\1/"
+ )
+ sed "${freshclam_sed_args[@]}" \
+ "${ED}"/etc/clamav/freshclam.conf.sample > \
+ "${ED}"/etc/clamav/freshclam.conf || die
+
+ if use milter ; then
+ # Note: only keep the "unix" ClamdSocket and MilterSocket!
+ local milter_sed_args=(
+ -e "s:^\(Example\):\# \1:"
+ -e "s:^\#\(PidFile\) .*:\1 ${EPREFIX}/run/clamav-milter.pid:"
+ -e "s/^#\(ClamdSocket unix:.*\)/\1/"
+ -e "s/^#\(User .*\)/\1/"
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:"
+ )
+ sed "${milter_sed_args[@]}" \
+ "${ED}"/etc/clamav/clamav-milter.conf.sample > \
+ "${ED}"/etc/clamav/clamav-milter.conf || die
+
+ systemd_newunit "${FILESDIR}/clamav-milter.service-0.104.0" clamav-milter.service
+ fi
+
+ local i
+ for i in clamd freshclam clamav-milter
+ do
+ if [[ -f "${ED}"/etc/"${i}".conf.sample ]] ; then
+ mv "${ED}"/etc/"${i}".conf{.sample,} || die
+ fi
+ done
+
+ # These both need to be writable by the clamav user
+ # TODO: use syslog by default; that's what it's for.
+ diropts -o clamav -g clamav
+ keepdir /var/lib/clamav
+ keepdir /var/log/clamav
+ fi
+ fi
+
+ if use doc ; then
+ local HTML_DOCS=( docs/html/. )
+ einstalldocs
+ fi
+
+ # Don't install man pages for utilities we didn't install
+ if use libclamav-only ; then
+ rm -r "${ED}"/usr/share/man || die
+ fi
+
+ find "${ED}" -name '*.la' -delete || die
+}
+
+pkg_postinst() {
+ if ! use libclamav-only ; then
+ if use systemd ; then
+ tmpfiles_process clamav-r1.conf
+ fi
+ fi
+
+ if use milter ; then
+ elog "For simple instructions how to setup the clamav-milter read the"
+ elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
+ fi
+
+ local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
+ if [[ ! -f "${databases}" ]] ; then
+ ewarn "You must run freshclam manually to populate the virus database"
+ ewarn "before starting clamav for the first time."
+ fi
+
+ if ! systemd_is_booted ; then
+ ewarn "This version of ClamAV provides separate OpenRC services"
+ ewarn "for clamd, freshclam, clamav-milter, and clamonacc. The"
+ ewarn "clamd service now starts only the clamd daemon itself. You"
+ ewarn "should add freshclam (and perhaps clamav-milter) to any"
+ ewarn "runlevels that previously contained clamd."
+ else
+ if ver_replacing -le 1.3.1; then
+ ewarn "From 1.3.1-r1 the Gentoo-provided systemd services have been"
+ ewarn "Retired in favour of using the units shipped by upstream."
+ ewarn "Ensure that any required services are configured and started."
+ ewarn "[email protected] has been retired as part of this transition."
+ fi
+ fi
+
+ if [[ -z ${REPLACING_VERSIONS} ]] && use clamonacc; then
+ einfo "'clamonacc' requires additional configuration before it"
+ einfo "can be enabled, and may not produce any output if not properly"
+ einfo "configured. Read the appropriate man page if clamonacc is desired."
+ fi
+
+}
diff --git a/app-antivirus/clamav/clamav-1.5.3.ebuild b/app-antivirus/clamav/clamav-1.5.3.ebuild
new file mode 100644
index 000000000000..40f85adee70c
--- /dev/null
+++ b/app-antivirus/clamav/clamav-1.5.3.ebuild
@@ -0,0 +1,285 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{11..14} )
+RUST_MIN_VER="1.87.0"
+
+declare -A GIT_CRATES=(
+ [clam-sigutil]='https://github.com/Cisco-Talos/clamav-signature-util;7cfeb7f630ce472239f5b0a794b62df7f592acc7;clamav-signature-util-%commit%'
+ [onenote_parser]='https://github.com/Cisco-Talos/onenote.rs;29c08532252b917543ff268284f926f30876bb79;onenote.rs-%commit%'
+)
+
+inherit cargo cmake eapi9-ver flag-o-matic python-any-r1 systemd tmpfiles
+
+MY_P=${P//_/-}
+
+DESCRIPTION="Clam Anti-Virus Scanner"
+HOMEPAGE="https://www.clamav.net/"
+SRC_URI="https://github.com/Cisco-Talos/clamav/archive/refs/tags/${MY_P}.tar.gz
+ https://deps.gentoo.zip/app-antivirus/clamav/${P}-crates.tar.xz
+ ${CARGO_CRATE_URIS}" # For the GIT_CRATES - use a crate tarball for everything else please.
+S=${WORKDIR}/clamav-${MY_P}
+
+LICENSE="Apache-2.0 BSD GPL-2 ISC MIT MPL-2.0 Unicode-DFS-2016 ZLIB"
+# 0/sts (short term support) if not an LTS release (typically odd and even minor versions respectively)
+if [[ $(( $(ver_cut 2) % 2 )) -eq 0 ]] ; then
+ SLOT="0/lts"
+else
+ SLOT="0/sts"
+fi
+
+if [[ ${PV} != *_rc* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
+fi
+
+IUSE="doc clamonacc +clamapp experimental libclamav-only milter rar selinux +system-mspack systemd test"
+
+REQUIRED_USE="libclamav-only? ( !clamonacc !clamapp !milter )
+ clamonacc? ( clamapp )
+ milter? ( clamapp )
+ test? ( !libclamav-only )"
+
+RESTRICT="!test? ( test )"
+
+# Require acct-{user,group}/clamav at build time so that we can set
+# the permissions on /var/lib/clamav in src_install rather than in
+# pkg_postinst; calling "chown" on the live filesystem scares me.
+COMMON_DEPEND="
+ acct-group/clamav
+ acct-user/clamav
+ app-arch/bzip2
+ dev-libs/check:=
+ dev-libs/json-c:=
+ dev-libs/libltdl
+ dev-libs/libpcre2:=
+ dev-libs/libxml2:=
+ dev-libs/openssl:=
+ >=virtual/zlib-1.2.2:=
+ virtual/libiconv
+ !libclamav-only? ( net-misc/curl )
+ clamapp? ( sys-libs/ncurses:= net-misc/curl )
+ elibc_musl? ( sys-libs/fts-standalone )
+ milter? ( mail-filter/libmilter:= )
+ rar? ( app-arch/unrar )
+ system-mspack? ( dev-libs/libmspack )
+ test? ( dev-python/pytest )
+"
+
+BDEPEND="
+ virtual/pkgconfig
+ doc? ( app-text/doxygen )
+ test? (
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep 'dev-python/pytest[${PYTHON_USEDEP}]')
+ )
+"
+
+DEPEND="${COMMON_DEPEND}
+ test? ( dev-libs/check )"
+
+RDEPEND="${COMMON_DEPEND}
+ selinux? ( sec-policy/selinux-clamav )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.4.1-pointer-types.patch"
+)
+
+python_check_deps() {
+ python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+ rust_pkg_setup
+ use test && python-any-r1_pkg_setup
+}
+
+src_prepare() {
+ cmake_src_prepare
+}
+
+src_configure() {
+ use elibc_musl && append-ldflags -lfts
+ use ppc64 && append-flags -mminimal-toc
+
+ local mycmakeargs=(
+ -DAPP_CONFIG_DIRECTORY="${EPREFIX}"/etc/clamav
+ -DBYTECODE_RUNTIME="interpreter" # https://github.com/Cisco-Talos/clamav/issues/581 (does not support modern llvm)
+ -DCLAMAV_GROUP="clamav"
+ -DCLAMAV_USER="clamav"
+ -DDATABASE_DIRECTORY="${EPREFIX}"/var/lib/clamav
+ -DENABLE_APP=$(usex clamapp ON OFF)
+ -DENABLE_CLAMONACC=$(usex clamonacc ON OFF)
+ -DENABLE_DOXYGEN=$(usex doc)
+ -DENABLE_EXPERIMENTAL=$(usex experimental ON OFF)
+ -DENABLE_EXTERNAL_MSPACK=$(usex system-mspack ON OFF)
+ -DENABLE_JSON_SHARED=ON
+ -DENABLE_MAN_PAGES=ON
+ -DENABLE_MILTER=$(usex milter ON OFF)
+ -DENABLE_SHARED_LIB=ON
+ -DENABLE_STATIC_LIB=OFF
+ -DENABLE_SYSTEMD=$(usex systemd ON OFF)
+ -DENABLE_TESTS=$(usex test ON OFF)
+ -DENABLE_UNRAR=$(usex rar ON OFF)
+ -DOPTIMIZE=ON
+ )
+
+ if use test ; then
+ # https://bugs.gentoo.org/818673
+ # Used to enable some more tests but doesn't behave well in
+ # sandbox necessarily(?) + needs certain debug symbols present
+ # in e.g. glibc.
+ mycmakeargs+=(
+ -DCMAKE_DISABLE_FIND_PACKAGE_Valgrind=ON
+ -DPYTHON_FIND_VERSION="${EPYTHON#python}"
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # init scripts
+ newinitd "${FILESDIR}/clamd.initd" clamd
+ newinitd "${FILESDIR}/freshclam.initd" freshclam
+ if use clamonacc; then
+ newinitd "${FILESDIR}/clamonacc.initd.2" clamonacc
+ newconfd "${FILESDIR}/clamonacc.confd" clamonacc
+ fi
+ use milter && \
+ newinitd "${FILESDIR}/clamav-milter.initd" clamav-milter
+
+ if ! use libclamav-only ; then
+ if use systemd ; then
+ # OpenRC services ensure their own permissions, so we can avoid
+ # a dependency on sys-apps/systemd-utils[tmpfiles] here, though
+ # we can change our minds and use it if we want to.
+ dotmpfiles "${FILESDIR}/tmpfiles.d/clamav-r1.conf"
+ fi
+
+ if use clamapp ; then
+ # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
+ local clamd_sed_args=(
+ -e "s:^\(Example\):\# \1:"
+ -e "s:^#\(PidFile\) .*:\1 ${EPREFIX}/run/clamd.pid:"
+ -e "s/^#\(User .*\)/\1/"
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:"
+ -e "s:^\#\(LogTime\).*:\1 yes:"
+ -e "s/^#\(DatabaseDirectory .*\)/\1/"
+ )
+
+ # 966587 - the systemd unit uses a different socket path
+ if use systemd; then
+ clamd_sed_args+=(
+ -e "s:^#\(LocalSocket \)/run.*:\1${EPREFIX}/run/clamav/clamd.ctl:"
+ )
+ else
+ clamd_sed_args+=(
+ # There's one in /tmp that we don't want to default-enable
+ -e "s:^#\(LocalSocket /run.*\):\1:"
+ )
+ fi
+
+ sed "${clamd_sed_args[@]}" \
+ "${ED}"/etc/clamav/clamd.conf.sample > \
+ "${ED}"/etc/clamav/clamd.conf || die
+
+ local freshclam_sed_args=(
+ -e "s:^\(Example\):\# \1:"
+ -e "s:^#\(PidFile\) .*:\1 ${EPREFIX}/run/freshclam.pid:"
+ -e "s/^#\(DatabaseOwner .*\)/\1/"
+ -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:"
+ -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamav/clamd.conf:"
+ -e "s:^\#\(ScriptedUpdates\).*:\1 yes:"
+ -e "s/^#\(DatabaseDirectory .*\)/\1/"
+ )
+ sed "${freshclam_sed_args[@]}" \
+ "${ED}"/etc/clamav/freshclam.conf.sample > \
+ "${ED}"/etc/clamav/freshclam.conf || die
+
+ if use milter ; then
+ # Note: only keep the "unix" ClamdSocket and MilterSocket!
+ local milter_sed_args=(
+ -e "s:^\(Example\):\# \1:"
+ -e "s:^\#\(PidFile\) .*:\1 ${EPREFIX}/run/clamav-milter.pid:"
+ -e "s/^#\(ClamdSocket unix:.*\)/\1/"
+ -e "s/^#\(User .*\)/\1/"
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:"
+ )
+ sed "${milter_sed_args[@]}" \
+ "${ED}"/etc/clamav/clamav-milter.conf.sample > \
+ "${ED}"/etc/clamav/clamav-milter.conf || die
+
+ systemd_newunit "${FILESDIR}/clamav-milter.service-0.104.0" clamav-milter.service
+ fi
+
+ local i
+ for i in clamd freshclam clamav-milter
+ do
+ if [[ -f "${ED}"/etc/"${i}".conf.sample ]] ; then
+ mv "${ED}"/etc/"${i}".conf{.sample,} || die
+ fi
+ done
+
+ # These both need to be writable by the clamav user
+ # TODO: use syslog by default; that's what it's for.
+ diropts -o clamav -g clamav
+ keepdir /var/lib/clamav
+ keepdir /var/log/clamav
+ fi
+ fi
+
+ if use doc ; then
+ local HTML_DOCS=( docs/html/. )
+ einstalldocs
+ fi
+
+ # Don't install man pages for utilities we didn't install
+ if use libclamav-only ; then
+ rm -r "${ED}"/usr/share/man || die
+ fi
+
+ find "${ED}" -name '*.la' -delete || die
+}
+
+pkg_postinst() {
+ if ! use libclamav-only ; then
+ if use systemd ; then
+ tmpfiles_process clamav-r1.conf
+ fi
+ fi
+
+ if use milter ; then
+ elog "For simple instructions how to setup the clamav-milter read the"
+ elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
+ fi
+
+ local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
+ if [[ ! -f "${databases}" ]] ; then
+ ewarn "You must run freshclam manually to populate the virus database"
+ ewarn "before starting clamav for the first time."
+ fi
+
+ if ! systemd_is_booted ; then
+ ewarn "This version of ClamAV provides separate OpenRC services"
+ ewarn "for clamd, freshclam, clamav-milter, and clamonacc. The"
+ ewarn "clamd service now starts only the clamd daemon itself. You"
+ ewarn "should add freshclam (and perhaps clamav-milter) to any"
+ ewarn "runlevels that previously contained clamd."
+ else
+ if ver_replacing -le 1.3.1; then
+ ewarn "From 1.3.1-r1 the Gentoo-provided systemd services have been"
+ ewarn "Retired in favour of using the units shipped by upstream."
+ ewarn "Ensure that any required services are configured and started."
+ ewarn "[email protected] has been retired as part of this transition."
+ fi
+ fi
+
+ if [[ -z ${REPLACING_VERSIONS} ]] && use clamonacc; then
+ einfo "'clamonacc' requires additional configuration before it"
+ einfo "can be enabled, and may not produce any output if not properly"
+ einfo "configured. Read the appropriate man page if clamonacc is desired."
+ fi
+
+}