# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Tom Gundersen <teg@jklm.no>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: Jochem Kossen <j.kossen@home.nl>
# Contributor: Hendrik Meyer <archlinux@t4cc0.re>

pkgname=lsof
pkgver=4.99.4
pkgrel=1
pkgdesc='Lists open files for running Unix processes'
url='https://github.com/lsof-org/lsof'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('custom')
depends=(
  glibc
  libtirpc
)
makedepends=(
  groff
)
source=(https://github.com/lsof-org/lsof/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz
        reproducible-builds.patch)
sha256sums=('0c444e2dabec14ad146cbb7f5b52b5ab4976728402ff348d9feced9ad9740c66'
            'fdc62c85a7ace604aec5248d0543e6789c0042bc8be1ae0717561e088c85eb08')
b2sums=('aa8e062f782f3e94688e725f963cc4a907abd49e1b78813ea3639afc284efb0946efd7f14f918f8792e253fb7bfceb6c3d258b84660d2af015a218d7cba16eb7'
        'f42255d02b1b56692e1b28a282b9490901882a0c4b3991ae39e8fcfc62a4eb8183db370b26e67e700334d1141dcc3e725d9ee8a1981f9108c992c88fd4089732')

prepare() {
  cd ${pkgname}-${pkgver}
  # https://github.com/lsof-org/lsof/issues/310
  patch -Np1 -i ../reproducible-builds.patch
}

build() {
  cd ${pkgname}-${pkgver}
  autoreconf -fiv
  ./configure \
    --prefix=/usr \
    --enable-security \
    --enable-no-sock-security \
    --with-libtirpc
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
