# Description: Library for high quality hyphenation and justification
# URL: https://sourceforge.net/projects/hunspell/files/Hyphen/
# Maintainer: Tim Biermann, tbier at posteo dot de

name=hyphen
version=2.8.8
release=1
source=(https://downloads.sourceforge.net/hunspell/$name-$version.tar.gz)

build() {
  cd $name-$version

  ./configure --prefix=/usr

  make
  make DESTDIR=$PKG install

  pushd $PKG/usr/share/hyphen/
  en_US_aliases="en_AG en_AU en_BS en_BW en_BZ en_CA en_DK en_GB en_GH en_HK en_IE en_IN en_JM en_NA en_NZ en_PH en_SG en_TT en_ZA en_ZW"
  for lang in $en_US_aliases; do
    ln -s hyph_en_US.dic hyph_$lang.dic
  done
  popd

  # the symlinks
  install -d -m 0755 $PKG/usr/share/myspell/dicts
  pushd $PKG/usr/share/myspell/dicts
  for file in $PKG/usr/share/hyphen/*; do
    ln -sv /usr/share/hyphen/$(basename $file) .
  done
  popd
}
