# Contributor: Florian Heigl <florian.heigl@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nvme-cli
pkgver=2.14
pkgrel=0
pkgdesc="NVM-Express user space tooling for Linux"
arch="all"
url="https://github.com/linux-nvme/nvme-cli"
license="GPL-2.0-or-later"
makedepends="
	bash
	json-c-dev
	libnvme-dev>=1.14
	linux-headers
	meson
	util-linux-dev
	uuidgen
	zlib-dev
	"
checkdepends="
	py3-nose2
	"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/linux-nvme/nvme-cli/archive/v$pkgver.tar.gz
	"
options="!check" # needs pci nvme stuff

build() {
	abuild-meson \
		-Db_lto=true \
		-Ddocs=man \
		-Dudevrulesdir=/usr/lib/udev/rules.d/ \
		-Djson-c=enabled \
		. output
	meson compile -C output
}

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

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	rm -rf "$pkgdir"/usr/lib/systemd
}

sha512sums="
7f600ee719f06283e136427a0f9eb0b22412f7f4549c774768caff54150207ba87e2a431ea1569e5ed86a554aecd23c00c4e8c351aa0168a81807c86a0cb2edc  nvme-cli-2.14.tar.gz
"
