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