1{ stdenv, fetchurl, lib, file
2, pkgconfig, intltool
3, glib, dbus_glib, json_glib
4, gobjectIntrospection, vala, gnome_doc_utils
5, gtkVersion ? null, gtk2 ? null, gtk3 ? null }:
6
7with lib;
8
9stdenv.mkDerivation rec {
10 name = let postfix = if gtkVersion == null then "glib" else "gtk${gtkVersion}";
11 in "libdbusmenu-${postfix}-${version}";
12 version = "${versionMajor}.${versionMinor}";
13 versionMajor = "12.10";
14 versionMinor = "2";
15
16 src = fetchurl {
17 url = "${meta.homepage}/${versionMajor}/${version}/+download/libdbusmenu-${version}.tar.gz";
18 sha256 = "9d6ad4a0b918b342ad2ee9230cce8a095eb601cb0cee6ddc1122d0481f9d04c9";
19 };
20
21 nativeBuildInputs = [ pkgconfig intltool ];
22
23 buildInputs = [
24 glib dbus_glib json_glib
25 gobjectIntrospection vala gnome_doc_utils
26 ] ++ optional (gtkVersion != null) (if gtkVersion == "2" then gtk2 else gtk3);
27
28 postPatch = ''
29 substituteInPlace {configure,ltmain.sh,m4/libtool.m4} \
30 --replace /usr/bin/file ${file}/bin/file
31 '';
32
33 # https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/libdbusmenu
34 preConfigure = ''
35 export HAVE_VALGRIND_TRUE="#"
36 export HAVE_VALGRIND_FALSE=""
37 '';
38
39 configureFlags = [
40 "CFLAGS=-Wno-error"
41 "--sysconfdir=/etc"
42 "--localstatedir=/var"
43 (if gtkVersion == null then "--disable-gtk" else "--with-gtk=${gtkVersion}")
44 "--disable-scrollkeeper"
45 ] ++ optional (gtkVersion != "2") "--disable-dumper";
46
47 installFlags = [
48 "sysconfdir=\${out}/etc"
49 "localstatedir=\${TMPDIR}"
50 ];
51
52 meta = {
53 description = "A library for passing menu structures across DBus";
54 homepage = "https://launchpad.net/dbusmenu";
55 license = with licenses; [ gpl3 lgpl21 lgpl3 ];
56 platforms = platforms.linux;
57 maintainers = [ maintainers.msteen ];
58 };
59}