1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

BEWARE: As rcoder(8) isn't present on FreeBSD 4 but clamd must be

be started before clamav-milter the startup-script for clamd
        must alphabetically arranged before the startup-script for
        clamav-milter. It was decided to use the clamd statup-scrtipt
        from security/clamav-devel (clamav-clamd.sh), so users running
        an older version of security/clamav have to change
        'clamd_enable="YES"' to 'clamav_clamd_enable="YES"' in
        /etc/rc.conf. On the other hand this changes makes it easier
        to switch between security/clamav and security/clamav-devel.

- Respect PTHREAD_CFLAGS.
- Use USE_LIBTOOL_VER=14 as the libtool shipping with clamav 0.65
  erroneously links against libc _and_ libc_r on FreeBSD 4.
- Don't link against libcipher on FreeBSD < 501100, clamav doesn't
  depend on it. The linker warnings suggesting that it is required
  were triggered by linking against both, libc and libc_r.
- Unconditionally depend on math/libgmp4. Otherwise, if libgmp4 is
  already installed on a FreeBSD 4-STABLE system compilation of
  security/clamav fails, as the headers of libgmp4 are used but the
  base libgmp is used for linking.
- Fix generation of clamav-milter.8 when building with WITH_MILTER
  (part of new files/patch-clamav-milter::Makefile.in).
- Don't USE_GETOPT_LONG when compiling with WITH_MILTER, clamav
  uses its own getopt_long() regardless if a devel/libgnugetopt is
  installed or the version in the base of FreeBSD 5 is present.
- Allow compilation of WITH_MILTER with mail/sendmail.
- Install a startup-script (taken from security/clamav-devel with some
  fixes in comments) for clamav-milter when compiled with WITH_MILTER.
- In pkg-descr remove the note that clamav-milter doesn't build on
  FreeBSD 4 with base gcc, it builds fine there. Mention that
  clamav-milter can be optionally used (taken from pkg-descr of
  security/clamav-devel).
- Fix compilation when an older version of security/clamav is installed.
  If there's an older version of libclamav installed clamav 0.65 will
  link against it instead of the newly built one. This is not a problem
  if the installed version is compatible with the new one as libclamav
  gets linked dynamically and the installed version will be replaced
  with the new one. However, if the older version is incompatible
  linking of clamav 0.65 fails. This problem was discovered by
  Jan-Peter Koopmann Jan-Peter.Koopmann@seceidos.de and the fix
  (most of the new patches in the files directory) confirmed working.
- In clamav-milter replace the path to the used sendmail executable with
  the location of the mailwrapper(8) (/usr/sbin/sendmail). Obtained
  from security/clamav-devel.

