summaryrefslogtreecommitdiff
path: root/app-antivirus/clamav
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-09-23 10:22:15 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-09-23 10:22:15 +0100
commit8b4ace9c50842c5b83401ea7b179dcab940387e1 (patch)
tree230f3135ceaace633cf93e9838b185c4a6664c2e /app-antivirus/clamav
parent9ee6d97c2883d42f204a533a8bc1f4562df778fb (diff)
gentoo resync : 23.09.2020
Diffstat (limited to 'app-antivirus/clamav')
-rw-r--r--app-antivirus/clamav/Manifest10
-rw-r--r--app-antivirus/clamav/clamav-0.103.0-r1.ebuild232
-rw-r--r--app-antivirus/clamav/files/clamav-0.103.0-system-tomsfastmath.patch115
-rw-r--r--app-antivirus/clamav/files/clamav-0.103.0-upstream-openrc.patch439
-rw-r--r--app-antivirus/clamav/files/clamav-milter.logrotate25
-rw-r--r--app-antivirus/clamav/files/clamd.logrotate17
-rw-r--r--app-antivirus/clamav/files/freshclam.logrotate17
-rw-r--r--app-antivirus/clamav/files/freshclamd.service-r110
-rw-r--r--app-antivirus/clamav/metadata.xml1
9 files changed, 865 insertions, 1 deletions
diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest
index f46f215496d2..9cb0a7f9dd5b 100644
--- a/app-antivirus/clamav/Manifest
+++ b/app-antivirus/clamav/Manifest
@@ -2,17 +2,25 @@ AUX clamav-0.101.2-tinfo.patch 854 BLAKE2B 46479552a2dffcf56c7b142062896e8ae34e3
AUX clamav-0.102.1-libxml2_pkgconfig.patch 4012 BLAKE2B 4c3e4fc3522d317c57bae942bbd1c9b91d11ddb782cfaa0593458180207ffb873f783cea892d8eefd2402f30b7a0c4dcbbd5b61e01a54f98432c1164b29e7d83 SHA512 ee6379c85f7d85e30bfa4efda728cf9207a5017905abed8a6241561825ca54ec58a6cec2c1a8452574a9356491c192e89f76d19c2e404602637dcc9576b3fdea
AUX clamav-0.102.2-fix-curl-detection.patch 844 BLAKE2B a813b1f6003b9cff03fca8d72dbd44d6a4f700e3d60aee83f782a87893a3c6753698ca8715237155185660301dd81dc55bf6a6e3b9095f57b099607182c90bf5 SHA512 27e6aa5ad418eaa32b56ea7bbdab0b5b4cd649e55d34eb094b5f02d7e68d8913f39664ffd6bc4a07faf88f60bdbd15b0c381fbbd6d9c1c62cc36e72e34cabd19
AUX clamav-0.102.3-system-tomsfastmath.patch 3769 BLAKE2B 36c6580709a9f3319643e547c37753a65240aaa2ed612465982ea35c392d5031ba105e8ac67a42453fa4960977579a04f61ad9bb30a8e693908c25daa3085154 SHA512 8749a0e0b97570371a4a661b82c210ab1c9e6cba46b7fdf63474daa745bc280ffc84c3e4030a3c659814ba845f38946cbda0f437130057c8a73b3dc762b09ae3
+AUX clamav-0.103.0-system-tomsfastmath.patch 3725 BLAKE2B 85640ded83600adfdcc03e8f42e3153c71a8b6c5884ca4cbd79a69121943fd171bc528aed26ded895189293008924cef6762a22001b4ee098fe5f680c7619bf0 SHA512 b67df39bc7d60f6ea9bb06d12413f0e4774185d4f020a68bdfdf8fe1ca669f70a62699b0f1100702af5ec47e460a35625dcaa09cfc6ea6d2f3957de227e87306
+AUX clamav-0.103.0-upstream-openrc.patch 16572 BLAKE2B 51e6207482cdbe5b82e3cdd73e38a11f5c215edb3905a40a97b2446d582ac59bc7467c43a3c2e2af6ee34fd8402964b6e2017c20960235e47c97810f501f9af6 SHA512 f5a984b71e246713df58b8e83503b2c063d8b44b7e4a5ee6245744aac1284ca2b135d6a9a002c411d06ff43515355283505a76fa45f67e6d236c5870b30f4f8c
AUX clamav-milter.README.gentoo 2284 BLAKE2B 7afc18f3dad57c2d7595257b356943efb3d1af28d55ac8f09f0506430fd0dedf0820906ced666a7237e3af44a9bc1b43fff017c03faad844f96b132ca4c5dde6 SHA512 38eadf2d919a0c48345600ea5a39c90e766b62e8b1ffc7bb01969a8fd93c4545f2030058a470ac7efb75a1d6c74f9930438f58aeff5035e19e38241ed381f7b3
+AUX clamav-milter.logrotate 1105 BLAKE2B 5bb2b00dbe6e74c51d4ed7233964cfddf0ef7fd8c913caad42a421fc152baa3ffc3e910f38f46ebb72a08a8b53eba880647a6988d38558ec52129afca8dddfad SHA512 cb6cbefc4a093fda5a3cdb52911ff13b04d641896271b844db9ca30a051cb4beb911ee973a5958df8bba59b7b922cfb23bfa69cdd4fe3c0c2b8abe76bf834c2f
AUX clamav-milter.service 284 BLAKE2B 7fbdce10ffa1d85aa671616f17ad45683177916269b434283582ecb53000f7a9a8978119e6a8170ddad8f7c0f14f09398fd7b893aad5d718083b002f6371ff21 SHA512 442148ac3c42ecbb893de5c6edde337b72a745d20f6c5ffa33131f9a0b2daadcffac39b686ada986a5ab500ea7b9153c448abc1b819e15fef488da1812bb0cee
AUX clamav-milter.service-r1 303 BLAKE2B 55253d9a660699411e352bc80837add840dc6740afed4fe64a86def84610cad836ea3ea620664f540f242b917aab560201cca9c33b9fbc9b1cef2c8b29bfce36 SHA512 5dc30e3c57d9bff6595155e8299336c579c713aed429ab770f10d7678dd74691a135aa2070a825ddb726fdabcb001c19caeb993c1cd9a6fcf95d1d47f7160540
AUX clamav.logrotate 391 BLAKE2B 9beb9e2918d7fbd30a9aeb479130086b620ab7a2e9e480cd4c4bd039929f3ac5bfd98f933731c974fc2797236a34847d8af7073436cf3d42bb2cdfb7959da0b0 SHA512 ef54facfa0ad830ea6eef499b92a1ffb37e719940385621dacd17062e556aa0d1f24104b3130a9a263f23621ab53f39283c10870a355ed6d505cc0e511b57224
AUX clamd.conf 234 BLAKE2B 90d64dcdce96767ff34da1537d25bf2b508e038bde66a7e991f49b0fde7b5ceb2028d7e7a1a7b4f2fbdc4efcfb2cdfe3e68552570d15d87eb7d9c30c7e013998 SHA512 ec069cf7aaf10b42a701938b57e1fde1ee15afd1d4af928edfa7e5d505ba8b3edaaceac449da0f4ac6beea09a3fb73453526ba0cd3a04e13259c1a2720f42f78
AUX clamd.conf-r1 129 BLAKE2B 3a6b0adc07df276054cda4d9b879b30e81fed06cee7562bc350d43e866f825c85788d3a7f45745111bf6a294e8cc20cc221433ad7bb291fbbc26b4e9107e580e SHA512 b85fd99c80242fb66380dfdef34387a2eff9326a1cb726940ab4bc450308e4942e57d1eb1cad979348f8aac685b53e2fa722cef0dab1f2ea2c958f2a5f818918
AUX clamd.initd-r6 3253 BLAKE2B 3d675b3ab2b0832abcb2206e0373e37ff19000fd125ca9240942edefab9ed54e12be4bce4112118710e44de5f4f66da61e1cc8e01d725021da629d05089b9412 SHA512 0a76233e67bc25ef4bdf02218c2b3771569c4f9b2b1ae8ca2da22fcf4c1fc0ea17013523c2e2b048ce3db5c793a568fb59b40f4be78186d3adc0f774c3442a79
+AUX clamd.logrotate 603 BLAKE2B f39f5938f8fca2d2820d86c8dc144dca0216468a3cfd7dcd84c794d9402e3978da254684053eab108d71263a75266a96f2b6f5e0c635a2b5b0a1a50068920bde SHA512 e9689c99e37a1f2814497e4df19bd760dd94b6134be72341dd3b7f6e5f67505cda913367a5e80873ae601c88a9d7aa994733b8ac7017a6d0aa62d2170845df37
AUX clamd.service 202 BLAKE2B 4d02132cdb44a7155e881037b45bab28f42445808d1d3ff5821e9b179b31efd7d5f217fb968efa17e77f6e0739f0258c4c49656283177a0f5b3d572490259bcd SHA512 799d3f33ca69841882f86f6853dd0dc6d8af73db8cfa5ce6dd6c873c5e7bc07d29bfe0f85cfb77edf2b0d8c05de73988d06148b993996ce639c5d0eeac908647
AUX clamd_at.service 228 BLAKE2B 85181b02329a86495d0737308417dd873424da0bb1cd376725e7857b8b911c841df89ce63ed665a1d0ca6d30f9456c9d47c370b36a2cf8df1e2f3f520d121fe0 SHA512 69a0ca31a7288b5494d8c85ce5ff859a8f34b8a93f573eded90c270099ecac30e01d8549a07a160d74bfdc3c5401c3fd625b178080ea2c02520aab91252739e7
+AUX freshclam.logrotate 631 BLAKE2B d5100e4f80227d3cda00193eb7a065f766d6b7b0c54ef58ad646fc7692cd4c6e572e053d368ba78c62c27cd3e1db111822208d29ecad67d10be7d5957d6622f3 SHA512 43838241c66bdf167105b25967576a568e0661e5b3292d24d3028837353280b03ffd1ea6adbbcbc152e50bc25f77357af42bbf3dd70817cf2cf02258ca0fe611
AUX freshclamd.service 240 BLAKE2B 1b72ffee3b0b1b51811aa5f3c7a52678b3beb260f020dd326a437d6abf4bc515392d0b263eeb0773de128b9c0eff1c1f0b7b604dd14b9dffd50aba31909963e1 SHA512 28da28d633f487806448e17aec36648b6ba12f549549485704607e403e64643caea6ee9420e8101f11b3edebe62b651e6d6c338ab232f33b97b315d64b3789ac
+AUX freshclamd.service-r1 177 BLAKE2B 8c9304e8c43e03288dcb1c6897b53e7c36b6e6116bb5c43db1e9735cc5d7b50094d33679d2b42839a09c572ad631daf572f62c57e4a7b74bfad5ce40a5916364 SHA512 5243465d30de1e64697455b3af50f62e6d7f3d0df7e2ef9b60f89dc974d8118ff67df0b44fbbddd04dd196ca17cf4306ac99f1eec42a5a0ddd42a64c4cb992c8
AUX tmpfiles.d/clamav.conf 33 BLAKE2B 447c5ad4ad79bc70fc386833fa763451d30bf30f1ae26434039a3926ca5aae9734e0152c83b5b9aa5bed87b17c1b685c4ea9f41c9cb6b3197b1e78e800b71fd9 SHA512 eabe5a94c2679b82ea3e29272eb448b47e60b271381d3e97f3970b1a9e086d61662aff2d29887950a911025294aa7cea8bfd9003d257963566b251bcaeb5f6b2
DIST clamav-0.102.4.tar.gz 13234444 BLAKE2B 7109da3e2281472032777b8a9d14ca6ff345aead33e5aaf0b9d1ff4721459926062f789dd1f7e8637155e4b9f3bce9f78127bf450f32baf3f1006b8083d3431a SHA512 29893deb8d2d913dff72331875d3dc3a10356bfb254ddfe1c1933b3ea4f8b76c96a1b840f95e72be36cbc0e00b9ec35e395225ef264761f53e709bb1026a4f09
+DIST clamav-0.103.0.tar.gz 13357078 BLAKE2B 6c4b05043f560a56f967642094ba4a9f9bd52268994ac43a99446650a78dafe0ec851b9ebcfe95f3e216fd7942e4756f2e20bda67ca9187e55523fbba9ca56d8 SHA512 e0712ed3c068dc8dab1d31b7cbc19cd69c62875fdcf314abb28e6f42660daf162a3aae69e0a008919e7b809675b68d35f79d3cb98379442bcbc6f5c8ee4313bf
EBUILD clamav-0.102.4.ebuild 6960 BLAKE2B 292ee4bf55f790a6002f10d4ea040272af557665e5251338d34a43760ffcb667c4fae1f581193425d3555c64b7dc71198621fe09309a9c2831b657162c71a5ed SHA512 8932730bfa50b9b467e3f59256b51054a51a12b52d9c54fb0b4c0b80ce06e8e897d4dd90b2b0044b3b8913a44d5c7aaaee3a177c821e7efe99af1fb4d52e3032
-MISC metadata.xml 861 BLAKE2B fa97cb689d37536e3d128d2033038b1a6331ae3d8f435e39330506731c96f742b55f579ca02c678393c0af21fbab88189de8754d80b97fba35cf5a4f4eb2dd9a SHA512 5e2c58dfbb033270cfa014bc207d83799be06aaa02d1b490d6c202ffc151b54be72cd4e15380faffed2e3957c395e43b6853d1abfee99fa42de81159b7656a00
+EBUILD clamav-0.103.0-r1.ebuild 7195 BLAKE2B c18b4ae4563472beda8125f2e554414ae8af01c11532569e92b3a45cbc6ef2dd30db1e6b2eb7e8ac0a8d4a511989b50b2e1d4bb623fd547bf82c7c45d1f1832e SHA512 acc96f49d8fc669ed0ccb69b9a8043058fd03be12568972f7349b9e1c67746cf008712499eb3215395556a957e7cebdc41540d57f21cc89ff827148922ffe2ee
+MISC metadata.xml 933 BLAKE2B 867499e23131bf714cdddd911ef727dc6e487be8c6f0be1985611bc2ce8bfbee639e114f8ade6a6b9418095d03a45095030168912ab21484da81385c53255b05 SHA512 c0a3132dbfafbdb8852d621de187cfbd5daa30ab682593b88c77278e0c8a58fb57ed1427b9f8aa798926ccc94db4a19eeec77915f06de9b0cd182237aa77a892
diff --git a/app-antivirus/clamav/clamav-0.103.0-r1.ebuild b/app-antivirus/clamav/clamav-0.103.0-r1.ebuild
new file mode 100644
index 000000000000..4217bc62b775
--- /dev/null
+++ b/app-antivirus/clamav/clamav-0.103.0-r1.ebuild
@@ -0,0 +1,232 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic systemd tmpfiles
+
+DESCRIPTION="Clam Anti-Virus Scanner"
+HOMEPAGE="https://www.clamav.net/"
+SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
+IUSE="bzip2 doc clamonacc clamdtop clamsubmit iconv ipv6 libclamav-only libressl milter metadata-analysis-api selinux systemd test uclibc xml"
+
+REQUIRED_USE="libclamav-only? ( !clamonacc !clamdtop !clamsubmit !milter !metadata-analysis-api )"
+
+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.
+CDEPEND="acct-group/clamav
+ acct-user/clamav
+ dev-libs/libltdl
+ dev-libs/libmspack
+ || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
+ dev-libs/tomsfastmath
+ >=sys-libs/zlib-1.2.2:=
+ bzip2? ( app-arch/bzip2 )
+ clamdtop? ( sys-libs/ncurses:0 )
+ clamsubmit? ( net-misc/curl dev-libs/json-c:= )
+ elibc_musl? ( sys-libs/fts-standalone )
+ iconv? ( virtual/libiconv )
+ !libclamav-only? ( net-misc/curl )
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )
+ milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
+ xml? ( dev-libs/libxml2 )"
+
+BDEPEND="virtual/pkgconfig"
+
+DEPEND="${CDEPEND}
+ metadata-analysis-api? ( dev-libs/json-c:* )
+ test? ( dev-libs/check )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-clamav )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328
+ "${FILESDIR}/${PN}-0.102.2-fix-curl-detection.patch" #709616
+ "${FILESDIR}/${PN}-0.103.0-system-tomsfastmath.patch" # 649394
+ "${FILESDIR}/${PN}-0.103.0-upstream-openrc.patch"
+)
+
+src_prepare() {
+ default
+
+ # Be extra sure that we're using the system copy of tomsfastmath
+ einfo "removing bundled copy of dev-libs/tomsfastmath"
+ rm -r libclamav/tomsfastmath || \
+ die "failed to remove bundled tomsfastmath"
+
+ AT_NO_RECURSIVE="yes" eautoreconf
+}
+
+src_configure() {
+ use elibc_musl && append-ldflags -lfts
+ use ppc64 && append-flags -mminimal-toc
+ use uclibc && export ac_cv_type_error_t=yes
+
+ # according to configure help it should be
+ # $(use_enable xml)
+ # but that does not work
+ # do not add this, since --disable-xml seems to override
+ # --without-xml
+ JSONUSE="--without-libjson"
+
+ if use clamsubmit || use metadata-analysis-api; then
+ # either of those 2 requires libjson.
+ # clamsubmit will be built as soon as libjson and curl are found
+ # but we only install the binary if requested
+ JSONUSE="--with-libjson=${EPREFIX}/usr"
+ fi
+
+ local myeconfargs=(
+ $(use_enable bzip2)
+ $(use_enable clamonacc)
+ $(use_enable clamdtop)
+ $(use_enable ipv6)
+ $(use_enable milter)
+ $(use_enable test check)
+ $(use_with xml)
+ $(use_with iconv)
+ ${JSONUSE}
+ $(use_enable libclamav-only)
+ $(use_with !libclamav-only libcurl)
+ --with-system-libmspack
+ --cache-file="${S}"/config.cache
+ --disable-experimental
+ --disable-static
+ --disable-zlib-vcheck
+ --enable-id-check
+ --with-dbdir="${EPREFIX}"/var/lib/clamav
+ # Don't call --with-zlib=/usr (see bug #699296)
+ --with-zlib
+ --disable-llvm
+ --enable-openrc
+ --runstatedir=/run
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_install() {
+ default
+
+ rm -rf "${ED}"/var/lib/clamav || die
+
+ if ! use libclamav-only ; then
+ if use systemd; then
+ # The tmpfiles entry is behind USE=systemd because the
+ # upstream OpenRC service files should (and do) ensure that
+ # the directories they need exist and have the correct
+ # permissions without the help of opentmpfiles. There are
+ # years-old root exploits in opentmpfiles, the design is
+ # fundamentally flawed, and the maintainer is not up to
+ # the task of fixing it.
+ dotmpfiles "${FILESDIR}/tmpfiles.d/clamav.conf"
+ systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
+ systemd_dounit "${FILESDIR}/clamd.service"
+ systemd_newunit "${FILESDIR}/freshclamd.service-r1" \
+ "freshclamd.service"
+ fi
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/clamd.logrotate" clamd
+ newins "${FILESDIR}/freshclam.logrotate" freshclam
+ use milter && \
+ newins "${FILESDIR}/clamav-milter.logrotate" clamav-milter
+
+ # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
+ sed -i -e "s:^\(Example\):\# \1:" \
+ -e "s/^#\(PidFile .*\)/\1/" \
+ -e "s/^#\(LocalSocket .*\)/\1/" \
+ -e "s/^#\(User .*\)/\1/" \
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
+ -e "s:^\#\(LogTime\).*:\1 yes:" \
+ -e "s/^#\(DatabaseDirectory .*\)/\1/" \
+ "${ED}"/etc/clamd.conf.sample || die
+
+ sed -i -e "s:^\(Example\):\# \1:" \
+ -e "s/^#\(PidFile .*\)/\1/" \
+ -e "s/^#\(DatabaseOwner .*\)/\1/" \
+ -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
+ -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
+ -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
+ -e "s/^#\(DatabaseDirectory .*\)/\1/" \
+ "${ED}"/etc/freshclam.conf.sample || die
+
+ if use milter ; then
+ # Note: only keep the "unix" ClamdSocket and MilterSocket!
+ sed -i -e "s:^\(Example\):\# \1:" \
+ -e "s/^#\(PidFile .*\)/\1/" \
+ -e "s/^#\(ClamdSocket unix:.*\)/\1/" \
+ -e "s/^#\(User .*\)/\1/" \
+ -e "s/^#\(MilterSocket unix:.*\)/\1/" \
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
+ "${ED}"/etc/clamav-milter.conf.sample || die
+
+ cat >> "${ED}"/etc/conf.d/clamd <<-EOF
+ MILTER_NICELEVEL=19
+ START_MILTER=no
+ EOF
+
+ systemd_newunit "${FILESDIR}/clamav-milter.service-r1" 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
+
+ if use doc ; then
+ local HTML_DOCS=( docs/html/. )
+ einstalldocs
+
+ if ! use libclamav-only ; then
+ doman docs/man/*.[1-8]
+ fi
+ fi
+
+ find "${ED}" -name '*.la' -delete || die
+}
+
+src_test() {
+ if use libclamav-only ; then
+ ewarn "Test target not available when USE=libclamav-only is set, skipping tests ..."
+ return 0
+ fi
+
+ emake quick-check
+}
+
+pkg_postinst() {
+ 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
+
+ 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."
+}
diff --git a/app-antivirus/clamav/files/clamav-0.103.0-system-tomsfastmath.patch b/app-antivirus/clamav/files/clamav-0.103.0-system-tomsfastmath.patch
new file mode 100644
index 000000000000..ad9276c1ad01
--- /dev/null
+++ b/app-antivirus/clamav/files/clamav-0.103.0-system-tomsfastmath.patch
@@ -0,0 +1,115 @@
+From 70cc96407302cf0fd4eee2b6a401253ed50fe4df Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Sun, 20 Sep 2020 11:16:06 -0400
+Subject: [PATCH 1/1] autotools: use system tomsfastmath if possible.
+
+---
+ configure.ac | 2 ++
+ libclamav/Makefile.am | 10 ++++++++--
+ libclamav/bignum.h | 6 +++++-
+ libclamav/xdp.c | 2 +-
+ m4/reorganization/libs/tomsfastmath.m4 | 12 ++++++++++++
+ 5 files changed, 28 insertions(+), 4 deletions(-)
+ create mode 100644 m4/reorganization/libs/tomsfastmath.m4
+
+diff --git a/configure.ac b/configure.ac
+index 8e0e810f8..773787e49 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -104,6 +104,7 @@ m4_include([m4/reorganization/libs/libmspack.m4])
+ if test "x$use_internal_mspack" = "xno"; then
+ mspack_msg="External, $LIBMSPACK_CFLAGS $LIBMSPACK_LIBS"
+ fi
++m4_include([m4/reorganization/libs/tomsfastmath.m4])
+
+ AM_MAINTAINER_MODE
+ m4_include([m4/reorganization/libs/libz.m4])
+@@ -376,6 +377,7 @@ fi
+ CL_MSG_STATUS([yara ],[$enable_yara],[$enable_yara])
+ CL_MSG_STATUS([fts ],[yes],[$lfs_fts_msg])
+
++CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
+
+ # Yep, downgrading the compiler avoids the bug too:
+ # 4.0.x, and 4.1.0 are the known buggy versions
+diff --git a/libclamav/Makefile.am b/libclamav/Makefile.am
+index ae655cfec..240fa23f8 100644
+--- a/libclamav/Makefile.am
++++ b/libclamav/Makefile.am
+@@ -588,8 +588,10 @@ libclamav_la_SOURCES += yara_arena.c \
+ yara_clam.h
+ endif
+
+-libclamav_la_SOURCES += bignum.h\
+- bignum_fast.h\
++libclamav_la_SOURCES += bignum.h
++
++if !SYSTEM_TOMSFASTMATH
++libclamav_la_SOURCES += bignum_fast.h\
+ tomsfastmath/addsub/fp_add.c\
+ tomsfastmath/addsub/fp_add_d.c\
+ tomsfastmath/addsub/fp_addmod.c\
+@@ -671,6 +673,10 @@ libclamav_la_SOURCES += bignum.h\
+ tomsfastmath/sqr/fp_sqr_comba_generic.c\
+ tomsfastmath/sqr/fp_sqr_comba_small_set.c\
+ tomsfastmath/sqr/fp_sqrmod.c
++else
++libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
++libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
++endif
+
+ .PHONY2: version.h.tmp
+ version.c: version.h
+diff --git a/libclamav/bignum.h b/libclamav/bignum.h
+index 8fdc956bb..56dfa957e 100644
+--- a/libclamav/bignum.h
++++ b/libclamav/bignum.h
+@@ -1,9 +1,13 @@
+ #ifndef BIGNUM_H_
+ #define BIGNUM_H_
+
++#if HAVE_SYSTEM_TOMSFASTMATH
++#include <tfm.h>
++#else
+ #define TFM_CHECK
+-
+ #include "bignum_fast.h"
++#endif
++
+ typedef fp_int mp_int;
+ #define mp_cmp fp_cmp
+ #define mp_toradix_n(a, b, c, d) fp_toradix_n(a, b, c, d)
+diff --git a/libclamav/xdp.c b/libclamav/xdp.c
+index 87423421d..6370221ff 100644
+--- a/libclamav/xdp.c
++++ b/libclamav/xdp.c
+@@ -52,7 +52,7 @@
+ #include "scanners.h"
+ #include "conv.h"
+ #include "xdp.h"
+-#include "bignum_fast.h"
++#include "bignum.h"
+ #include "filetypes.h"
+
+ static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
+diff --git a/m4/reorganization/libs/tomsfastmath.m4 b/m4/reorganization/libs/tomsfastmath.m4
+new file mode 100644
+index 000000000..2a821a14d
+--- /dev/null
++++ b/m4/reorganization/libs/tomsfastmath.m4
+@@ -0,0 +1,12 @@
++dnl Check for system tomsfastmath
++PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
++
++AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
++
++if test "x$have_system_tomsfastmath" = "xyes"; then
++ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
++ tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
++else
++ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
++ tomsfastmath_msg="Internal"
++fi
+--
+2.26.2
+
diff --git a/app-antivirus/clamav/files/clamav-0.103.0-upstream-openrc.patch b/app-antivirus/clamav/files/clamav-0.103.0-upstream-openrc.patch
new file mode 100644
index 000000000000..a7676f0ab82a
--- /dev/null
+++ b/app-antivirus/clamav/files/clamav-0.103.0-upstream-openrc.patch
@@ -0,0 +1,439 @@
+diff --git a/Makefile.am b/Makefile.am
+index 12e7fcc28..a3c47e23a 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -52,6 +52,17 @@ nodist_include_HEADERS = clamav-types.h clamav-version.h
+ distuninstallcheck_listfiles = find . -type f ! -name clamd.conf ! -name freshclam.conf ! -name daily.cvd ! -name main.cvd -print
+ DISTCLEANFILES = target.h
+ DISTCHECK_CONFIGURE_FLAGS=--enable-milter --disable-clamav --enable-all-jit-targets --enable-llvm=yes --with-system-llvm=no --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) CC="$(CC)" CXX="$(CXX)" YACC="$(YACC)" LEX="$(LEX)" AR="$(AR)" AS="$(AS)"
++
++
++# This command allows us to replace bindir, libdir, etc.
++# within our script and conf file. The example is taken
++# from the autoconf documentation and can be found in the
++# "Installation Directory Variables" section.
++editgnudirs = sed -e 's|@BINDIR[@]|$(bindir)|g' \
++ -e 's|@SBINDIR[@]|$(sbindir)|g' \
++ -e 's|@RUNSTATEDIR[@]|$(runstatedir)|g'
++export editgnudirs
++
+ lcov:
+ ($(MAKE); cd unit_tests; $(MAKE) lcov)
+ quick-check:
+diff --git a/clamav-milter/Makefile.am b/clamav-milter/Makefile.am
+index 1ec4afff6..c75c2b4a3 100644
+--- a/clamav-milter/Makefile.am
++++ b/clamav-milter/Makefile.am
+@@ -35,6 +35,27 @@ clamav_milter_SOURCES = \
+ man_MANS = $(top_builddir)/docs/man/clamav-milter.8
+ AM_CFLAGS=@WERR_CFLAGS_MILTER@
+
++
++if INSTALL_OPENRC_SERVICES
++
++openrcdir = $(sysconfdir)/init.d
++
++# The next rule allows us to replace @RUNSTATEDIR@ and friends within
++# our OpenRC service scripts. This example is taken from the autoconf
++# documentation in the "Installation Directory Variables" section.
++openrc_SCRIPTS_src = openrc/clamav-milter.in.in
++openrc_SCRIPTS_intermediate = openrc/clamav-milter.in
++nodist_openrc_SCRIPTS = openrc/clamav-milter
++DISTCLEANFILES = $(nodist_openrc_SCRIPTS) $(openrc_SCRIPTS_intermediate)
++$(nodist_openrc_SCRIPTS): $(openrc_SCRIPTS_src) $(openrc_SCRIPTS_intermediate) Makefile
++ rm -f $@ $@.tmp
++ $(editgnudirs) $@.in > $@.tmp
++ mv $@.tmp $@
++
++endif
++EXTRA_DIST = $(openrc_SCRIPTS_src)
++
++
+ endif
+
+ LIBS = $(top_builddir)/libclamav/libclamav.la $(top_builddir)/shared/libshared.la @CLAMAV_MILTER_LIBS@ @THREAD_LIBS@
+diff --git a/clamav-milter/openrc/clamav-milter.in.in b/clamav-milter/openrc/clamav-milter.in.in
+new file mode 100644
+index 000000000..71053564a
+--- /dev/null
++++ b/clamav-milter/openrc/clamav-milter.in.in
+@@ -0,0 +1,34 @@
++#!/sbin/openrc-run
++
++# Note: the "Foreground" option in clamav-milter.conf MUST
++# be set to "no".
++command="@SBINDIR@/clamav-milter"
++
++# For now, must be manually synchronized with the PidFile
++# variable in clamav-milter.conf.
++#
++# https://bugzilla.clamav.net/show_bug.cgi?id=12595
++#
++pidfile="@RUNSTATEDIR@/${RC_SVCNAME}.pid"
++
++depend() {
++ # The milter can successfully launch without clamd, but it's not a
++ # great user experience to have the milter start accepting requests
++ # that it can't process. The "use" dependency below will start clamd
++ # before clamav-milter, so long as clamd is also present this runlevel.
++ use clamd
++}
++
++start_pre() {
++ # This exists to support the (disabled) default MilterSocket setting
++ # within clamav-milter.conf. The "clamav" user and group agree with
++ # the (disabled) default "User" and "MilterSocketGroup" settings.
++ #
++ # Creating this directory is harmless even when a local socket is
++ # not used. In fact, the clamd service that we depend on should
++ # create it as well, to hold its own local socket (if enabled).
++ checkpath --directory \
++ --mode 0755 \
++ --owner clamav:clamav \
++ "@RUNSTATEDIR@/clamav"
++}
+diff --git a/clamd/Makefile.am b/clamd/Makefile.am
+index 12b872b1f..725bc2fc1 100644
+--- a/clamd/Makefile.am
++++ b/clamd/Makefile.am
+@@ -44,6 +44,25 @@ if INSTALL_SYSTEMD_UNITS
+ systemdsystemunit_DATA = clamav-daemon.socket clamav-daemon.service
+ endif
+
++if INSTALL_OPENRC_SERVICES
++
++openrcdir = $(sysconfdir)/init.d
++
++# The next rule allows us to replace @RUNSTATEDIR@ and friends within
++# our OpenRC service scripts. This example is taken from the autoconf
++# documentation in the "Installation Directory Variables" section.
++openrc_SCRIPTS_src = openrc/clamd.in.in
++openrc_SCRIPTS_intermediate = openrc/clamd.in
++nodist_openrc_SCRIPTS = openrc/clamd
++DISTCLEANFILES = $(nodist_openrc_SCRIPTS) $(openrc_SCRIPTS_intermediate)
++$(nodist_openrc_SCRIPTS): $(openrc_SCRIPTS_src) $(openrc_SCRIPTS_intermediate) Makefile
++ rm -f $@ $@.tmp
++ $(editgnudirs) $@.in > $@.tmp
++ mv $@.tmp $@
++
++endif
++EXTRA_DIST = $(openrc_SCRIPTS_src)
++
+ LIBS = $(top_builddir)/libclamav/libclamav.la $(top_builddir)/shared/libshared.la @CLAMD_LIBS@ @THREAD_LIBS@
+ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav -I$(top_builddir)/libclamav -I$(top_srcdir)/libclamunrar_iface @SSL_CPPFLAGS@ @JSON_CPPFLAGS@ @PCRE_CPPFLAGS@
+
+diff --git a/clamd/openrc/clamd.in.in b/clamd/openrc/clamd.in.in
+new file mode 100644
+index 000000000..5d38f9a84
+--- /dev/null
++++ b/clamd/openrc/clamd.in.in
+@@ -0,0 +1,33 @@
++#!/sbin/openrc-run
++
++# Note: the "Foreground" option in clamd.conf must be set to "no"
++command="@SBINDIR@/clamd"
++extra_started_commands="reload"
++
++# For now, must be manually synchronized with the PidFile variable
++# in clamd.conf.
++#
++# https://bugzilla.clamav.net/show_bug.cgi?id=12595
++#
++pidfile="@RUNSTATEDIR@/${RC_SVCNAME}.pid"
++
++start_pre() {
++ # This exists to support the (disabled) default LocalSocket setting
++ # within clamd.conf. The "clamav" user and group agree with the
++ # (disabled) default "User" and "LocalSocketGroup" settings in
++ # clamd.conf. And everything here agrees with the
++ # clamav-daemon.socket systemd service.
++ #
++ # Creating this directory is harmless even when a local socket is
++ # not used.
++ checkpath --directory \
++ --mode 0755 \
++ --owner clamav:clamav \
++ "@RUNSTATEDIR@/clamav"
++}
++
++reload() {
++ ebegin "Reloading ${RC_SVCNAME}"
++ "@BINDIR@/clamdscan" --reload
++ eend $?
++}
+diff --git a/clamonacc/Makefile.am b/clamonacc/Makefile.am
+index 181e22056..864a7fc2a 100644
+--- a/clamonacc/Makefile.am
++++ b/clamonacc/Makefile.am
+@@ -56,6 +56,25 @@ if INSTALL_SYSTEMD_UNITS
+ systemdsystemunit_DATA = clamav-clamonacc.service
+ endif
+
++if INSTALL_OPENRC_SERVICES
++
++openrcdir = $(sysconfdir)/init.d
++
++# The next rules allow us to replace @RUNSTATEDIR@ and friends within
++# our OpenRC service scripts. This example is taken from the autoconf
++# documentation in the "Installation Directory Variables" section.
++openrc_SCRIPTS_src = openrc/clamonacc.in.in
++openrc_SCRIPTS_intermediate = openrc/clamonacc.in
++nodist_openrc_SCRIPTS = openrc/clamonacc
++DISTCLEANFILES = $(nodist_openrc_SCRIPTS) $(openrc_SCRIPTS_intermediate)
++$(nodist_openrc_SCRIPTS): $(openrc_SCRIPTS_src) $(openrc_SCRIPTS_intermediate) Makefile
++ rm -f $@ $@.tmp
++ $(editgnudirs) $@.in > $@.tmp
++ mv $@.tmp $@
++
++endif
++EXTRA_DIST = $(openrc_SCRIPTS_src)
++
+ LIBS = $(top_builddir)/shared/libshared.la $(top_builddir)/libclamav/libclamav.la @CURL_LIBS@ @CLAMONACC_LIBS@ @THREAD_LIBS@
+ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/clamonacc -I$(top_srcdir)/shared -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_builddir)/libclamav -I$(top_srcdir)/libclamunrar_iface @CURL_CPPFLAGS@ @SSL_CPPFLAGS@ @CLAMONACC_CPPFLAGS@ @JSON_CPPFLAGS@ @PCRE_CPPFLAGS@
+
+diff --git a/clamonacc/openrc/clamonacc.in.in b/clamonacc/openrc/clamonacc.in.in
+new file mode 100644
+index 000000000..844cd49dd
+--- /dev/null
++++ b/clamonacc/openrc/clamonacc.in.in
+@@ -0,0 +1,18 @@
++#!/sbin/openrc-run
++
++command="@SBINDIR@/clamonacc"
++pidfile="@RUNSTATEDIR@/${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"
++command_background=true
++
++depend() {
++ # Unlike the milter, the on-access scanner will simply fail to start
++ # until clamd is available.
++ need clamd
++}
+diff --git a/configure.ac b/configure.ac
+index 7b2a777d4..8e0e810f8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -79,6 +79,12 @@ if test "$enable_experimental" = "yes"; then
+ VERSION_SUFFIX="$VERSION_SUFFIX-exp"
+ fi
+
++# Autoconf 2.70 will support this, and many distros patch it in,
++# but Autoconf 2.70 hasn't actually been released yet (it's in beta).
++AS_IF([test -z "${runstatedir}"], [runstatedir='${localstatedir}/run'])
++AC_SUBST([runstatedir])
++
++
+ build_configure_args=`echo "$ac_configure_args" | sed -e 's/[\"]//g'`
+ AC_SUBST([BUILD_CONFIGURE_FLAGS], [$build_configure_args])
+
+@@ -104,6 +110,7 @@ m4_include([m4/reorganization/libs/libz.m4])
+ m4_include([m4/reorganization/libs/bzip.m4])
+ m4_include([m4/reorganization/libs/unrar.m4])
+ m4_include([m4/reorganization/libs/systemd.m4])
++m4_include([m4/reorganization/libs/openrc.m4])
+ m4_include([m4/reorganization/code_checks/ipv6.m4])
+ m4_include([m4/reorganization/code_checks/dns.m4])
+ m4_include([m4/reorganization/code_checks/fanotify.m4])
+@@ -192,7 +199,10 @@ AC_CONFIG_FILES([
+ libclamav.pc
+ platform.h
+ clamav-types.h
+- clamav-version.h])
++ clamav-version.h
++ etc/clamd.conf.sample.in
++ etc/clamav-milter.conf.sample.in
++ etc/freshclam.conf.sample.in])
+ if test "x$enable_libclamav_only" != "xyes"; then
+ AC_CONFIG_FILES([
+ clamscan/Makefile
+@@ -202,10 +212,14 @@ if test "x$enable_libclamav_only" != "xyes"; then
+ clamd/Makefile
+ clamd/clamav-daemon.service
+ clamd/clamav-daemon.socket
++ clamd/openrc/clamd.in
+ clamdscan/Makefile
+ clamsubmit/Makefile
++ clamonacc/openrc/clamonacc.in
+ clamav-milter/Makefile
++ clamav-milter/openrc/clamav-milter.in
+ freshclam/clamav-freshclam.service
++ freshclam/openrc/freshclam.in
+ freshclam/Makefile
+ sigtool/Makefile
+ clamconf/Makefile
+diff --git a/etc/Makefile.am b/etc/Makefile.am
+index 487c31429..bee68f1d0 100644
+--- a/etc/Makefile.am
++++ b/etc/Makefile.am
+@@ -18,11 +18,31 @@
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ # MA 02110-1301, USA.
+
+-EXTRA_DIST = clamd.conf.sample freshclam.conf.sample clamav-milter.conf.sample
++EXTRA_DIST = clamd.conf.sample.in.in \
++ freshclam.conf.sample.in.in \
++ clamav-milter.conf.sample.in.in
+ CFGINST = @CFGDIR@
+
+ sysconf_DATA = clamd.conf.sample freshclam.conf.sample
+
++# Custom variable to simplify the "edit" rule below.
++sysconf_DATA_intermediate = clamd.conf.sample.in freshclam.conf.sample.in
++
+ if HAVE_MILTER
+ sysconf_DATA += clamav-milter.conf.sample
++sysconf_DATA_intermediate += clamav-milter.conf.sample.in
+ endif
++
++# Otherwise these don't get cleaned up by "make distclean",
++# even though they are auto-generated.
++DISTCLEANFILES = $(sysconf_DATA) $(sysconf_DATA_intermediate)
++
++# This rule includes EVERY source/intermediate file as a dependency of
++# EVERY output file, which is clearly wrong, but it may be the best we
++# can do without duplication. At least it's the right kind of wrong,
++# and rebuilds too often rather than not often enough.
++$(sysconf_DATA): $(sysconf_DATA_intermediate) $(EXTRA_DIST) Makefile
++ rm -f $@ $@.tmp
++ $(editgnudirs) $@.in > $@.tmp
++ mv $@.tmp $@
++>>>>>>> ea2f2442b... etc: convert conf files to templates and make @VARIABLE@ substitutions.
+diff --git a/etc/clamav-milter.conf.sample b/etc/clamav-milter.conf.sample.in.in
+similarity index 98%
+rename from etc/clamav-milter.conf.sample
+rename to etc/clamav-milter.conf.sample.in.in
+index bf46b4fc5..c3c5d2000 100644
+--- a/etc/clamav-milter.conf.sample
++++ b/etc/clamav-milter.conf.sample.in.in
+@@ -17,7 +17,7 @@ Example
+ # inet6:port@[hostname|ip-address] - to specify an ipv6 socket
+ #
+ # Default: no default
+-#MilterSocket /tmp/clamav-milter.socket
++#MilterSocket unix:@RUNSTATEDIR@/clamav/clamav-milter.socket
+ #MilterSocket inet:7357
+
+ # Define the group ownership for the (unix) milter socket.
+@@ -64,7 +64,7 @@ Example
+ # also owned by root to keep other users from tampering with it.
+ #
+ # Default: disabled
+-#PidFile /var/run/clamav-milter.pid
++#PidFile @RUNSTATEDIR@/clamav-milter.pid
+
+ # Optional path to the global temporary directory.
+ # Default: system specific (usually /tmp or /var/tmp).
+@@ -91,6 +91,7 @@ Example
+ # fashion.
+ #
+ # Default: no default
++#ClamdSocket unix:@RUNSTATEDIR@/clamav/clamd.ctl
+ #ClamdSocket tcp:scanner.mydomain:7357
+
+
+diff --git a/etc/clamd.conf.sample b/etc/clamd.conf.sample.in.in
+similarity index 99%
+rename from etc/clamd.conf.sample
+rename to etc/clamd.conf.sample.in.in
+index 828dd5ad9..0e0ea4b12 100644
+--- a/etc/clamd.conf.sample
++++ b/etc/clamd.conf.sample.in.in
+@@ -74,7 +74,7 @@ Example
+ # It is recommended that the directory where this file is stored is
+ # also owned by root to keep other users from tampering with it.
+ # Default: disabled
+-#PidFile /var/run/clamd.pid
++#PidFile @RUNSTATEDIR@/clamd.pid
+
+ # Optional path to the global temporary directory.
+ # Default: system specific (usually /tmp or /var/tmp).
+@@ -93,7 +93,7 @@ Example
+
+ # Path to a local socket file the daemon will listen on.
+ # Default: disabled (must be specified by a user)
+-#LocalSocket /tmp/clamd.socket
++#LocalSocket @RUNSTATEDIR@/clamav/clamd.ctl
+
+ # Sets the group ownership on the unix socket.
+ # Default: disabled (the primary group of the user running clamd)
+diff --git a/etc/freshclam.conf.sample b/etc/freshclam.conf.sample.in.in
+similarity index 99%
+rename from etc/freshclam.conf.sample
+rename to etc/freshclam.conf.sample.in.in
+index 2f7d14618..3af3a3485 100644
+--- a/etc/freshclam.conf.sample
++++ b/etc/freshclam.conf.sample.in.in
+@@ -51,7 +51,7 @@ Example
+ # It is recommended that the directory where this file is stored is
+ # also owned by root to keep other users from tampering with it.
+ # Default: disabled
+-#PidFile /var/run/freshclam.pid
++#PidFile @RUNSTATEDIR@/freshclam.pid
+
+ # By default when started freshclam drops privileges and switches to the
+ # "clamav" user. This directive allows you to change the database owner.
+diff --git a/freshclam/Makefile.am b/freshclam/Makefile.am
+index ab6ac8f1c..6b16b3d3e 100644
+--- a/freshclam/Makefile.am
++++ b/freshclam/Makefile.am
+@@ -32,6 +32,26 @@ if INSTALL_SYSTEMD_UNITS
+ systemdsystemunit_DATA = clamav-freshclam.service
+ endif
+
++if INSTALL_OPENRC_SERVICES
++
++openrcdir = $(sysconfdir)/init.d
++
++# The next rule allows us to replace @RUNSTATEDIR@ and friends within
++# our OpenRC service scripts. This example is taken from the autoconf
++# documentation in the "Installation Directory Variables" section.
++openrc_SCRIPTS_src = openrc/freshclam.in.in
++openrc_SCRIPTS_intermediate = openrc/freshclam.in
++nodist_openrc_SCRIPTS = openrc/freshclam
++DISTCLEANFILES = $(nodist_openrc_SCRIPTS) $(openrc_SCRIPTS_intermediate)
++$(nodist_openrc_SCRIPTS): $(openrc_SCRIPTS_src) $(openrc_SCRIPTS_intermediate) Makefile
++ rm -f $@ $@.tmp
++ $(editgnudirs) $@.in > $@.tmp
++ mv $@.tmp $@
++
++endif
++EXTRA_DIST = $(openrc_SCRIPTS_src)
++
++
+ AM_CFLAGS=@WERR_CFLAGS@
+ DEFS = @DEFS@
+ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav -I$(top_builddir)/libclamav -I$(top_srcdir)/libclamunrar_iface -I$(top_srcdir)/libfreshclam @CURL_CPPFLAGS@ @SSL_CPPFLAGS@ @FRESHCLAM_CPPFLAGS@ @ZLIB_CFLAGS@ @JSON_CPPFLAGS@ @PCRE_CPPFLAGS@
+diff --git a/freshclam/openrc/freshclam.in.in b/freshclam/openrc/freshclam.in.in
+new file mode 100644
+index 000000000..9feb73747
+--- /dev/null
++++ b/freshclam/openrc/freshclam.in.in
+@@ -0,0 +1,8 @@
++#!/sbin/openrc-run
++
++command="@BINDIR@/freshclam"
++pidfile="@RUNSTATEDIR@/${RC_SVCNAME}.pid"
++
++# Ignore the value of "PidFile" set in freshclam.conf.
++command_args="-p ${pidfile}"
++command_args_background="--daemon"
+diff --git a/m4/reorganization/libs/openrc.m4 b/m4/reorganization/libs/openrc.m4
+new file mode 100644
+index 000000000..1a73d1589
+--- /dev/null
++++ b/m4/reorganization/libs/openrc.m4
+@@ -0,0 +1,8 @@
++dnl Should we install our OpenRC service files?
++AC_ARG_ENABLE([openrc],
++ AS_HELP_STRING([--enable-openrc],
++ [Install OpenRC service files]),
++ [],
++ [enable_openrc=no])
++AM_CONDITIONAL(INSTALL_OPENRC_SERVICES,
++ [test "x$enable_openrc" = "xyes"])
diff --git a/app-antivirus/clamav/files/clamav-milter.logrotate b/app-antivirus/clamav/files/clamav-milter.logrotate
new file mode 100644
index 000000000000..24782df604b6
--- /dev/null
+++ b/app-antivirus/clamav/files/clamav-milter.logrotate
@@ -0,0 +1,25 @@
+# This script is intended to rotate the logs for clamav-milter in its
+# default configuration on Gentoo, where clamav-milter writes to its
+# own log file but does not rotate that file itself. The clamav-milter
+# daemon is capable of rotating its own logs; if you have "LogRotate
+# yes" in clamav-milter.conf then you do not need this script (and
+# should disable it). Likewise, if you are logging to syslog
+# (LogSyslog yes), this is redundant.
+#
+# This is more complicated than the clamd/freshclam scripts because
+# the milter doesn't yet reopen its log files when it receives a
+# SIGHUP. See https://bugzilla.clamav.net/show_bug.cgi?id=12615
+# for that. Instead we have to attempt OpenRC/systemd service
+# restarts on (only) the machines that support them.
+/var/log/clamav/clamav-milter.log {
+ su clamav clamav
+ missingok
+ postrotate
+ if command -v rc-service 2>/dev/null; then
+ rc-service clamav-milter status 2>/dev/null 1>&2 && rc-service clamav-milter restart 1>/dev/null
+ fi
+ if command -v systemctl 2>/dev/null; then
+ systemctl try-restart clamav-milter
+ fi
+ endscript
+}
diff --git a/app-antivirus/clamav/files/clamd.logrotate b/app-antivirus/clamav/files/clamd.logrotate
new file mode 100644
index 000000000000..68ee9b361668
--- /dev/null
+++ b/app-antivirus/clamav/files/clamd.logrotate
@@ -0,0 +1,17 @@
+# This script is intended to rotate the logs for clamd in its default
+# configuration on Gentoo, where clamd writes to its own log file but
+# does not rotate that file itself. The clamd daemon is capable of
+# rotating its own logs; if you have "LogRotate yes" in clamd.conf
+# then you do not need this script (and should disable it). Likewise,
+# if you are logging to syslog (LogSyslog yes), this is redundant.
+/var/log/clamav/clamd.log {
+ su clamav clamav
+ missingok
+ postrotate
+ if test -f /run/clamd.pid; then
+ /bin/kill -HUP $(cat /run/clamd.pid)
+ else
+ true
+ fi
+ endscript
+}
diff --git a/app-antivirus/clamav/files/freshclam.logrotate b/app-antivirus/clamav/files/freshclam.logrotate
new file mode 100644
index 000000000000..ba6b5de3ba1c
--- /dev/null
+++ b/app-antivirus/clamav/files/freshclam.logrotate
@@ -0,0 +1,17 @@
+# This script is intended to rotate the logs for freshclam in its default
+# configuration on Gentoo, where freshclam writes to its own log file but
+# does not rotate that file itself. The freshclam daemon is capable of
+# rotating its own logs; if you have "LogRotate yes" in freshclam.conf
+# then you do not need this script (and should disable it). Likewise,
+# if you are logging to syslog (LogSyslog yes), this is redundant.
+/var/log/clamav/freshclam.log {
+ su clamav clamav
+ missingok
+ postrotate
+ if test -f /run/freshclam.pid; then
+ /bin/kill -HUP $(cat /run/freshclam.pid)
+ else
+ true
+ fi
+ endscript
+}
diff --git a/app-antivirus/clamav/files/freshclamd.service-r1 b/app-antivirus/clamav/files/freshclamd.service-r1
new file mode 100644
index 000000000000..fa1e0139ddda
--- /dev/null
+++ b/app-antivirus/clamav/files/freshclamd.service-r1
@@ -0,0 +1,10 @@
+[Unit]
+Description=clamav updater
+
+[Service]
+Type=forking
+PIDFile=/run/freshclam.pid
+ExecStart=/usr/bin/freshclam -d -p /run/freshclam.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-antivirus/clamav/metadata.xml b/app-antivirus/clamav/metadata.xml
index 5433359bc410..f00c88d870a3 100644
--- a/app-antivirus/clamav/metadata.xml
+++ b/app-antivirus/clamav/metadata.xml
@@ -6,6 +6,7 @@
<name>Gentoo Antivirus Project</name>
</maintainer>
<use>
+ <flag name="clamonacc">Build the clamonacc on-access scanner</flag>
<flag name="clamdtop">A Top like tool which shows what clamd is currently scanning amongst other things</flag>
<flag name="clamsubmit">A tool to submit false positives / negatives</flag>
<flag name="libclamav-only">Bypass building of libfreshclam and the ClamAV CLI applications.</flag>