pkgname=util-linux
pkgver=2.41.1
pkgdesc='Miscellaneous system utilities for Linux'
homepage='https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/'
arch=('x86_64')
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://www.kernel.org/pub/linux/utils/${pkgname}/v${pkgver%.*}/${sources[0]}")
md5sums=("7e5e68845e2f347cf96f5448165f1764")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  rm tests/ts/kill/decode
}

src_build() {
  ./configure --bindir=/usr/bin     \
              --libdir=/usr/lib     \
              --runstatedir=/run    \
              --sbindir=/usr/sbin   \
              --disable-chfn-chsh   \
              --disable-login       \
              --disable-nologin     \
              --disable-su          \
              --disable-setpriv     \
              --disable-runuser     \
              --disable-pylibmount  \
              --disable-liblastlog2 \
              --disable-static      \
              --without-python      \
              ADJTIME_PATH=/var/lib/hwclock/adjtime \
              --docdir=/usr/share/doc/util-linux-${pkgver}
  make
}

src_check() {
  leaf_record_message "lsfd: inotify is known to fail without CONFIG_NETLINK_DIAG."
  leaf_record_message "kill: decode functions is knwon to fail with >=bash-5.3-rc1."
  if [[ ! -f /etc/fstab ]]; then
    touch /etc/fstab
  fi
  chown -R leaf .
  su leaf -c "make -k check"
}

src_install() {
  make DESTDIR="${pkgdir}" install
}

# vim:ft=sh syn=sh et sw=2:
