#!/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 |---------------------------------------

pkgbase=libseccomp
pkgname=(libseccomp python-libseccomp)
pkgver=2.5.5
pkgrel=02
pkgdesc='Enhanced seccomp library'
url="https://github.com/seccomp/libseccomp"
depends=('glibc')
checkdepends=('valgrind')
makedepends=('gperf' 'cython' 'python-setuptools' 'automake' 'autoconf')
source=(https://github.com/seccomp/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz{,.asc})

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
}

##  only 1 test fails, comment check section out and makepkg again without -f if it fails
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
}

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

arch=(x86_64)

license=('LGPL2.1')

validpgpkeys=('7100AADFAE6E6E940D2E0AD655E45A5AE8CA7C8A' # Paul Moore <paul@paul-moore.com>
  '47A68FCE37C7D7024FD65E11356CE62C2B524099') # Tom Hromatka <tom.hromatka@oracle.com>

sha256sums=(248a2c8a4d9b9858aa6baf52712c34afefcf9c9e94b76dce02c1c9aa25fb3375  # libseccomp-2.5.5.tar.gz
	f3bf8a946020d3047581f11fe6ac71971a842115ddb362562b193861ef57d97b) # libseccomp-2.5.5.tar.gz.asc

##  1c95458436f7de8d2e8797bf24565417f1b021cc26f18f1a8d6e8c8c3be952ef  libseccomp-2.5.5-02-x86_64.pkg.tar.lz
##  51fe26228e2780e2e1350e3b76c2d041afbce3ad3eea33cfd11969eae1f6bbf0  python-libseccomp-2.5.5-02-x86_64.pkg.tar.lz

