# Template file for 'logrotate'
pkgname=logrotate
version=3.7.8
revision=1
distfiles="${DEBIAN_SITE}/main/l/${pkgname}/${pkgname}_${version}.orig.tar.gz"
build_style=gnu_makefile
make_install_args="PREFIX=$XBPS_DESTDIR/$pkgname-$version"
short_desc="Log file rotation and periodic maintenance"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=21aa3dc830e8cc895ee4199d9325aa1e37cd3b525d0eaef400f66f6c7fc536dd
long_desc="
 $pkgname performs periodic maintenance of log files. The most common
 action is rotating log files and archiving the old logs to one or more
 places, but it can also periodically copy logs to a central repository
 without truncating them. It can run commands both before and after log
 rotation to handle stopping, restarting, or sending signals to servers,
 and it automatically compresses logs when it archives them."

conf_files="/etc/logrotate.conf"

Add_dependency run glibc
Add_dependency run popt
Add_dependency full gzip
Add_dependency build popt-devel

pre_build()
{
	sed -i "s|CFLAGS = -Wall|CFLAGS += -Wall|" $wrksrc/Makefile
	sed -i 's|$(BASEDIR)/man|$(BASEDIR)/share/man|' $wrksrc/Makefile
	sed -i "s|/bin/\(g.*zip\)|/usr/bin/\1|g" $wrksrc/config.h
}

post_install()
{
	install -d ${DESTDIR}/etc/cron.daily ${DESTDIR}/etc/logrotate.d
	install -m644 ${FILESDIR}/logrotate.conf ${DESTDIR}/etc
	install -m744 ${FILESDIR}/logrotate.cron-daily \
		${DESTDIR}/etc/cron.daily/logrotate
}
