# Contributor: Florian Heigl <florian.heigl@gmail.com>
# Maintainer: Florian Heigl <florian.heigl@gmail.com>
pkgname=nvme-cli
pkgver=1.4
pkgrel=0
pkgdesc="NVM-Express user space tooling for Linux"
arch="all"
url="https://github.com/linux-nvme/nvme-cli"
license="GPL"
depends=""
makedepends="$depends_dev linux-headers coreutils"
subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp"
source="$pkgname-$pkgver.tar.gz::https://github.com/linux-nvme/nvme-cli/archive/v${pkgver}.tar.gz
	"

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

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

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

sha512sums="8d7e2f0717562bfe2306306830983644e4b118bd6705a0386fcae02f6d171faa76a6d594f01fc8ee57dcbf1a41ea0a84cd4527f7a729fddc3431975cf6914955  nvme-cli-1.4.tar.gz"
