#!/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.4
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=(d82902400405cf0068574ef3dc1fe5f5926207543ba1ae6f8e7a1576351dcbdb # libseccomp-2.5.4.tar.gz
	af37e70eb422e6f983c1f135a3abb342c3b787716520b71bd774e4906003807f) # libseccomp-2.5.4.tar.gz.asc

##  226aa3c99dd7b147cc59745dee12b08782ae8630ff1a8c45c598949f5318aff4  libseccomp-2.5.4-02-x86_64.pkg.tar.lz
##  ee74a1d62129e9163f5c6fa50cfbeafd53dee809dde043f07a5f08f96eb37c0f  python-libseccomp-2.5.4-02-x86_64.pkg.tar.lz

