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

build() {
	abuild-meson \
		-Dtest=true \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

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="
be7ec268432eb8e34092d025e6a40379e83d54e5f87943beeb87ed8fe9db4c5c8261b09cc3230ada28300151382f97b1c2da45f54e8aad68af9946f484d0b28b  mpc-0.35.tar.xz
"