PR:		59948
Submitted by:	Marius Strobl <marius@alchemy.franken.de>
Approved by:	maintainer
This commit is contained in:
Alexander Leidinger 2003-12-08 14:06:49 +00:00
parent 68a46b37ab
commit 71b93e612e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=95378
13 changed files with 214 additions and 69 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= clamav
PORTVERSION= 0.65
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= security
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= clamav
@ -15,6 +15,7 @@ MASTER_SITE_SUBDIR= clamav
MAINTAINER= markun@onohara.to
COMMENT= Command line virus scanner written entirely in C
LIB_DEPENDS= gmp.6:${PORTSDIR}/math/libgmp4
RUN_DEPENDS= lha:${PORTSDIR}/archivers/lha \
unarj:${PORTSDIR}/archivers/unarj \
unrar:${PORTSDIR}/archivers/unrar \
@ -26,27 +27,29 @@ USE_REINPLACE= yes
USE_GMAKE= yes
GNU_CONFIGURE= yes
CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
#USE_LIBTOOL_VER=14
USE_LIBTOOL_VER=14
INSTALLS_SHLIB= yes
PKGINSTALL= ${WRKDIR}/pkg-install
CONFIGURE_ARGS= --with-dbdir=${DATADIR} \
--disable-clamav --enable-bigstack
CFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= ${PTHREAD_LIBS}
CFLAGS+= ${PTHREAD_CFLAGS} -I${LOCALBASE}/include
LDFLAGS+= ${PTHREAD_LIBS} -L${LOCALBASE}/lib
CONFIGURE_ENV+= LDFLAGS="${LDFLAGS}"
MAN1= clamscan.1 freshclam.1 sigtool.1 clamdscan.1
MAN5= clamav.conf.5
MAN8= clamd.8 clamav-milter.8
CLAMD_SOCKET?= /var/run/clamav/clamd
CLAMAV_CLAMD_SOCKE?= /var/run/clamav/clamd
CLAMAV_MILTER_SOCKET?= /var/run/clmilter.sock
CONFLICTS= clamav-devel-*
SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' \
-e 's|%%DATADIR%%|${DATADIR}|g' \
-e 's|%%CLAMD_SOCKET%%|${CLAMD_SOCKET}|g'
-e 's|%%CLAMAV_CLAMD_SOCKET%%|${CLAMAV_CLAMD_SOCKET}|g' \
-e 's|%%CLAMAV_MILTER_SOCKET%%|${CLAMAV_MILTER_SOCKET}|g'
SED_CONF= -E -e 's|^\#?(Example)$$|\#\1|' \
-e 's|^\#?(LogFile) .*$$|\1 /var/log/clamav/clamd.log|' \
@ -67,20 +70,11 @@ SED_SCRIPT+= -e 's|%%RC_SUBR%%|${RC_SUBR}|g' \
PLIST_SUB+= RC_DIR=${RC_DIR} \
RC_SUFX=${RC_SUFX}
.if ${OSVERSION} < 501100
# compiles only with optimizer
CFLAGS+= -O
LDFLAGS+= -lcipher
.endif
.if ${OSVERSION} > 500023
# Approximate time libgmp was removed from the base system
LDFLAGS+= -L${LOCALBASE}/lib
LIB_DEPENDS= gmp.6:${PORTSDIR}/math/libgmp4
.endif
.if defined(WITH_MILTER)
USE_GETOPT_LONG= yes
.if exists(${LOCALBASE}/lib/libmilter.a)
CPPFLAGS+= -I${LOCALBASE}/include
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}"
.endif
CONFIGURE_ARGS+= --enable-milter
PLIST_SUB+= CLAMAV-MILTER=""
.else
@ -88,8 +82,10 @@ PLIST_SUB+= CLAMAV-MILTER="@comment "
.endif
post-patch:
@${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_LIBS}|g' \
@${REINPLACE_CMD} -e 's|-pthread -lc_r|${PTHREAD_LIBS}|g' \
${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
@${REINPLACE_CMD} -e 's|/usr/lib/sendmail|/usr/sbin/sendmail|g' \
${WRKSRC}/clamav-milter/clamav-milter.c
pre-configure:
@${REINPLACE_CMD} -e 's|clamav.conf|&.default|' \
@ -104,18 +100,25 @@ post-build:
@${SED} ${SED_CONF} ${BUILD_WRKSRC}/etc/clamav.conf \
>${BUILD_WRKSRC}/etc/clamav.conf.default
@${SED} ${SED_SCRIPT} ${PKGDIR}/pkg-install >${PKGINSTALL}
@${SED} ${SED_SCRIPT} ${FILESDIR}/clamd.sh >${WRKDIR}/clamd.sh
@${SED} ${SED_SCRIPT} ${FILESDIR}/clamav-clamd.sh \
>${WRKDIR}/clamav-clamd.sh
@${SED} ${SED_SCRIPT} ${FILESDIR}/clamav-milter.sh \
>${WRKDIR}/clamav-milter.sh
pre-install:
@${SETENV} PKG_PREFIX=${PREFIX} \
${SH} ${PKGINSTALL} ${PREFIX} PRE-INSTALL
post-install:
@${INSTALL_SCRIPT} ${WRKDIR}/clamd.sh ${RC_DIR}/clamd${RC_SUFX}
@${INSTALL_SCRIPT} ${WRKDIR}/clamav-clamd.sh ${RC_DIR}/clamd${RC_SUFX}
@${CHOWN} -R clamav:clamav ${DATADIR}
@[ -f ${PREFIX}/etc/clamav.conf ] || \
${CP} ${PREFIX}/etc/clamav.conf.default ${PREFIX}/etc/clamav.conf
@${SETENV} PKG_PREFIX=${PREFIX} \
${SH} ${PKGINSTALL} ${PREFIX} POST-INSTALL
.if defined(WITH_MILTER)
@${INSTALL_SCRIPT} ${WRKDIR}/clamav-milter.sh \
${RC_DIR}/clamav-milter${RC_SUFX}
.endif
.include <bsd.port.post.mk>

View File

