summary refs log tree commit diff
path: root/pkgs/tools/inputmethods/fcitx/unwrapped.nix
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2017-12-30 07:21:07 +0900
committerMatthieu Coudron <mattator@gmail.com>2018-01-29 02:06:57 +0900
commitbee66be64a5c7d2af09ecf62919d849e52a510f6 (patch)
treef93042197f1ac4b2da528faa9c457825c3941abc /pkgs/tools/inputmethods/fcitx/unwrapped.nix
parentd14d82389c59caf4a754f8c67a9dfe70da8368b5 (diff)
downloadnixpkgs-bee66be64a5c7d2af09ecf62919d849e52a510f6.tar
nixpkgs-bee66be64a5c7d2af09ecf62919d849e52a510f6.tar.gz
nixpkgs-bee66be64a5c7d2af09ecf62919d849e52a510f6.tar.bz2
nixpkgs-bee66be64a5c7d2af09ecf62919d849e52a510f6.tar.lz
nixpkgs-bee66be64a5c7d2af09ecf62919d849e52a510f6.tar.xz
nixpkgs-bee66be64a5c7d2af09ecf62919d849e52a510f6.tar.zst
nixpkgs-bee66be64a5c7d2af09ecf62919d849e52a510f6.zip
fcitx: 4.2.9.1 -> 4.2.9.5
fcitx now relies on xkeyboard_config.
Diffstat (limited to 'pkgs/tools/inputmethods/fcitx/unwrapped.nix')
-rw-r--r--pkgs/tools/inputmethods/fcitx/unwrapped.nix71
1 files changed, 62 insertions, 9 deletions
diff --git a/pkgs/tools/inputmethods/fcitx/unwrapped.nix b/pkgs/tools/inputmethods/fcitx/unwrapped.nix
index c489b3e4ed7..27eb35ce6ae 100644
--- a/pkgs/tools/inputmethods/fcitx/unwrapped.nix
+++ b/pkgs/tools/inputmethods/fcitx/unwrapped.nix
@@ -2,27 +2,75 @@
 , libxml2, enchant, isocodes, icu, libpthreadstubs
 , pango, cairo, libxkbfile, libXau, libXdmcp, libxkbcommon
 , dbus, gtk2, gtk3, qt4, extra-cmake-modules
+, xkeyboard_config, pcre, libuuid, curl, cacert
+, withPinyin ? true
+, fetchFromGitHub
 }:
 
+let
+  # releases at http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz
+  # contains all data but if we want to compile from source, we need to
+  # fetch them ourselves
+  # to update the urls and where to unpack these, look into the
+  # src/module/*/data/CMakeLists.txt files
+  # fcitx_download tgt_name url output)
+  dicts = let SPELL_EN_DICT_VER="20121020"; in fetchurl {
+      url = "http://download.fcitx-im.org/data/en_dict-${SPELL_EN_DICT_VER}.tar.gz";
+      sha256 = "1svcb97sq7nrywp5f2ws57cqvlic8j6p811d9ngflplj8xw5sjn4";
+  };
+  table = fetchurl {
+      url = http://download.fcitx-im.org/data/table.tar.gz;
+      sha256 = "1dw7mgbaidv3vqy0sh8dbfv8631d2zwv5mlb7npf69a1f8y0b5k1";
+  };
+  pystroke-data = let PY_STROKE_VER="20121124"; in fetchurl {
+      url = "http://download.fcitx-im.org/data/py_stroke-${PY_STROKE_VER}.tar.gz";
+      sha256 = "0j72ckmza5d671n2zg0psg7z9iils4gyxz7jgkk54fd4pyljiccf";
+  };
+  pytable-data = let PY_TABLE_VER="20121124"; in fetchurl {
+      url = "http://download.fcitx-im.org/data/py_table-${PY_TABLE_VER}.tar.gz";
+      sha256 = "011cg7wssssm6hm564cwkrrnck2zj5rxi7p9z5akvhg6gp4nl522";
+  };
+  pinyin-data = fetchurl {
+      url = http://download.fcitx-im.org/data/pinyin.tar.gz;
+      sha256 = "1qfq5dy4czvd1lvdnxzyaiir9x8b1m46jjny11y0i33m9ar2jf2q";
+  };
+in
 stdenv.mkDerivation rec {
   name = "fcitx-${version}";
-  version = "4.2.9.1";
+  version = "4.2.9.5";
 
-  src = fetchurl {
-    url    = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz";
-    sha256 = "0xvcmm4yi7kagf55d0yl3ql5ssbkm9410fwbz3kd988pchichdsk";
+  src = fetchFromGitHub {
+    owner = "fcitx";
+    repo = "fcitx";
+    rev = version;
+    sha256 = "0rv69bacdvblka85dakz4ldpznrgwj59nqcccp5mkkn1rab4zh1r";
   };
 
+  # put data at the correct locations else cmake tries to fetch them,
+  # which fails in sandboxed mode
+  prePatch = ''
+    cp ${dicts} src/module/spell/dict/$(stripHash ${dicts})
+    cp ${table} src/im/table/data/$(stripHash ${table})
+  ''
+  + stdenv.lib.optionalString withPinyin ''
+    cp ${pystroke-data} src/module/pinyin-enhance/data/$(stripHash ${pystroke-data})
+    cp ${pytable-data} src/module/pinyin-enhance/data/$(stripHash ${pytable-data})
+    cp ${pinyin-data} src/im/pinyin/data/$(stripHash ${pinyin-data})
+  ''
+  ;
+
   postPatch = ''
     substituteInPlace src/frontend/qt/CMakeLists.txt \
       --replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins
+
+    patchShebangs cmake/
   '';
 
-  nativeBuildInputs = [ cmake extra-cmake-modules intltool pkgconfig ];
+  nativeBuildInputs = [ cmake extra-cmake-modules intltool pkgconfig pcre ];
 
   buildInputs = [
-    enchant gettext isocodes icu libpthreadstubs libXau libXdmcp libxkbfile
-    libxkbcommon libxml2 dbus cairo gtk2 gtk3 pango qt4
+    xkeyboard_config enchant gettext isocodes icu libpthreadstubs libXau libXdmcp libxkbfile
+    libxkbcommon libxml2 dbus cairo gtk2 gtk3 pango qt4 libuuid
   ];
 
   cmakeFlags = ''
@@ -33,10 +81,15 @@ stdenv.mkDerivation rec {
     -DENABLE_OPENCC=OFF
     -DENABLE_PRESAGE=OFF
     -DENABLE_XDGAUTOSTART=OFF
-  '';
+    -DENABLE_PINYIN=${if withPinyin then "ON" else "OFF"}
+    -DENABLE_TABLE=ON
+    -DENABLE_SPELL=ON
+    -DENABLE_QT_GUI=ON
+    -DXKB_RULES_XML_FILE='${xkeyboard_config}/share/X11/xkb/rules/evdev.xml'
+    '';
 
   meta = with stdenv.lib; {
-    homepage    = "https://github.com/fcitx/fcitx";
+    homepage    = http://github.com/fcitx/fcitx;
     description = "A Flexible Input Method Framework";
     license     = licenses.gpl2;
     platforms   = platforms.linux;