diff --git a/security/clamav/Makefile b/security/clamav/Makefile index 4ec7b82f0247..fcfd0e4de443 100644 --- a/security/clamav/Makefile +++ b/security/clamav/Makefile @@ -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 diff --git a/security/clamav/files/clamd.sh b/security/clamav/files/clamav-clamd.sh similarity index 63% rename from security/clamav/files/clamd.sh rename to security/clamav/files/clamav-clamd.sh index 9a5fe99cb911..add634772cea 100644 --- a/security/clamav/files/clamd.sh +++ b/security/clamav/files/clamav-clamd.sh @@ -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" diff --git a/security/clamav/files/clamav-milter.sh b/security/clamav/files/clamav-milter.sh new file mode 100644 index 000000000000..7c1028cb936c --- /dev/null +++ b/security/clamav/files/clamav-milter.sh @@ -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" diff --git a/security/clamav/files/patch-clamav-milter::Makefile.in b/security/clamav/files/patch-clamav-milter::Makefile.in new file mode 100644 index 000000000000..bcdc3f2c964c --- /dev/null +++ b/security/clamav/files/patch-clamav-milter::Makefile.in @@ -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 diff --git a/security/clamav/files/patch-clamd::Makefile.in b/security/clamav/files/patch-clamd::Makefile.in new file mode 100644 index 000000000000..4f98104fc06b --- /dev/null +++ b/security/clamav/files/patch-clamd::Makefile.in @@ -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 diff --git a/security/clamav/files/patch-clamdscan::Makefile.in b/security/clamav/files/patch-clamdscan::Makefile.in new file mode 100644 index 000000000000..f612bdcfdd18 --- /dev/null +++ b/security/clamav/files/patch-clamdscan::Makefile.in @@ -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 diff --git a/security/clamav/files/patch-clamscan::Makefile.in b/security/clamav/files/patch-clamscan::Makefile.in new file mode 100644 index 000000000000..b9559bd919bb --- /dev/null +++ b/security/clamav/files/patch-clamscan::Makefile.in @@ -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 diff --git a/security/clamav/files/patch-freshclam::Makefile.in b/security/clamav/files/patch-freshclam::Makefile.in new file mode 100644 index 000000000000..cca90c882479 --- /dev/null +++ b/security/clamav/files/patch-freshclam::Makefile.in @@ -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 diff --git a/security/clamav/files/patch-sigtool::Makefile.in b/security/clamav/files/patch-sigtool::Makefile.in new file mode 100644 index 000000000000..7b7209581986 --- /dev/null +++ b/security/clamav/files/patch-sigtool::Makefile.in @@ -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 diff --git a/security/clamav/files/patch5-libclamav::zziplib::zzip-file.c b/security/clamav/files/patch5-libclamav::zziplib::zzip-file.c deleted file mode 100644 index 234f1ce5af2c..000000000000 --- a/security/clamav/files/patch5-libclamav::zziplib::zzip-file.c +++ /dev/null @@ -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 - #include - #include - #include -@@ -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) diff --git a/security/clamav/files/patch5-libclamav::zziplib::zzip-stat.c b/security/clamav/files/patch5-libclamav::zziplib::zzip-stat.c deleted file mode 100644 index 745fdb031292..000000000000 --- a/security/clamav/files/patch5-libclamav::zziplib::zzip-stat.c +++ /dev/null @@ -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) diff --git a/security/clamav/pkg-descr b/security/clamav/pkg-descr index b0eb16cd9c81..0850cba4e5f8 100644 --- a/security/clamav/pkg-descr +++ b/security/clamav/pkg-descr @@ -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/ diff --git a/security/clamav/pkg-plist b/security/clamav/pkg-plist index 81ecc48d0fe2..bd5aa5750bb4 100644 --- a/security/clamav/pkg-plist +++ b/security/clamav/pkg-plist @@ -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