# Description: A GPL virus scanner
# URL: http://www.clamav.net/
# Maintainer: Matt Housh, jaeger at crux dot ninja
# Depends on: bzip2 libgmp curl cmake libxml2 libpcre2 json-c rust

name=clamav
version=1.1.0
release=1
source=(http://www.clamav.net/downloads/production/$name-$version.tar.gz \
	clamd.conf freshclam.conf clamd freshclam)

build() {
	mkdir build
	cd build
	cmake -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
		-DAPP_CONFIG_DIRECTORY=/etc \
		-DENABLE_MILTER=OFF \
		-DENABLE_TESTS=OFF \
		../$name-$version
	cmake .
	make DESTDIR=$PKG install
	mkdir -p $PKG/var/run/$name $PKG/var/log/$name
	chown -R $name:$name $PKG/var/run/$name $PKG/var/log/$name
	install -o root -g root -m 0644 $SRC/{clamd,freshclam}.conf \
		$PKG/etc/
	install -d $PKG/etc/rc.d
	install -o root -g root -m 0755 $SRC/{clamd,freshclam} \
		$PKG/etc/rc.d/
	install -o clamav -g clamav -m 0775 -d $PKG/usr/share/clamav
	rm -r $PKG/usr/share/doc $PKG/etc/*.sample
}
