opt/hunspell-en/Pkgfile
2015-09-06 14:08:09 +10:00

52 lines
1.4 KiB
Plaintext

# Description: Hunspell dictionary for English
# URL: http://wordlist.sourceforge.net/
# Maintainer: Alan Mizrahi, alan at mizrahi dot com dot ve
# Depends on: hunspell
name=hunspell-en
version=7.1
release=1
source=(
http://downloads.sourceforge.net/wordlist/hunspell-en_US-$version-0.zip
http://downloads.sourceforge.net/wordlist/hunspell-en_CA-$version-0.zip
http://crux.ster.zone/downloads/en_GB.zip/md5/218909136738f4564b81ecd145ade6ee/en_GB.zip
)
build() {
declare -A missing
missing[en_GB]="en_AG en_AU en_BS en_BW en_BZ en_DK en_GH en_HK en_IE en_IN en_JM en_NA en_NG en_NZ en_SG en_TT en_ZA en_ZW"
missing[en_US]="en_PH"
mkdir -p $PKG/usr/share/hunspell
cp $SRC/*.aff $SRC/*.dic $PKG/usr/share/hunspell/
# Replace duplicate files with symbolic links
pushd $PKG/usr/share/hunspell
(md5sum * | sort | uniq --repeated -w 32 --all-repeated=separate; echo) | \
while read sum name; do
if [ -n "$name" ]; then
[ -z "$dups" ] && declare -A dups
dups[${#dups[*]}]=$name
else
for name in ${dups[@]}; do
[ $name != ${dups[0]} ] && ln -s -f ${dups[0]} $name
done
unset dups
fi
done
popd
# Create symbolic links for missing dictionaries
pushd $PKG/usr/share/hunspell
for lang in ${!missing[@]}; do
echo "source language is $lang"
for new in ${missing[$lang]}; do
echo "new language is $new"
ln -s $lang.aff $new.aff
ln -s $lang.dic $new.dic
done
done
popd
}