# Template file for 'logrotate'
pkgname=logrotate
version=3.7.9
distfiles="https://fedorahosted.org/releases/l/o/$pkgname/${pkgname}-${version}.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=080caf904e70e04da16b8dfa95a5a787ec7d722ee1af18ccea437d3ffdd6fec0
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
}