@ -11,14 +11,14 @@
#
# Add the following lines to /etc/rc.conf to enable clamd:
#
#clamd_enable="YES"
#clamav_clamd_enable="YES"
#
# See clamd(8) for flags
#
. %%RC_SUBR%%
name=clamd
name=clamav_clamd
rcvar=`set_rcvar`
command=%%PREFIX%%/sbin/clamd
@ -30,10 +30,10 @@ start_precmd=start_precmd
start_precmd()
{
if [ -S "$clamd_socket" ]; then
warn "Stale socket $clamd_socket removed."
rm "$clamd_socket"
fi
if [ -S "$clamd_socket" ]; then
warn "Stale socket $clamd_socket removed."
rm "$clamd_socket"
fi
}
stop_postcmd=stop_postcmd
@ -45,9 +45,9 @@ stop_postcmd()
# set defaults
clamd_enable=${clamd_enable:-"NO"}
clamd_flags=${clamd_flags:-""}
clamd_socket=${clamd_socket:-"%%CLAMD_SOCKET%%"}
clamav_clamd_enable=${clamav_clamd_enable:-"NO"}
clamav_clamd_flags=${clamav_clamd_flags:-""}
clamav_clamd_socket=${clamav_clamd_socket:-"%%CLAMAV_CLAMD_SOCKET%%"}
load_rc_config $name
run_rc_command "$1"

View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: clamav-milter
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: FreeBSD shutdown
#
# Add the following lines to /etc/rc.conf to enable clamav-milter:
#
#clamav_milter="YES"
#
# See clamav-milter(1) for flags
#
. %%RC_SUBR%%
name=clamav_milter
rcvar=`set_rcvar`
command=%%PREFIX%%/sbin/clamav-milter
required_dirs=%%DATADIR%%
required_files=%%PREFIX%%/etc/clamav.conf
start_precmd=start_precmd
start_precmd()
{
if [ -S "$clamav_milter_socket" ]; then
warn "Stale socket $clamav_milter_socket removed."
rm "$clamav_milter_socket"
fi
}
# set defaults
clamav_milter_enable=${clamav_milter_enable:-"NO"}
clamav_milter_socket=${clamav_milter_socket:-"%%CLAMAV_MILTER_SOCKET%%"}
clamav_milter_flags=${clamav_milter_flags:-"--postmaster-only --local --outgoing --max-children=50"}
load_rc_config $name
# add socket to any given argument
clamav_milter_flags="${clamav_milter_flags} ${clamav_milter_socket}"
run_rc_command "$1"

View File

