# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=wrk
pkgver=4.0.2
pkgrel=0
pkgdesc="wrk is a modern HTTP benchmarking tool"
url="https://github.com/wg/wrk"
# requires -march=i586 to build on x86
arch="x86_64"
license="Apache-2.0"
depends=""
depends_dev=""
options="!check" # upstream does not provide tests
makedepends="libressl-dev perl-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/wg/wrk/archive/$pkgver.tar.gz"
builddir="$srcdir"/$pkgname-$pkgver

build() {
	cd "$builddir"
	# see https://github.com/wg/wrk/issues/310
	touch buildinf.h
	make -j1 -C "$builddir"
}

package() {
	cd "$builddir"
	mkdir -p $pkgdir/usr/bin
	mkdir -p $pkgdir/usr/share/doc/$pkgname/scripts
        install -m755 -D $pkgname "$pkgdir"/usr/bin/$pkgname
	install -m644 -D README "$pkgdir"/usr/share/doc/$pkgname/
	install -m644 -D LICENSE "$pkgdir"/usr/share/doc/$pkgname/
	install -m644 -D NOTICE "$pkgdir"/usr/share/doc/$pkgname/
	install -m755 -D scripts/* "$pkgdir"/usr/share/doc/$pkgname/scripts/
}

sha512sums="4279cf7136e2919779be3f61f462136a7a5288eac481104b844193682a8fc554581fd3942624d0be9317a3e82c82497927a124b9b4dbdf455e30d3f0cad1fdea  wrk-4.0.2.tar.gz"
