# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Conributor: Mélanie Chauvel (ariasuni) <perso at hack-libre dot org>

pkgname=nuspell
pkgver=5.1.7
pkgrel=2
pkgdesc='Fast and safe spellchecking C++ library'
arch=('x86_64' 'aarch64')
url='https://nuspell.github.io/'
license=('LGPL-3.0-or-later')
depends=('icu' 'glibc' 'libstdc++' 'libgcc')
makedepends=('cmake' 'pandoc' 'doxygen')
checkdepends=('catch2' 'expat')
source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/nuspell/nuspell/archive/v${pkgver}.tar.gz")
sha512sums=('cb030dca90a52000a7cf4ea7f15e10ee90aec59e56e8212f8ba69f37e070f1100390393191cdbbf88b14836f408c8eb2fb9712be3d472491b1c93dd5cedd9a40')

# 1st rebuild enchant
# 2nd rebuild epiphany against nuspell/enchant that checkdepens on both

build() {
  cmake -B "${pkgname}-${pkgver}"/build \
    -S ${pkgbase}-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DBUILD_SHARED_LIBS=ON
  cmake --build "${pkgname}-${pkgver}"/build
}

check() {
  ctest --test-dir "${pkgname}-${pkgver}"/build
}

package() {
  DESTDIR="${pkgdir}" cmake --install "${pkgname}-${pkgver}"/build
}
