# $Id: PKGBUILD 140594 2011-10-17 10:45:41Z angvp $
# Maintainer: AndyRTR <andyrtr@archlinux.org>

pkgname=mythes-es
pkgver=20110402
pkgrel=1
pkgdesc="Spanish thesaurus"
arch=(any)
url="http://openthes-es.berlios.de/"
license=('LGPL')
optdepends=('libmythes: offers thesaurus library functions')
source=('http://openthes-es.berlios.de/download/Spanish-Dictionaries.oxt')
md5sums=('9c39572a9ef621aa85fdd359d4693872')

build() {
  /bin/true
}

package() {
  cd "$srcdir"
  install -dm755 ${pkgdir}/usr/share/mythes
  cp -p th_es_ES_v2.* $pkgdir/usr/share/mythes

  pushd $pkgdir/usr/share/mythes/
  es_ES_aliases="es_AR es_BO es_CL es_CO es_CR es_CU es_DO es_EC es_GT es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_UY es_VE"
  for lang in $es_ES_aliases; do
        ln -s th_es_ES_v2.idx "th_"$lang"_v2.idx"
        ln -s th_es_ES_v2.dat "th_"$lang"_v2.dat"
  done
  popd

  # the symlinks
  install -dm755 ${pkgdir}/usr/share/myspell/dicts
  pushd $pkgdir/usr/share/myspell/dicts
    for file in $pkgdir/usr/share/mythes/*; do
      ln -sv /usr/share/mythes/$(basename $file) .
    done
  popd
  
}
