# $Id: PKGBUILD 200372 2013-11-27 08:27:58Z angvp $
# Maintainer: Angel Velasquez <angvp@archlinux.org> 
# Maintainer: AndyRTR <andyrtr@archlinux.org>

pkgname=hunspell-es
pkgver=0.7
pkgrel=2
epoch=1
pkgdesc="Spanish hunspell dictionaries"
arch=(any)
url="https://forja.rediris.es/projects/rla-es/"
license=('LGPL3')
makedepends=('hunspell')
optdepends=('hunspell:	the spell checking libraries and apps')
noextract=(es_ANY.oxt es_AR.oxt es_BO.oxt es_CL.oxt es_CO.oxt 
           es_CR.oxt es_CU.oxt es_DO.oxt es_EC.oxt es_ES.oxt 
           es_GT.oxt es_HN.oxt es_MX.oxt es_NI.oxt es_PA.oxt 
           es_PE.oxt es_PR.oxt es_PY.oxt es_SV.oxt es_UY.oxt es_VE.oxt)
source=('http://forja.rediris.es/frs/download.php/2933/es_ANY.oxt'
        'http://forja.rediris.es/frs/download.php/2953/es_AR.oxt'
        'http://forja.rediris.es/frs/download.php/2952/es_BO.oxt'
        'http://forja.rediris.es/frs/download.php/2951/es_CL.oxt'
        'http://forja.rediris.es/frs/download.php/2950/es_CO.oxt'
        'http://forja.rediris.es/frs/download.php/2949/es_CR.oxt'
        'http://forja.rediris.es/frs/download.php/2948/es_CU.oxt'
        'http://forja.rediris.es/frs/download.php/2947/es_DO.oxt'
        'http://forja.rediris.es/frs/download.php/2946/es_EC.oxt'
        'http://forja.rediris.es/frs/download.php/2945/es_ES.oxt'
        'http://forja.rediris.es/frs/download.php/2944/es_GT.oxt'
        'http://forja.rediris.es/frs/download.php/2943/es_HN.oxt'
        'http://forja.rediris.es/frs/download.php/2942/es_MX.oxt'
        'http://forja.rediris.es/frs/download.php/2941/es_NI.oxt'
        'http://forja.rediris.es/frs/download.php/2940/es_PA.oxt'
        'http://forja.rediris.es/frs/download.php/2939/es_PE.oxt'
        'http://forja.rediris.es/frs/download.php/2938/es_PR.oxt'
        'http://forja.rediris.es/frs/download.php/2937/es_PY.oxt'
        'http://forja.rediris.es/frs/download.php/2936/es_SV.oxt'
        'http://forja.rediris.es/frs/download.php/2935/es_UY.oxt'
        'http://forja.rediris.es/frs/download.php/2934/es_VE.oxt')
md5sums=('e3d4b38f280e7376178529db2ece982b'
         '68ee8f4ebc89a1fa461045d4dbb9b7be'
         '1ebf11b6094e0bfece8e95cc34e7a409'
         '092a388101350b77af4fd789668582bd'
         'fc440fd9fc55ca2dfb9bfa34a1e63864'
         '7510fd0f4eb3c6e65523a8d0960f77dd'
         '0ab4b9638f58ddd3d95d1265918ff39e'
         '24a20fd4d887693afef539e6f1a3b58e'
         '5d7343a246323ceda58cfbbf1428e279'
         '59dd45e6785ed644adbbd73f4f126182'
         'b1a9be80687e3117c67ac46aad6b8d66'
         'd0db5bebd6925738b524de9709950f22'
         '0de780714f84955112f38f35fb63a894'
         'd259d7be17c34df76c7de40c80720a39'
         '085fbdbed6a2e248630c801881563b7a'
         'f4673063246888995d4eaa2d4a24ee3d'
         'e67bcf891ba9eeaeb57a60ec8e57f1ac'
         'ba98e3197c81db4c572def2c5cca942d'
         'c68ca9d188cb23c88cdd34a069c5a013'
         'aeb9d39e4d17e9c904c1f3567178aad6'
         '8afa9619aede2d9708e799e0f5d0fcab')

package() {
  cd "$srcdir"
  for file in *.oxt; do
    LANG=en_US.utf8 bsdtar -xf $file
  done

  install -dm755 "${pkgdir}/usr/share/hunspell"
  install -m644 es_*.dic es_*.aff "$pkgdir/usr/share/hunspell"

  # the symlinks
  install -dm755 "${pkgdir}/usr/share/myspell/dicts"
  pushd "$pkgdir/usr/share/myspell/dicts"
    for file in "$pkgdir"/usr/share/hunspell/*; do
      ln -sv /usr/share/hunspell/$(basename $file) .
    done
  popd
  
  # docs
  install -dm755 "${pkgdir}/usr/share/doc/$pkgname"
  install -m644 README.txt "$pkgdir/usr/share/doc/$pkgname"
}

