2013-03-23 17:08:47 +01:00
|
|
|
{ stdenv, fetchurl, pkgconfig, autoconf, automake, libtool
|
|
|
|
, expat, systemd, glib, dbus_glib, python
|
2013-09-06 23:36:30 +02:00
|
|
|
, libX11, libICE, libSM, useX11 ? (stdenv.isLinux || stdenv.isDarwin) }:
|
2008-12-16 00:45:52 +01:00
|
|
|
|
2008-02-02 21:41:06 +01:00
|
|
|
let
|
2014-02-20 10:36:11 +01:00
|
|
|
version = "1.8.0";
|
|
|
|
sha256 = "04qbsyw92279hfkwic5h6jc5999p87qsaqqgc6zcqddmh9r8r7vn";
|
2011-08-26 16:57:48 +02:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
inherit (stdenv) lib;
|
2010-07-20 14:53:07 +02:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
buildInputsX = lib.optionals useX11 [ libX11 libICE libSM ];
|
2013-03-23 17:08:47 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
# also other parts than "libs" need this statically linked lib
|
|
|
|
makeInternalLib = "(cd dbus && make libdbus-internal.la)";
|
2013-03-23 17:08:47 +01:00
|
|
|
|
2013-06-18 14:59:32 +02:00
|
|
|
systemdOrEmpty = lib.optional stdenv.isLinux systemd;
|
2013-03-23 17:08:47 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
# A generic builder for individual parts (subdirs) of D-Bus
|
|
|
|
dbus_drv = name: subdirs: merge: stdenv.mkDerivation (lib.mergeAttrsByFuncDefaultsClean [{
|
2013-03-23 17:08:47 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
name = "dbus-${name}-${version}";
|
2013-03-23 17:08:47 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
2013-03-23 17:08:47 +01:00
|
|
|
|
2013-09-06 15:51:38 +02:00
|
|
|
patches = [
|
|
|
|
./ignore-missing-includedirs.patch
|
|
|
|
./ucred-dirty-hack.patch
|
|
|
|
./no-create-dirs.patch
|
|
|
|
]
|
|
|
|
++ lib.optional (stdenv.isSunOS || stdenv.isLinux) ./implement-getgrouplist.patch
|
|
|
|
;
|
|
|
|
|
|
|
|
# build only the specified subdirs
|
|
|
|
postPatch = "sed '/SUBDIRS/s/=.*/=" + subdirs + "/' -i Makefile.am\n"
|
|
|
|
# use already packaged libdbus instead of trying to build it again
|
|
|
|
+ lib.optionalString (name != "libs") ''
|
|
|
|
for mfile in */Makefile.am; do
|
|
|
|
sed 's,\$(top_builddir)/dbus/\(libdbus-[0-9]\),${libs}/lib/\1,g' -i "$mfile"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
propagatedBuildInputs = [ expat ];
|
|
|
|
buildInputs = [ autoconf automake libtool ]; # ToDo: optional selinux?
|
2013-03-23 17:08:47 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs .
|
|
|
|
substituteInPlace tools/Makefile.am --replace 'install-localstatelibDATA:' 'disabled:'
|
|
|
|
autoreconf -fi
|
|
|
|
'';
|
2011-08-26 16:57:48 +02:00
|
|
|
|
2013-09-06 15:51:38 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--with-session-socket-dir=/tmp"
|
|
|
|
"--with-systemdsystemunitdir=$(out)/lib/systemd"
|
|
|
|
];
|
2011-08-26 16:57:48 +02:00
|
|
|
|
2013-09-06 15:51:38 +02:00
|
|
|
enableParallelBuilding = true;
|
2008-12-16 00:45:52 +01:00
|
|
|
|
2013-09-06 15:51:38 +02:00
|
|
|
doCheck = true;
|
2011-08-26 16:57:48 +02:00
|
|
|
|
2013-09-06 15:51:38 +02:00
|
|
|
installFlags = "sysconfdir=$(out)/etc";
|
2011-08-26 16:57:48 +02:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
} merge ]);
|
2012-09-27 04:21:14 +02:00
|
|
|
|
2013-06-13 20:58:44 +02:00
|
|
|
libs = dbus_drv "libs" "dbus" ({
|
2013-04-11 22:12:00 +02:00
|
|
|
# Enable X11 autolaunch support in libdbus. This doesn't actually depend on X11
|
|
|
|
# (it just execs dbus-launch in dbus.tools), contrary to what the configure script demands.
|
2011-08-03 13:45:57 +02:00
|
|
|
NIX_CFLAGS_COMPILE = "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
|
2013-06-13 20:58:44 +02:00
|
|
|
} // stdenv.lib.optionalAttrs (systemdOrEmpty != []) {
|
|
|
|
buildInputs = [ systemd.headers ];
|
|
|
|
patches = [ ./systemd.patch ]; # bypass systemd detection
|
|
|
|
});
|
|
|
|
|
2008-02-02 21:41:06 +01:00
|
|
|
|
2013-10-24 18:08:48 +02:00
|
|
|
attrs = rec {
|
|
|
|
# If you change much fix indentation
|
2010-02-11 03:43:45 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
# This package has been split because most applications only need dbus.lib
|
|
|
|
# which serves as an interface to a *system-wide* daemon,
|
|
|
|
# see e.g. http://en.wikipedia.org/wiki/D-Bus#Architecture .
|
|
|
|
# Also some circular dependencies get split by this (like with systemd).
|
2011-08-26 16:57:48 +02:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
inherit libs;
|
2011-12-14 19:22:55 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
tools = dbus_drv "tools" "tools" {
|
|
|
|
configureFlags = [ "--with-dbus-daemondir=${daemon}/bin" ];
|
2013-06-13 20:58:44 +02:00
|
|
|
buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs daemon dbus_glib ];
|
2013-09-06 23:36:30 +02:00
|
|
|
NIX_CFLAGS_LINK =
|
|
|
|
stdenv.lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed "
|
|
|
|
+ "-ldbus-1";
|
2013-06-18 14:59:32 +02:00
|
|
|
|
|
|
|
meta.platforms = stdenv.lib.platforms.all;
|
2013-03-23 17:08:47 +01:00
|
|
|
};
|
2008-02-02 21:41:06 +01:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
daemon = dbus_drv "daemon" "bus" {
|
|
|
|
preBuild = makeInternalLib;
|
2013-06-13 20:58:44 +02:00
|
|
|
buildInputs = systemdOrEmpty;
|
2008-02-02 21:41:06 +01:00
|
|
|
};
|
2007-06-05 18:56:10 +02:00
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
# Some of the tests don't work yet; in fact, @vcunat tried several packages
|
|
|
|
# containing dbus testing, and all of them have some test failure.
|
|
|
|
tests = dbus_drv "tests" "test" {
|
|
|
|
preBuild = makeInternalLib;
|
2013-06-13 20:58:44 +02:00
|
|
|
buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs tools daemon dbus_glib python ];
|
2013-09-06 23:36:30 +02:00
|
|
|
NIX_CFLAGS_LINK =
|
|
|
|
stdenv.lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed "
|
|
|
|
+ "-ldbus-1";
|
2013-03-23 17:08:47 +01:00
|
|
|
};
|
|
|
|
|
2013-04-11 22:12:00 +02:00
|
|
|
docs = dbus_drv "docs" "doc" {
|
2013-03-23 17:08:47 +01:00
|
|
|
postInstall = ''rm -r "$out/lib"'';
|
|
|
|
};
|
2013-10-24 18:08:48 +02:00
|
|
|
};
|
|
|
|
in attrs.libs // attrs
|