# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Étienne Deparis <etienne@depar.is>

pkgname=libnitrokey
pkgver=3.6
pkgrel=1
pkgdesc='Communicate with Nitrokey stick devices in a clean and easy manner'
url='https://www.nitrokey.com'
arch=('x86_64')
license=('LGPL3')
depends=('glibc' 'gcc-libs' 'hidapi' 'libusb')
makedepends=('cmake' 'qt5-tools' 'catch2')
provides=('libnitrokey.so')
source=(https://github.com/Nitrokey/libnitrokey/releases/download/v${pkgver}/libnitrokey-v${pkgver}.tar.gz{,.sig})
sha512sums=('4ffc465f9c6b7ee672d0d2aa8bfaa891f939816513f5d400e8156316e6708306c62ce9abb9ca55d3467bcc53e8c1203c57b2f5f16e046dd322c89cdec1740b3c'
            'SKIP')
validpgpkeys=('868184069239FF65DE0BCD7DD9BAE35991DE5B22') # Szczepan Zalega <szczepan.zalega@gmail.com>

prepare() {
  cd ${pkgname}-v${pkgver}
  sed '/REQUIRE(std::regex_match(s, pattern));/d' -i unittest/test_offline.cc
}

build() {
  cd ${pkgname}-v${pkgver}
  cmake . \
    -B build \
    -DBUILD_SHARED_LIBS=ON \
    -DCOMPILE_OFFLINE_TESTS=ON \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib
  make -C build VERBOSE=1
}

check() {
  cd ${pkgname}-v${pkgver}/build
  ctest -VV
}

package() {
  cd ${pkgname}-v${pkgver}
  make -C build DESTDIR="${pkgdir}" install
}

# vim: ts=2 sw=2 et:
