Subject: [alpine-devel] new aport clamav

From: "Carlo Landmeter" <[email-masked]>
Date: Tue, 03 Feb 2009 11:01:08 +0000

see attached git patch.

carlo

From 20f28375ec5b8a039cfc8eac36f90e113e630be8 Mon Sep 17 00:00:00 2001
From: Carlo Landmeter <[email-masked]>
Date: Tue, 3 Feb 2009 11:00:09 +0000
Subject: [PATCH] extra/clamav: new aport

---
 extra/clamav/APKBUILD                |   39 ++++++++++++++++++
 extra/clamav/clamav-0.94.2-nls.patch |   71 ++++++++++++++++++++++++++++++++++
 extra/clamav/clamav.confd            |    9 ++++
 extra/clamav/clamav.initd            |   39 ++++++++++++++++++
 extra/clamav/clamav.install          |   10 +++++
 5 files changed, 168 insertions(+), 0 deletions(-)
 create mode 100644 extra/clamav/APKBUILD
 create mode 100644 extra/clamav/clamav-0.94.2-nls.patch
 create mode 100644 extra/clamav/clamav.confd
 create mode 100644 extra/clamav/clamav.initd
 create mode 100644 extra/clamav/clamav.install

diff --git a/extra/clamav/APKBUILD b/extra/clamav/APKBUILD
new file mode 100644
index 0000000..28cafd4
--- /dev/null
+++ b/extra/clamav/APKBUILD
@@ -0,0 +1,39 @@
+# Contributor: Carlo Landmeter <clandmeter at gmail>
+# Maintainer: Carlo Landmeter <clandmeter at gmail>
+pkgname=clamav
+pkgver=0.94.2
+pkgrel=0
+pkgdesc="An anti-virus toolkit for UNIX"
+url="http://www.clamav.net/"
+license="GPL"
+depends="zlib gmp"
+install=clamav.install
+makedepends="gmp-dev zlib-dev"
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+	clamav.initd
+	clamav.confd
+	clamav-0.94.2-nls.patch
+	$install"
+
+build() {
+	cd "$srcdir/$pkgname-$pkgver"
+
+	patch -p0 -i "$srcdir/clamav-0.94.2-nls.patch" || return 1
+
+	./configure --prefix=/usr \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--infodir=/usr/share/info \
+		--disable-clamav
+	make || return 1
+	make DESTDIR="$pkgdir" install
+
+	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+md5sums="1181e6d62341b84708f126cc353f7ebf  clamav-0.94.2.tar.gz
+d0c708403940c51e52eb27ea1610a27d  clamav.initd
+431dfe7403323e247a88b97beade5d78  clamav.confd
+328a0c3449a6b516e443d7db5a0d4d01  clamav-0.94.2-nls.patch"
diff --git a/extra/clamav/clamav-0.94.2-nls.patch b/extra/clamav/clamav-0.94.2-nls.patch
new file mode 100644
index 0000000..7e02a29
--- /dev/null
+++ b/extra/clamav/clamav-0.94.2-nls.patch
@@ -0,0 +1,71 @@
+Patch to disable nls (gettext) support for clamd. Taken from gentoo:
+http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-antivirus/clamav/files/clamav-0.94-nls.patch?view=log
+
+--- clamav-milter/clamav-milter.c	Fri Nov 21 22:24:41 2008
++++ clamav-milter/clamav-milter.c	Mon Feb  2 09:30:14 2009
+@@ -113,6 +113,7 @@
+ 
+ #ifdef	C_LINUX
+ #include <sys/sendfile.h>	/* FIXME: use sendfile on BSD not Linux */
++#ifdef ENABLE_NLS
+ #include <libintl.h>
+ #include <locale.h>
+ 
+@@ -125,7 +126,8 @@
+ #define	_(s)	s
+ #define	N_(s)	s
+ 
+-#endif
++#endif /* ENABLE_NLS */
++#endif /* C_LINUX */
+ 
+ #ifdef	USE_SYSLOG
+ #include <syslog.h>
+@@ -774,7 +776,7 @@
+ 	else
+ 		progname = "clamav-milter";
+ 
+-#ifdef	C_LINUX
++#ifdef	ENABLE_NLS
+ 	setlocale(LC_ALL, "");
+ 	bindtextdomain(progname, DATADIR"/clamav-milter/locale");
+ 	textdomain(progname);
+--- configure.in	Wed Nov 26 12:15:08 2008
++++ configure.in	Mon Feb  2 09:30:14 2009
+@@ -609,6 +609,14 @@
+     fi
+ fi
+ 
++AC_ARG_ENABLE([nls],
++               AC_HELP_STRING([--disable-nls], [disable NLS support]),
++               [want_nls=$enableval], [want_nls=yes]
++)
++if test $want_nls = yes; then
++       CPPFLAGS="$CPPFLAGS -DENABLE_NLS"
++fi
++
+ AC_ARG_ENABLE([ipv6],
+ [  --disable-ipv6          disable IPv6 support],
+ want_ipv6=$enableval, want_ipv6="yes")
+--- shared/getopt.c	Fri Nov 21 22:24:42 2008
++++ shared/getopt.c	Mon Feb  2 09:30:14 2009
+@@ -82,7 +82,7 @@
+ 
+ #ifndef _
+ /* This is for other GNU distributions with internationalized messages.  */
+-# if defined HAVE_LIBINTL_H || defined _LIBC
++# if (defined(HAVE_LIBINTL_H) || defined(_LIBC)) && defined(ENABLE_NLS)
+ #  include <libintl.h>
+ #  ifndef _
+ #   define _(msgid)	gettext (msgid)
+--- shared/output.c	Tue Nov 25 20:11:00 2008
++++ shared/output.c	Mon Feb  2 09:30:14 2009
+@@ -61,7 +61,7 @@
+ pthread_mutex_t logg_mutex = PTHREAD_MUTEX_INITIALIZER;
+ #endif
+ 
+-#ifdef  C_LINUX
++#if defined(C_LINUX) && defined(ENABLE_NLS)
+ #include <libintl.h>
+ #include <locale.h>
+ 
diff --git a/extra/clamav/clamav.confd b/extra/clamav/clamav.confd
new file mode 100644
index 0000000..0abb80c
--- /dev/null
+++ b/extra/clamav/clamav.confd
@@ -0,0 +1,9 @@
+# Sample conf.d file for alpine linux
+
+#
+# Specify daemon $OPTS here.
+#
+
+OPTS=""
+USER="nobody"
+GROUP="nobody"
diff --git a/extra/clamav/clamav.initd b/extra/clamav/clamav.initd
new file mode 100644
index 0000000..980c53e
--- /dev/null
+++ b/extra/clamav/clamav.initd
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+
+# Sample init.d file for alpine linux.
+
+NAME=
+DAEMON=/usr/sbin/$NAME
+
+depend() {
+	need net
+}
+
+start() {
+	ebegin "Starting ${NAME}"
+		start-stop-daemon --start --quiet --background \
+			--make-pidfile --pidfile /var/run/${NAME}.pid \
+			--chuid ${USER}:${GROUP} \
+			--exec ${DAEMON} -- ${OPTS}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ${NAME}"
+		start-stop-daemon --stop --quiet \
+			--exec ${DAEMON} \
+			--pidfile /var/run/${NAME}.pid \
+	eend $?
+}
+
+reload() {
+	ebegin "Reloading ${NAME}"
+	if ! service_started "${NAME}" ; then
+		eend 1 "${NAME} is not started"
+		return 1
+	fi
+	start-stop-daemon --stop --oknodo --signal HUP \
+		--exec ${DAEMON} --pidfile /var/run/${NAME}.pid
+	eend $?
+}
+
diff --git a/extra/clamav/clamav.install b/extra/clamav/clamav.install
new file mode 100644
index 0000000..8d427d9
--- /dev/null
+++ b/extra/clamav/clamav.install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+case "$1" in
+	post_install)
+	echo '*'
+	echo '* Adding new user clamav'
+	echo '*'
+	adduser -H -s /bin/false -D clamav 2>/dev/null
+	;;
+esac
-- 
1.6.1

---

From: Natanael Copa <[email-masked]>
Date: Tue, 03 Feb 2009 15:02:51 +0100

> carlo

looks very good. you even managed to get that nls stuff correct!

commited.

thanks!

-nc

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---