# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=gatling
pkgver=0.15
pkgrel=2
pkgdesc="High performance web server"
url="https://www.fefe.de/gatling/"
arch="x86_64 x86 ppc64le"
license="GPL-2.0"
depends=""
depends_dev=""
makedepends="libressl-dev libowfat-dev zlib-dev"
install="gatling.pre-install"
subpackages="$pkgname-doc"
source="https://www.fefe.de/$pkgname/$pkgname-$pkgver.tar.xz
	build-fixes.patch

	gatling.confd
	gatling.initd"

builddir="$srcdir/$pkgname-$pkgver"
build() {
	cd "$builddir"
	CFLAGS="$CFLAGS -std=c99"

	make prefix=/usr \
		CFLAGS="$CFLAGS -I/usr/include/libowfat" \
		LDFLAGS="$LDFLAGS" \
		gatling tlsgatling || return 1
}

package() {
	cd "$builddir"
	install -Dm644 gatling.1 \
		"$pkgdir"/usr/share/doc/man/man1/gatling.1 \
		|| return 1

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/
	install -m644 README.ftp README.http README.tls \
		"$pkgdir"/usr/share/doc/$pkgname/ \
		|| return 1

	mkdir -p "$pkgdir"/usr/bin/
	install -m755 gatling tlsgatling \
		"$pkgdir"/usr/bin/ || return 1

	install -Dm755 "$srcdir"/gatling.initd \
		"$pkgdir"/etc/init.d/gatling || return 1
	install -Dm644 "$srcdir"/gatling.confd \
		"$pkgdir"/etc/conf.d/gatling || return 1
}

md5sums="08784f9014fa298b47ef09fee69a3c55  gatling-0.15.tar.xz
24c05ce3ed75c16da9da69abc6e7682d  build-fixes.patch
661560d0d3c05625eca4cc7947fe0ad5  gatling.confd
fa10da598217cfaabc93161b0b364f53  gatling.initd"
sha256sums="6fa329d0ced0c80deb8dde5460e9d9e984bee94f265043d7fdec0e253dce9aa4  gatling-0.15.tar.xz
6c355dccc45a0ccf3e333b6774e47a74c5d0c93832c969a1565f424d437fd639  build-fixes.patch
6e8f2217b44d3d7aef0be0dc7ce97447ce5ac97d98e267c42af55d188b9b5ce7  gatling.confd
42fe83c5a06a87585ba1ecbb49c58089940b96fbe5ec4239c93af1dc62e5380b  gatling.initd"
sha512sums="b76d220a0644f1e6e7ea966a4eff409964c564fc4a31c4efdb764e5f7b5857bc58c26bc31e860fe35df932cbd60fb2b0f4f21c75cb5aa56427e8a2a453684716  gatling-0.15.tar.xz
888e3a3698a168313199d7d4ecbd48aae20de9d84e324322fdf1a7ebfab4d14af5f0d8ddf1b4475830d0e213ddac71f7db4efe50de0da8a0a2c8e95ed1ce9803  build-fixes.patch
b51e5145fa5f67dd933f8b7c06d633545152b253c51891ef4519b83707b0001034506a7a8807a37d104dcab47320a5233093d9d89211b36753ac316e447b54a9  gatling.confd
456ee7f2c62b682376f301b1727e32e68a53fe5b50bd9d9b1e00225e6d0e6bc62fa328b503ca2ebf899ff4c6ca68d9998785ee83749d4590c3c0196a5aadb133  gatling.initd"
