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

pkgname=ndctl
pkgver=71.1
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=('json-c' 'keyutils' 'kmod' 'systemd-libs' 'util-linux-libs')
makedepends=('asciidoctor' 'bash-completion' 'systemd' 'xmlto')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pmem/ndctl/archive/v$pkgver.tar.gz")
sha512sums=('92fb06ca64455775ce0b89ba0846f70235e02fe3502e2a8a55a858f76f87cb90ae98f5bf01620e5884f667ea78ee2bee2cd9e7a85ffa8f8d9c456e9282ca9ebc')

prepare() {
  # fix location of modprobe.d conf
  sed -i 's|^modprobedir =.*|modprobedir = /usr/lib/modprobe.d/|' $pkgname-$pkgver/Makefile.am
}

build() {
  cd "$srcdir"/$pkgname-$pkgver
  ./autogen.sh
  ./configure --prefix=/usr --sysconfdir=/etc
  make
}

package() {
  cd "$srcdir"/$pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
