# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=bspwm
pkgver=0.9.4
pkgrel=0
pkgdesc="Tiling window manager based on binary space partitioning"
url="https://github.com/baskerville/bspwm"
arch="all"
license="BSD-2-Clause"
makedepends="libxcb-dev xcb-util-dev xcb-util-wm-dev xcb-util-keysyms-dev"
options="!check" # depends on missing jshon package
subpackages="
	$pkgname-doc
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/baskerville/$pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	make PREFIX=/usr
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" PREFIX=/usr install
}

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

	mkdir -p "$subpkgdir"/usr/share/zsh/site-functions
	mv "$pkgdir"/usr/share/zsh/site-functions/* \
		"$subpkgdir"/usr/share/zsh/site-functions

}

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

	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions/
	mv "$pkgdir"/usr/share/bash-completion/completions/* \
		"$subpkgdir"/usr/share/bash-completion/completions/
}

fishcomp() {
	pkgdesc="Fish completion for $pkgname"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	mkdir -p "$subpkgdir"/usr/share/fish/completions/
	mv "$pkgdir"/usr/share/fish/vendor_completions.d/*.fish \
		"$subpkgdir"/usr/share/fish/completions/
}

sha512sums="88f03766215684e3781063d635bdcd29abf7775ab6ea22010f3b7553faa3f41eac53e806841267166340c22d14ed999f08ecceed1c35dfb2daeddb0cf037fb11  bspwm-0.9.4.tar.gz"
