# Contributor: dai9ah <dai9ah@protonmail.com>
# Maintainer: dai9ah <dai9ah@protonmail.com>
pkgname=mpdcron
pkgver=0.3
pkgrel=0
pkgdesc="Cron-like daemon for mpd"
url="https://github.com/alip/mpdcron"
arch="all"
license="GPL-2.0-only"
makedepends="autoconf automake curl-dev glib-dev libdaemon-dev libmpdclient-dev
	libnotify-dev libtool sqlite-dev
	"
subpackages="$pkgname-doc
	$pkgname-dev
	$pkgname-zsh-completion:zshcomp:noarch
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/alip/$pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./autogen.sh
	./configure \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--enable-gmodule \
		--with-standard-modules=all
	make
}

check() {
	cd "$builddir"/src
	./mpdcron --help > /dev/null
}

package() {
	make DESTDIR="$pkgdir" -C "$builddir" install
}

zshcomp() {
	pkgdesc="Zsh completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	mkdir -p "$subpkgdir"/usr/share/zsh/site-functions
	install -Dm644 "$builddir"/zsh-completion/_* \
		"$subpkgdir"/usr/share/zsh/site-functions/
}

sha512sums="19c55d9edfeda7ecd317c449d195f90c3bda04f0d7a26cc6395b437f7d501e3ea8a00820367807e61c073ed6aa38bd69fc4948de8061cbbd20f7f393204d11e5  mpdcron-0.3.tar.gz"
