pkgname=kbd
pkgver=2.8.0
pkgdesc="Keytable files and keyboard utilities"
arch=('x86_64')
homepage="http://www.kbd-project.org"
license=('GPL-2.0-or-later')
sources=("${pkgname}-${pkgver}.tar.xz"
  "kbd-${pkgver}-backspace-1.patch"
)
urls=("https://www.kernel.org/pub/linux/utils/${pkgname}/${sources[0]}"
  "https://www.linuxfromscratch.org/patches/lfs/12.4/${sources[1]}"
)
md5sums=("24b5d24f7483726b88f214dc6c77aa41"
  "f75cca16a38da6caa7d52151f7136895"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  patch -Np1 -i ${distdir}/${sources[1]}
  sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure
  sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in
}

src_build() {
  ./configure --prefix=/usr --disable-vlock
  make
}

src_check() {
  leaf_record_message "tests are known to fail without valgrind."
  make check
}

src_install() {
  make DESTDIR="${pkgdir}" install
  install -d -v "${pkgdir}/usr/share/doc/kbd-${pkgver}"
  cp -R -v docs/doc -T "${pkgdir}/usr/share/doc/kbd-${pkgver}"
}
