commit: f1c56987f30ff7859362a5e7c0328c1fc1a19b58 Author: Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr> AuthorDate: Sun Feb 22 14:00:16 2026 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Feb 23 16:50:07 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1c56987
app-i18n/mozc: add 3.33.6089 upstream renamed mozc icons w/ e13338a, tested & reported by palapapa do not duplicate distfiles Closes: https://bugs.gentoo.org/969637 Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr> Part-of: https://codeberg.org/gentoo/gentoo/pulls/123 Merges: https://codeberg.org/gentoo/gentoo/pulls/123 Signed-off-by: Sam James <sam <AT> gentoo.org> app-i18n/mozc/Manifest | 11 + app-i18n/mozc/mozc-3.33.6089.ebuild | 434 ++++++++++++++++++++++++++++++++++++ 2 files changed, 445 insertions(+) diff --git a/app-i18n/mozc/Manifest b/app-i18n/mozc/Manifest index 663c997ba4a2..29c0976ea77e 100644 --- a/app-i18n/mozc/Manifest +++ b/app-i18n/mozc/Manifest @@ -35,10 +35,21 @@ DIST mozc-2.32.5994.102-properties.svg 812 BLAKE2B 17f3facef4594c38b94a3be325d7a DIST mozc-2.32.5994.102-tool.png 360 BLAKE2B e699107fb3d5d8fd202ea8f65908a63b2d9b8c5aa4eaeed0db15a5bc5eb4af4735814f20b8e641736b08fbee2691836a5d5e8b94b4b653aac836f8afa982b791 SHA512 35f270784ff7b947aa3636d9531c502775315116f694f95a21a93ef9bf77d67ab7b194153b186a8371a78ce8b162ca82fb232aea92dc37ba2de86c79fe8f19b1 DIST mozc-2.32.5994.102-tool.svg 326 BLAKE2B df5947d23720f168d40403c00dc20e547ae30dd8f92c8448d5675fe28344903a65e139c4739c83fa64db9233b012ddcd3e5ad663d96417a8dcb4b83ba020d4ad SHA512 471ae428ca8312b4ecc8ab3f7348f89b2778e853a3106e21b5027b5fa23d8ea2eb301a18d64203af52e4ca8bfe51f184966e01670c514dc019a649c5f557e08a DIST mozc-2.32.5994.102.tar.gz 28284987 BLAKE2B d62a1b77141e31b8991ed39e84d8daff8f9112efdae82a2ede77654fbe15d2d83b73b747a21b18fc4fcd1faa5324dac50c9e3dfff900ebd546e47ec1d1b4ccc0 SHA512 eac685aa710acfc3af6137793ac506870acfd79d8826ffbb053f6fda850d9cf680f0a9ab59a788a36d98f0dd1fe48d8d19dbf1328b9dcab5ed9976f4f80e13ea +DIST mozc-3.33.6089.tar.gz 28288333 BLAKE2B cbf8dc2fc2849bd928a472ebd884c9dbaea9c1592afc32aa09c6991f7c5cbf0b3b1383955fd18006693129e2bae3d185851afe994e1d7c274842fa5ccb218ef3 SHA512 878ca8c19839e06c00176e588c045c5090c59fc6579c4849ac185f7a165e9ea2e25295cec4c7bf0b8b5050720a8bac9725e710230c20afccd88b33e00b2511b7 +DIST mozc-3352476__jigyosyo.zip 774194 BLAKE2B 46cb54e9d9ee183031dbda9cecbbcf24a341488a0320286f264fb2f9e44638373f432463bbfd2fadaa65f64dba9afce9ca4ae01b8315f3853dcf6b8361e1339d SHA512 ec76f0c9b02a8f0a8633d752ebdb80ac7c4d5c71dfd9916cc9140d446bae8e09755db8d40eca87fbb08d21c31db80ec977f307c497f0d731087c73a1df9ea0c7 +DIST mozc-3352476__ken_all.zip 1694438 BLAKE2B 03879037406a9d95c33d14bbde6fdd33acae0e6fda328e960c9f10aad74f2f34353d8b03e98ea247659587821d839783be2f031c3e756eac292ec52094c7ede6 SHA512 00aef90b785a703d536813616eeec7057eeaf681b83bc35c6c4b597df298ccb6bbd97f97845c7570788e7f063d94b4c62e359ccc698fcaeff17ce472bc1b9225 +DIST mozc-4.0.0__dictionary.png 205 BLAKE2B f92fdeae34eff41473c6c9b0f6fb5a3c784b7b98fd6932b03953131f78ab97c961eb94f88e542f593acf0d2af176e28a3d638e50e912aa695de882477117b2d6 SHA512 aac820bbf51b2dfe23a9e0de57c2c9f4301e021c3ae29047ec8918ccb22b698f775ceee1dfe5ceaf21ada9228085ae1a36e65ab33fd811acf072e4d380225d9c +DIST mozc-4.0.0__dictionary.svg 294 BLAKE2B 24464c7238fc58056c4c9e94f72c9ece8313a09ef1fd57f07b2178dcf78b722fff4965d42ac867c135db969a905306f99e7d6e4f5c028029646b77d6eee3de33 SHA512 648b486ec244c117ae25aadbff1f14211a311df37161b7777c442aff2f7f8dd61d41912d81891a0de29383e3430ee80ecdad7d9b1fb9e0ea7addcbf97af018c3 +DIST mozc-4.0.0__properties.png 557 BLAKE2B 33a12b009e0dff7a46385a59287a8d179ec931e6cd98a5b13480ade870035259928d8655ca578954307a76eca92ea98dbe4ec4f904f2074c21c848b3a2b6f0d7 SHA512 1cbd9307f0e96c1255c1cb915d10d2254281574c8fcf54e97a518d3a49475cc7775d6f4042a04e2358f7db5808986eef9cd9b84fff571dce1b9ec23f8fb3a8fd +DIST mozc-4.0.0__properties.svg 812 BLAKE2B 17f3facef4594c38b94a3be325d7a00d5538c4f098853b5e70254b572305440adbba7e597cee4645ffd1884631cab5ff50dd25a5368b7aff1972290e6ceaab91 SHA512 637b8ec750fa0a5a32afbcefb43430d122de889d32ce6295327934dede6051d1a37678a895b8c2fa26ab0c28f5a372e7b6ca0aad7acebaf64cc5a88c32ff43de +DIST mozc-4.0.0__tool.png 360 BLAKE2B e699107fb3d5d8fd202ea8f65908a63b2d9b8c5aa4eaeed0db15a5bc5eb4af4735814f20b8e641736b08fbee2691836a5d5e8b94b4b653aac836f8afa982b791 SHA512 35f270784ff7b947aa3636d9531c502775315116f694f95a21a93ef9bf77d67ab7b194153b186a8371a78ce8b162ca82fb232aea92dc37ba2de86c79fe8f19b1 +DIST mozc-4.0.0__tool.svg 326 BLAKE2B df5947d23720f168d40403c00dc20e547ae30dd8f92c8448d5675fe28344903a65e139c4739c83fa64db9233b012ddcd3e5ad663d96417a8dcb4b83ba020d4ad SHA512 471ae428ca8312b4ecc8ab3f7348f89b2778e853a3106e21b5027b5fa23d8ea2eb301a18d64203af52e4ca8bfe51f184966e01670c514dc019a649c5f557e08a DIST mozc-bcr-470a7a43196aeffd5f6c3ff41bbcfeb120a04341.tar.gz 4496750 BLAKE2B eff0dc194d6062e5be927244ebe4e94557391c71c1734e1c7be13071d2efee5d82b18eba7d750e60f7d6eab5db57a021135df54b5cb7f48b208c436543d8126b SHA512 ae05a1aa336ef0966533fca0542cb0e4a8403e3e232d8c4dc4565a9864fb0a26a3785029d3aeac257bc00b0cf45ca555420fd0db1205911c57ef28e737d96d01 DIST mozc-bcr-b553f46a71d17fe8f32661f64e755cf6fac03ada.tar.gz 3374577 BLAKE2B 20722deebafffe44f39246c2a2ca11af155585871106fd182f77fba010d5bab907107f078dbba667dfb9f38c375896322fa0b5c1b51fc5b0aef18d99c48d4f7d SHA512 45dea3670a932e370f9ffcd98a5b99e988dfe16fa7140d71230a27bd83b97343dc4dcf96a14ed3bdd50cb17976e484699dbd4e1ffc5b1aba420c16f00f05a37e DIST mozc-fcitx5-2.31.5851.102.tar.gz 28530201 BLAKE2B 4f42970b2bde2173d49cccaefafff0d65c792934b923dc5cbced83de143a5622fa0b9aca672a8e2b536cd5601100754740b09ea2953d00b662f5dc9e04f0f704 SHA512 d60b3d11110acb6e838300ecaa398b8abd652e9ad7a94bd0e2bbaf8cf7d217aaa62241916a607c4f8cf0fe6e9434a31b7fb8dae2a3cd7e20e0022fda137946f1 DIST mozc-fcitx5-2.32.5994.102.tar.gz 28373979 BLAKE2B b38ce9527035e16916e5820f63b4e9e6cf93549f29ab1f88e8ee689f829429c459fff60772a3eff429c9c98b61afca931f5354f28c7afe583cce996b35021761 SHA512 9cee1ce170e55dc803c3eb739800c5f1cb9c50e7315361078bda6e12b767e50781c059ae03ab29316fc2b4647af07abb3d865a273c76e41e1c712129d62dbbbf +DIST mozc-fcitx5-3.33.6089.tar.gz 28374851 BLAKE2B 5c95f2ed71c771937c0fa6fa8011c6c88140eb2e47bdcbdd342d678ada509ddc2c002714b0ef48b450401edaf5e7d4fa08448aff040b14f97e6b9953f9ab2fb8 SHA512 0a146170383a402a7f71fbf88bcd96a1e78338dbe99c71f8285ac34474770bfbde7340367e13565a602ef85e6d5270ca56dcb84109a9685a75162ea0f8b27036 +DIST mozc-japanese-usage-dictionary__2025-01-25.tar.gz 72003 BLAKE2B 3eef55aa1bd45c209e6457c6ef68105b2c157403be89b8d12cb2401f2e9d75b8b40d381a0ab24a6b99cf284208100fcc57213b4699db1a31a669a43ba7533aae SHA512 ac4be3e60f16804c8aba3491c6bd858bae13834951ea63d90a7d8811ee7a23221f56d161ed9009e5cc9c1df9f0379eee82668f0728c8674cd820051a54baf547 DIST platforms-0.0.10.tar.gz 7680 BLAKE2B dd19db938cc7efe706c94f8149265952ecafe7e2811e84924377b1b1f0138e7104da2252d64a4dc03f66d8a3284716fa09888721294d885de852a69324fcb596 SHA512 a92e54fccebc6ac9715be6ffb09f0bb20d402de4837ad5002e9c292b54f8b84a573b049c0e8192f955bb51b19c9926a3affc880f3d4dce28f535f97241b0663f DIST platforms-1.0.0.tar.gz 7879 BLAKE2B eaa82522a86d75669befeaa6023b46fb6c482cd9a0e818d5f99c602a2bf7e359e51ef61298aeda40cea15b7f281eba04cf9a37e637f92fc8c7b5d209693fd8e1 SHA512 cb05b7157e4e3b8ec05f1e4ac3e5eecc73d9a3ed5729455058a1290a5f04fb4e58be30368fc2ce6a90d6938ada331ea2abaeaaeaede16d1ae2ee091fa0c1faef DIST protobuf-29.3.zip 11127807 BLAKE2B 1889a4948335a5a27e6dee0549bab3f226e634eb8dbce97830b1aa84787026258c135431241afcbfebbe2433ce933d0733bebeeb990c5b5924f09d5e625edb43 SHA512 09cb3eed78d41444b336e5a7bbcc1ca3679ad7c625ecdceb6d5d3b6430baa924b7da3dd4befdf068f2124ecf9fe986f1cc4d7b3b97177a8117af0acb182e63c8 diff --git a/app-i18n/mozc/mozc-3.33.6089.ebuild b/app-i18n/mozc/mozc-3.33.6089.ebuild new file mode 100644 index 000000000000..fea5d54d9ec7 --- /dev/null +++ b/app-i18n/mozc/mozc-3.33.6089.ebuild @@ -0,0 +1,434 @@ +# Copyright 2025-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +inherit desktop dot-a edo elisp-common flag-o-matic multiprocessing python-any-r1 savedconfig toolchain-funcs xdg + +# USE_BAZEL_VERSION in .bazeliskrc +BAZEL_VER="8.4.1" +# 2025-10-22, release of mozc-2.32.5994.102, bump only if required +BAZEL_BCR_HASH="470a7a43196aeffd5f6c3ff41bbcfeb120a04341" +# Merge remote just after the tag of mozc +MOZC_FCITX_HASH="fbcc430814bfcd6df1a25d13ed9417e76ca49723" + +# submodules, but archives are fetched by bazel from bazel_dist +ABS_VER="20250814.0" +GTEST_VER="1.17.0" +JUD_VER="2025-01-25" +# sha256sum of tarball +JUD_CHECKSUM="ebfc8681eb207f14a2c36a7a71522b1aa8a405d10ab36a83a9a024d4ce58c0ca" +PROTO_VER="32.0" + +# to simplify update +CPYTHON_VER="3.11.13+20250610" +RPYTHON_VER="1.5.4" +JAPZIP_HASH="3352476" +GICONS_VER="4.0.0" + +DESCRIPTION="Mozc - Japanese input method editor." +HOMEPAGE="https://github.com/google/mozc" +# for new release, update versions according to MODULE.bazel or failures of the fetch's phase of bazel +SRC_URI=" + amd64? ( + https://releases.bazel.build/${BAZEL_VER}/release/bazel-${BAZEL_VER}-linux-x86_64 + https://github.com/astral-sh/python-build-standalone/releases/download/${CPYTHON_VER#*+}/cpython-${CPYTHON_VER}-x86_64-unknown-linux-gnu-install_only.tar.gz + ) + arm64? ( + https://releases.bazel.build/${BAZEL_VER}/release/bazel-${BAZEL_VER}-linux-arm64 + https://github.com/astral-sh/python-build-standalone/releases/download/${CPYTHON_VER#*+}/cpython-${CPYTHON_VER}-aarch64-unknown-linux-gnu-install_only.tar.gz + ) + !fcitx5? ( https://github.com/google/${PN}/archive/refs/tags/${PV}.tar.gz + -> ${P}.tar.gz ) + fcitx5? ( https://github.com/fcitx/${PN}/archive/${MOZC_FCITX_HASH}.tar.gz + -> ${PN}-fcitx5-${PV}.tar.gz ) + test? ( https://github.com/google/googletest/releases/download/v${GTEST_VER}/googletest-${GTEST_VER}.tar.gz ) + https://github.com/bazelbuild/bazel-central-registry/archive/${BAZEL_BCR_HASH}.tar.gz + -> ${PN}-bcr-${BAZEL_BCR_HASH}.tar.gz + https://github.com/abseil/abseil-cpp/releases/download/${ABS_VER}/abseil-cpp-${ABS_VER}.tar.gz + https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/${JUD_VER}.tar.gz + -> ${PN}-japanese-usage-dictionary__${JUD_VER}.tar.gz + https://github.com/protocolbuffers/protobuf/releases/download/v${PROTO_VER}/protobuf-${PROTO_VER}.zip + https://github.com/bazel-contrib/rules_python/releases/download/${RPYTHON_VER}/rules_python-${RPYTHON_VER}.tar.gz + https://github.com/bazelbuild/apple_support/releases/download/1.23.1/apple_support.1.23.1.tar.gz + https://github.com/bazel-contrib/bazel_features/releases/download/v1.30.0/bazel_features-v1.30.0.tar.gz + https://github.com/bazelbuild/bazel-skylib/releases/download/1.8.1/bazel-skylib-1.8.1.tar.gz + https://github.com/bazelbuild/platforms/releases/download/1.0.0/platforms-1.0.0.tar.gz + https://github.com/bazelbuild/rules_android_ndk/releases/download/v0.1.3/rules_android_ndk-v0.1.3.tar.gz + https://github.com/bazelbuild/rules_apple/releases/download/4.1.2/rules_apple.4.1.2.tar.gz + https://github.com/bazelbuild/rules_cc/releases/download/0.2.2/rules_cc-0.2.2.tar.gz + https://github.com/bazelbuild/rules_java/releases/download/8.14.0/rules_java-8.14.0.tar.gz + https://github.com/bazelbuild/rules_kotlin/releases/download/v1.9.6/rules_kotlin-v1.9.6.tar.gz + https://github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz + https://github.com/bazelbuild/rules_pkg/releases/download/1.1.0/rules_pkg-1.1.0.tar.gz + https://github.com/bazelbuild/rules_shell/releases/download/v0.3.0/rules_shell-v0.3.0.tar.gz + https://github.com/bazelbuild/rules_swift/releases/download/3.1.2/rules_swift.3.1.2.tar.gz + https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz + https://github.com/hiroyuki-komatsu/japanpost_zipcode/raw/${JAPZIP_HASH}/ken_all.zip + -> ${PN}-${JAPZIP_HASH}__ken_all.zip + https://github.com/hiroyuki-komatsu/japanpost_zipcode/raw/${JAPZIP_HASH}/jigyosyo.zip + -> ${PN}-${JAPZIP_HASH}__jigyosyo.zip + https://raw.githubusercontent.com/google/material-design-icons/${GICONS_VER}/png/action/chrome_reader_mode/materialiconsoutlined/48dp/1x/outline_chrome_reader_mode_black_48dp.png + -> ${PN}-${GICONS_VER}__dictionary.png + https://raw.githubusercontent.com/google/material-design-icons/${GICONS_VER}/src/action/chrome_reader_mode/materialiconsoutlined/24px.svg + -> ${PN}-${GICONS_VER}__dictionary.svg + https://raw.githubusercontent.com/google/material-design-icons/${GICONS_VER}/png/action/settings/materialiconsround/48dp/1x/round_settings_black_48dp.png + -> ${PN}-${GICONS_VER}__properties.png + https://raw.githubusercontent.com/google/material-design-icons/${GICONS_VER}/src/action/settings/materialiconsround/24px.svg + -> ${PN}-${GICONS_VER}__properties.svg + https://raw.githubusercontent.com/google/material-design-icons/${GICONS_VER}/png/action/build/materialicons/48dp/1x/baseline_build_black_48dp.png + -> ${PN}-${GICONS_VER}__tool.png + https://raw.githubusercontent.com/google/material-design-icons/${GICONS_VER}/src/action/build/materialicons/24px.svg + -> ${PN}-${GICONS_VER}__tool.svg +" +S="${WORKDIR}/${P}/src" + +# 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" +IUSE="debug emacs fcitx5 +gui +ibus renderer test" +REQUIRED_USE="|| ( emacs fcitx5 ibus )" +RESTRICT="!test? ( test )" + +DEPEND=" + fcitx5? ( app-i18n/fcitx:5 ) + gui? ( dev-qt/qtbase:6[gui,widgets] ) + ibus? ( + app-i18n/ibus + dev-libs/glib:2 + ) + renderer? ( dev-qt/qtbase:6[gui,widgets] ) +" +RDEPEND="${DEPEND} + emacs? ( app-editors/emacs:* ) +" +BDEPEND=" + ${PYTHON_DEPS} + app-arch/unzip + virtual/pkgconfig + fcitx5? ( sys-devel/gettext ) +" + +SITEFILE="50${PN}-gentoo.el" + +PATCHES=( + "${FILESDIR}"/${PN}-2.31.5851.102-fix_path.patch +) + +pkg_setup() { + python-any-r1_pkg_setup +} + +src_unpack() { + case $(tc-arch) in + amd64) export EARCH=x86_64 ;; + arm64) export EARCH=arm64 ;; + *) die "architecture not supported: $(tc-arch)" ;; + esac + cp "${DISTDIR}"/bazel-${BAZEL_VER}-linux-${EARCH} bazel || die + chmod +x bazel || die + + unpack ${PN}-bcr-${BAZEL_BCR_HASH}.tar.gz + ln -sfT bazel-central-registry-${BAZEL_BCR_HASH} bcr || die + + # create symlinks for distdir with the name wanted by bazel + mkdir bazel_dist || die + pushd "${DISTDIR}" >/dev/null || die + for dep in *.{tar.gz,zip,png,svg}; do + ln -sfT "${DISTDIR}/${dep}" "${WORKDIR}/bazel_dist/${dep#*__}" || die + done + popd >/dev/null || die + + if use fcitx5; then + unpack ${PN}-fcitx5-${PV}.tar.gz + ln -sfT "${WORKDIR}"/${PN}-${MOZC_FCITX_HASH} "${WORKDIR}"/${P} || die + else + unpack ${P}.tar.gz + fi +} + +ebazel() { + debug-print-function ${FUNCNAME} "${@}" + + edo "${WORKDIR}"/bazel "$@" +} + +mozc_icons() { + if use fcitx5 || use gui || use ibus; then + return 0 + fi +} + +src_prepare() { + default + + # use tarball instead of zip for japanese-usage-dictionary (avoid CI failure) + sed -e "/^ *name = \"ja_usage_dict\"/,/^ *sha256/s/sha256 =.*,$/sha256 = \"${JUD_CHECKSUM}\",/" \ + -e "\@.*github.com/hiroyuki-komatsu/japanese-usage-dictionary@s:%s.zip:%s.tar.gz:" \ + -i MODULE.bazel || die + + # declare a patch to bazel for rules_python + cat >> MODULE.bazel <<-_EOF_ || die + single_version_override( + module_name = "rules_python", + patches = [ "bazel/rules_python_fix_shebang.patch" ], + version = "${RPYTHON_VER}", + ) + _EOF_ + # 'install' the patch for rules_python + # check py_runtime_info.bzl from ${WORKDIR}/bazel_dist/rules_python-${RPYTHON_VER}.tar.gz to update the patch + cp "${FILESDIR}"/${PN}-2.32.5994.102-bazel_patch-fix_shebang.patch bazel/rules_python_fix_shebang.patch || die + # fix shebang + sed -e "s:@PYTHON@:${PYTHON}:" \ + -i bazel/rules_python_fix_shebang.patch || die + + # fix paths to preserve compatibility + sed -e "/LINUX_MOZC_SERVER_DIR/s:=.*:= \"/usr/libexec/mozc\":" \ + -e "/IBUS_MOZC_PATH/s:=.*:= \"/usr/libexec/ibus-engine-mozc\":" \ + -i config.bzl || die + + # respect prefix + if [[ -n ${EPREFIX} ]]; then + sed -e "s@/usr@${EPREFIX}/usr@" -i config.bzl || die + fi + + # fix pkg-config for fcitx5 / ibus / glib / Qt + tc-export PKG_CONFIG + sed -e "s@\"pkg-config\"@\"${PKG_CONFIG}\"@" \ + -i bazel/pkg_config_repository.bzl || die + + # bug #877765 + restore_config mozcdic-ut.txt + if [[ -f mozcdic-ut.txt && -s mozcdic-ut.txt ]]; then + einfo "mozcdic-ut.txt found. Adding to mozc dictionary..." + cat mozcdic-ut.txt >> "${S}"/data/dictionary_oss/dictionary00.txt || die + fi + + # custom the target 'package' defined in unix/BUILD.bazel + if ! mozc_icons; then + sed -e "\@:icons@d" \ + -i unix/BUILD.bazel || die + fi + + if ! use emacs; then + sed -e "\@//unix/emacs:mozc_emacs_helper@d" \ + -e "\@//unix/emacs:mozc.el@d" \ + -i unix/BUILD.bazel || die + fi + + if ! use gui; then + sed -e "\@//gui/tool:mozc_tool@d" \ + -i unix/BUILD.bazel || die + fi + + if ! use ibus; then + sed -e "\@//unix/ibus:gen_mozc_xml@d" \ + -e "\@//unix/ibus:ibus_mozc@d" \ + -i unix/BUILD.bazel || die + fi + + if ! use renderer; then + sed -e "\@//renderer/qt:mozc_renderer@d" \ + -i unix/BUILD.bazel || die + fi +} + +src_configure() { + # to investigate, but there's lot of static libs + lto-guarantee-fat + + # https://bazel.build/reference/be/make-variables + tc-export CC AR + + # fix external/zlib+ w/ clang-21 + append-cppflags -DHAVE_UNISTD_H=1 + + MYEBAZELARGS=( + --compilation_mode="$(usex debug dbg opt)" + --config="oss_linux" + --distdir="${WORKDIR}/bazel_dist" + --jobs="$(get_makeopts_jobs)" + --registry="file://${WORKDIR}/bcr" + --repository_cache="${WORKDIR}/bazel_cache" + --spawn_strategy="local" # portage is already sandboxed + --strip="$(usex debug never always)" + --subcommands # be verbose + --verbose_failures + ) + + if use fcitx5; then + MYEBAZELARGS+=( + unix/fcitx5/fcitx5-mozc.so + # just to be sure, use_server is enabled by default + --define server=1 + ) + fi + + # add all targets/testsuites by default, then filter + if use test; then + MYEBAZELARGS+=( /... ) + # not unix, no testsuite + SKIP_TESTS=( -protocol/... ) + ! use emacs && SKIP_TESTS+=( -unix/emacs/... ) + ! use gui && SKIP_TESTS+=( -gui/... ) + ! use ibus && SKIP_TESTS+=( -unix/ibus/... ) + ! use renderer && SKIP_TESTS+=( -renderer/... ) + use fcitx5 && SKIP_TESTS+=( -unix/fcitx/... ) + fi + + local cppflags + for cppflags in ${CPPFLAGS}; do + MYEBAZELARGS+=( --copt="${cppflags}" ) + done + + local cflags + for cflags in ${CFLAGS}; do + MYEBAZELARGS+=( --conlyopt="${cflags}" ) + done + + local cxxflags + for cxxflags in ${CXXFLAGS}; do + MYEBAZELARGS+=( --cxxopt="${cxxflags}" ) + done + + local ldflags + for ldflags in ${LDFLAGS}; do + MYEBAZELARGS+=( --linkopt="${ldflags}" ) + done + + # clean cache, just in case + ebazel clean --expunge + + # this build --nobuild generates bazel_cache + # this is useful to debug or make patch + ebazel build --nobuild package "${MYEBAZELARGS[@]}" -- "${SKIP_TESTS[@]}" +} + +src_compile() { + ebazel build package "${MYEBAZELARGS[@]}" -- "${SKIP_TESTS[@]}" + + # bazel-bin is a symlink, copy files to avoid problem with symlink then + cp -R bazel-bin/unix out_linux || die + + use emacs && elisp-compile unix/emacs/*.el +} + +src_test() { + ebazel test --build_tests_only "${MYEBAZELARGS[@]}" -- "${SKIP_TESTS[@]}" +} + +src_install() { + unzip -qo out_linux/mozc.zip -d "${ED}" || die + + # remove mozc.el, in a wrong path + # already compiled elsewhere and installed then + if use emacs; then + rm -r "${ED}"/usr/share/emacs/site-lisp/emacs-mozc || die + elisp-install ${PN} unix/emacs/*.{el,elc} + elisp-site-file-install "${FILESDIR}"/${SITEFILE} ${PN} + fi + + if mozc_icons; then + # remove tmp with duplicate icons zipped + rm -r "${ED}"/tmp || die + if ! use ibus; then + rm -r "${ED}"/usr/share/ibus-mozc || die + fi + if ! use gui; then + rm -r "${ED}"/usr/share/icons/mozc || die + fi + fi + + if use fcitx5; then + exeinto /usr/$(get_libdir)/fcitx5 + doexe out_linux/fcitx5/fcitx5-mozc.so + + # see scripts/install_fcitx5_data + insinto /usr/share/fcitx5/addon + newins unix/fcitx5/mozc-addon.conf mozc.conf + + insinto /usr/share/fcitx5/inputmethod + doins unix/fcitx5/mozc.conf + + export MOPREFIX="fcitx5-mozc" + local mo_file + for mo_file in unix/fcitx5/po/*.po; do + msgfmt "${mo_file}" -o "${mo_file%.po}.mo" && domo "${mo_file%.po}.mo" || die + done + + msgfmt --xml -d unix/fcitx5/po/ \ + --template unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in \ + -o unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml || die + insinto /usr/share/metainfo + doins unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml + + # see scripts/install_fcitx5_icons + local orgfcitx5="org.fcitx.Fcitx5.fcitx_mozc" + newicon -s 128 data/images/product_icon_32bpp-128.png ${orgfcitx5}.png + newicon -s 128 data/images/product_icon_32bpp-128.png fcitx_mozc.png + newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png ${orgfcitx5}.png + newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png fcitx_mozc.png + for uiimg in ../scripts/icons/ui-*.png; do + dimg="${uiimg#*ui-}" + newicon -s 48 "${uiimg}" "${orgfcitx5}_${dimg}" + newicon -s 48 "${uiimg}" "fcitx_mozc_${dimg}" + done + fi + + [[ -s mozcdic-ut.txt ]] && save_config mozcdic-ut.txt + + insinto /usr/libexec/mozc/documents + doins data/installer/credits_en.html +} + +pkg_postinst() { + elog + elog "ENVIRONMENTAL VARIABLES" + elog + elog "MOZC_SERVER_DIRECTORY" + elog " Mozc server directory" + elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc\"" + elog "MOZC_DOCUMENTS_DIRECTORY" + elog " Mozc documents directory" + elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc/documents\"" + elog "MOZC_CONFIGURATION_DIRECTORY" + elog " Mozc configuration directory" + elog " Value used by default: \"~/.mozc\"" + elog + if use emacs; then + elog + elog "USAGE IN EMACS" + elog + elog "mozc-mode is minor mode to input Japanese text using Mozc server." + elog "mozc-mode can be used via LEIM (Library of Emacs Input Method)." + elog + elog "In order to use mozc-mode by default, the following settings should be added to" + elog "Emacs init file (~/.emacs.d/init.el or ~/.emacs):" + elog + elog " (require 'mozc)" + elog " (set-language-environment \"Japanese\")" + elog " (setq default-input-method \"japanese-mozc\")" + elog + elog "With the above settings, typing C-\\ (which is bound to \"toggle-input-method\"" + elog "by default) will enable mozc-mode." + elog + elog "Alternatively, at run time, after loading mozc.el, mozc-mode can be activated by" + elog "calling \"set-input-method\" and entering \"japanese-mozc\"." + elog + + elisp-site-regen + fi + xdg_pkg_postinst +} + +pkg_postrm() { + if use emacs; then + elisp-site-regen + fi + xdg_pkg_postrm +}
