commit: c757b9c569a5fba8f309f0950c28438a05f41456 Author: Matt Jolly <kangie <AT> gentoo <DOT> org> AuthorDate: Mon Mar 9 01:47:58 2026 +0000 Commit: Matt Jolly <kangie <AT> gentoo <DOT> org> CommitDate: Mon Mar 9 01:47:58 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c757b9c5
app-antivirus/clamav: add 1.4.4 Bug: https://bugs.gentoo.org/787233 Bug: https://bugs.gentoo.org/966587 Bug: https://bugs.gentoo.org/971014 Signed-off-by: Matt Jolly <kangie <AT> gentoo.org> app-antivirus/clamav/Manifest | 2 + app-antivirus/clamav/clamav-1.4.4.ebuild | 284 +++++++++++++++++++++++++++ app-antivirus/clamav/files/clamonacc.confd | 2 + app-antivirus/clamav/files/clamonacc.initd.2 | 18 ++ 4 files changed, 306 insertions(+) diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest index 983dd00727dd..90be0d7c2956 100644 --- a/app-antivirus/clamav/Manifest +++ b/app-antivirus/clamav/Manifest @@ -64,6 +64,8 @@ DIST clamav-1.0.7.tar.gz 10348714 BLAKE2B cd57fd9eb7ca5a4ea980cdedcf5977c1d11b28 DIST clamav-1.4.1.tar.gz 13427299 BLAKE2B 395c8a54a35e701e29a833b3b284ad55ab580a6990aae79044fd31e6878d714d31c66c5a8e1ee238b13c942cfb7cadd7046e739c2a19b5751f73eb329f5c479e SHA512 066d6117e717ee272fc9628eb1346f3777276a7e0937e1216f14a6e9edd86aea291a34fc02a60466481f0f06107d799a83bf2a9e0adec549e4c69c61d3ca6259 DIST clamav-1.4.2.tar.gz 13427816 BLAKE2B 22c1cb99da3187fa127b01d1dec7a0857b3aee1ffcb931f8b060e803ffef09c43f989a49f03e5d2ec0bc75c110da1db1b8da0a8b251af0edda6eea71f0065b10 SHA512 48576dc4c440b00f125c7958e8f7bb785a07c24fdf83994df72e3bcd85e9b013562133c556a0929af4106a973a0a15821bcbb83f85268ae601a68926f6c9e35e 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.5.1.tar.gz 13988704 BLAKE2B 49ba4e89ec4d3d76bbe8daa3bc5131d068b5b336a9b910fdea09fdefa44e886d1254140ed0ae621786b2db5f80fbd27bb66ea6b3dde643fbabce1a0160e5303d SHA512 aecf30cd4629716bb2f09d433a21a2905d3e60bbc7c5fc8b7c69e064b6523b4683d7631542f1a66692810bfeaf0adc549ff2ea891b37139f99488e370dc2a211 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 diff --git a/app-antivirus/clamav/clamav-1.4.4.ebuild b/app-antivirus/clamav/clamav-1.4.4.ebuild new file mode 100644 index 000000000000..2d1ae3d51f72 --- /dev/null +++ b/app-antivirus/clamav/clamav-1.4.4.ebuild @@ -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" + +# 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/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/files/clamonacc.confd b/app-antivirus/clamav/files/clamonacc.confd new file mode 100644 index 000000000000..4c6a19e7cae1 --- /dev/null +++ b/app-antivirus/clamav/files/clamonacc.confd @@ -0,0 +1,2 @@ +# Extra options to pass to clamonacc. See clamonacc(1) for details. +CLAMONACC_OPTS="" diff --git a/app-antivirus/clamav/files/clamonacc.initd.2 b/app-antivirus/clamav/files/clamonacc.initd.2 new file mode 100644 index 000000000000..37b341a0aaeb --- /dev/null +++ b/app-antivirus/clamav/files/clamonacc.initd.2 @@ -0,0 +1,18 @@ +#!/sbin/openrc-run + +command="/usr/sbin/clamonacc" +pidfile="/run/${RC_SVCNAME}.pid" + +# clamonacc doesn't support a PID file at the moment, so we +# run it in the foreground and let OpenRC background it. +# +# https://bugzilla.clamav.net/show_bug.cgi?id=12595 +# +command_args="--foreground ${CLAMONACC_OPTS}" +command_background=true + +depend() { + # Unlike the milter, the on-access scanner will simply fail to start + # until clamd is available. + need clamd +}
