# Template file for 'mtr'
pkgname=mtr
version=0.87
revision=2
build_style="gnu-configure"
hostmakedepends="automake pkg-config gtk+-devel"
makedepends="ncurses-devel gtk+-devel"
depends="libcap-progs"
short_desc="Combines the functionality of traceroute and ping into one tool"
maintainer="Steven R <dev@styez.com>"
license="GPL-2"
homepage="http://www.bitwizard.nl/mtr/"
distfiles="https://github.com/traviscross/mtr/archive/v${version}.tar.gz"
checksum=ac177953e7c834d5326fc52d63377b6d0b42d05db8017556390629b87e44e183
#nocross=yes

post_extract() {
	sed -i 's/__GLIBC__/__linux__/g' configure.ac dns.c
}

pre_configure() {
	./bootstrap.sh
}

do_configure() {
	mkdir $wrksrc/build_nox $wrksrc/build_x11
	cd $wrksrc/build_nox
	$wrksrc/configure ${configure_args} --without-gtk

	cd $wrksrc/build_x11
	$wrksrc/configure ${configure_args}
}

do_build() {
	for p in $wrksrc/build_nox $wrksrc/build_x11; do
		cd $p
		make ${makejobs}
	done
}

do_install() {
	cd $wrksrc/build_nox
	make DESTDIR=$DESTDIR install
	chmod 0755 $DESTDIR/usr/bin/*
}

mtr-x11_package() {
	provides="mtr-${version}_${revision}"
	replaces="mtr>0"
	short_desc+=" - X11 version"
	pkg_install() {
		cd $wrksrc/build_x11
		make DESTDIR=$PKGDESTDIR install
		chmod 0755 $PKGDESTDIR/usr/bin/*
	}
}
