2020-04-24 23:36:52 +00:00
|
|
|
{ clangStdenv, fetchFromGitHub, fetchurl, fetchpatch, gyp, which, ninja,
|
2020-09-25 04:45:31 +00:00
|
|
|
python, pkgconfig, protobuf, gtk2, zinnia, qt5, libxcb, tegaki-zinnia-japanese,
|
2020-04-24 23:36:52 +00:00
|
|
|
fcitx, gettext }:
|
|
|
|
let
|
|
|
|
japanese_usage_dictionary = fetchFromGitHub {
|
|
|
|
owner = "hiroyuki-komatsu";
|
|
|
|
repo = "japanese-usage-dictionary";
|
|
|
|
rev = "e5b3425575734c323e1d947009dd74709437b684";
|
|
|
|
sha256 = "0pyrpz9c8nxccwpgyr36w314mi8h132cis8ijvlqmmhqxwsi30hm";
|
|
|
|
};
|
|
|
|
icons = fetchurl {
|
|
|
|
url = "http://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-icon.tar.gz";
|
|
|
|
sha256 = "10bdjn481jsh32vll7r756l392anz44h6207vjqwby3rplk31np1";
|
|
|
|
};
|
|
|
|
in clangStdenv.mkDerivation rec {
|
|
|
|
name = "fcitx-mozc-${version}";
|
2020-08-20 17:08:02 +00:00
|
|
|
version = "2.23.2815.102";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "mozc";
|
2020-08-20 17:08:02 +00:00
|
|
|
rev = "afb03ddfe72dde4cf2409863a3bfea160f7a66d8";
|
|
|
|
sha256 = "0w2dy2j9x5nc7x3g95j17r3m60vbfyn5j617h7js9xryv33yzpgx";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
nativeBuildInputs = [ gyp which ninja python pkgconfig qt5.wrapQtAppsHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ protobuf gtk2 zinnia qt5.qtbase libxcb fcitx gettext ];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
rmdir $sourceRoot/src/third_party/japanese_usage_dictionary/
|
|
|
|
ln -s ${japanese_usage_dictionary} $sourceRoot/src/third_party/japanese_usage_dictionary
|
|
|
|
tar -xzf ${icons} -C $sourceRoot/src
|
|
|
|
'';
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
patch_version = "${version}.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch rec {
|
|
|
|
name = "fcitx-mozc-${patch_version}.patch";
|
|
|
|
url = "https://download.fcitx-im.org/fcitx-mozc/${name}";
|
2020-08-20 17:08:02 +00:00
|
|
|
sha256 = "0a8q3vzcbai1ccdrl6qdb81gvbw8aby4lqkl6qs9hg68p6zg42hg";
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
# https://github.com/google/mozc/pull/444 - fix for gcc8 STL
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/google/mozc/commit/82d38f929882a9c62289b179c6fe41efed249987.patch";
|
|
|
|
sha256 = "07cja1b7qfsd3i76nscf1zwiav74h7d6h2g9g2w4bs3h1mc9jwla";
|
|
|
|
})
|
2020-08-20 17:08:02 +00:00
|
|
|
# Support dates after 2019
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://salsa.debian.org/debian/mozc/-/raw/master/debian/patches/add_support_new_japanese_era.patch";
|
|
|
|
sha256 = "1dsiiglrmm8i8shn2hv0j2b8pv6miysjrimj4569h606j4lwmcw2";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/unix/fcitx/mozc.conf \
|
|
|
|
--replace "/usr/share/fcitx/mozc/icon/mozc.png" "mozc"
|
|
|
|
'';
|
|
|
|
|
|
|
|
configurePhase = ''
|
2020-09-25 04:45:31 +00:00
|
|
|
export GYP_DEFINES="document_dir=$out/share/doc/mozc use_libzinnia=1 use_libprotobuf=1 use_fcitx5=0 zinnia_model_file=${tegaki-zinnia-japanese}/share/tegaki/models/zinnia/handwriting-ja.model"
|
2020-04-24 23:36:52 +00:00
|
|
|
cd src && python build_mozc.py gyp --gypdir=${gyp}/bin --server_dir=$out/lib/mozc
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
PYTHONPATH="$PWD:$PYTHONPATH" python build_mozc.py build -c Release \
|
|
|
|
server/server.gyp:mozc_server \
|
|
|
|
gui/gui.gyp:mozc_tool \
|
|
|
|
unix/fcitx/fcitx.gyp:fcitx-mozc
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -d $out/share/licenses/fcitx-mozc
|
|
|
|
head -n 29 server/mozc_server.cc > $out/share/licenses/fcitx-mozc/LICENSE
|
|
|
|
install -m 644 data/installer/*.html $out/share/licenses/fcitx-mozc/
|
|
|
|
|
|
|
|
install -d $out/share/doc/mozc
|
|
|
|
install -m 644 data/installer/*.html $out/share/doc/mozc/
|
|
|
|
|
|
|
|
install -D -m 755 out_linux/Release/mozc_server $out/lib/mozc/mozc_server
|
|
|
|
install -m 755 out_linux/Release/mozc_tool $out/lib/mozc/mozc_tool
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
wrapQtApp $out/lib/mozc/mozc_tool
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
install -D -m 755 out_linux/Release/fcitx-mozc.so $out/lib/fcitx/fcitx-mozc.so
|
|
|
|
install -D -m 644 unix/fcitx/fcitx-mozc.conf $out/share/fcitx/addon/fcitx-mozc.conf
|
|
|
|
install -D -m 644 unix/fcitx/mozc.conf $out/share/fcitx/inputmethod/mozc.conf
|
|
|
|
|
|
|
|
install -d $out/share/doc/mozc
|
|
|
|
|
|
|
|
for mofile in out_linux/Release/gen/unix/fcitx/po/*.mo
|
|
|
|
do
|
|
|
|
filename=`basename $mofile`
|
|
|
|
lang=$filename.mo
|
|
|
|
install -D -m 644 "$mofile" "$out/share/locale/$lang/LC_MESSAGES/fcitx-mozc.mo"
|
|
|
|
done
|
|
|
|
|
|
|
|
install -d $out/share/fcitx/imicon
|
|
|
|
install -m 644 fcitx-mozc-icons/mozc.png $out/share/fcitx/imicon/mozc.png
|
|
|
|
install -d $out/share/fcitx/mozc/icon
|
|
|
|
install -m 644 fcitx-mozc-icons/*.png $out/share/fcitx/mozc/icon/
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with clangStdenv.lib; {
|
|
|
|
isFcitxEngine = true;
|
|
|
|
description = "Fcitx engine for Google japanese input method";
|
|
|
|
homepage = "https://github.com/google/mozc";
|
|
|
|
downloadPage = "http://download.fcitx-im.org/fcitx-mozc/";
|
|
|
|
license = licenses.free;
|
|
|
|
platforms = platforms.linux;
|
2020-08-20 17:08:02 +00:00
|
|
|
maintainers = with maintainers; [ gebner ericsagnes ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|