# Maintainer: David P. <megver83@parabola.nu>
# Maintainer (arch): Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Florian Pritz <bluewind@xinu.at>
# Contributor: Christoph Vigano <mail@cvigano.de>

pkgname=lib32-p11-kit
pkgver=0.24.0
pkgrel=1
pkgdesc="Loads and enumerates PKCS#11 modules (32-bit library)"
url="https://p11-glue.freedesktop.org"
arch=(x86_64)
license=(BSD)
depends=(lib32-glibc lib32-libtasn1 lib32-libffi libp11-kit)
makedepends=(git meson lib32-elogind)
provides=(libp11-kit.so)
source=(https://github.com/p11-glue/p11-kit/releases/download/$pkgver/p11-kit-$pkgver.tar.xz{,.sig})
sha256sums=('81e6140584f635e4e956a1b93a32239acf3811ff5b2d3a5c6094e94e99d2c685'
            'SKIP')
validpgpkeys=('C0F67099B808FB063E2C81117BFB1108D92765AF'  # Stef Walter
              '462225C3B46F34879FC8496CD605848ED7E69871') # Daiki Ueno

prepare() {
  cd p11-kit-$pkgver
}

build() {
  export CC="gcc -m32"
  export CXX="g++ -m32"
  export PKG_CONFIG="i686-pc-linux-gnu-pkg-config"

  arch-meson p11-kit-$pkgver build \
    --buildtype debugoptimized \
    --libdir /usr/lib32 \
    -D bash_completion=disabled \
    -D trust_paths=/etc/ca-certificates/trust-source:/usr/share/ca-certificates/trust-source -D systemd=disabled
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"

  rm -rf "$pkgdir"/etc "$pkgdir"/usr/{bin,include,lib,share}

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 p11-kit-$pkgver/COPYING
}

# vim:set ts=2 sw=2 et:
