# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Christian Hesse <eworm@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>

pkgname=procps-ng
pkgver=4.0.3
pkgrel=1
pkgdesc='Utilities for monitoring your system and its processes'
url='https://gitlab.com/procps-ng/procps'
license=(GPL LGPL)
arch=(x86_64)
depends=(glibc ncurses libncursesw.so systemd-libs)
makedepends=(systemd)
conflicts=(procps sysvinit-tools)
provides=(procps sysvinit-tools libproc2.so)
replaces=(procps sysvinit-tools)
options=('!emptydirs')
validpgpkeys=('5D2FB320B825D93904D205193938F96BDF50FEA5') # Craig Small <csmall@debian.org>
source=(https://downloads.sourceforge.net/project/$pkgname/Production/${pkgname}-${pkgver}.tar.xz{,.asc})
sha256sums=('303c8ec4f96ae18d8eaef86c2bd0986938764a45dc505fe0a0af868c674dba92'
            'SKIP')
b2sums=('138995397aa2ae742a457a4b2ddd65f67ba29d2eb9bd330a6e44f3cb65e93fc87122f3bd4cc8d10c0d73c7981a3d0d0472949d2d3b83c582cd0376c713698d1f'
        'SKIP')

prepare() {
  cd procps-ng-$pkgver
  sed 's:<ncursesw/:<:g' -i src/watch.c
}

build() {
  cd procps-ng-$pkgver
  ./configure \
    --prefix=/usr \
    --exec-prefix=/ \
    --sysconfdir=/etc \
    --libdir=/usr/lib \
    --bindir=/usr/bin \
    --sbindir=/usr/bin \
    --enable-watch8bit \
    --with-systemd \
    --disable-modern-top \
    --disable-kill

  make
}

package() {
  cd procps-ng-$pkgver
  make DESTDIR="$pkgdir" install
}
