1 { lib, clangStdenv, fetchFromGitHub, fetchurl, fetchpatch, fetchgit
2 , python3Packages, mesa, ninja, pkg-config, protobuf, zinnia, qt5, fcitx5
3 , jsoncpp, gtest, which, gtk2, unzip, abseil-cpp, breakpad }:
5 inherit (python3Packages) python gyp six;
6 japanese_usage_dictionary = fetchFromGitHub {
7 owner = "hiroyuki-komatsu";
8 repo = "japanese-usage-dictionary";
9 rev = "e5b3425575734c323e1d947009dd74709437b684";
10 sha256 = "0pyrpz9c8nxccwpgyr36w314mi8h132cis8ijvlqmmhqxwsi30hm";
12 zipcode_rel = "202011";
14 url = "https://osdn.net/projects/ponsfoot-aur/storage/mozc/jigyosyo-${zipcode_rel}.zip";
15 sha256 = "j7MkNtd4+QTi91EreVig4/OV0o5y1+KIjEJBEmLK/mY=";
17 x-ken-all = fetchurl {
19 "https://osdn.net/projects/ponsfoot-aur/storage/mozc/x-ken-all-${zipcode_rel}.zip";
20 sha256 = "ExS0Cg3rs0I9IOVbZHLt8UEfk8/LmY9oAHPVVlYuTPw=";
23 in clangStdenv.mkDerivation rec {
24 pname = "fcitx5-mozc";
25 version = "2.26.4220.102";
27 src = fetchFromGitHub {
30 rev = "1882e33b61673b66d63277f82b4c80ae4e506c10";
31 sha256 = "R+w0slVFpqtt7PIr1pyupJjRoQsABVZiMdZ9fKGKAqw=";
34 nativeBuildInputs = [ gyp ninja mesa python pkg-config qt5.wrapQtAppsHook six which unzip ];
36 buildInputs = [ protobuf zinnia qt5.qtbase fcitx5 abseil-cpp jsoncpp gtest gtk2 ];
39 # Support linking system abseil-cpp
41 url = "https://salsa.debian.org/debian/mozc/-/raw/debian/sid/debian/patches/0007-Update-src-base-absl.gyp.patch";
42 sha256 = "UiS0UScDKyAusXOhc7Bg8dF8ARQQiVTylEhAOxqaZt8=";
48 unzip ${x-ken-all} -d $sourceRoot/src/
49 unzip ${jigyosyo} -d $sourceRoot/src/
51 rmdir $sourceRoot/src/third_party/breakpad/
52 ln -s ${breakpad} $sourceRoot/src/third_party/breakpad
53 rmdir $sourceRoot/src/third_party/gtest/
54 ln -s ${gtest} $sourceRoot/src/third_party/gtest
55 rmdir $sourceRoot/src/third_party/gyp/
56 ln -s ${gyp} $sourceRoot/src/third_party/gyp
57 rmdir $sourceRoot/src/third_party/japanese_usage_dictionary/
58 ln -s ${japanese_usage_dictionary} $sourceRoot/src/third_party/japanese_usage_dictionary
61 # Copied from https://github.com/archlinux/svntogit-community/blob/packages/fcitx5-mozc/trunk/PKGBUILD
64 export GYP_DEFINES="document_dir=$out/share/doc/mozc use_libzinnia=1 use_libprotobuf=1 use_libabseil=1"
67 rm unix/fcitx/fcitx.gyp
70 PYTHONPATH="$PWD:$PYTHONPATH" python dictionary/gen_zip_code_seed.py --zip_code="x-ken-all.csv" --jigyosyo="JIGYOSYO.CSV" >> data/dictionary_oss/dictionary09.txt
72 # use libstdc++ instead of libc++
73 sed "/stdlib=libc++/d;/-lc++/d" -i gyp/common.gypi
76 python build_mozc.py gyp --gypdir=${gyp}/bin --server_dir=$out/lib/mozc
80 python build_mozc.py build -c Release \
81 server/server.gyp:mozc_server \
82 gui/gui.gyp:mozc_tool \
83 unix/fcitx5/fcitx5.gyp:fcitx5-mozc
88 export _bldtype=Release
89 ../scripts/install_server
90 install -d $out/share/licenses/fcitx5-mozc
91 head -n 29 server/mozc_server.cc > $out/share/licenses/fcitx5-mozc/LICENSE
92 install -m644 data/installer/*.html $out/share/licenses/fcitx5-mozc/
93 install -d $out/share/fcitx5/addon
94 install -d $out/share/fcitx5/inputmethod
95 install -d $out/lib/fcitx5
96 ../scripts/install_fcitx5
100 description = "Fcitx5 Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)";
101 homepage = "https://github.com/fcitx/mozc";
102 license = licenses.bsd3;
103 maintainers = with maintainers; [ berberman ];
104 platforms = platforms.linux;