# Copyright     : Obarun
#------------------------
# Maintainer    : Eric Vidal <eric@obarun.org>
# Maintainer    : Jean-Michel T.Dydak <jean-michel@obarun.org>
#----------------
# Obarun PkgSrc : https://git.obarun.org/pkg/obextra/ndctl
#--------------------------------------------------------------
# DESCRIPTION ]

pkgname=ndctl
pkgver=73
pkgrel=2
pkgdesc="Utility library for managing the libnvdimm (non-volatile memory device) sub-system in the Linux kernel"
url='https://github.com/pmem/ndctl'

track="archive/v$pkgver"
target="$pkgname-$pkgver"
source=(
    "https://github.com/pmem/ndctl/${track}/${target}.tar.gz"
)

#----------------------
# BUILD CONFIGURATION ]

makedepends=(
    'asciidoctor'
    'bash-completion'
    'xmlto'
    'meson'
)

#------------------------
# INSTALL CONFIGURATION ]

depends=(
    'iniparser'
    'json-c'
    'keyutils'
    'kmod'
    'eudev'
    'util-linux-libs'
)

#----------------
# BUILD PREPARE ]

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

#----------------
# BUILD CONTROL ]

_flags=(
    -Dsystemd=disabled
)

#--------
# BUILD ]

build() {
    arch-meson $pkgname-$pkgver build ${_flags[@]}
    meson compile -C build
}

#----------
# PACKAGE ]

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

#--------------------
# ARCH LICENSE AUTH ]

arch=(x86_64)
license=(LGPL)

sha512sums=('')
