#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=procps-ng
pkgver=4.0.4
pkgrel=02
pkgdesc='Utilities for monitoring your system and its processes w/o systemd'
url='https://gitlab.com/procps-ng/procps'
depends=(glibc ncurses libncursesw.so)
conflicts=(procps sysvinit-tools)
provides=(procps sysvinit-tools libproc2.so)
replaces=(procps sysvinit-tools)
options=('!emptydirs')
source=(https://downloads.sourceforge.net/project/$pkgname/Production/${pkgname}-${pkgver}.tar.xz{,.asc}
	'sysctl.conf'
	0001-build-sys-Add-systemd-elogind-to-w.patch
	0002-ps-Don-t-crash-when-using-short-option.patch)

prepare() {
  cd procps-ng-$pkgver
  sed 's:<ncursesw/:<:g' -i src/watch.c
   patch -Np1 < ../0001-build-sys-Add-systemd-elogind-to-w.patch
   patch -Np1 < ../0002-ps-Don-t-crash-when-using-short-option.patch
  autoreconf -fi
}

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

  make
}

package() {
  cd procps-ng-$pkgver
  make DESTDIR="$pkgdir" install
    install -Dm644 "${srcdir}/sysctl.conf" "$pkgdir/etc/sysctl.conf"
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=(GPL LGPL)

validpgpkeys=(5D2FB320B825D93904D205193938F96BDF50FEA5) # Craig Small <csmall@debian.org>

sha256sums=(22870d6feb2478adb617ce4f09a787addaf2d260c5a8aa7b17d889a962c5e42e  # procps-ng-4.0.4.tar.xz
	ff4787b2f45cc99d06e7c6d8e00a55d45ba942a3cc7e1f3ef6720b0dd091e077  # procps-ng-4.0.4.tar.xz.asc
	1bba9d009539f9fe18c19f5c4f4272da276f5c13c8b21e7291baf2374deb5d24  # sysctl.conf
	77ed82ad684c71319704080a09c7d65efa1b06db4f35b240de7c30fef4caafc5  # 0001-build-sys-Add-systemd-elogind-to-w.patch
	2331953f1c859b4973b2f99fbc84495b03a2d5e584370da66adbd45cbbf7825a) # 0002-ps-Don-t-crash-when-using-short-option.patch

##  95ee18523f49cddfbb918d09f9f2581a4251738fda9acfca8a7af09a4effe6ee  procps-ng-4.0.4-02-x86_64.pkg.tar.lz
