Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Oct 2021 08:53:31 GMT
From:      Yasuhiro Kimura <yasu@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: e761728685b1 - main - security/clamav-lts: Add new port
Message-ID:  <202110070853.1978rVgQ099961@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yasu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e761728685b12571bdf0a8a20d4506c8c58f934c

commit e761728685b12571bdf0a8a20d4506c8c58f934c
Author:     Yasuhiro Kimura <yasu@FreeBSD.org>
AuthorDate: 2021-09-18 08:44:56 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2021-10-07 08:52:06 +0000

    security/clamav-lts: Add new port
    
    * Add Long Term Support release of ClamAV
    * Add CONFLICTS_INSTALL to security/clamav
    * Add entry to UPDATING that explains
      - Upstream changed their end-of-life policy and LTS release is
        introduced
      - How to switch from regular release (security/clamav) to LTS
        release (security/clamav-lts)
    
    Note about setting PORTEPOCH
    
    In general new port should not set PORTEPOCH. But in this case it
    should be set with following reason.
    
    1. Recently upstream changed their end-of-life policy as following.
      - Regular feature release (= 0.xyz.0 release) is released more
        frequently, and life time of each feature release is shortened to
        about 4 months.
      - To compensate for the short lifetime of regular feature release,
        Long Term Support feature release is introduced and its life time
        is about 3 years.
    2. First LTS starts with version 0.103.3 and it is same as current
       version of security/clamav.
    3. Because of short lifetime of regular feature release, it is
       probable that not a few users of security/clamav want to switch to
       security/clamav-lts after the latter is connected (and the former
       is updated to 0.104.0).
    3. For such users the entry is added to UPDATING about how to switch
       from security/clamav to security/clamav-lts. And binary package
       user is suggested to execute
       `pkg set -o security/clamav:security/clamav-lts`. This command
       changes the origin of already installed clamav packages. So user
       can switch to LTS version without reinstalling.
    4. But if PORTEPOCH isn't set in security/clamav-lts, binary package
       user who executed above command will notice that version of
       installed package (0.103.3,1) succeeds to current version of
       security/clamav-lts (0.103.3). The situation doesn't change after
       new patch release (0.103.4 for example) is released and it causes
       the problem that installed package isn't properly upgraded with
       `pkg upgrade`.
    5. So PORTEPOCH is set in  security/clamav-lts to prevent binary
       package user from suffering from such problem.
---
 UPDATING                                           |  28 ++++
 security/Makefile                                  |   1 +
 security/clamav-lts/Makefile                       | 179 +++++++++++++++++++++
 security/clamav-lts/distinfo                       |   3 +
 security/clamav-lts/files/clamav-clamd.in          |  51 ++++++
 security/clamav-lts/files/clamav-freshclam.in      |  45 ++++++
 security/clamav-lts/files/clamav-milter.in         | 101 ++++++++++++
 .../clamav-lts/files/extra-patch-shared_output.c   |  17 ++
 ...h-libclamav_c++_llvm_include_llvm_Support_CFG.h |  62 +++++++
 security/clamav-lts/files/pkg-deinstall.in         |  25 +++
 security/clamav-lts/pkg-descr                      |   8 +
 security/clamav-lts/pkg-plist                      |  81 ++++++++++
 security/clamav/Makefile                           |   2 +
 13 files changed, 603 insertions(+)

diff --git a/UPDATING b/UPDATING
index 7aa749aafd2e..509879b0cdd4 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,34 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20211007:
+  AFFECTS: user of security/clamav
+  AUTHOR: yasu@FreeBSD.org
+
+  Upstream changed end-of-life policy and introduced long time support
+  (LTS) feature release.
+
+  * LTS feature release will be identified approximately every two
+    years and supported for at least three years from the initial
+    publication date of that LTS feature version.
+  * Regular (non-LTS) feature releases will be supported for at least
+    four months from the initial publication date of the next feature
+    release or until the feature release after that is published.
+
+  According to it new port security/clamav-lts is added for users who
+  want to use LTS version of ClamAV.
+
+  Users wanting to switch to LTS version can replace security/clamav
+  with security/clamav-lts with one of following commands.
+
+  If you use pkg with binary packages:
+    # pkg set -o security/clamav:security/clamav-lts
+    # pkg upgrade
+  If you use portmaster:
+    # portmaster -o security/clamav-lts security/clamav
+  If you use portupgrade:
+    # portupgrade -o security/clamav-lts security/clamav
+
 20211006:
 AFFECTS: users of misc/freebsd-doc-*
 AUTHOR: blackend@FreeBSD.org
