# Copyright 2010-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="8" PYTHON_COMPAT=( python3_{9..11} ) inherit elisp-common multiprocessing python-any-r1 toolchain-funcs desktop xdg DESCRIPTION="Mozc - Japanese input method editor" HOMEPAGE="https://github.com/google/mozc" if [[ "${PV}" == "9999" ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/google/mozc" EGIT_SUBMODULES=(src/third_party/japanese_usage_dictionary) else MOZC_GIT_REVISION="7f02ce1923516502854aa48a95e2c1e84a3e5a9f" MOZC_DATE="${PV#*_p}" MOZC_DATE="${MOZC_DATE%%_p*}" FCITX_MOZC_GIT_REVISION="36fb17175ceb2ade323ad729e0d7cfb06f98e675" FCITX_MOZC_DATE="${PV#*_p}" FCITX_MOZC_DATE="${FCITX_MOZC_DATE#*_p}" FCITX_MOZC_DATE="${FCITX_MOZC_DATE%%_p*}" JAPANESE_USAGE_DICTIONARY_GIT_REVISION="a4a66772e33746b91e99caceecced9a28507e925" JAPANESE_USAGE_DICTIONARY_DATE="20180701040110" SRC_URI="https://github.com/google/${PN}/archive/${MOZC_GIT_REVISION}.tar.gz -> ${PN}-${PV%%_p*}-${MOZC_DATE}.tar.gz https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/${JAPANESE_USAGE_DICTIONARY_GIT_REVISION}.tar.gz -> japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_DATE}.tar.gz https://github.com/fcitx/${PN}/archive/${FCITX_MOZC_GIT_REVISION}.tar.gz -> fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz" fi # Mozc: BSD # src/data/dictionary_oss: ipadic, public-domain # src/data/unicode: unicode # japanese-usage-dictionary: BSD-2 LICENSE="BSD BSD-2 ipadic public-domain unicode" SLOT="0" #KEYWORDS="~amd64 ~arm64 ~ppc64 x86" KEYWORDS="~amd64 ~x86" IUSE="debug emacs fcitx4 fcitx5 +gui ibus renderer test" REQUIRED_USE="|| ( emacs fcitx4 fcitx5 ibus )" RESTRICT="!test? ( test )" BDEPEND="$(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]') >=dev-libs/protobuf-3.0.0 dev-build/gyp app-alternatives/ninja virtual/pkgconfig emacs? ( app-editors/emacs:* ) fcitx4? ( sys-devel/gettext ) fcitx5? ( sys-devel/gettext )" DEPEND=">=dev-cpp/abseil-cpp-20211102[cxx17(+)] >=dev-libs/protobuf-3.0.0:= fcitx4? ( app-i18n/fcitx:4 virtual/libintl ) fcitx5? ( app-i18n/fcitx:5 app-i18n/libime sys-devel/gettext virtual/libintl ) gui? ( dev-qt/qtcore:5 dev-qt/qtgui:5 dev-qt/qtwidgets:5 ) ibus? ( >=app-i18n/ibus-1.4.1 dev-libs/glib:2 x11-libs/libxcb ) renderer? ( dev-libs/glib:2 x11-libs/cairo x11-libs/gtk+:2 x11-libs/pango ) test? ( >=dev-cpp/gtest-1.8.0 dev-libs/jsoncpp )" RDEPEND=">=dev-cpp/abseil-cpp-20211102[cxx17(+)] >=dev-libs/protobuf-3.0.0:= emacs? ( app-editors/emacs:* ) fcitx4? ( app-i18n/fcitx:4 virtual/libintl ) fcitx5? ( app-i18n/fcitx:5 app-i18n/libime sys-devel/gettext virtual/libintl ) gui? ( dev-qt/qtcore:5 dev-qt/qtgui:5 dev-qt/qtwidgets:5 ) ibus? ( >=app-i18n/ibus-1.4.1 dev-libs/glib:2 x11-libs/libxcb ) renderer? ( dev-libs/glib:2 x11-libs/cairo x11-libs/gtk+:2 x11-libs/pango )" S="${WORKDIR}/${P}/src" SITEFILE="50${PN}-gentoo.el" execute() { einfo "$@" "$@" } python_check_deps() { has_version -b "dev-python/six[${PYTHON_USEDEP}]" } src_unpack() { if [[ "${PV}" == "9999" ]]; then git-r3_src_unpack if use fcitx4 || use fcitx5; then local EGIT_SUBMODULES=() git-r3_fetch https://github.com/fcitx/mozc refs/heads/fcitx git-r3_checkout https://github.com/fcitx/mozc "${WORKDIR}/fcitx-mozc" fi if use fcitx5; then cp -pr "${WORKDIR}"/fcitx{,5}-mozc || die fi else unpack ${PN}-${PV%%_p*}-${MOZC_DATE}.tar.gz mv mozc-${MOZC_GIT_REVISION} ${P} || die unpack japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_DATE}.tar.gz cp -p japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_GIT_REVISION}/usage_dict.txt ${P}/src/third_party/japanese_usage_dictionary || die if use fcitx4 || use fcitx5; then unpack fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz if use fcitx4; then cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx-${PN} || die fi if use fcitx5; then cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx5-${PN} || die fi rm -r mozc-${FCITX_MOZC_GIT_REVISION} || die fi fi xz -cd "${FILESDIR}"/${PN}-2.26.4632-system_abseil-cpp.patch.xz > \ "${S}"/${PN}-2.26.4632-system_abseil-cpp.patch || die } src_prepare() { if use fcitx4; then cp -pr "${WORKDIR}/fcitx-mozc/src/unix/fcitx" unix || die fi if use fcitx5; then cp -pr "${WORKDIR}/fcitx5-mozc/src/unix/fcitx5" unix || die fi pushd "${WORKDIR}/${P}" > /dev/null || die eapply "${S}/${PN}-2.26.4632-system_abseil-cpp.patch" eapply "${FILESDIR}/${PN}-2.26.4220-system_gtest.patch" eapply "${FILESDIR}/${PN}-2.26.4220-system_jsoncpp.patch" eapply "${FILESDIR}/${PN}-2.26.4632-environmental_variables.patch" # eapply "${FILESDIR}/${PN}-2.26.4632-server_path_check.patch" eapply_user popd > /dev/null || die sed \ -e "s/def GypMain(options, unused_args):/def GypMain(options, gyp_args):/" \ -e "s/RunOrDie(gyp_command + gyp_options)/RunOrDie(gyp_command + gyp_options + gyp_args)/" \ -e "s/RunOrDie(\[ninja/&, '-j$(makeopts_jobs "${MAKEOPTS}" 999)', '-l$(makeopts_loadavg "${MAKEOPTS}" 0)', '-v'/" \ -i build_mozc.py || die local ar=($(tc-getAR)) local cc=($(tc-getCC)) local cxx=($(tc-getCXX)) local ld=($(tc-getLD)) local nm=($(tc-getNM)) local readelf=($(tc-getREADELF)) # Use absolute paths. Non-absolute paths are mishandled by GYP. ar[0]=$(type -P ${ar[0]}) cc[0]=$(type -P ${cc[0]}) cxx[0]=$(type -P ${cxx[0]}) ld[0]=$(type -P ${ld[0]}) nm[0]=$(type -P ${nm[0]}) readelf[0]=$(type -P ${readelf[0]}) sed \ -e "s: