# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=beanstalkd
pkgver=1.13
pkgrel=0
pkgdesc="Beanstalk is a simple, fast work queue"
url="https://kr.github.io/beanstalkd/"
arch="all"
license="MIT"
makedepends="clang"
install="$pkgname.pre-install"
pkgusers="beanstalk"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kr/beanstalkd/archive/v$pkgver.tar.gz
	$pkgname.confd
	$pkgname.initd
	remove-werror.patch
	"

build() {
	make
}

check() {
	make check
}

package() {
	mkdir -p "$pkgdir"/var/lib/beanstalkd
	chown $pkgusers "$pkgdir"/var/lib/beanstalkd
	make PREFIX="$pkgdir"/usr install
	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
	install -D -m644 "doc/beanstalkd.1" "$pkgdir/usr/share/man/man1/beanstalkd.1"
}

sha512sums="
7b5d1a185765a6abe4f1fb8ff2ce7ab0d00b9b2d87ed78ee6349895cdab43e7eac9bb9da5aa1e7b378038e69ac20113e7a663529b0fd77b697257bc384b7deda  beanstalkd-1.13.tar.gz
0460ba20e5596308a1a07ce50a8e431de6a86d557e0b4c63097c8d5998dc5704b56bec573fce37619cc4f5c0e7abf28ad251b4279fd6ad7fceb0e93b49d221fe  beanstalkd.confd
6b665411341033c16781f8ef254a527ff60629860fd649bb7aa4b79dabbd87edee8d33a4579a4f451eb8a5fbb979d2cc3f8a23d4c5e2eaa18c7225362f94df3e  beanstalkd.initd
42949d11294b5f42c96d06ce13aff76d596c3268af7442ade669cada29a58ed7612bf88521e6621bb100232b5875c982f3e6ddb1989799d74175135c89981146  remove-werror.patch
"
