ibus-mozc: init at 3.35.6354

Split the IBus engine and renderer from the Mozc server package, retain
the existing ibus-engines aliases, and install all runtime icons
referenced by the engine.

Assisted-by: pi (OpenAI GPT-5.6-sol)
This commit is contained in:
Shogo Takata
2026-07-26 16:41:11 +09:00
parent 57d405d5da
commit 4fb2ac3db0
6 changed files with 169 additions and 55 deletions

View File

@@ -368,6 +368,8 @@
- All databases of the MySQL family – `mysql`, `mariadb` and `percona` – now provide a client-only package `client` sub-attribute. Use the `<dbname>.client` package if the server components are not needed. The main package continues to ship the client binaries as well.
- `mozc` has been split into `mozc`, `ibus-mozc` and `emacs-mozc`. The `ibus-mozc` package replaces the previous `ibus-engines.mozc` alias.
- Package-URL (PURL, https://github.com/package-url/purl-spec) metadata identifier has been added for `fetchgit`, `fetchpypi`, `fetchFromGithub` fetchers and to `buildPerlPackage`.
`mkDerivation` has been adjusted to reuse this information.
Package-URLs allow reliably identifying and locating software packages.

View File

@@ -0,0 +1,136 @@
{
lib,
qt6,
pkg-config,
ibus,
unzip,
python3,
libglvnd,
glib,
stdenv,
writableTmpDirAsHomeHook,
makeDesktopItem,
copyDesktopItems,
mozc,
}:
let
pname = "ibus-mozc";
inherit (mozc)
version
src
bazel
bazelCommonArgs
vendorDeps
setupBazelVendor
;
nativeBuildInputs = [
bazel
copyDesktopItems
pkg-config
python3
qt6.wrapQtAppsHook
unzip
writableTmpDirAsHomeHook
];
buildInputs = [
glib
ibus
libglvnd
qt6.qtbase
];
includePath = lib.makeIncludePath buildInputs;
libraryPath = lib.makeLibraryPath buildInputs;
bazelArgs = bazelCommonArgs ++ [
"--action_env=C_INCLUDE_PATH=${includePath}"
"--action_env=CPLUS_INCLUDE_PATH=${includePath}"
"--action_env=LIBRARY_PATH=${libraryPath}"
"renderer/qt:mozc_renderer"
"unix/ibus:ibus_mozc"
];
in
stdenv.mkDerivation {
inherit
pname
version
src
nativeBuildInputs
buildInputs
;
strictDeps = true;
__structuredAttrs = true;
patches = [ ./renderer-path.patch ];
env.USE_BAZEL_VERSION = bazel.version;
# Work around Bazel's username lookup with sandbox=false and auto-allocate-uids=true.
env.USER = "nixbld";
postPatch = ''
cd src
${setupBazelVendor vendorDeps}
substituteInPlace config.bzl \
--replace-fail "/usr/lib/mozc" "${mozc}/lib/mozc" \
--replace-fail "/usr" "$out"
# Server and tools live in mozc, but the candidate renderer lives here.
substituteInPlace base/system_util.cc \
--subst-var-by renderer_dir "$out/lib/mozc"
'';
buildPhase = ''
runHook preBuild
bazel build --lockfile_mode=error --vendor_dir=vendor_dir ${lib.escapeShellArgs bazelArgs}
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm555 bazel-bin/renderer/qt/mozc_renderer "$out/lib/mozc/mozc_renderer"
install -Dm555 bazel-bin/unix/ibus/ibus_mozc "$out/lib/ibus-mozc/ibus-engine-mozc"
install -Dm555 bazel-bin/unix/ibus/mozc.xml "$out/share/ibus/component/mozc.xml"
unzip bazel-bin/unix/icons.zip -d "$out/share/ibus-mozc/"
install -Dm444 data/images/product_icon_32bpp-128.png "$out/share/ibus-mozc/product_icon.png"
install -Dm444 data/images/icon.svg "$out/share/ibus-mozc/product_icon.svg"
install -Dm444 ../LICENSE "$out/share/licenses/$pname/LICENSE"
runHook postInstall
'';
# create a desktop file for gnome-control-center
# contents copied from ubuntu
desktopItems = [
(makeDesktopItem {
name = "ibus-setup-mozc-jp";
desktopName = "Mozc Setup";
exec = "${mozc}/lib/mozc/mozc_tool --mode=config_dialog";
type = "Application";
startupNotify = true;
noDisplay = true;
})
];
passthru = {
inherit vendorDeps;
};
meta = {
isIbusEngine = true;
description = "Japanese input method from Google";
homepage = "https://github.com/google/mozc";
license = lib.licenses.free;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
pineapplehunter
];
};
}

View File

