# $Id: PKGBUILD 145866 2012-01-03 12:46:54Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>

pkgname=hunspell-it
pkgver=2.4
_pkgver=2_4
_date=2007_09_01
pkgrel=3
pkgdesc="Italian dictionary for Hunspell"
arch=('any')
url="http://sourceforge.net/projects/linguistico/"
license=('GPL3')
makedepends=('hunspell')
optdepends=('hunspell: the spell checking libraries and apps')
source=("http://downloads.sourceforge.net/linguistico/italiano_${_pkgver}_${_date}.zip")
md5sums=('e7fbd9e2dfb25ea3288cdb918e1e1260')

build() {
  cd "${srcdir}"

  # Fix dic file empty lines (FS#22275)
  sed '/^\/$/d' -i it_IT.dic
}

package() {
  cd "${srcdir}"
  install -dm755 ${pkgdir}/usr/share/hunspell

  install -D -m644 it_IT.dic "${pkgdir}/usr/share/hunspell/it_IT.dic"
  install -D -m644 it_IT.aff "${pkgdir}/usr/share/hunspell/it_IT.aff"

  pushd $pkgdir/usr/share/hunspell/
  it_IT_aliases="it_CH"
  for lang in $it_IT_aliases; do
       ln -s it_IT.aff $lang.aff
       ln -s it_IT.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
}
