# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=ndctl
pkgver=79
pkgrel=1
pkgdesc='Utility library for managing the libnvdimm (non-volatile memory device) sub-system in the Linux kernel'
arch=('x86_64')
url="https://github.com/pmem/ndctl"
license=('LGPL')
depends=('iniparser' 'json-c' 'keyutils' 'kmod' 'libtraceevent' 'libtracefs' 'systemd-libs'
         'util-linux-libs')
makedepends=('asciidoctor' 'bash-completion' 'cmake' 'meson' 'systemd' 'xmlto')
source=("https://github.com/pmem/ndctl/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('36e178e93dc263cfa72504d3f7fd101a10abcb278c0e2157f98510b91e04cabcd17aa850f654a8870757a15730ea91abf09a79f632236ee3af18cd1c73f61871')

prepare() {
  # fix location of modprobe.d conf
  sed -i "s|^modprobedatadir =.*|modprobedatadir = '/usr/lib/modprobe.d/'|" $pkgname-$pkgver/contrib/meson.build
}

build() {
  arch-meson $pkgname-$pkgver build
  meson compile -C build
}

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

package() {
  meson install -C build --destdir "$pkgdir"
}
