# Template file for 'hunspell-en_GB-ize'
pkgname=hunspell-en_GB-ize
_vpkgname=${pkgname%-*}
_variant=${pkgname##*-}
version=2020.12.07
revision=3
short_desc="English dictionary for hunspell ${_variant} variant"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="SCOWL" # not in SPDX
homepage="http://wordlist.aspell.net/dicts"
distfiles="${SOURCEFORGE_SITE}/wordlist/speller/${version}/${pkgname}-${version}.zip"
checksum=869b749ec9805b87cd05f43307f20998651331b5aa5b04506413af0c2df2f231
provides="${_vpkgname}-${version}_${revision}"
replaces="${_vpkgname}>=0"

build_options="bdic"
desc_option_bdic="Enable Chromium's bdic format"

if [ "$XBPS_WORDSIZE" = 64 ]; then
	hostmakedepends=" qt6-webengine"
	build_options_default="bdic"
else
	case "$XBPS_MACHINE" in
	i686*)
		hostmakedepends=" qt5-webengine"
		build_options_default="bdic"
		;;
	esac
fi

if [ "$build_option_bdic" ]; then
	depends="hunspell-qtwebengine-dict"
fi

do_build() {
	PATH="/usr/lib/qt6/libexec:/usr/lib/qt5/bin:$PATH"
	if [ "$build_option_bdic" ]; then
		qwebengine_convert_dict en_GB-${_variant}.dic \
			en_GB-${_variant}.bdic
	fi
}

do_install() {
	vinstall en_GB-${_variant}.aff 644 /usr/share/hunspell en_GB.aff
	vinstall en_GB-${_variant}.dic 644 /usr/share/hunspell en_GB.dic
	if [ "$build_option_bdic" ]; then
		vinstall en_GB-${_variant}.bdic 644 \
			usr/share/hunspell-bdic en_GB.bdic
	fi
	vlicense README_en_GB-${_variant}.txt SCOWL
}
