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

pkgbase=libcap-ng
pkgname=(libcap-ng python-capng)
pkgver=0.8.2
pkgrel=06
pkgdesc='A library for Linux that makes using posix capabilities easy'
url='https://people.redhat.com/sgrubb/libcap-ng/'
arch=('x86_64')
depends=('glibc')
makedepends=('python' 'swig' 'autoconf' 'automake')
source=(https://github.com/stevegrubb/libcap-ng/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)

prepare() {
  cd ${pkgbase}-${pkgver}
  autoreconf -fiv
}

build() {
  cd ${pkgbase}-${pkgver}
  ./configure \
    --prefix=/usr \
    --enable-static=no \
    --without-python \
    --with-python3
  make
}

check() {
  cd ${pkgbase}-${pkgver}
  make check
}

package_libcap-ng() {
  provides=('libcap-ng.so' 'libdrop_ambient.so')

  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install

  # remove files provided by python-capng
  rm -frv "${pkgdir}/usr/lib/python"*
}

package_python-capng() {
  pkgdesc+=' (Python bindings)'
  depends+=('libcap-ng.so')
  provides=('python-libcap-ng')

  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install

  # remove files provided by libcap-ng
  rm -frv "${pkgdir}/usr/lib/"{lib*,pkgconfig}
  rm -frv "${pkgdir}/usr/"{bin,include,share}
}

#---- license gpg-key sha256sums ----

license=('LGPL2.1')

sha256sums=(65b86885b8d873e55c05bd49427fd370d559b26f0c2089ac9194828e6a2fe233) #  libcap-ng-0.8.2.tar.gz
