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

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - remove makedepend on pandoc, set -DBUILD_DOCS=OFF
#  - move catch2 to makedepends

pkgname=nuspell
pkgver=5.1.6
pkgrel=1
pkgdesc='Fast and safe spellchecking C++ library'
arch=('x86_64')
url='https://nuspell.github.io/'
license=('LGPL-3.0-or-later')
depends=('icu' 'glibc' 'gcc-libs')
makedepends=('cmake' 'catch2')
checkdepends=('catch2' 'expat')
source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/nuspell/nuspell/archive/v${pkgver}.tar.gz")
sha512sums=('ab6d9394a55d9a2a347ccae47aeef6a96af70f421ad6ea8f7ac7fde2052790f37fb1c7ec3112daac7600d193430a560cb1915ab6557c9353717f65cb32f13ab8')

# 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 \
    -DBUILD_DOCS=OFF
  cmake --build "${pkgname}-${pkgver}"/build
}

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

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