2021-01-17 10:17:16 +01:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, cmake, intltool, gettext
|
2019-09-01 02:53:52 +02:00
|
|
|
, libxml2, enchant2, isocodes, icu, libpthreadstubs
|
2016-07-11 17:50:22 +02:00
|
|
|
, pango, cairo, libxkbfile, libXau, libXdmcp, libxkbcommon
|
2016-07-29 15:59:01 +02:00
|
|
|
, dbus, gtk2, gtk3, qt4, extra-cmake-modules
|
2021-03-01 21:52:38 +01:00
|
|
|
, xkeyboard_config, pcre, libuuid, xorg, makeWrapper
|
2017-12-29 23:21:07 +01:00
|
|
|
, withPinyin ? true
|
2019-03-27 14:27:00 +01:00
|
|
|
, fetchFromGitLab
|
2016-07-11 17:50:22 +02:00
|
|
|
}:
|
|
|
|
|
2017-12-29 23:21:07 +01:00
|
|
|
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 {
|
2020-04-01 03:11:51 +02:00
|
|
|
url = "http://download.fcitx-im.org/data/table.tar.gz";
|
2017-12-29 23:21:07 +01:00
|
|
|
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 {
|
2020-04-01 03:11:51 +02:00
|
|
|
url = "http://download.fcitx-im.org/data/pinyin.tar.gz";
|
2017-12-29 23:21:07 +01:00
|
|
|
sha256 = "1qfq5dy4czvd1lvdnxzyaiir9x8b1m46jjny11y0i33m9ar2jf2q";
|
|
|
|
};
|
|
|
|
in
|
2016-07-11 17:50:22 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "fcitx";
|
2019-03-27 14:27:00 +01:00
|
|
|
version = "4.2.9.6";
|
2016-07-11 17:50:22 +02:00
|
|
|
|
2019-03-27 14:27:00 +01:00
|
|
|
src = fetchFromGitLab {
|
2017-12-29 23:21:07 +01:00
|
|
|
owner = "fcitx";
|
|
|
|
repo = "fcitx";
|
|
|
|
rev = version;
|
2019-03-27 14:27:00 +01:00
|
|
|
sha256 = "0j5vaf930lb21gx4h7z6mksh1fazqw32gajjjkyir94wbmml9n3s";
|
2016-07-11 17:50:22 +02:00
|
|
|
};
|
|
|
|
|
2017-12-29 23:21:07 +01:00
|
|
|
# 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})
|
|
|
|
''
|
2021-01-15 10:19:50 +01:00
|
|
|
+ lib.optionalString withPinyin ''
|
2017-12-29 23:21:07 +01:00
|
|
|
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})
|
|
|
|
''
|
|
|
|
;
|
|
|
|
|
2019-09-01 02:53:52 +02:00
|
|
|
patches = [ ./find-enchant-lib.patch ];
|
|
|
|
|
2016-07-11 17:50:22 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/frontend/qt/CMakeLists.txt \
|
|
|
|
--replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins
|
2017-12-29 23:21:07 +01:00
|
|
|
|
|
|
|
patchShebangs cmake/
|
2016-07-11 17:50:22 +02:00
|
|
|
'';
|
|
|
|
|
2021-03-01 21:52:38 +01:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/fcitx \
|
|
|
|
--prefix PATH : "${xorg.xmodmap}/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake extra-cmake-modules intltool pkg-config pcre makeWrapper ];
|
2016-07-29 15:59:01 +02:00
|
|
|
|
2016-07-11 17:50:22 +02:00
|
|
|
buildInputs = [
|
2019-09-01 02:53:52 +02:00
|
|
|
xkeyboard_config enchant2 gettext isocodes icu libpthreadstubs libXau libXdmcp libxkbfile
|
2017-12-29 23:21:07 +01:00
|
|
|
libxkbcommon libxml2 dbus cairo gtk2 gtk3 pango qt4 libuuid
|
2016-07-11 17:50:22 +02:00
|
|
|
];
|
|
|
|
|
2019-10-28 10:17:49 +01:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DENABLE_QT_IM_MODULE=ON"
|
|
|
|
"-DENABLE_GTK2_IM_MODULE=ON"
|
|
|
|
"-DENABLE_GTK3_IM_MODULE=ON"
|
|
|
|
"-DENABLE_GIR=OFF"
|
|
|
|
"-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'"
|
|
|
|
];
|
2016-07-11 17:50:22 +02:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/fcitx/fcitx";
|
2016-07-11 17:50:22 +02:00
|
|
|
description = "A Flexible Input Method Framework";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ ericsagnes ];
|
|
|
|
};
|
|
|
|
}
|