@ -0,0 +1,29 @@
--- clamav-milter/Makefile.in.orig Wed Nov 12 02:36:48 2003
+++ clamav-milter/Makefile.in Fri Nov 21 18:23:35 2003
@@ -122,7 +122,7 @@
@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@clamav_milter_LDADD = ../clamd/cfgfile.o ../clamd/others.o ../clamscan/getopt.o
-@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@man_MANS = ../docs/clamav-milter.8
+@BUILD_CLAMD_TRUE@@HAVE_MILTER_TRUE@man_MANS = ../docs/man/clamav-milter.8
DEFS = @DEFS@
# CLAMD_LIBS is used, because clamav-milter requires the same libraries as clamd
@@ -162,7 +162,7 @@
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ $(LIBS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(clamav_milter_SOURCES)
@@ -209,7 +209,7 @@
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
clamav-milter$(EXEEXT): $(clamav_milter_OBJECTS) $(clamav_milter_DEPENDENCIES)
@rm -f clamav-milter$(EXEEXT)
- $(LINK) $(clamav_milter_LDFLAGS) $(clamav_milter_OBJECTS) $(clamav_milter_LDADD) $(LIBS)
+ $(LINK) $(clamav_milter_LDFLAGS) $(clamav_milter_OBJECTS) $(clamav_milter_LDADD)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core

View File

@ -0,0 +1,20 @@
--- clamd/Makefile.in.orig Fri Nov 21 17:07:49 2003
+++ clamd/Makefile.in Fri Nov 21 17:10:33 2003
@@ -181,7 +181,7 @@
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ $(LIBS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(clamd_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
@@ -225,7 +225,7 @@
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
clamd$(EXEEXT): $(clamd_OBJECTS) $(clamd_DEPENDENCIES)
@rm -f clamd$(EXEEXT)
- $(LINK) $(clamd_LDFLAGS) $(clamd_OBJECTS) $(clamd_LDADD) $(LIBS)
+ $(LINK) $(clamd_LDFLAGS) $(clamd_OBJECTS) $(clamd_LDADD)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core

View File

@ -0,0 +1,20 @@
--- clamdscan/Makefile.in.orig Fri Nov 21 17:14:13 2003
+++ clamdscan/Makefile.in Fri Nov 21 17:14:45 2003
@@ -156,7 +156,7 @@
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ $(LIBS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(clamdscan_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
@@ -200,7 +200,7 @@
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
clamdscan$(EXEEXT): $(clamdscan_OBJECTS) $(clamdscan_DEPENDENCIES)
@rm -f clamdscan$(EXEEXT)
- $(LINK) $(clamdscan_LDFLAGS) $(clamdscan_OBJECTS) $(clamdscan_LDADD) $(LIBS)
+ $(LINK) $(clamdscan_LDFLAGS) $(clamdscan_OBJECTS) $(clamdscan_LDADD)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core

View File

@ -0,0 +1,20 @@
--- clamscan/Makefile.in.orig Fri Nov 21 17:03:08 2003
+++ clamscan/Makefile.in Fri Nov 21 17:04:35 2003
@@ -163,7 +163,7 @@
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ $(LIBS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(clamscan_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
@@ -207,7 +207,7 @@
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
clamscan$(EXEEXT): $(clamscan_OBJECTS) $(clamscan_DEPENDENCIES)
@rm -f clamscan$(EXEEXT)
- $(LINK) $(clamscan_LDFLAGS) $(clamscan_OBJECTS) $(clamscan_LDADD) $(LIBS)
+ $(LINK) $(clamscan_LDFLAGS) $(clamscan_OBJECTS) $(clamscan_LDADD)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core

View File

@ -0,0 +1,20 @@
--- freshclam/Makefile.in.orig Fri Nov 21 17:15:56 2003
+++ freshclam/Makefile.in Fri Nov 21 17:16:27 2003
@@ -161,7 +161,7 @@
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ $(LIBS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(freshclam_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
@@ -205,7 +205,7 @@
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
freshclam$(EXEEXT): $(freshclam_OBJECTS) $(freshclam_DEPENDENCIES)
@rm -f freshclam$(EXEEXT)
- $(LINK) $(freshclam_LDFLAGS) $(freshclam_OBJECTS) $(freshclam_LDADD) $(LIBS)
+ $(LINK) $(freshclam_LDFLAGS) $(freshclam_OBJECTS) $(freshclam_LDADD)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core

View File

@ -0,0 +1,20 @@
--- sigtool/Makefile.in.orig Fri Nov 21 17:12:10 2003
+++ sigtool/Makefile.in Fri Nov 21 17:13:13 2003
@@ -149,7 +149,7 @@
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ $(LIBS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(sigtool_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
@@ -193,7 +193,7 @@
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
sigtool$(EXEEXT): $(sigtool_OBJECTS) $(sigtool_DEPENDENCIES)
@rm -f sigtool$(EXEEXT)
- $(LINK) $(sigtool_LDFLAGS) $(sigtool_OBJECTS) $(sigtool_LDADD) $(LIBS)
+ $(LINK) $(sigtool_LDFLAGS) $(sigtool_OBJECTS) $(sigtool_LDADD)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core

View File

@ -1,26 +0,0 @@
--- libclamav/zziplib/zzip-file.c.orig Wed Feb 5 04:32:11 2003
+++ libclamav/zziplib/zzip-file.c Wed Feb 5 04:35:05 2003
@@ -11,6 +11,7 @@
* that can be found in COPYING.ZZIP
*/
+#include <strings.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
@@ -94,7 +95,6 @@
return 0;
}
-
static int zzip_inflate_init(ZZIP_FILE *, struct zzip_dir_hdr *);
/**
@@ -113,6 +113,7 @@
struct zzip_dir_hdr * hdr = dir->hdr0;
int (*cmp)(zzip_char_t*, zzip_char_t*);
+ (void)strcasecmp("","");
cmp = (o_mode & ZZIP_CASEINSENSITIVE)? strcasecmp: strcmp;
if (o_mode & ZZIP_IGNOREPATH)

View File

@ -1,10 +0,0 @@
--- libclamav/zziplib/zzip-stat.c.orig Wed Feb 5 04:36:09 2003
+++ libclamav/zziplib/zzip-stat.c Wed Feb 5 04:36:32 2003
@@ -32,6 +32,7 @@
struct zzip_dir_hdr * hdr = dir->hdr0;
int (*cmp)(zzip_char_t*, zzip_char_t*);
+ (void)strcasecmp("","");
cmp = (flags & ZZIP_CASEINSENSITIVE) ? strcasecmp : strcmp;
if (flags & ZZIP_IGNOREPATH)

View File

@ -1,7 +1,7 @@
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.
On FreeBSD 4.X the milter interface isn't built by default because
it needs gcc30 or higher.
Optionally you can use the clamav-milter interface to connect
clamav with sendmail.
WWW: http://clamav.sourceforge.net/

View File

@ -4,6 +4,7 @@ bin/clamscan
bin/clamdscan
bin/freshclam
bin/sigtool
%%CLAMAV-MILTER%%etc/rc.d/clamav-milter%%RC_SUFX%%
%%CLAMAV-MILTER%%sbin/clamav-milter
sbin/clamd
include/clamav.h