net-misc/hoppscotch-bin: bump version to 24.12.0.0
[gentoo-zh.git] / app-dicts / fcitx-pinyin-zhwiki / fcitx-pinyin-zhwiki-0.2.5.20241218.ebuild
blob624ee3105dc52d266918ab553d19881282ba7d85
1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 PYTHON_COMPAT=( python3_{10..13} )
7 inherit python-any-r1
9 MY_PN="fcitx5-pinyin-zhwiki"
10 CONVERTERV=$(ver_cut 1-3)
11 ZHWIKIV="20241201"
12 WEBSLANGV=$(ver_cut 4)
14 DESCRIPTION="Fcitx 5 Pinyin Dictionary from zh.wikipedia.org"
15 HOMEPAGE="https://github.com/felixonmars/fcitx5-pinyin-zhwiki"
16 SRC_URI="
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 )"
25 SLOT="5"
26 KEYWORDS="~amd64"
27 IUSE="+fcitx rime"
28 REQUIRED_USE="|| ( fcitx rime )"
30 RDEPEND="
31         fcitx? ( app-i18n/fcitx:5 )
32         rime? ( || ( app-i18n/ibus-rime app-i18n/fcitx-rime ) )
33         !app-dicts/fcitx-pinyin-zhwiki-bin
35 BDEPEND="
36         ${PYTHON_DEPS}
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}]
41         ')
44 _emake() {
45         emake \
46                 VERSION="${ZHWIKIV}" \
47                 WEB_SLANG_VERSION="${WEBSLANGV}" \
48                 "$@"
51 python_check_deps() {
52         python_has_version "dev-python/pypinyin[${PYTHON_USEDEP}]" &&
53         python_has_version "app-i18n/opencc[python(-),${PYTHON_SINGLE_USEDEP}]"
56 src_unpack() {
57         default
58         cp "${DISTDIR}/web-slang-${WEBSLANGV}.source" "${S}" || die
59         cp "${WORKDIR}/zhwiki-${ZHWIKIV}-all-titles-in-ns0" "${S}" || die
62 src_prepare() {
63         # remove network access and decompression
64         sed -i -e '14d;17d;23d' Makefile || die
65         default
68 src_compile() {
69         use fcitx && _emake zhwiki.dict
70         use rime && _emake zhwiki.dict.yaml
73 src_install() {
74         use fcitx && _emake DESTDIR="${ED}" install
75         use rime && _emake DESTDIR="${ED}" install_rime_dict