# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

_pkgname=libffi
pkgname=static-compat-$_pkgname
pkgver=3.4.4
pkgrel=1
pkgdesc='Portable foreign function interface library'
arch=('x86_64')
url='https://sourceware.org/libffi/'
license=('MIT')
depends=('glibc-static-compat')
makedepends=('static-compat-configure')
checkdepends=('dejagnu')
options=(!emptydirs staticlibs)
source=(https://github.com/libffi/libffi/releases/download/v${pkgver}/libffi-${pkgver}.tar.gz)
sha256sums=('d66c56ad259a82cf2a9dfc408b32bf5da52371500b84745f7fb8b645712df676')
b2sums=('189fe1ffe9507f204581b0ab09995dc7e7b761bb4eac7e338e9f5ff81431aebcef6c182c1839c9f9acb2706697a260c67e6d1351cf7e2aed7c4eb5d694f6f8fd')

prepare() {
  source static-compat-environment
  cd $_pkgname-$pkgver
  autoreconf -fiv
}

build() {
  source static-compat-environment
  cd $_pkgname-$pkgver
  static-compat-configure \
    --disable-shared \
    --enable-static \
    --enable-pax_emutramp
  make
}

check() {
  source static-compat-environment
  #make -C $_pkgname-$pkgver check
}

package() {
  source static-compat-environment
  cd $_pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  rm -r "$pkgdir/$static_compat_prefix"/share/{man,info}
  install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}

# vim: ts=2 sw=2 et:
