1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{10..13} )
9 MY_PN="fcitx5-pinyin-zhwiki"
10 CONVERTERV=$(ver_cut 1-3)
12 WEBSLANGV=$(ver_cut 4)
14 DESCRIPTION="Fcitx 5 Pinyin Dictionary from zh.wikipedia.org"
15 HOMEPAGE="https://github.com/felixonmars/fcitx5-pinyin-zhwiki"
17 https://github.com/felixonmars/${MY_PN}/archive/refs/tags/${CONVERTERV}.tar.gz -> ${PN}-${CONVERTERV}.tar.gz
18 https://github.com/felixonmars/${MY_PN}/releases/download/${CONVERTERV}/web-slang-${WEBSLANGV}.source
19 https://dumps.wikimedia.org/zhwiki/${ZHWIKIV}/zhwiki-${ZHWIKIV}-all-titles-in-ns0.gz
22 S="${WORKDIR}/${MY_PN}-${CONVERTERV}"
24 LICENSE="Unlicense || ( CC-BY-SA-4.0 FDL-1.3 )"
28 REQUIRED_USE="|| ( fcitx rime )"
31 fcitx? ( app-i18n/fcitx:5 )
32 rime? ( || ( app-i18n/ibus-rime app-i18n/fcitx-rime ) )
33 !app-dicts/fcitx-pinyin-zhwiki-bin
37 fcitx? ( app-i18n/libime:5 )
38 $(python_gen_any_dep '
39 dev-python/pypinyin[${PYTHON_USEDEP}]
40 app-i18n/opencc[python(-),${PYTHON_SINGLE_USEDEP}]
46 VERSION="${ZHWIKIV}" \
47 WEB_SLANG_VERSION="${WEBSLANGV}" \
52 python_has_version "dev-python/pypinyin[${PYTHON_USEDEP}]" &&
53 python_has_version "app-i18n/opencc[python(-),${PYTHON_SINGLE_USEDEP}]"
58 cp "${DISTDIR}/web-slang-${WEBSLANGV}.source" "${S}" || die
59 cp "${WORKDIR}/zhwiki-${ZHWIKIV}-all-titles-in-ns0" "${S}" || die
63 # remove network access and decompression
64 sed -i -e '14d;17d;23d' Makefile || die
69 use fcitx && _emake zhwiki.dict
70 use rime && _emake zhwiki.dict.yaml
74 use fcitx && _emake DESTDIR="${ED}" install
75 use rime && _emake DESTDIR="${ED}" install_rime_dict