diff --git a/security/Makefile b/security/Makefile
index 98f6bbbffe3c..ca6e5b123dbc 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -88,6 +88,7 @@
     SUBDIR += cl-md5-sbcl
     SUBDIR += clamassassin
     SUBDIR += clamav
+    SUBDIR += clamav-lts
     SUBDIR += clamav-unofficial-sigs
     SUBDIR += clamd-stream-client
     SUBDIR += clamfs
diff --git a/security/clamav-lts/Makefile b/security/clamav-lts/Makefile
new file mode 100644
index 000000000000..679807a965f5
--- /dev/null
+++ b/security/clamav-lts/Makefile
@@ -0,0 +1,179 @@
+PORTNAME=	clamav
+PORTVERSION=	0.103.3
+PORTEPOCH=	1
+CATEGORIES=	security
+MASTER_SITES=	https://www.clamav.net/downloads/production/
+PKGNAMESUFFIX=	-lts
+
+MAINTAINER=	yasu@FreeBSD.org
+COMMENT=	Command line virus scanner written entirely in C
+
+LICENSE=	GPLv2
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+LIB_DEPENDS=	libcurl.so:ftp/curl \
+		libltdl.so:devel/libltdl \
+		libmspack.so:archivers/libmspack
+
+USES=		compiler cpe gmake gnome libtool ncurses pathfix pkgconfig ssl
+USE_LDCONFIG=	yes
+USE_RC_SUBR=	clamav-clamd clamav-freshclam
+
+GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--disable-dependency-tracking \
+		--enable-bigstack \
+		--enable-clamdtop \
+		--libdir=${PREFIX}/lib \
+		--with-dbdir=${DBDIR} \
+		--with-libcurl=${LOCALBASE} \
+		--with-openssl=${OPENSSLBASE} \
+		--with-system-libmspack=${LOCALBASE}/lib/libmspack.so
+
+INSTALL_TARGET=	install-strip
+CFLAGS_i386=	-march=i486
+# This port has a problem with -pthread,
+# force to use -lthr until it's not fixed.
+LDFLAGS+=	-lthr
+
+CONFLICTS_INSTALL=	clamav-[0-9]*
+
+SUB_FILES=	pkg-deinstall
+SUB_LIST+=	CHMOD=${CHMOD} \
+		CHOWN=${CHOWN} \
+		CLAMAV_CLAMD_PIDFILE=${CLAMAV_CLAMD_PIDFILE} \
+		CLAMAV_CLAMD_SOCKET=${CLAMAV_CLAMD_SOCKET} \
+		CLAMAV_MILTER_SOCKET=${CLAMAV_MILTER_SOCKET} \
+		CLAMAVGROUP=${CLAMAVGROUP} \
+		CLAMAVUSER=${CLAMAVUSER} \
+		DBDIR=${DBDIR} \
+		LOGDIR=${LOGDIR} \
+		RUNDIR=${RUNDIR}
+
+CLAMAVUSER?=	clamav
+CLAMAVGROUP?=	clamav
+
+.if ${CLAMAVUSER} == "clamav"
+USERS=		clamav
+.endif
+
+.if ${CLAMAVGROUP} == "clamav"
+GROUPS=		clamav mail
+.endif
+
+PLIST_SUB+=	CLAMAVGROUP=${CLAMAVGROUP} \
+		CLAMAVUSER=${CLAMAVUSER} \
+		DBDIR=${DBDIR} \
+		LOGDIR=${LOGDIR} \
+		RUNDIR=${RUNDIR}
+
+OPTIONS_DEFINE=	ARC ARJ DMG_XAR DOCS EXPERIMENTAL ICONV IPV6 JSON LDAP LHA \
+		MILTER PCRE STDERR TESTS UNRAR UNZOO
+
+OPTIONS_DEFAULT=	ARC ARJ DMG_XAR JSON MILTER PCRE UNRAR UNZOO
+OPTIONS_SUB=		yes
+
+ARC_DESC=		Enable arch archives support
+ARJ_DESC=		Enable arj archives support
+DMG_XAR_DESC=		Enable DMG and XAR archives support
+EXPERIMENTAL_DESC=	Build experimental code
+LHA_DESC=		Enable lha archives support
+MILTER_DESC=		Compile the milter interface
+STDERR_DESC=		Print logs to stderr instead of stdout
+TESTS_DESC=		Run compile-time tests (req. python)
+UNZOO_DESC=		Enable zoo archives support
+
+ARC_RUN_DEPENDS=		arc:archivers/arc
+ARJ_RUN_DEPENDS=		arj:archivers/arj
+DMG_XAR_USE=			GNOME=libxml2
+DMG_XAR_CONFIGURE_WITH=		xml=${LOCALBASE}
+EXPERIMENTAL_CONFIGURE_ENABLE=	experimental
+ICONV_USES=			iconv
+ICONV_CONFIGURE_WITH=		iconv
+IPV6_CONFIGURE_ENABLE=		ipv6
+JSON_LIB_DEPENDS=		libjson-c.so:devel/json-c
+JSON_CONFIGURE_WITH=		libjson=${LOCALBASE}
+LDAP_USE=			OPENLDAP=yes
+LDAP_LDFLAGS=			-lldap -L${LOCALBASE}/lib
+LHA_RUN_DEPENDS=		lha:archivers/lha
+.if !exists(/usr/lib/libmilter.so)
+MILTER_LIB_DEPENDS+=		libmilter.so:mail/libmilter
+.endif
+MILTER_USE=			RC_SUBR=clamav-milter
+MILTER_CONFIGURE_ENABLE=	milter
+MILTER_CONFIGURE_WITH=		sendmail=/usr/sbin/sendmail
+.if !exists(/usr/lib/libmilter.so)
+MILTER_CFLAGS=			-I${LOCALBASE}/include
+MILTER_LDFLAGS=			-L${LOCALBASE}/lib
+.endif
+PCRE_LIB_DEPENDS=		libpcre2-8.so:devel/pcre2
+PCRE_CONFIGURE_WITH=		pcre
+STDERR_EXTRA_PATCHES=		${FILESDIR}/extra-patch-shared_output.c
+TESTS_BUILD_DEPENDS=		${LOCALBASE}/include/check.h:devel/check
+TESTS_USES=			python:build
+TESTS_CONFIGURE_ENABLE=		check
+UNRAR_CONFIGURE_ENABLE=		unrar
+UNZOO_RUN_DEPENDS=		unzoo:archivers/unzoo
+
+CLAMAV_CLAMD_SOCKET?=	${RUNDIR}/clamd.sock
+CLAMAV_CLAMD_PIDFILE?=	${RUNDIR}/clamd.pid
+CLAMAV_MILTER_SOCKET?=	${RUNDIR}/clmilter.sock
+
+DBDIR=		/var/db/clamav
+LOGDIR=		/var/log/clamav
+RUNDIR=		/var/run/clamav
+PY_NO_THREAD=	${WRKDIR}/.python-has-no-threads
+
+SED_CONF=	-E -e 's|^\#?(Example)$$|\#\1|' -e \
+		's|^\#?((Update)?LogFile) .*/([a-z]+\.log)$$|\1 ${LOGDIR}/\3|' \
+		-e 's|^\#?(PidFile) .*/([a-z\-]+\.pid)$$|\1 ${RUNDIR}/\2|' -e \
+		's|^\#?(LocalSocket) .*$$|\1 ${CLAMAV_CLAMD_SOCKET}|' -e \
+		's|^\#?(User) .*$$|\1 ${CLAMAVUSER}|' -e \
+		's|^\#?(AllowSupplementaryGroups).*$$|\1 yes|' -e \
+		's|^\#?(ScanMail).*$$|\1 yes|' -e \
+		's|^\#?(DatabaseDirectory) .*$$|\1 ${DBDIR}|' -e \
+		's|^\#?(DatabaseOwner) .*$$|\1 ${CLAMAVUSER}|' -e \
+		's|^\#?(FixStaleSocket).*$$|\1 yes|' -e \
+		's|^\#?(NotifyClamd) .*$$|\1 ${PREFIX}/etc/clamd.conf|' -e \
+		's|^\#?(MilterSocket) */tmp.*$$|\1 ${CLAMAV_MILTER_SOCKET}|' -e \
+		's|^\#?(ClamdSocket).*$$|\1 unix:${CLAMAV_CLAMD_SOCKET}|'
+
+.include <bsd.port.pre.mk>
+
+post-patch:
+	@${REINPLACE_CMD} ${SED_CONF} \
+		${WRKSRC}/etc/clamd.conf.sample \
+		${WRKSRC}/etc/freshclam.conf.sample \
+		${WRKSRC}/etc/clamav-milter.conf.sample
+.if ${CHOSEN_COMPILER_TYPE} == gcc
+	@${REINPLACE_CMD} -e 's|-Wno-logical-op-parentheses||' \
+			  -e 's|-Wno-dangling-else||' \
+		${WRKSRC}/libclamav/Makefile.am \
+		${WRKSRC}/libclamav/Makefile.in \
+		${WRKSRC}/libclamunrar/makefile
+.endif
+
+pre-configure-TESTS-on:
+	@if ! ${PYTHON_CMD} -c "import thread" >/dev/null 2>&1; then \
+		${ECHO_MSG} ""; \
+		${ECHO_MSG} "==========================================================================="; \
+		${ECHO_MSG} "= Unit tests REQUIRES python built with thread support, and yours is not. ="; \
+		${ECHO_MSG} "= It will not be called during this build                                 ="; \
+		${ECHO_MSG} "==========================================================================="; \
+		${ECHO_MSG} ""; \
+		${TOUCH} ${PY_NO_THREAD}; \
+	fi
+
+post-build-TESTS-on:
+	@if [ ! -f "${PY_NO_THREAD}" ]; then \
+		${MAKE_CMD} -C ${WRKSRC} check; \
+	fi
+
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/clamav-config.h ${STAGEDIR}${PREFIX}/include
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}/html \
+		  ${STAGEDIR}${DBDIR} \
+		  ${STAGEDIR}${LOGDIR} \
+		  ${STAGEDIR}${RUNDIR}
+	(cd ${WRKSRC}/docs/html; ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/html)
+
+.include <bsd.port.post.mk>
diff --git a/security/clamav-lts/distinfo b/security/clamav-lts/distinfo
new file mode 100644
index 000000000000..808efe68f12a
--- /dev/null
+++ b/security/clamav-lts/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1624295813
+SHA256 (clamav-0.103.3.tar.gz) = 9f6e3d18449f3d1a3992771d696685249dfa12736fe2b2929858f2c7d8276ae9
+SIZE (clamav-0.103.3.tar.gz) = 13389239
diff --git a/security/clamav-lts/files/clamav-clamd.in b/security/clamav-lts/files/clamav-clamd.in
new file mode 100644
index 000000000000..b9c562f47987
--- /dev/null
+++ b/security/clamav-lts/files/clamav-clamd.in
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# PROVIDE: clamav_clamd
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable clamd:
+#
+# clamav_clamd_enable="YES"
+# clamav_clamd_flags="<set as needed>"
+#
+# See clamd(8) for flags
+#
+
+. /etc/rc.subr
+
+name=clamav_clamd
+rcvar=clamav_clamd_enable
+
+# read settings, set default values
+load_rc_config "$name"
+
+: ${clamav_clamd_enable:=NO}
+: ${clamav_clamd_socket="%%CLAMAV_CLAMD_SOCKET%%"}
+: ${clamav_clamd_pidfile="%%CLAMAV_CLAMD_PIDFILE%%"}
+: ${clamav_clamd_user="%%CLAMAVUSER%%"}
+
+command=%%PREFIX%%/sbin/clamd
+required_dirs=%%DBDIR%%
+required_files=%%PREFIX%%/etc/clamd.conf
+
+start_precmd=clamav_clamd_precmd
+extra_commands=reload
+reload_cmd="%%PREFIX%%/bin/clamdscan --reload"
+
+#clamav .93 won't start without a valid main.c[vl]d file
+clamav_clamd_precmd()
+{
+	local rundir=${clamav_clamd_pidfile%/*}
+	if [ ! -d $rundir ] ; then
+		install -d -m 0755 -o ${clamav_clamd_user} -g ${clamav_clamd_user} $rundir
+	fi
+	if [ ! -f %%DBDIR%%/main.cvd -a ! -f %%DBDIR%%/main.cld ];then
+		echo "Missing %%DBDIR%%/*.cvd or *.cld files.  You must run freshclam first"
+		exit 1
+	fi
+}
+
+run_rc_command "$1"
diff --git a/security/clamav-lts/files/clamav-freshclam.in b/security/clamav-lts/files/clamav-freshclam.in
new file mode 100644
index 000000000000..affd41e1c6a3
--- /dev/null
+++ b/security/clamav-lts/files/clamav-freshclam.in
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# PROVIDE: clamav_freshclam
+# REQUIRE: LOGIN clamav_clamd
+# BEFORE: mail
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable the freshclam daemon:
+#
+# clamav_freshclam_enable="YES"
+# clamav_freshclam_flags="<set as needed>"
+#
+# See freshclam(1) for flags
+#
+
+. /etc/rc.subr
+
+name=clamav_freshclam
+rcvar=clamav_freshclam_enable
+
+# read settings, set default values
+load_rc_config ${name}
+
+: ${clamav_freshclam_enable:=NO}
+: ${clamav_freshclam_pidfile=%%RUNDIR%%/freshclam.pid}
+: ${clamav_freshclam_user=%%CLAMAVUSER%%}
+
+command=%%PREFIX%%/bin/freshclam
+pidfile=${clamav_freshclam_pidfile}
+command_args="--daemon -p ${pidfile}"
+required_dirs=%%DBDIR%%
+required_files=%%PREFIX%%/etc/freshclam.conf
+
+start_precmd=clamav_freshclam_precmd
+
+clamav_freshclam_precmd()
+{
+	local rundir=${clamav_freshclam_pidfile%/*}
+	if [ ! -d $rundir ] ; then
+		install -d -m 0755 -o ${clamav_freshclam_user} -g ${clamav_freshclam_user} $rundir
+	fi
+}
+
+run_rc_command "$1"
diff --git a/security/clamav-lts/files/clamav-milter.in b/security/clamav-lts/files/clamav-milter.in
new file mode 100644
index 000000000000..ab540d9034ff
--- /dev/null
+++ b/security/clamav-lts/files/clamav-milter.in
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+# PROVIDE: clamav_milter
+# REQUIRE: LOGIN clamav_clamd
+# BEFORE: mail
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable clamav-milter:
+#
+# clamav_milter_enable="YES"
+#
+# See clamav-milter(1) for flags
+#
+
+. /etc/rc.subr
+
+name=clamav_milter
+rcvar=clamav_milter_enable
+
+load_rc_config $name
+
+: ${clamav_milter_enable:=NO}
+: ${clamav_milter_socket="%%CLAMAV_MILTER_SOCKET%%"}
+: ${clamav_milter_conf="%%PREFIX%%/etc/clamav-milter.conf"}
+: ${clamav_milter_flags="-c ${clamav_milter_conf}"}
+: ${clamav_milter_socktimeout=60}
+: ${clamav_milter_socket_mode=777}
+: ${clamav_milter_socket_user=%%CLAMAVUSER%%}
+: ${clamav_milter_socket_group=%%CLAMAVGROUP%%}
+: ${clamav_clamd_enable:=NO}
+: ${clamav_clamd_socket="%%CLAMAV_CLAMD_SOCKET%%"}
+
+command=%%PREFIX%%/sbin/clamav-milter
+required_dirs=%%DBDIR%%
+required_files=${clamav_milter_conf}
+
+start_precmd=start_precmd
+start_postcmd=start_postcmd
+
+start_precmd()
+{
+	if [ -S "$clamav_milter_socket" ]; then
+		warn "Stale socket $clamav_milter_socket removed."
+		rm "$clamav_milter_socket"
+	fi
+	rc_flags="${flags:-$clamav_milter_flags}"
+
+	clamav_clamd_socket_prefix=${clamav_clamd_socket%:*}
+	# We can have inet or inet6, try to remove 6
+	clamav_clamd_socket_prefix=${clamav_clamd_socket_prefix%6}
+	
+	if checkyesno clamav_clamd_enable && [ "x$clamav_clamd_socket" != "x" -a "${clamav_clamd_socket_prefix}" != "inet" ]; then
+		echo -n "Waiting for clamd socket.. "
+		i=${clamav_milter_socktimeout}
+		while [ $i -ne 0 ]
+		do
+			[ -S "$clamav_clamd_socket" ] && break
+			if [ `expr $i % 10` -eq 0 ]; then
+				echo -n "${i}.. "
+			fi
+			sleep 1
+			i=$(($i-1))
+		done
+		echo
+		if [ $i -eq 0 ]; then
+			echo "There is no clamd socket (${clamav_clamd_socket})!"
+			exit 1
+		fi
+	fi
+}
+
+start_postcmd()
+{
+	clamav_milter_socket_prefix=${clamav_milter_socket%:*}
+	# We can have inet or inet6, try to remove 6
+	clamav_milter_socket_prefix=${clamav_milter_socket_prefix%6}
+	
+	if [ "x$clamav_milter_socket" != "x" -a "${clamav_milter_socket_prefix}" != "inet" ]; then
+		echo -n "Waiting for clamav-milter socket.. "
+		i=${clamav_milter_socktimeout}
+		while [ $i -ne 0 ]
+		do
+			[ -S "$clamav_milter_socket" ] && break
+			if [ `expr $i % 10` -eq 0 ]; then
+				echo -n "${i}.. "
+			fi
+			sleep 1
+			i=$(($i-1))
+		done
+		echo
+		if [ $i -eq 0 ]; then
+			echo "There is no clamav-milter socket (${clamav_milter_socket})!"
+			exit 1
+		fi
+		%%CHMOD%% ${clamav_milter_socket_mode} ${clamav_milter_socket}
+		%%CHOWN%% ${clamav_milter_socket_user}:${clamav_milter_socket_group} ${clamav_milter_socket}
+	fi
+}
+
+run_rc_command "$1"
diff --git a/security/clamav-lts/files/extra-patch-shared_output.c b/security/clamav-lts/files/extra-patch-shared_output.c
new file mode 100644
index 000000000000..ddb4ab029f38
--- /dev/null
+++ b/security/clamav-lts/files/extra-patch-shared_output.c
@@ -0,0 +1,17 @@
+--- shared/output.c.orig	Thu May 18 22:10:40 2006
++++ shared/output.c	Thu May 18 22:12:43 2006
+@@ -236,7 +236,13 @@
+ 	return;
+     }
+ 
+-    fd = stdout;
++/*    fd = stdout; (missing flag 'mprintf_stdout') --eh.  */
++
++     if(mprintf_stdout)
++         fd = stdout;
++     else
++         fd = stderr;
++
+ 
+ /* legend:
+  * ! - error
diff --git a/security/clamav-lts/files/patch-libclamav_c++_llvm_include_llvm_Support_CFG.h b/security/clamav-lts/files/patch-libclamav_c++_llvm_include_llvm_Support_CFG.h
new file mode 100644
index 000000000000..dd70c2ca4d20
--- /dev/null
+++ b/security/clamav-lts/files/patch-libclamav_c++_llvm_include_llvm_Support_CFG.h
@@ -0,0 +1,62 @@
+--- libclamav/c++/llvm/include/llvm/Support/CFG.h.orig	2016-04-22 15:02:19 UTC
++++ libclamav/c++/llvm/include/llvm/Support/CFG.h
+@@ -27,8 +27,9 @@ namespace llvm {
+ 
+ template <class Ptr, class USE_iterator> // Predecessor Iterator
+ class PredIterator : public std::iterator<std::forward_iterator_tag,
+-                                          Ptr, ptrdiff_t> {
+-  typedef std::iterator<std::forward_iterator_tag, Ptr, ptrdiff_t> super;
++                                          Ptr, ptrdiff_t, Ptr*, Ptr*> {
++  typedef std::iterator<std::forward_iterator_tag, Ptr, ptrdiff_t, Ptr*,
++                                                                    Ptr*> super;
+   typedef PredIterator<Ptr, USE_iterator> Self;
+   USE_iterator It;
+ 
+@@ -40,6 +41,7 @@ class PredIterator : public std::iterator<std::forward
+ 
+ public:
+   typedef typename super::pointer pointer;
++  typedef typename super::reference reference;
+ 
+   explicit inline PredIterator(Ptr *bb) : It(bb->use_begin()) {
+     advancePastNonTerminators();
+@@ -49,7 +51,7 @@ class PredIterator : public std::iterator<std::forward
+   inline bool operator==(const Self& x) const { return It == x.It; }
+   inline bool operator!=(const Self& x) const { return !operator==(x); }
+ 
+-  inline pointer operator*() const {
++  inline reference operator*() const {
+     assert(!It.atEnd() && "pred_iterator out of range!");
+     return cast<TerminatorInst>(*It)->getParent();
+   }
+@@ -87,10 +89,11 @@ inline const_pred_iterator pred_end(const BasicBlock *
+ 
+ template <class Term_, class BB_>           // Successor Iterator
+ class SuccIterator : public std::iterator<std::bidirectional_iterator_tag,
+-                                          BB_, ptrdiff_t> {
++                                          BB_, ptrdiff_t, BB_*, BB_*> {
+   const Term_ Term;
+   unsigned idx;
+-  typedef std::iterator<std::bidirectional_iterator_tag, BB_, ptrdiff_t> super;
++  typedef std::iterator<std::bidirectional_iterator_tag, BB_, ptrdiff_t, BB_*,
++                                                                    BB_*> super;
+   typedef SuccIterator<Term_, BB_> Self;
+ 
+   inline bool index_is_valid(int idx) {
+@@ -99,6 +102,7 @@ class SuccIterator : public std::iterator<std::bidirec
+ 
+ public:
+   typedef typename super::pointer pointer;
++  typedef typename super::reference reference;
+   // TODO: This can be random access iterator, only operator[] missing.
+ 
+   explicit inline SuccIterator(Term_ T) : Term(T), idx(0) {// begin iterator
+@@ -122,7 +126,7 @@ class SuccIterator : public std::iterator<std::bidirec
+   inline bool operator==(const Self& x) const { return idx == x.idx; }
+   inline bool operator!=(const Self& x) const { return !operator==(x); }
+ 
+-  inline pointer operator*() const { return Term->getSuccessor(idx); }
++  inline reference operator*() const { return Term->getSuccessor(idx); }
+   inline pointer operator->() const { return operator*(); }
+ 
+   inline Self& operator++() { ++idx; return *this; } // Preincrement
diff --git a/security/clamav-lts/files/pkg-deinstall.in b/security/clamav-lts/files/pkg-deinstall.in
new file mode 100644
index 000000000000..47b5c7f8abf3
--- /dev/null
+++ b/security/clamav-lts/files/pkg-deinstall.in
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+if [ "$2" != "POST-DEINSTALL" ]; then
+	exit 0
+fi
+
+CLAMAVUSER=%%CLAMAVUSER%%
+
+echo
+echo "===================================================="
+echo
+echo "If you want remove clamav permanently from you system"
+echo "execute following commands:"
+echo
+echo " # rm -rf %%LOGDIR%%"
+echo " # rm -rf %%RUNDIR%%"
+echo " # rm -rf %%DBDIR%%"
+if pw usershow "${CLAMAVUSER}" 2>/dev/null 1>&2; then
+	echo " # pw userdel ${CLAMAVUSER}"
+fi
+echo
+echo "===================================================="
+echo
+
+exit 0
diff --git a/security/clamav-lts/pkg-descr b/security/clamav-lts/pkg-descr
new file mode 100644
index 000000000000..541af4c17b4b
--- /dev/null
+++ b/security/clamav-lts/pkg-descr
@@ -0,0 +1,8 @@
+This the Long Term Support (LTS) version of Clam Antivirus.
+Clam Antivirus is command line virus scanner written entirely in C
+and its database is kept up to date. It also detects polymorphic
+viruses, scans compressed files and supported by AMaViS.
+Optionally you can use the clamav-milter interface to connect
+clamav with sendmail.
+
+WWW: https://www.clamav.net/
diff --git a/security/clamav-lts/pkg-plist b/security/clamav-lts/pkg-plist
new file mode 100644
index 000000000000..726d7d1722df
--- /dev/null
+++ b/security/clamav-lts/pkg-plist
@@ -0,0 +1,81 @@
+bin/clamav-config
+bin/clambc
+bin/clamconf
+bin/clamdscan
+bin/clamdtop
+bin/clamscan
+%%JSON%%bin/clamsubmit
+bin/freshclam
+bin/sigtool
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Contribute.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Installation-Unix.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Installation-Unix/Steps-Debian-Ubuntu.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Installation-Unix/Steps-Redhat-CentOS.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Installation-Unix/Steps-macOS.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Installation-Windows.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Introduction.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/OnAccess.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/AllowLists.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/AuthenticodeRules.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/BodySignatureFormat.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/BytecodeSignatures.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/ContainerMetadata.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/DatabaseInfo.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/DynamicConfig.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/EncryptedArchives.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/ExtendedSignatures.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/FileTypeMagic.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/FileTypes.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/FunctionalityLevels.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/HashSignatures.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/LogicalSignatures.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/PhishSigs.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Signatures/YaraRules.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Usage.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Usage/Configuration.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Usage/Scanning.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/Usage/SignatureManagement.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/development.html
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/images/demon.png
+%%PORTDOCS%%%%DOCSDIR%%/html/UserManual/libclamav.html
+include/clamav-config.h
+include/clamav-types.h
+include/clamav-version.h
+include/clamav.h
+include/libfreshclam.h
+lib/libclamav.so
+lib/libclamav.so.9
+lib/libclamav.so.9.0.5
+%%UNRAR%%lib/libclamunrar.so
+%%UNRAR%%lib/libclamunrar.so.9
+%%UNRAR%%lib/libclamunrar.so.9.0.5
+%%UNRAR%%lib/libclamunrar_iface.so
+%%UNRAR%%lib/libclamunrar_iface.so.9
+%%UNRAR%%lib/libclamunrar_iface.so.9.0.5
+lib/libfreshclam.so
+lib/libfreshclam.so.2
+lib/libfreshclam.so.2.0.1
+libdata/pkgconfig/libclamav.pc
+man/man1/clambc.1.gz
+man/man1/clamconf.1.gz
+man/man1/clamdscan.1.gz
+man/man1/clamdtop.1.gz
+man/man1/clamscan.1.gz
+%%JSON%%man/man1/clamsubmit.1.gz
+man/man1/freshclam.1.gz
+man/man1/sigtool.1.gz
+man/man5/clamav-milter.conf.5.gz
+man/man5/clamd.conf.5.gz
+man/man5/freshclam.conf.5.gz
+man/man8/clamav-milter.8.gz
+man/man8/clamd.8.gz
+%%MILTER%%sbin/clamav-milter
+sbin/clamd
+@sample etc/clamd.conf.sample
+%%MILTER%%@sample etc/clamav-milter.conf.sample
+@sample etc/freshclam.conf.sample
+@dir(%%CLAMAVUSER%%,%%CLAMAVGROUP%%,0755) %%DBDIR%%
+@dir(%%CLAMAVUSER%%,%%CLAMAVGROUP%%,0755) %%LOGDIR%%
+@dir(%%CLAMAVUSER%%,%%CLAMAVGROUP%%,0755) %%RUNDIR%%
diff --git a/security/clamav/Makefile b/security/clamav/Makefile
index 6e0336b57503..ad1beb45d440 100644
--- a/security/clamav/Makefile
+++ b/security/clamav/Makefile
@@ -42,6 +42,8 @@ CFLAGS_i386=	-march=i486
 # force to use -lthr until it's not fixed.
 LDFLAGS+=	-lthr
 
+CONFLICTS_INSTALL=	clamav-[0-9]*
+
 SUB_FILES=	pkg-deinstall
 SUB_LIST+=	CHMOD=${CHMOD} \
 		CHOWN=${CHOWN} \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110070853.1978rVgQ099961>