1{ stdenv, fetchurl, makeWrapper
2, intltool, isocodes, pkgconfig
3, python3, pygobject3
4, gtk2, gtk3, atk, dconf, glib
5, dbus, libnotify, gobjectIntrospection, wayland
6}:
7
8stdenv.mkDerivation rec {
9 name = "ibus-${version}";
10 version = "1.5.13";
11
12 src = fetchurl {
13 url = "https://github.com/ibus/ibus/releases/download/${version}/${name}.tar.gz";
14 sha256 = "1wd5azlsgdih8qw6gi15rv130s6d90846n3r1ccwmp6z882xhwzd";
15 };
16
17 postPatch = ''
18 # These paths will be set in the wrapper.
19 sed -e "/export IBUS_DATAROOTDIR/ s/^.*$//" \
20 -e "/export IBUS_LIBEXECDIR/ s/^.*$//" \
21 -e "/export IBUS_LOCALEDIR/ s/^.*$//" \
22 -e "/export IBUS_PREFIX/ s/^.*$//" \
23 -i "setup/ibus-setup.in"
24 '';
25
26 configureFlags = [
27 "--disable-gconf"
28 "--enable-dconf"
29 "--disable-memconf"
30 "--enable-ui"
31 "--enable-python-library"
32 ];
33
34 buildInputs = [
35 python3 pygobject3
36 intltool isocodes pkgconfig
37 gtk2 gtk3 dconf
38 dbus libnotify gobjectIntrospection wayland
39 ];
40
41 propagatedBuildInputs = [ glib ];
42
43 nativeBuildInputs = [ makeWrapper ];
44
45 preConfigure = ''
46 # Fix hard-coded installation paths, so make does not try to overwrite our
47 # Python installation.
48 sed -e "/py2overridesdir=/ s|=.*$|=$out/lib/${python3.libPrefix}|" \
49 -e "/pyoverridesdir=/ s|=.*$|=$out/lib/${python3.libPrefix}|" \
50 -e "/PYTHON2_LIBDIR/ s|=.*|=$out/lib/${python3.libPrefix}|" \
51 -i configure
52
53 # Don't try to generate a system-wide dconf database; it wouldn't work.
54 substituteInPlace data/dconf/Makefile.in --replace "dconf update" "echo"
55 '';
56
57 preFixup = ''
58 for f in "$out/bin"/*; do #*/
59 wrapProgram "$f" \
60 --prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
61 --prefix PYTHONPATH : "$PYTHONPATH" \
62 --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0" \
63 --prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules"
64 done
65 '';
66
67 meta = with stdenv.lib; {
68 homepage = https://github.com/ibus/ibus;
69 description = "Intelligent Input Bus for Linux / Unix OS";
70 platforms = platforms.linux;
71 maintainers = [ maintainers.ttuegel ];
72 };
73}