astroterm: 1.0.4 -> 1.0.6 (#378908)
[NixPkgs.git] / pkgs / by-name / li / libdbusmenu / package.nix
blob504b1954d06828c72c7af35f93f6e87bfc1dccba
2   stdenv,
3   fetchurl,
4   lib,
5   file,
6   pkg-config,
7   intltool,
8   glib,
9   dbus-glib,
10   json-glib,
11   gobject-introspection,
12   vala,
13   gtkVersion ? null,
14   gtk2,
15   gtk3,
16   testers,
19 stdenv.mkDerivation (finalAttrs: {
20   pname = "libdbusmenu-${if gtkVersion == null then "glib" else "gtk${gtkVersion}"}";
21   version = "16.04.0";
23   src =
24     let
25       inherit (finalAttrs) version;
26     in
27     fetchurl {
28       url = "https://launchpad.net/dbusmenu/${lib.versions.majorMinor version}/${version}/+download/libdbusmenu-${version}.tar.gz";
29       sha256 = "12l7z8dhl917iy9h02sxmpclnhkdjryn08r8i4sr8l3lrlm4mk5r";
30     };
32   nativeBuildInputs = [
33     vala
34     pkg-config
35     intltool
36     gobject-introspection
37   ];
39   buildInputs =
40     [
41       glib
42       dbus-glib
43       json-glib
44     ]
45     ++ lib.optional (gtkVersion != null)
46       {
47         "2" = gtk2;
48         "3" = gtk3;
49       }
50       .${gtkVersion} or (throw "unknown GTK version ${gtkVersion}");
52   patches = [
53     ./requires-glib.patch
54   ];
56   postPatch = ''
57     for f in {configure,ltmain.sh,m4/libtool.m4}; do
58       substituteInPlace $f \
59         --replace /usr/bin/file ${file}/bin/file
60     done
61   '';
63   # https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/libdbusmenu
64   preConfigure = ''
65     export HAVE_VALGRIND_TRUE="#"
66     export HAVE_VALGRIND_FALSE=""
67   '';
69   configureFlags = [
70     "CFLAGS=-Wno-error"
71     "--sysconfdir=/etc"
72     "--localstatedir=/var"
73     # TODO use `lib.withFeatureAs`
74     (if gtkVersion == null then "--disable-gtk" else "--with-gtk=${gtkVersion}")
75     "--disable-scrollkeeper"
76   ] ++ lib.optional (gtkVersion != "2") "--disable-dumper";
78   doCheck = false; # generates shebangs in check phase, too lazy to fix
80   installFlags = [
81     "sysconfdir=${placeholder "out"}/etc"
82     "localstatedir=\${TMPDIR}"
83     "typelibdir=${placeholder "out"}/lib/girepository-1.0"
84   ];
86   passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
88   meta = with lib; {
89     description = "Library for passing menu structures across DBus";
90     homepage = "https://launchpad.net/dbusmenu";
91     license = with licenses; [
92       gpl3
93       lgpl21
94       lgpl3
95     ];
96     pkgConfigModules = [
97       "dbusmenu-glib-0.4"
98       "dbusmenu-jsonloader-0.4"
99     ] ++ lib.optional (gtkVersion == "3") "dbusmenu-gtk${gtkVersion}-0.4";
100     platforms = platforms.linux;
101     maintainers = [ maintainers.msteen ];
102   };