# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=libexttextcat
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=3.4.7
pkgrel=1
pkgdesc="N-Gram-Based Text Categorization library primarily intended for language guessing. (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='https://wiki.documentfoundation.org/Libexttextcat'
msys2_references=(
  'archlinux: libexttextcat'
)
license=('spdx:BSD-3-Clause-Clear')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools")
source=("https://dev-www.libreoffice.org/src/${_realname}-${pkgver}.tar.xz")
sha256sums=('df0a59d413a5b202573d8d4f5159e33a8538da4f8e8e60979facc64d6290cebd')

prepare() {
  cd "${_realname}-${pkgver}"

  autoreconf -fiv
}

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  ../"${_realname}-${pkgver}"/configure \
    --prefix="${MINGW_PREFIX}" \
    --disable-static \
    --disable-werror

  make
}

check() {
  cd "${srcdir}/build-${MSYSTEM}"

  make check || true
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  make install DESTDIR="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
