# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=ndctl
pkgver=78
pkgrel=2
pkgdesc='Utility library for managing the libnvdimm (non-volatile memory device) sub-system in the Linux kernel'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
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=('ad217dd45c8d6bbd0089a88c46e1e04813b65e97c8817aaddeca967b20ce948e76c4b7ede5517c45d0b645b5c3dc61aac95cc944e8e5fc60100e45b41f13f2a0')

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"
}
