1{ stdenv, fetchurl, lib, file
2, pkgconfig, intltool
3, glib, dbus-glib, json-glib
4, gobject-introspection, vala_0_38, 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 = "16.04";
14 versionMinor = "0";
15
16 src = fetchurl {
17 url = "${meta.homepage}/${versionMajor}/${version}/+download/libdbusmenu-${version}.tar.gz";
18 sha256 = "12l7z8dhl917iy9h02sxmpclnhkdjryn08r8i4sr8l3lrlm4mk5r";
19 };
20
21 nativeBuildInputs = [ pkgconfig intltool ];
22
23 buildInputs = [
24 glib dbus-glib json-glib
25 gobject-introspection vala_0_38 gnome-doc-utils
26 ] ++ optional (gtkVersion != null) (if gtkVersion == "2" then gtk2 else gtk3);
27
28 postPatch = ''
29 for f in {configure,ltmain.sh,m4/libtool.m4}; do
30 substituteInPlace $f \
31 --replace /usr/bin/file ${file}/bin/file
32 done
33 '';
34
35 # https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/libdbusmenu
36 preConfigure = ''
37 export HAVE_VALGRIND_TRUE="#"
38 export HAVE_VALGRIND_FALSE=""
39 '';
40
41 configureFlags = [
42 "CFLAGS=-Wno-error"
43 "--sysconfdir=/etc"
44 "--localstatedir=/var"
45 (if gtkVersion == null then "--disable-gtk" else "--with-gtk=${gtkVersion}")
46 "--disable-scrollkeeper"
47 ] ++ optional (gtkVersion != "2") "--disable-dumper";
48
49 doCheck = false; # generates shebangs in check phase, too lazy to fix
50
51 installFlags = [
52 "sysconfdir=\${out}/etc"
53 "localstatedir=\${TMPDIR}"
54 "typelibdir=\${out}/lib/girepository-1.0"
55 ];
56
57 meta = {
58 description = "Library for passing menu structures across DBus";
59 homepage = https://launchpad.net/dbusmenu;
60 license = with licenses; [ gpl3 lgpl21 lgpl3 ];
61 platforms = platforms.linux;
62 maintainers = [ maintainers.msteen ];
63 };
64}