1# TODO: Resolve the issues with the Mono bindings.
2
3{ stdenv, fetchurl, lib, file
4, pkgconfig, autoconf
5, glib, dbus_glib, gtkVersion
6, gtk2 ? null, libindicator-gtk2 ? null, libdbusmenu-gtk2 ? null
7, gtk3 ? null, libindicator-gtk3 ? null, libdbusmenu-gtk3 ? null
8, python, pygobject, pygtk, gobjectIntrospection, vala
9, monoSupport ? false, mono ? null, gtk-sharp ? null
10 }:
11
12with lib;
13
14stdenv.mkDerivation rec {
15 name = let postfix = if gtkVersion == "2" && monoSupport then "sharp" else "gtk${gtkVersion}";
16 in "libappindicator-${postfix}-${version}";
17 version = "${versionMajor}.${versionMinor}";
18 versionMajor = "12.10";
19 versionMinor = "0";
20
21 src = fetchurl {
22 url = "${meta.homepage}/${versionMajor}/${version}/+download/libappindicator-${version}.tar.gz";
23 sha256 = "17xlqd60v0zllrxp8bgq3k5a1jkj0svkqn8rzllcyjh8k0gpr46m";
24 };
25
26 nativeBuildInputs = [ pkgconfig autoconf ];
27
28 buildInputs = [
29 glib dbus_glib
30 python pygobject pygtk gobjectIntrospection vala
31 ] ++ (if gtkVersion == "2"
32 then [ gtk2 libindicator-gtk2 libdbusmenu-gtk2 ] ++ optionals monoSupport [ mono gtk-sharp ]
33 else [ gtk3 libindicator-gtk3 libdbusmenu-gtk3 ]);
34
35 postPatch = ''
36 substituteInPlace configure.ac \
37 --replace '=codegendir pygtk-2.0' '=codegendir pygobject-2.0'
38 autoconf
39 substituteInPlace {configure,ltmain.sh,m4/libtool.m4} \
40 --replace /usr/bin/file ${file}/bin/file
41 '';
42
43 configureFlags = [
44 "CFLAGS=-Wno-error"
45 "--sysconfdir=/etc"
46 "--localstatedir=/var"
47 "--with-gtk=${gtkVersion}"
48 ];
49
50 postConfigure = ''
51 substituteInPlace configure \
52 --replace /usr/bin/file ${file}/bin/file
53 '';
54
55 installFlags = [
56 "sysconfdir=\${out}/etc"
57 "localstatedir=\${TMPDIR}"
58 ];
59
60 meta = {
61 description = "A library to allow applications to export a menu into the Unity Menu bar";
62 homepage = "https://launchpad.net/libappindicator";
63 license = with licenses; [ lgpl21 lgpl3 ];
64 platforms = platforms.linux;
65 maintainers = [ maintainers.msteen ];
66 };
67}