pkgname=procps-ng
pkgver=4.0.5
pkgdesc='Utilities for monitoring your system and its processes'
homepage='https://gitlab.com/procps-ng/procps'
license=(GPL LGPL)
arch=(x86_64)
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://sourceforge.net/projects/procps-ng/files/Production/${sources[0]}")
md5sums=("90803e64f51f192f3325d25c3335d057")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  ./configure --prefix=/usr                             \
            --libdir=/usr/lib                           \
            --docdir=/usr/share/doc/procps-ng-${pkgver} \
            --disable-static                            \
            --disable-kill                              \
            --enable-watch8bit                          \
            --with-systemd
  make
}

src_check() {
  chown -R leaf .
  chown -R leaf ${TMPDIR}
  leaf_record_message "ps with output flag bsdtime,cputime,etime,etimes is known to fail without CONFIG_BSD_PROCESS_ACCT."
  leaf_record_message "one pgrep test is known to fail in chroot."
  su leaf -c "PATH=$PATH make check"
}

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

