pkgname=snowball-stemmer
pkgver=2.2.0
pkgdesc="Snowball compiler and stemming algorithms"
homepage="https://snowballstem.org/ https://github.com/snowballstem/snowball/"
license=("BSD")
slot="0/${pkgver%%.*}"
_patches=("snowball-stemmer-2.2.0-shared-library.patch")
_patch_sums=("611dc546bd3744d0c9d86fea2206707eafbe6c9bd2384bbe6d017a4e8a5ef919eeb32e594157e6767a63398f7cdb2fc9d87969eb544756a7c853d33efdc45693")
sources=("${pkgname}-${pkgver}.tar.gz"
  "${_patches[@]}"
)
urls=("https://github.com/snowballstem/snowball/archive/v${pkgver}.tar.gz"
  "${_patches[@]}"
)
sha512sums=("02c43313de9de2518ea51cfb11f1c29145fc046c7838329bfdefd70b604009ad44b6db8175c25b0db31f03db30a6aec5857aa35775a9c204ec976df9cae62957"
  "${_patch_sums[@]}"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  for _patch in ${_patches[@]}; do
    patch -p1 -i ${filedir}/${_patch}
  done
}

src_build() {
  make
}

src_install() {
  install -D snowball stemwords -t "$pkgdir/usr/bin"
  install -Dm644 COPYING -t "$pkgdir/usr/share/licenses/$pkgname"
  install -Dm644 include/libstemmer.h -t "$pkgdir/usr/include"
  install -Dm644 libstemmer.so.${pkgver} -t "$pkgdir/usr/lib"
  ln -s libstemmer.so.${pkgver} "$pkgdir/usr/lib/libstemmer.so.${pkgver%%.*}"
  ln -s libstemmer.so.${pkgver%%.*} "$pkgdir/usr/lib/libstemmer.so"
}

# vim:ft=sh syn=sh et sw=2:
