# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>

pkgname=hunspell-fr
pkgver=4.4.1
pkgrel=1
pkgdesc="French (modern) hunspell dictionaries"
arch=(any)
url="http://www.dicollecte.org/"
license=('GPL' 'MPL' 'LGPL')
optdepends=('hunspell:	the spell checking libraries and apps')
source=(http://www.dicollecte.org/download/fr/${pkgname}-moderne-v${pkgver}.zip)
md5sums=('21797904e86e2faa2057cca18fc90105')

package() {
  cd "${srcdir}"
  install -dm755 ${pkgdir}/usr/share/hunspell
  install -m644 fr-moderne.dic ${pkgdir}/usr/share/hunspell/fr_FR.dic
  install -m644 fr-moderne.aff ${pkgdir}/usr/share/hunspell/fr_FR.aff

  pushd ${pkgdir}/usr/share/hunspell/
  fr_FR_aliases="fr_BE fr_CA fr_CH fr_LU"
  for lang in ${fr_FR_aliases}; do
	ln -s fr_FR.aff ${lang}.aff
	ln -s fr_FR.dic ${lang}.dic
  done

  popd

  # 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_fr.txt $pkgdir/usr/share/doc/${pkgname}/README_fr.txt
}
