1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-15 17:25:11 +00:00
nixpkgs/pkgs/tools/inputmethods/fcitx-engines/fcitx-mozc/default.nix

114 lines
4.4 KiB
Nix
Raw Normal View History

{ lib, clangStdenv, fetchFromGitHub, fetchurl, fetchpatch, gyp, which, ninja,
python, pkg-config, protobuf, gtk2, zinnia, qt5, libxcb, tegaki-zinnia-japanese,
2015-11-25 07:18:26 +00:00
fcitx, gettext }:
let
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}";
version = "2.23.2815.102";
2015-11-25 07:18:26 +00:00
src = fetchFromGitHub {
owner = "google";
repo = "mozc";
rev = "afb03ddfe72dde4cf2409863a3bfea160f7a66d8";
sha256 = "0w2dy2j9x5nc7x3g95j17r3m60vbfyn5j617h7js9xryv33yzpgx";
2015-11-25 07:18:26 +00:00
};
nativeBuildInputs = [ gyp which ninja python pkg-config qt5.wrapQtAppsHook ];
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
tar -xzf ${icons} -C $sourceRoot/src
2015-11-25 07:18:26 +00:00
'';
patch_version = "${version}.1";
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}";
sha256 = "0a8q3vzcbai1ccdrl6qdb81gvbw8aby4lqkl6qs9hg68p6zg42hg";
2015-11-25 07:18:26 +00:00
})
fctix-engines.mozc: fix build This fixes: FAILED: obj/engine/engine.engine.o clang++ -MMD -MF obj/engine/engine.engine.o.d -DOS_LINUX -DMOZC_BUILD -DCHANNEL_DEV -DENABLE_GTK_RENDERER -DNDEBUG -DQT_NO_DEBUG -DNO_LOGGING -DIGNORE_HELP_FLAG -DIGNORE_INVALID_FLAG -I/build/source/src -Igen -Igen/proto_out -Wall -Wno-char-subscripts -Wno-sign-compare -Wno-deprecated-declarations -Wwrite-strings -fPIC -fno-exceptions -fmessage-length=0 -fno-strict-aliasing -funsigned-char -include base/namespace.h -pipe -pthread -fno-omit-frame-pointer -fstack-protector --param=ssp-buffer-size=4 -Wtype-limits -O2 -Wno-deprecated -Wno-covered-switch-default -Wno-unnamed-type-template-args -Wno-c++11-narrowing -std=gnu++0x -std=gnu++0x -c ../../engine/engine.cc -o obj/engine/engine.engine.o In file included from ../../engine/engine.cc:30: In file included from /build/source/src/engine/engine.h:33: In file included from /nix/store/pcs8pq4a5rkym1hzibqz7da45fxkmig7-gcc-8.3.0/include/c++/8.3.0/memory:62: In file included from /nix/store/pcs8pq4a5rkym1hzibqz7da45fxkmig7-gcc-8.3.0/include/c++/8.3.0/bits/stl_algobase.h:66: /nix/store/pcs8pq4a5rkym1hzibqz7da45fxkmig7-gcc-8.3.0/include/c++/8.3.0/bits/stl_iterator_base_funcs.h:183:2: error: cannot decrement value of type 'mozc::ZeroQueryDict::iterator' --__i; ^ ~~~ /nix/store/pcs8pq4a5rkym1hzibqz7da45fxkmig7-gcc-8.3.0/include/c++/8.3.0/bits/stl_iterator_base_funcs.h:206:12: note: in instantiation of function template specialization 'std::__advance<mozc::ZeroQueryDict::iterator, long>' requested here std::__advance(__i, __d, std::__iterator_category(__i)); ^ /nix/store/pcs8pq4a5rkym1hzibqz7da45fxkmig7-gcc-8.3.0/include/c++/8.3.0/bits/stl_algo.h:2137:9: note: in instantiation of function template specialization 'std::advance<mozc::ZeroQueryDict::iterator, long>' requested here std::advance(__middle, __half); ^ /nix/store/pcs8pq4a5rkym1hzibqz7da45fxkmig7-gcc-8.3.0/include/c++/8.3.0/bits/stl_algo.h:2190:19: note: in instantiation of function template specialization 'std::__equal_range<mozc::ZeroQueryDict::iterator, unsigned long, __gnu_cxx::__ops::_Iter_less_val, __gnu_cxx::__ops::_Val_less_iter>' requested here return std::__equal_range(__first, __last, __val, ^ /build/source/src/prediction/zero_query_dict.h:213:17: note: in instantiation of function template specialization 'std::equal_range<mozc::ZeroQueryDict::iterator, unsigned long>' requested here return std::equal_range(begin(), end(), iter.index()); ^ 1 error generated.
2019-09-10 22:57:49 +01:00
# https://github.com/google/mozc/pull/444 - fix for gcc8 STL
(fetchpatch {
url = "https://github.com/google/mozc/commit/82d38f929882a9c62289b179c6fe41efed249987.patch";
sha256 = "07cja1b7qfsd3i76nscf1zwiav74h7d6h2g9g2w4bs3h1mc9jwla";
})
# Support dates after 2019
(fetchpatch {
url = "https://salsa.debian.org/debian/mozc/-/raw/master/debian/patches/add_support_new_japanese_era.patch";
sha256 = "1dsiiglrmm8i8shn2hv0j2b8pv6miysjrimj4569h606j4lwmcw2";
})
2015-11-25 07:18:26 +00:00
];
postPatch = ''
substituteInPlace src/unix/fcitx/mozc.conf \
--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 use_fcitx5=0 zinnia_model_file=${tegaki-zinnia-japanese}/share/tegaki/models/zinnia/handwriting-ja.model"
cd src && python build_mozc.py gyp --gypdir=${gyp}/bin --server_dir=$out/lib/mozc
2015-11-25 07:18:26 +00:00
'';
buildPhase = ''
PYTHONPATH="$PWD:$PYTHONPATH" python build_mozc.py build -c Release \
2015-11-25 07:18:26 +00:00
server/server.gyp:mozc_server \
gui/gui.gyp:mozc_tool \
unix/fcitx/fcitx.gyp:fcitx-mozc
2015-11-25 07:18:26 +00:00
'';
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/
2015-11-25 07:18:26 +00:00
install -d $out/share/doc/mozc
install -m 644 data/installer/*.html $out/share/doc/mozc/
2015-11-25 07:18:26 +00: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
2020-08-22 16:51:00 +01:00
wrapQtApp $out/lib/mozc/mozc_tool
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
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
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
install -m 644 fcitx-mozc-icons/*.png $out/share/fcitx/mozc/icon/
2015-11-25 07:18:26 +00:00
'';
meta = with lib; {
2015-11-25 07:29:50 +00:00
isFcitxEngine = true;
description = "Fcitx engine for Google japanese input method";
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 = with maintainers; [ gebner ericsagnes ];
2015-11-25 07:18:26 +00:00
};
}