@@ -0,0 +1,21 @@
--- a/src/base/system_util.cc
+++ b/src/base/system_util.cc
@@ -356,7 +356,7 @@ std::string SystemUtil::GetRendererPath() {
if (server_path.empty()) {
return "";
}
- return FileUtil::JoinPath(server_path, kMozcRenderer);
+ return FileUtil::JoinPath("@renderer_dir@", kMozcRenderer);
}
std::string SystemUtil::GetToolPath() {
--- a/src/unix/ibus/mozc_engine.cc
+++ b/src/unix/ibus/mozc_engine.cc
@@ -216,6 +216,5 @@ bool UseMozcCandidateWindow(const IbusConfig& ibus_config) {
- const std::string renderer_path =
- FileUtil::JoinPath(SystemUtil::GetServerDirectory(), "mozc_renderer");
+ const std::string renderer_path = SystemUtil::GetRendererPath();
if (absl::Status s = FileUtil::FileExists(renderer_path); !s.ok()) {
LOG(ERROR) << s;
return false;
}

View File

@@ -8,10 +8,8 @@
mozcdic-ut-place-names,
mozcdic-ut-skk-jisyo,
mozcdic-ut-sudachidict,
withIbus ? false,
}:
mozc.override {
inherit withIbus;
dictionaries = [
mozcdic-ut-alt-cannadic
mozcdic-ut-edict2

View File

@@ -6,16 +6,11 @@
bazel_9,
glib,
ibus,
unzip,
xdg-utils,
python3,
libglvnd,
stdenv,
writableTmpDirAsHomeHook,
makeDesktopItem,
copyDesktopItems,
withIbus ? false,
dictionaries ? [ ],
merge-ut-dictionaries,
@@ -25,7 +20,7 @@ let
ut-dictionary = merge-ut-dictionaries.override { inherit dictionaries; };
pname = "mozc";
pname = "mozc-server";
version = "3.35.6354";
src = fetchFromGitHub {
@@ -38,17 +33,13 @@ let
nativeBuildInputs = [
bazel
copyDesktopItems
pkg-config
python3
qt6.wrapQtAppsHook
unzip
writableTmpDirAsHomeHook
];
buildInputs = [
glib
ibus
libglvnd
qt6.qtbase
];
@@ -64,19 +55,13 @@ let
"--@com_google_protobuf//bazel/flags:prefer_prebuilt_protoc=false"
];
bazelArgs =
bazelCommonArgs
++ [
"--action_env=C_INCLUDE_PATH=${includePath}"
"--action_env=CPLUS_INCLUDE_PATH=${includePath}"
"--action_env=LIBRARY_PATH=${libraryPath}"
"gui/tool:mozc_tool"
"server:mozc_server"
]
++ lib.optionals withIbus [
"renderer/qt:mozc_renderer"
"unix/ibus:ibus_mozc"
];
bazelArgs = bazelCommonArgs ++ [
"--action_env=C_INCLUDE_PATH=${includePath}"
"--action_env=CPLUS_INCLUDE_PATH=${includePath}"
"--action_env=LIBRARY_PATH=${libraryPath}"
"gui/tool:mozc_tool"
"server:mozc_server"
];
bazelPythonConfig = ''
local_runtime_repo = use_repo_rule(
@@ -247,38 +232,11 @@ stdenv.mkDerivation {
install -Dm555 bazel-bin/server/mozc_server "$out/lib/mozc/mozc_server"
install -Dm555 bazel-bin/gui/tool/mozc_tool "$out/lib/mozc/mozc_tool"
''
+ lib.optionalString withIbus ''
install -Dm555 bazel-bin/renderer/qt/mozc_renderer "$out/lib/mozc/mozc_renderer"
install -Dm555 bazel-bin/unix/ibus/ibus_mozc "$out/lib/ibus-mozc/ibus-engine-mozc"
install -Dm555 bazel-bin/unix/ibus/mozc.xml "$out/share/ibus/component/mozc.xml"
unzip bazel-bin/unix/icons.zip -d "$out/share/ibus-mozc/"
install -Dm444 data/images/product_icon_32bpp-128.png "$out/share/ibus-mozc/product_icon.png"
install -Dm444 data/images/icon.svg "$out/share/ibus-mozc/product_icon.svg"
''
+ ''
install -Dm444 ../LICENSE "$out/share/licenses/$pname/LICENSE"
runHook postInstall
'';
desktopItems = lib.optionals withIbus [
(makeDesktopItem {
name = "ibus-setup-mozc-jp";
desktopName = "Mozc Setup";
exec = "@out@/lib/mozc/mozc_tool --mode=config_dialog";
type = "Application";
startupNotify = true;
noDisplay = true;
})
];
postFixup = lib.optionalString withIbus ''
substituteInPlace "$out/share/applications/ibus-setup-mozc-jp.desktop" \
--subst-var out
'';
passthru = {
inherit
vendorDeps
@@ -289,7 +247,6 @@ stdenv.mkDerivation {
;
};
meta = {
isIbusEngine = withIbus;
description = "Japanese input method from Google";
homepage = "https://github.com/google/mozc";
changelog = "https://github.com/google/mozc/releases/tag/${version}";

View File

@@ -1752,8 +1752,8 @@ with pkgs;
m17n = callPackage ../tools/inputmethods/ibus-engines/ibus-m17n { };
mozc = mozc.override { withIbus = true; };
mozc-ut = mozc-ut.override { withIbus = true; };
mozc = ibus-mozc;
mozc-ut = ibus-mozc.override { mozc = mozc-ut; };
pinyin = callPackage ../tools/inputmethods/ibus-engines/ibus-pinyin { };