# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=psmisc
pkgver=23.7
pkgrel=1
pkgdesc="Miscellaneous procfs tools"
arch=('i686' 'x86_64')
url="https://gitlab.com/psmisc/psmisc"
license=('GPL')
groups=('sys-utils')
depends=('gcc-libs' 'ncurses' 'libiconv' 'libintl')
makedepends=('gcc' 'ncurses-devel' 'libiconv-devel' 'gettext-devel' 'autotools' 'gcc')
source=(${pkgname}-${pkgver}.tar.gz::https://gitlab.com/psmisc/psmisc/-/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz
        "0000-fix-build.patch")
sha256sums=('8f2526ce7ac6ef4976454cd63095fa10e467ef745cf33dc4f91df0bd7b10b905'
            '76a8ae44d356ddce5d120ad71e880ac5d85e303f34a92a53d52be81aa583be97')

prepare() {
  cd ${pkgname}-v${pkgver}

  # https://gitlab.com/psmisc/psmisc/-/merge_requests/39
  patch -Np1 -i ../0000-fix-build.patch

  echo ${pkgver} > .tarball-version
  ./autogen.sh
}

build() {
  cd ${pkgname}-v${pkgver}
  ./configure \
    --prefix=/usr \
    --without-libiconv-prefix \
    --without-libintl-prefix \
    --disable-harden-flags \
    --disable-statx

  make
}

package() {
  cd ${pkgname}-v${pkgver}
  make DESTDIR=${pkgdir} install
}
