# Template file for 'nvme-cli'
pkgname=nvme-cli
version=2.16
revision=1
build_style=meson
configure_args="-Ddocs=man -Dudevrulesdir=lib/udev/rules.d"
hostmakedepends="pkg-config"
makedepends="libnvme-devel zlib-devel json-c-devel"
short_desc="NVMe management command line interface"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only"
homepage="https://nvmexpress.org"
changelog="https://github.com/linux-nvme/nvme-cli/releases"
distfiles="https://github.com/linux-nvme/nvme-cli/archive/v${version}.tar.gz"
checksum=989682ed7b250a2c7a8127e362ffc5d29f5c370127abe405be09c73216da2b97
conf_files="/etc/nvme/*.conf"

case "$XBPS_TARGET_MACHINE" in
	x86_64-musl) make_check="no" # uint128 test fails on x86_64-musl
	;;
esac

if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
	makedepends+=" libhugetlbfs-devel"
else
	CFLAGS="-D_GNU_SOURCE"
fi

post_install() {
	# remove files that need systemd
	rm "${DESTDIR}/usr/lib/udev/rules.d/70-nvmf-autoconnect.rules"         # calls systemctl
	rm "${DESTDIR}/usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf"  # needs 70-nvmf-autoconnect.rules
}
