From 40f09d57e856331c6bbe79277009d081248cf753 Mon Sep 17 00:00:00 2001 From: Justin Bronder Date: Mon, 11 Dec 2017 08:08:25 -0500 Subject: [PATCH] dev-qt/qtwebengine-dicts: initial packaging Packaging of dictionaries suitable for use by QtWebEngine per https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-spellchecker-example.html. This is simply done by by running qwebengine_convert_dict on each myspell dictionary. Note that: - qt5-build is not used as the dictionaries are not directly dependent upon the version of Qt being used. - Dictionaries are built for every installed myspell dictionary. This could result in a few extra dictionaries if the user is stripping L10N_* flags but that saves complexity in the ebuild as the map from language to dictionary files(s) isn't something that can be simply done with string parsing. See comments in ebuild. Package-Manager: Portage-2.3.13, Repoman-2.3.3 --- dev-qt/qtwebengine-dicts/metadata.xml | 16 ++++ .../qtwebengine-dicts-1.0.ebuild | 78 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 dev-qt/qtwebengine-dicts/metadata.xml create mode 100644 dev-qt/qtwebengine-dicts/qtwebengine-dicts-1.0.ebuild diff --git a/dev-qt/qtwebengine-dicts/metadata.xml b/dev-qt/qtwebengine-dicts/metadata.xml new file mode 100644 index 000000000..9ebfd304d --- /dev/null +++ b/dev-qt/qtwebengine-dicts/metadata.xml @@ -0,0 +1,16 @@ + + + + + qt@gentoo.org + Gentoo Qt Project + + + jsbronder@gentoo.org + Justin Bronder + + + https://bugreports.qt.io/ + https://doc.qt.io/ + + diff --git a/dev-qt/qtwebengine-dicts/qtwebengine-dicts-1.0.ebuild b/dev-qt/qtwebengine-dicts/qtwebengine-dicts-1.0.ebuild new file mode 100644 index 000000000..038d6cb06 --- /dev/null +++ b/dev-qt/qtwebengine-dicts/qtwebengine-dicts-1.0.ebuild @@ -0,0 +1,78 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit qmake-utils + +DESCRIPTION="Hunspell dictionaries for QtWebEngine" +HOMEPAGE="https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-spellchecker-example.html" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~x86" +IUSE="" + +# Cribbed from app-text/hunspell +LANGS="af bg ca cs cy da de de-1901 el en eo es et fo fr ga gl he hr hu ia id +is it kk km ku lt lv mi mk ms nb nl nn pl pt pt-BR ro ru sk sl sq sv sw tn uk +zu" + +DEPEND=" + app-dicts/myspell-en + dev-qt/qtwebengine:5" + +for lang in ${LANGS}; do + IUSE+=" l10n_${lang}" + case ${lang} in + de-1901) dict="de_1901";; + pt-BR) dict="pt-br";; + *) dict="${lang}";; + esac + DEPEND+=" l10n_${lang}? ( app-dicts/myspell-${dict} )" +done +unset dict lang + +RDEPEND="${DEPEND}" + +S="${WORKDIR}" + +src_configure() { + : +} + +src_compile() { + local dicts + local dic + local bdic_fn + local prefix + + mkdir -p "${T}"/bdics || die + + # File-renaming done to match + # https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries.git/+/master + + # TODO: This doesn't respect the l10n USE flags for the package and rather + # just builds qtwebengine dictionaries for everything that is installed. + # It's not immediately obvious how to filter as there isn't a consistent + # map from language to dictionaries. For example: + # en: en_AU, en_CA, en_GB, en_US, en_ZA + # kk: kk_KZ, kk_noun_adj, kk_test + # pt-BR: pt_BR + # etc. + for dic in "${EPREFIX}"/usr/share/hunspell/*.dic; do + bdic_fn=$(basename ${dic}) + bdic_fn=${bdic_fn%.dic}.bdic + bdic_fn=${bdic_fn/_/-} + + $(qt5_get_bindir)/qwebengine_convert_dict \ + ${dic} \ + "${T}"/bdics/${bdic_fn} || die + done +} + +src_install() { + insinto /usr/share/qt5/qtwebengine_dictionaries + doins "${T}"/bdics/*.bdic +}