1{ stdenv, fetchgit, lib
2, pkg-config, autoreconfHook
3, glib, dbus-glib
4, gtkVersion ? "3"
5, gtk2, libindicator-gtk2, libdbusmenu-gtk2
6, gtk3, libindicator-gtk3, libdbusmenu-gtk3
7, gtk-doc, vala, gobject-introspection
8, monoSupport ? false, mono, gtk-sharp-2_0, gtk-sharp-3_0
9, testers
10}:
11
12let
13 throwBadGtkVersion = throw "unknown GTK version ${gtkVersion}";
14in
15
16stdenv.mkDerivation (finalAttrs: {
17 pname = let postfix = if monoSupport then "sharp" else "gtk${gtkVersion}";
18 in "libappindicator-${postfix}";
19 version = "12.10.1+20.10.20200706.1";
20
21 outputs = [ "out" "dev" ];
22
23 src = fetchgit {
24 url = "https://git.launchpad.net/ubuntu/+source/libappindicator";
25 rev = "fe25e53bc7e39cd59ad6b3270cd7a6a9c78c4f44";
26 sha256 = "0xjvbl4gn7ra2fs6gn2g9s787kzb5cg9hv79iqsz949rxh4iw32d";
27 };
28
29 nativeBuildInputs = [ pkg-config autoreconfHook vala gobject-introspection gtk-doc ];
30
31 propagatedBuildInputs = {
32 "2" = [ gtk2 libdbusmenu-gtk2 ];
33 "3" = [ gtk3 libdbusmenu-gtk3 ];
34 }.${gtkVersion} or throwBadGtkVersion;
35
36 buildInputs = [
37 glib dbus-glib
38 {
39 "2" = libindicator-gtk2;
40 "3" = libindicator-gtk3;
41 }.${gtkVersion} or throwBadGtkVersion
42 ] ++ lib.optionals monoSupport [
43 mono
44 {
45 "2" = gtk-sharp-2_0;
46 "3" = gtk-sharp-3_0;
47 }.${gtkVersion} or throwBadGtkVersion
48 ];
49
50 preAutoreconf = ''
51 gtkdocize
52 '';
53
54 configureFlags = [
55 "CFLAGS=-Wno-error"
56 "--sysconfdir=/etc"
57 "--localstatedir=/var"
58 "--with-gtk=${gtkVersion}"
59 ];
60
61 doCheck = false; # generates shebangs in check phase, too lazy to fix
62
63 installFlags = [
64 "sysconfdir=${placeholder "out"}/etc"
65 "localstatedir=\${TMPDIR}"
66 ];
67
68 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
69
70 meta = with lib; {
71 description = "A library to allow applications to export a menu into the Unity Menu bar";
72 homepage = "https://launchpad.net/libappindicator";
73 license = with licenses; [ lgpl21 lgpl3 ];
74 pkgConfigModules = {
75 "2" = [ "appindicator-0.1" ];
76 "3" = [ "appindicator3-0.1" ];
77 }.${gtkVersion} or throwBadGtkVersion;
78 platforms = platforms.linux;
79 maintainers = [ maintainers.msteen ];
80 # TODO: Resolve the issues with the Mono bindings.
81 broken = monoSupport;
82 };
83})