mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
app-antivirus/clamav: add 1.5.2
Closes: https://bugs.gentoo.org/787233 Closes: https://bugs.gentoo.org/966587 Bug: https://bugs.gentoo.org/971014 Signed-off-by: Matt Jolly <kangie@gentoo.org>
This commit is contained in:
@@ -67,6 +67,8 @@ DIST clamav-1.4.3.tar.gz 13431353 BLAKE2B bb775323df020949dfd793e5f145686eaa417a
|
||||
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.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-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
|
||||
|
||||
284
app-antivirus/clamav/clamav-1.5.2.ebuild
Normal file
284
app-antivirus/clamav/clamav-1.5.2.ebuild
Normal file
@@ -0,0 +1,284 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
PYTHON_COMPAT=( python3_{11..13} )
|
||||
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/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 "clamd@.service 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
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user