# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mpc
pkgver=0.29
pkgrel=0
pkgdesc="Minimalist command line interface to MPD"
url="https://www.musicpd.org/clients/mpc/"
arch="all"
license="GPL-2.0"
makedepends="libmpdclient-dev py-sphinx meson"
subpackages="$pkgname-bash-completion:bashcomp:noarch $pkgname-doc"
source="http://www.musicpd.org/download/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
	0001-doc-meson.build-drop-bogus-man-from-manpage-install-.patch"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=release \
		. output
	ninja -C output
}

package() {
	cd "$builddir"
	DESTDIR="$pkgdir" ninja -C output install
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions
	mv "$pkgdir"/usr/share/doc/mpc/contrib/mpc-completion.bash \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

sha512sums="3013b43f3b7d9a1b591c498515440afde1ba16656199f821addbc5018e2e6b0c84c4c7aa9ddbac40a51260d4ba3c281c128a61801f0cdfade5d10e9ead031757  mpc-0.29.tar.xz
870d97246cb89de68ebcb98ba21efe1f8b9b65bf6bb1353ea8c82c9a024624931fb07104a1e58103054b8dff588b4627077168fc9830a6be50bb86c9bed9117b  0001-doc-meson.build-drop-bogus-man-from-manpage-install-.patch"
