# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mpc
pkgver=0.28
pkgrel=1
pkgdesc="Minimalist command line interface to MPD"
url="https://www.musicpd.org/clients/mpc/"
arch="all"
license="GPL-2.0"
makedepends="libmpdclient-dev"
subpackages="$pkgname-bash-completion:bashcomp:noarch $pkgname-doc"
source="http://www.musicpd.org/download/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz"

builddir="$srcdir/$pkgname-$pkgver"

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

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" 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/$pkgname/$pkgname-completion.bash \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

sha512sums="1d0c96c3c7cee2eac2d3cf25f09d74b5807b8ea56ff7dfc033b8fa690fd4d42de726a641e4f2552550d8a1c1b2840575aec5c595166ca5ae5776fcc93c8fb7cf  mpc-0.28.tar.xz"
