# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=shairport-sync
pkgver=3.1.7
pkgrel=1
pkgdesc="AirTunes emulator. Shairport Sync adds multi-room capability with Audio Synchronisation"
url="https://github.com/mikebrady/shairport-sync"
arch="all"
license="custom"
depends="avahi"
makedepends="autoconf automake libtool alsa-lib-dev libdaemon-dev popt-dev
	libressl-dev soxr-dev avahi-dev libconfig-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mikebrady/$pkgname/archive/$pkgver.tar.gz
	$pkgname.initd"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare
	cd "$builddir"
	autoreconf -i -f
}

build() {
	cd "$builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-piddir=/run \
		--with-alsa \
		--with-avahi \
		--with-ssl=openssl \
		--with-soxr
	make
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install
	install -m 755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="ba9ed2fd840d05c88a65ee684531639ebf17830be07c9036247f3004271c2f7c3174b07ad962b721f567644a3fc0d4441b3a3157c7cf22226ede7f2b4522a6c5  shairport-sync-3.1.7.tar.gz
aeead51ef0f17d360bb1e2d2ae897974ef507ef56db84e6aeb79d8ec522c3bb9336f01ff4150e70fecfebf9808dd7190cb2839e287cf0ef6e1886504c1f1edc6  shairport-sync.initd"
