Skip to content

Commit

Permalink
dev-qt/qtwebengine-dicts: initial packaging
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jsbronder committed Dec 11, 2017
1 parent 0091001 commit e386e57
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dev-qt/qtwebengine-dicts/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>[email protected]</email>
<name>Gentoo Qt Project</name>
</maintainer>
<maintainer type="person">
<email>[email protected]</email>
<name>Justin Bronder</name>
</maintainer>
<upstream>
<bugs-to>https://bugreports.qt.io/</bugs-to>
<doc>https://doc.qt.io/</doc>
</upstream>
</pkgmetadata>
78 changes: 78 additions & 0 deletions dev-qt/qtwebengine-dicts/qtwebengine-dicts-1.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

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=""

S="${WORKDIR}"

# 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"

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}
"

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/_/-}

"${EPREFIX}"/usr/$(get_libdir)/qt5/bin/qwebengine_convert_dict \
${dic} \
"${T}"/bdics/${bdic_fn} || die
done
}

src_install() {
insinto /usr/share/qt5/qtwebengine_dictionaries
doins "${T}"/bdics/*.bdic
}

0 comments on commit e386e57

Please sign in to comment.