2017-04-26 07:49:44 +01:00
|
|
|
{ clangStdenv, fetchFromGitHub, fetchurl, fetchpatch, gyp, which, ninja,
|
|
|
|
python, pkgconfig, protobuf, gtk2, zinnia, qt5, libxcb, tegaki-zinnia-japanese,
|
2015-11-25 07:18:26 +00:00
|
|
|
fcitx, gettext }:
|
|
|
|
let
|
2017-04-26 07:49:44 +01:00
|
|
|
japanese_usage_dictionary = fetchFromGitHub {
|
|
|
|
owner = "hiroyuki-komatsu";
|
|
|
|
repo = "japanese-usage-dictionary";
|
|
|
|
rev = "e5b3425575734c323e1d947009dd74709437b684";
|
2015-11-25 07:18:26 +00:00
|
|
|
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}";
|
2017-04-26 07:49:44 +01:00
|
|
|
version = "2.20.2673.102";
|
2015-11-25 07:18:26 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "mozc";
|
2017-04-26 07:49:44 +01:00
|
|
|
rev = "280e38fe3d9db4df52f0713acf2ca65898cd697a";
|
|
|
|
sha256 = "0s599f817gjgqynm4n1yll1ipd25ai2c55y8k6wvhg9s7qaxnyhs";
|
2015-11-25 07:18:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ gyp which ninja python pkgconfig ];
|
2017-04-26 07:49:44 +01:00
|
|
|
buildInputs = [ protobuf gtk2 zinnia qt5.qtbase libxcb fcitx gettext ];
|
2015-11-25 07:18:26 +00:00
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
rmdir $sourceRoot/src/third_party/japanese_usage_dictionary/
|
|
|
|
ln -s ${japanese_usage_dictionary} $sourceRoot/src/third_party/japanese_usage_dictionary
|
2017-04-26 07:49:44 +01:00
|
|
|
tar -xzf ${icons} -C $sourceRoot/src
|
2015-11-25 07:18:26 +00:00
|
|
|
'';
|
|
|
|
|
2017-04-26 07:49:44 +01:00
|
|
|
patch_version = "2.18.2612.102.1";
|
2017-10-27 00:44:19 +01:00
|
|
|
patches = [
|
2015-11-25 07:18:26 +00:00
|
|
|
(fetchpatch rec {
|
|
|
|
name = "fcitx-mozc-${patch_version}.patch";
|
|
|
|
url = "https://download.fcitx-im.org/fcitx-mozc/${name}";
|
2017-04-26 07:49:44 +01:00
|
|
|
sha256 = "1f9m4310kz09v5qvnv75ka2vq63m7by023qrkpddgq4dv7gxx3ca";
|
2015-11-25 07:18:26 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/unix/fcitx/mozc.conf \
|
2017-10-27 00:44:19 +01:00
|
|
|
--replace "/usr/share/fcitx/mozc/icon/mozc.png" "mozc"
|
2015-11-25 07:18:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
export GYP_DEFINES="document_dir=$out/share/doc/mozc use_libzinnia=1 use_libprotobuf=1"
|
2017-04-26 07:49:44 +01:00
|
|
|
cd src && python build_mozc.py gyp --gypdir=${gyp}/bin --server_dir=$out/lib/mozc
|
2015-11-25 07:18:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2017-04-26 07:49:44 +01:00
|
|
|
PYTHONPATH="$PWD:$PYTHONPATH" python build_mozc.py build -c Release \
|
2015-11-25 07:18:26 +00:00
|
|
|
server/server.gyp:mozc_server \
|
2017-04-26 07:49:44 +01:00
|
|
|
gui/gui.gyp:mozc_tool \
|
|
|
|
unix/fcitx/fcitx.gyp:fcitx-mozc
|
2015-11-25 07:18:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-04-26 07:49:44 +01:00
|
|
|
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/
|
2015-11-25 07:18:26 +00:00
|
|
|
|
|
|
|
install -d $out/share/doc/mozc
|
2017-04-26 07:49:44 +01:00
|
|
|
install -m 644 data/installer/*.html $out/share/doc/mozc/
|
2015-11-25 07:18:26 +00:00
|
|
|
|
2017-04-26 07:49:44 +01:00
|
|
|
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
|
2015-11-25 07:18:26 +00:00
|
|
|
|
2017-04-26 07:49:44 +01: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
|
2015-11-25 07:18:26 +00:00
|
|
|
|
|
|
|
install -d $out/share/doc/mozc
|
|
|
|
|
2017-04-26 07:49:44 +01:00
|
|
|
for mofile in out_linux/Release/gen/unix/fcitx/po/*.mo
|
2015-11-25 07:18:26 +00:00
|
|
|
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
|
2017-04-26 07:49:44 +01:00
|
|
|
install -m 644 fcitx-mozc-icons/mozc.png $out/share/fcitx/imicon/mozc.png
|
2015-11-25 07:18:26 +00:00
|
|
|
install -d $out/share/fcitx/mozc/icon
|
2017-04-26 07:49:44 +01:00
|
|
|
install -m 644 fcitx-mozc-icons/*.png $out/share/fcitx/mozc/icon/
|
2015-11-25 07:18:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with clangStdenv.lib; {
|
2015-11-25 07:29:50 +00:00
|
|
|
isFcitxEngine = true;
|
|
|
|
description = "Fcitx engine for Google japanese input method";
|
2017-10-27 00:44:19 +01:00
|
|
|
homepage = https://github.com/google/mozc;
|
2015-11-25 07:29:50 +00:00
|
|
|
downloadPage = "http://download.fcitx-im.org/fcitx-mozc/";
|
|
|
|
license = licenses.free;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.ericsagnes ];
|
2015-11-25 07:18:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|