2016-01-17 23:04:40 +00:00
|
|
|
{ stdenv, fetchurl, pkgconfig, autoreconfHook
|
2013-03-23 16:08:47 +00:00
|
|
|
, expat, systemd, glib, dbus_glib, python
|
2015-03-19 00:49:31 +00:00
|
|
|
, libX11 ? null, libICE ? null, libSM ? null, x11Support ? (stdenv.isLinux || stdenv.isDarwin) }:
|
|
|
|
|
|
|
|
assert x11Support -> libX11 != null
|
|
|
|
&& libICE != null
|
|
|
|
&& libSM != null;
|
2008-12-15 23:45:52 +00:00
|
|
|
|
2008-02-02 20:41:06 +00:00
|
|
|
let
|
2015-07-23 12:42:47 +00:00
|
|
|
version = "1.8.20";
|
|
|
|
sha256 = "0fkh3d5r57a659hw9lqnw4v0bc5556vx54fsf7l9c732ci6byksw";
|
2011-08-26 14:57:48 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
inherit (stdenv) lib;
|
2010-07-20 12:53:07 +00:00
|
|
|
|
2015-03-19 00:49:31 +00:00
|
|
|
buildInputsX = lib.optionals x11Support [ libX11 libICE libSM ];
|
2013-03-23 16:08:47 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
# also other parts than "libs" need this statically linked lib
|
|
|
|
makeInternalLib = "(cd dbus && make libdbus-internal.la)";
|
2013-03-23 16:08:47 +00:00
|
|
|
|
2013-06-18 12:59:32 +00:00
|
|
|
systemdOrEmpty = lib.optional stdenv.isLinux systemd;
|
2013-03-23 16:08:47 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
# A generic builder for individual parts (subdirs) of D-Bus
|
|
|
|
dbus_drv = name: subdirs: merge: stdenv.mkDerivation (lib.mergeAttrsByFuncDefaultsClean [{
|
2013-03-23 16:08:47 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
name = "dbus-${name}-${version}";
|
2013-03-23 16:08:47 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
2013-03-23 16:08:47 +00:00
|
|
|
|
2013-09-06 13:51:38 +00: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
|
|
|
|
'';
|
|
|
|
|
2016-01-17 23:04:40 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig autoreconfHook ];
|
2013-09-06 13:51:38 +00:00
|
|
|
propagatedBuildInputs = [ expat ];
|
2016-01-17 23:04:40 +00:00
|
|
|
|
|
|
|
preAutoreconf = ''
|
|
|
|
substituteInPlace tools/Makefile.am --replace 'install-localstatelibDATA:' 'disabled:'
|
|
|
|
'';
|
2013-03-23 16:08:47 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
preConfigure = ''
|
2015-01-08 09:26:49 +00:00
|
|
|
patchShebangs .
|
2013-04-11 20:12:00 +00:00
|
|
|
'';
|
2011-08-26 14:57:48 +00:00
|
|
|
|
2013-09-06 13:51:38 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--with-session-socket-dir=/tmp"
|
2014-03-13 20:44:51 +00:00
|
|
|
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
|
2015-03-19 00:49:31 +00:00
|
|
|
] ++ lib.optional (!x11Support) "--without-x";
|
2011-08-26 14:57:48 +00:00
|
|
|
|
2013-09-06 13:51:38 +00:00
|
|
|
enableParallelBuilding = true;
|
2008-12-15 23:45:52 +00:00
|
|
|
|
2013-09-06 13:51:38 +00:00
|
|
|
doCheck = true;
|
2011-08-26 14:57:48 +00:00
|
|
|
|
2013-09-06 13:51:38 +00:00
|
|
|
installFlags = "sysconfdir=$(out)/etc";
|
2011-08-26 14:57:48 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
} merge ]);
|
2012-09-27 02:21:14 +00:00
|
|
|
|
2014-04-15 22:59:26 +00:00
|
|
|
libs = dbus_drv "libs" "dbus" {
|
2013-04-11 20:12:00 +00: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 11:45:57 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
|
2014-04-15 22:59:26 +00:00
|
|
|
buildInputs = [ systemdOrEmpty ];
|
2015-05-03 18:30:09 +00:00
|
|
|
meta.platforms = stdenv.lib.platforms.all;
|
2014-04-15 22:59:26 +00:00
|
|
|
};
|
2013-06-13 18:58:44 +00:00
|
|
|
|
2008-02-02 20:41:06 +00:00
|
|
|
|
2013-10-24 16:08:48 +00:00
|
|
|
attrs = rec {
|
|
|
|
# If you change much fix indentation
|
2010-02-11 02:43:45 +00:00
|
|
|
|
2013-04-11 20:12:00 +00: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 .
|
2011-08-26 14:57:48 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
inherit libs;
|
2011-12-14 18:22:55 +00:00
|
|
|
|
2014-04-22 14:01:45 +00:00
|
|
|
tools = dbus_drv "tools" "tools bus" {
|
|
|
|
preBuild = makeInternalLib;
|
|
|
|
buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs ];
|
2014-04-15 22:59:26 +00:00
|
|
|
NIX_CFLAGS_LINK =
|
2014-05-17 09:19:32 +00:00
|
|
|
stdenv.lib.optionalString (!stdenv.isDarwin && !stdenv.isSunOS) "-Wl,--as-needed "
|
2013-09-06 21:36:30 +00:00
|
|
|
+ "-ldbus-1";
|
2013-06-18 12:59:32 +00:00
|
|
|
|
2015-02-01 10:38:15 +00:00
|
|
|
# don't provide another dbus-1.pc (with incorrect include and link dirs),
|
|
|
|
# also remove useless empty dirs
|
|
|
|
postInstall = ''
|
|
|
|
rm "$out"/lib/pkgconfig/dbus-1.pc
|
|
|
|
rmdir --parents --ignore-fail-on-non-empty "$out"/{lib/pkgconfig,share/dbus-1/*}
|
|
|
|
'';
|
|
|
|
|
2014-08-09 12:32:54 +00:00
|
|
|
meta.platforms = with stdenv.lib.platforms; allBut darwin;
|
2013-03-23 16:08:47 +00:00
|
|
|
};
|
2008-02-02 20:41:06 +00:00
|
|
|
|
2014-04-22 14:01:45 +00:00
|
|
|
daemon = tools;
|
2007-06-05 16:56:10 +00:00
|
|
|
|
2013-04-11 20:12:00 +00:00
|
|
|
docs = dbus_drv "docs" "doc" {
|
2013-03-23 16:08:47 +00:00
|
|
|
postInstall = ''rm -r "$out/lib"'';
|
|
|
|
};
|
2013-10-24 16:08:48 +00:00
|
|
|
};
|
|
|
|
in attrs.libs // attrs
|
2015-02-01 10:38:15 +00:00
|
|
|
|