# Compiling Time: 0.03 SBU
# Maintainer: Kapolnasi Tamas <ktamas@tdc.hu>

pkgname=iptraf
pkgver=3.0.0
pkgrel=5
pkgdesc="Interactive Colorful IP LAN Monitor"
url="http://iptraf.seul.org/"
depends=('glibc>=2.22-7' 'ncurses>=6.0-6')
groups=('network')
archs=('i686' 'x86_64')
up2date="lynx -dump http://iptraf.seul.org/download.html|grep 'iptraf-.*.tar.gz$'|sed -n 's/.*traf-\(.*\)\.t.*/\1/; 2 p'"
source=(ftp://iptraf.seul.org/pub/iptraf/$pkgname-$pkgver.tar.gz iptraf-3.0.0-headerfix.patch)
sha1sums=('e5032b564593a8ec336751d41c090e5cdb7663a1' \
          '0d0230b41a290efd6c6dbe9981b454aeec62f13a')

build() {
	Fpatchall || return 1

	Fsed '^CFLAGS.*' '' src/Makefile
	#WORKDIR
	Fsed '/var/local/iptraf' '/etc/iptraf' src/Makefile
	#TARGET
	Fsed '/usr/local/bin' '/usr/sbin' src/Makefile
	Fsed '/var/local/iptraf' '/etc/iptraf' Documentation/iptraf.8
	Fsed '/var/local/iptraf' '/etc/iptraf' Documentation/rvnamed.8
	Fsed "Documentation/*" "/usr/share/doc/iptraf-$pkgver/html/" Documentation/iptraf.8

	cd src || Fdie
	make || Fdie

	Fmkdir etc/{iptraf,tmpfiles.d}
	Fmkdir var/log/iptraf

	cat > $Fdestdir/etc/tmpfiles.d/iptraf.conf << EOF
d $Flocalstatedir/run/iptraf 0755 root root -
EOF
	Fmkdir usr/sbin
	Fmkdir usr/man/man8
	Fmkdir usr/share/pixmaps
        Fmkdir usr/share/doc/$pkgname-$pkgver/html
	Fmkdir usr/share/doc/$pkgname-$pkgver/html/stylesheet-images

	Fexerel /usr/sbin/iptraf
	Fexerel /usr/sbin/rvnamed

	local DOC="/$pkgname-$pkgver/Documentation"
	Ffile $DOC/*.html /usr/share/doc/$pkgname-$pkgver/html
	Ffile $DOC/stylesheet-images/*.gif /usr/share/doc/$pkgname-$pkgver/html/stylesheet-images/
	Ffile $DOC/iptraf.8 /usr/man/man8/
	Ffile $DOC/rvnamed.8 /usr/man/man8/
	Ffile $DOC/iptraf.xpm /usr/share/pixmaps/
}



# optimization OK
