# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=polygraph
pkgver=4.3.2
pkgrel=1
pkgdesc="Performance testing tool for Web intermediaries"
url="http://www.web-polygraph.org"
arch="all"
license="Apache2"
depends="zlib-dev"
depends_dev=
makedepends="$depends_dev"
install=
subpackages="$pkgname-dev $pkgname-doc"
source="http://www.web-polygraph.org/downloads/srcs/$pkgname-$pkgver-src.tgz
	10-fix-ftbfs-gcc-4.7.patch
	"


_builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install

	# remove the 2 lines below (and this) if there is no init.d script
	# install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	# install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

md5sums="74d9ad75ed355afbbeefa166954da54f  polygraph-4.3.2-src.tgz
3c7399d3f005c8afb867e9ea3f0d6f4c  10-fix-ftbfs-gcc-4.7.patch"
sha256sums="b0104448ff3c2f29cebeb5ad5ee6e6f670438d8b78fa095fd54f3b16d99569bb  polygraph-4.3.2-src.tgz
65185b6b695e62efa39cc778fd253afef250b2999eeec8b3e29b41369db3cdb0  10-fix-ftbfs-gcc-4.7.patch"
sha512sums="a660427f9e21dddb102a172238823091c64983ca6eb938eb5aa9cd1d980e2b2b061614f41162000c838514d164124e08c0fe4517bda1e3f2bf6498831957674b  polygraph-4.3.2-src.tgz
e091fb9cab4cb3053df532df9012cd093a7eb3493aad112ba38eb31d534185bc83c6b9b5eeb424316f9354b04d13a3a92a1af45e6134a60690e5f4a6b3180a27  10-fix-ftbfs-gcc-4.7.patch"