# Contributor: Florian Heigl <florian.heigl@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nvme-cli
pkgver=2.11
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
	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
	basename.patch
	locale.patch
	"
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 --no-rebuild -C output
}

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

sha512sums="
33de20ad990a3b87fef46fa486832edde41907223aa6b8a47606e605b360745fd7e2054226bf93a59b2a09c6bc04d0b684e4b3bb27c3fc0e6110c64a558cadc0  nvme-cli-2.11.tar.gz
91e8dfe8b9c545b3e1b6dbdf8eafaea51ea4a1e71fabb2b3a24a247f78a578868139adc1a80bb224699a16224353d93a3662652b1243586aead2c4f208519ab0  basename.patch
ec9461240649cdd9b9acbc6e94a58db8831af75e7a9cff1d2389b1d7a27c2f0f178c710c8c2a6b323ff86df06745b74dc72826754c3864ce30ade08f35d0fcc9  locale.patch
"
