# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=umurmur
pkgver=0.2.17
pkgrel=1
pkgdesc="Minimalistic Mumble server primarily targeted to run on routers"
url="http://umurmur.net/"
arch="all"
license="BSD"
depends=""
makedepends="libconfig-dev libressl-dev protobuf-c-dev autoconf automake"
install="$pkgname.post-install"
subpackages="$pkgname-doc"
pkgusers="umurmur"
pkggroups="umurmur"
source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	$pkgname.conf"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare || return 1

	cd "$builddir"
	autoreconf -fi
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-ssl=openssl \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1
	install -Dm644 "$srcdir"/$pkgname.conf \
		"$pkgdir"/etc/$pkgname/umurmurd.conf || return 1

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

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/
	install -Dm644 AUTHORS ChangeLog README.md \
		"$pkgdir"/usr/share/doc/$pkgname/
}

sha512sums="a496a51fd7815ad117f5aee17bb78cbd319c584ad60ab8aebbfd8ddf7b1760f443f2337bc74be1e0d5af17d3c3df2ae6c9060eca576cf1e6ed4c6cb0825e9c15  umurmur-0.2.17.tar.gz
1c22da6478738b8ac77aecbbf8e41260a957ddffec350020e56b622c70445ebf8dc28feb563b878f2c64132742d8e1e0cbcbd2a50f0c0b29a309ca29598d8c94  umurmur.initd
b6412621522c9148d5eaced25ff4fb023b0c84206a969120e261b4a89386c46961f1c485435a1763935f538c04c03f7b4b83d45779f1ba796b627cdb0d2436a0  umurmur.confd
0a5882dca2daf686716d7b78f916e4506c7b98e3460ccd56aace087dca88b686b659e32b325bf253922cc824049a800b06e5006ea04cc5539c82b63cda5cccea  umurmur.conf"
