# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgbase=libseccomp
pkgname=(libseccomp python-libseccomp)
pkgver=%version%
pkgrel=%release%
pkgdesc='Enhanced seccomp library'
arch=('x86_64')
license=('LGPL2.1')
url="https://github.com/seccomp/libseccomp"
depends=('glibc')
checkdepends=('valgrind')
makedepends=('gperf' 'cython' 'python-setuptools')
source=(https://github.com/seccomp/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz{,.asc})
sha256sums=('248a2c8a4d9b9858aa6baf52712c34afefcf9c9e94b76dce02c1c9aa25fb3375'
            'SKIP')
b2sums=('d770cee1f3e02fbbcd9f25655b360ab38160ad800e2829a67f2b9da62b095a90be99ac851a67344cf95bd6810a6268da4655dc1d37d996e58239c4999eb41998'
        'SKIP')
validpgpkeys=(
  '7100AADFAE6E6E940D2E0AD655E45A5AE8CA7C8A' # Paul Moore <paul@paul-moore.com>
  '47A68FCE37C7D7024FD65E11356CE62C2B524099' # Tom Hromatka <tom.hromatka@oracle.com>
)

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

build() {
  cd ${pkgbase}-${pkgver}
  ./configure --prefix=/usr
  make
  cd src/python
  env VERSION_RELEASE=${pkgver} python setup.py build
}

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

package_libseccomp() {
  provides=('libseccomp.so')
  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 CHANGELOG README.md SECURITY.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}

package_python-libseccomp() {
  depends=('python')
  cd ${pkgbase}-${pkgver}/src/python
  env VERSION_RELEASE=${pkgver} python setup.py install --root="${pkgdir}" --prefix=/usr -O1 --skip-build
}

# vim: ts=2 sw=2 et:
