1{ stdenv, fetchurl, wrapGAppsHook
2, intltool, isocodes, pkgconfig
3, python3
4, gtk2, gtk3, atk, dconf, glib, json_glib
5, dbus, libnotify, gobjectIntrospection, wayland
6}:
7
8let
9 emojiData = let
10 srcs = {
11 data = fetchurl {
12 url = "http://unicode.org/Public/emoji/5.0/emoji-data.txt";
13 sha256 = "0zfn3z61xy76yah3d24dd745qjssrib009m4nvqpnx4sf1r13i2x";
14 };
15 sequences = fetchurl {
16 url = "http://unicode.org/Public/emoji/5.0/emoji-sequences.txt";
17 sha256 = "0xzk7hi2a8macx9s5gj2pb36d38y8fa9001sj71g6kw25c2h94cn";
18 };
19 variation-sequences = fetchurl {
20 url = "http://unicode.org/Public/emoji/5.0/emoji-variation-sequences.txt";
21 sha256 = "1wlg4gbq7spmpppjfy5zdl82sj0hc836p8gljgfrjmwsjgybq286";
22 };
23 zwj-sequences = fetchurl {
24 url = "http://unicode.org/Public/emoji/5.0/emoji-zwj-sequences.txt";
25 sha256 = "0rrnk94mhm3k9vs74pvyvs4ir7f31f1libx7c196fmdqvp1qfafw";
26 };
27 test = fetchurl {
28 url = "http://unicode.org/Public/emoji/5.0/emoji-test.txt";
29 sha256 = "1dvxw5xp1xiy13c1p1c7l2xc9q8f8znk47kb7q8g7bbgbi21cq5m";
30 };
31 };
32 in stdenv.mkDerivation {
33 name = "emoji-data-5.0";
34 unpackPhase = ":";
35 dontBuild = true;
36 installPhase = with stdenv.lib; ''
37 mkdir $out
38 ${builtins.toString (flip mapAttrsToList srcs (k: v: ''
39 cp ${v} $out/emoji-${k}.txt
40 ''))}
41 '';
42 };
43 cldrEmojiAnnotation = stdenv.mkDerivation rec {
44 name = "cldr-emoji-annotation-${version}";
45 version = "31.0.1_1";
46 src = fetchurl {
47 url = "https://github.com/fujiwarat/cldr-emoji-annotation/releases/download/${version}/${name}.tar.gz";
48 sha256 = "1a3qzsab7vzjqpdialp1g8ppr21x05v0ph8ngyq9pyjkx4vzcdi7";
49 };
50 };
51 pyEnv = python3.buildEnv.override {
52 extraLibs = [ python3.pkgs.pygobject3 ];
53 };
54in stdenv.mkDerivation rec {
55 name = "ibus-${version}";
56 version = "1.5.16";
57
58 src = fetchurl {
59 url = "https://github.com/ibus/ibus/releases/download/${version}/${name}.tar.gz";
60 sha256 = "07py16jb81kd7vkqhcia9cb2avsbg5jswp2kzf0k4bprwkxppd9n";
61 };
62
63 postPatch = ''
64 # These paths will be set in the wrapper.
65 sed -e "/export IBUS_DATAROOTDIR/ s/^.*$//" \
66 -e "/export IBUS_LIBEXECDIR/ s/^.*$//" \
67 -e "/export IBUS_LOCALEDIR/ s/^.*$//" \
68 -e "/export IBUS_PREFIX/ s/^.*$//" \
69 -i "setup/ibus-setup.in"
70 '';
71
72 configureFlags = [
73 "--disable-gconf"
74 "--enable-dconf"
75 "--disable-memconf"
76 "--enable-ui"
77 "--enable-python-library"
78 "--with-unicode-emoji-dir=${emojiData}"
79 "--with-emoji-annotation-dir=${cldrEmojiAnnotation}/share/unicode/cldr/common/annotations"
80 ];
81
82 buildInputs = [
83 pyEnv
84 intltool isocodes pkgconfig
85 gtk2 gtk3 dconf
86 json_glib
87 dbus libnotify gobjectIntrospection wayland
88 ];
89
90 propagatedBuildInputs = [ glib ];
91
92 nativeBuildInputs = [ wrapGAppsHook ];
93
94 outputs = [ "out" "dev" ];
95
96 enableParallelBuilding = true;
97
98 preConfigure = ''
99 # Fix hard-coded installation paths, so make does not try to overwrite our
100 # Python installation.
101 sed -e "/py2overridesdir=/ s|=.*$|=$out/lib/${python3.libPrefix}|" \
102 -e "/pyoverridesdir=/ s|=.*$|=$out/lib/${python3.libPrefix}|" \
103 -e "/PYTHON2_LIBDIR/ s|=.*|=$out/lib/${python3.libPrefix}|" \
104 -i configure
105
106 # Don't try to generate a system-wide dconf database; it wouldn't work.
107 substituteInPlace data/dconf/Makefile.in --replace "dconf update" "echo"
108 '';
109
110 doInstallCheck = true;
111 installCheckPhase = "$out/bin/ibus version";
112
113 meta = with stdenv.lib; {
114 homepage = https://github.com/ibus/ibus;
115 description = "Intelligent Input Bus for Linux / Unix OS";
116 platforms = platforms.linux;
117 maintainers = [ maintainers.ttuegel ];
118 };
119}