# Copyright 2010-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="7" PYTHON_COMPAT=( python3_{8..9} ) inherit elisp-common multiprocessing python-any-r1 toolchain-funcs 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="" MOZC_DATE="${PV#*_p}" MOZC_DATE="${MOZC_DATE%%_p*}" FCITX_MOZC_GIT_REVISION="" FCITX_MOZC_DATE="${PV#*_p}" FCITX_MOZC_DATE="${FCITX_MOZC_DATE#*_p}" FCITX_MOZC_DATE="${FCITX_MOZC_DATE%%_p*}" JAPANESE_USAGE_DICTIONARY_GIT_REVISION="" JAPANESE_USAGE_DICTIONARY_DATE="" fi DESCRIPTION="Mozc - Japanese input method editor" HOMEPAGE="https://github.com/google/mozc" if [[ "${PV}" == "9999" ]]; then SRC_URI="" else 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 fcitx4? ( 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="" IUSE="debug emacs fcitx4 +gui ibus renderer test" REQUIRED_USE="|| ( emacs fcitx4 ibus )" RESTRICT="!test? ( test )" BDEPEND="$(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]') >=dev-libs/protobuf-3.0.0 dev-util/gyp dev-util/ninja virtual/pkgconfig emacs? ( app-editors/emacs:* ) fcitx4? ( sys-devel/gettext )" DEPEND=">=dev-cpp/abseil-cpp-20200923[cxx17(+)] >=dev-libs/protobuf-3.0.0:= fcitx4? ( app-i18n/fcitx:4 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-20200923[cxx17(+)] >=dev-libs/protobuf-3.0.0:= emacs? ( app-editors/emacs:* ) fcitx4? ( app-i18n/fcitx:4 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; 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 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; then unpack fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz mv mozc-${FCITX_MOZC_GIT_REVISION} fcitx-${PN} fi fi } src_prepare() { if use fcitx4; then cp -pr "${WORKDIR}/fcitx-mozc/src/unix/fcitx" unix || die fi pushd "${WORKDIR}/${P}" > /dev/null || die eapply "${FILESDIR}/${PN}-2.26.4220-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.4220-environmental_variables.patch" eapply "${FILESDIR}/${PN}-2.26.4220-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)', '-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: