dbus: split into multiple outputs and fix referrers
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
{ stdenv, fetchurl, pkgconfig, autoconf, automake, libtool
|
||||
, expat, systemd, glib, dbus_glib, python
|
||||
{ stdenv, lib, fetchurl, pkgconfig, expat, systemd, glib, dbus_glib, python
|
||||
, libX11 ? null, libICE ? null, libSM ? null, x11Support ? (stdenv.isLinux || stdenv.isDarwin) }:
|
||||
|
||||
assert x11Support -> libX11 != null
|
||||
@@ -10,107 +9,76 @@ let
|
||||
version = "1.8.20";
|
||||
sha256 = "0fkh3d5r57a659hw9lqnw4v0bc5556vx54fsf7l9c732ci6byksw";
|
||||
|
||||
inherit (stdenv) lib;
|
||||
|
||||
buildInputsX = lib.optionals x11Support [ libX11 libICE libSM ];
|
||||
|
||||
# also other parts than "libs" need this statically linked lib
|
||||
makeInternalLib = "(cd dbus && make libdbus-internal.la)";
|
||||
|
||||
systemdOrEmpty = lib.optional stdenv.isLinux systemd;
|
||||
|
||||
# A generic builder for individual parts (subdirs) of D-Bus
|
||||
dbus_drv = name: subdirs: merge: stdenv.mkDerivation (lib.mergeAttrsByFuncDefaultsClean [{
|
||||
|
||||
name = "dbus-${name}-${version}";
|
||||
self = stdenv.mkDerivation {
|
||||
name = "dbus-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
patches = [
|
||||
./ignore-missing-includedirs.patch
|
||||
./ucred-dirty-hack.patch
|
||||
./no-create-dirs.patch
|
||||
]
|
||||
++ lib.optional (stdenv.isSunOS || stdenv.isLinux) ./implement-getgrouplist.patch
|
||||
;
|
||||
patches = [ ./ignore-missing-includedirs.patch ]
|
||||
++ lib.optional stdenv.isSunOS ./implement-getgrouplist.patch;
|
||||
postPatch = ''
|
||||
substituteInPlace tools/Makefile.in \
|
||||
--replace 'install-localstatelibDATA:' 'disabled:' \
|
||||
--replace 'install-data-local:' 'disabled:' \
|
||||
--replace 'installcheck-local:' 'disabled:'
|
||||
substituteInPlace bus/Makefile.in \
|
||||
--replace '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus' ':'
|
||||
'' + /* cleanup of runtime references */ ''
|
||||
substituteInPlace ./dbus/dbus-sysdeps-unix.c \
|
||||
--replace 'DBUS_BINDIR "/dbus-launch"' "\"$lib/bin/dbus-launch\""
|
||||
substituteInPlace ./tools/dbus-launch.c \
|
||||
--replace 'DBUS_DAEMONDIR"/dbus-daemon"' '"/run/current-system/sw/bin/dbus-daemon"'
|
||||
'';
|
||||
|
||||
# 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
|
||||
'';
|
||||
outputs = [ "dev" "out" "lib" "doc" ];
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
propagatedBuildInputs = [ expat ];
|
||||
buildInputs = [ autoconf automake libtool ]; # ToDo: optional selinux?
|
||||
|
||||
preConfigure = ''
|
||||
patchShebangs .
|
||||
substituteInPlace tools/Makefile.am --replace 'install-localstatelibDATA:' 'disabled:'
|
||||
autoreconf -fi
|
||||
'';
|
||||
buildInputs = lib.optional stdenv.isLinux systemd
|
||||
++ lib.optionals x11Support [ libX11 libICE libSM ];
|
||||
# ToDo: optional selinux?
|
||||
|
||||
configureFlags = [
|
||||
"--localstatedir=/var"
|
||||
"--sysconfdir=/etc"
|
||||
"--with-session-socket-dir=/tmp"
|
||||
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
|
||||
# this package installs nothing into those dirs and they create a dependency
|
||||
"--datadir=/run/current-system/sw/share"
|
||||
"--libexecdir=$(out)/libexec" # we don't need dbus-daemon-launch-helper
|
||||
] ++ lib.optional (!x11Support) "--without-x";
|
||||
|
||||
# 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.
|
||||
NIX_CFLAGS_COMPILE = "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
|
||||
NIX_CFLAGS_LINK = lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
installFlags = "sysconfdir=$(out)/etc";
|
||||
installFlags = "sysconfdir=$(out)/etc datadir=$(out)/share";
|
||||
|
||||
} merge ]);
|
||||
|
||||
libs = dbus_drv "libs" "dbus" {
|
||||
# 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.
|
||||
NIX_CFLAGS_COMPILE = "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
|
||||
buildInputs = [ systemdOrEmpty ];
|
||||
meta.platforms = stdenv.lib.platforms.all;
|
||||
};
|
||||
|
||||
|
||||
attrs = rec {
|
||||
# If you change much fix indentation
|
||||
|
||||
# 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 .
|
||||
|
||||
inherit libs;
|
||||
|
||||
tools = dbus_drv "tools" "tools bus" {
|
||||
preBuild = makeInternalLib;
|
||||
buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs ];
|
||||
NIX_CFLAGS_LINK =
|
||||
stdenv.lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed "
|
||||
+ "-ldbus-1";
|
||||
|
||||
# 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/*}
|
||||
# it's executed from $lib by absolute path
|
||||
postFixup = ''
|
||||
_moveToOutput bin/dbus-launch "$lib"
|
||||
ln -s "$lib/bin/dbus-launch" "$out/bin/"
|
||||
'';
|
||||
|
||||
meta.platforms = with stdenv.lib.platforms; allBut darwin;
|
||||
passthru = {
|
||||
dbus-launch = "${self.lib}/bin/dbus-launch";
|
||||
daemon = self.out;
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Simple interprocess messaging system";
|
||||
homepage = http://www.freedesktop.org/wiki/Software/dbus/;
|
||||
license = licenses.gpl2Plus; # most is also under AFL-2.1
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
daemon = tools;
|
||||
|
||||
docs = dbus_drv "docs" "doc" {
|
||||
postInstall = ''rm -r "$out/lib"'';
|
||||
};
|
||||
};
|
||||
in attrs.libs // attrs
|
||||
in self
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
diff --git a/bus/Makefile.am b/bus/Makefile.am
|
||||
index 6cbc09a..be60bb8 100644
|
||||
--- a/bus/Makefile.am
|
||||
+++ b/bus/Makefile.am
|
||||
@@ -212,7 +212,6 @@ clean-local:
|
||||
/bin/rm *.bb *.bbg *.da *.gcov || true
|
||||
|
||||
install-data-hook:
|
||||
- $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
|
||||
$(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
|
||||
$(mkinstalldirs) $(DESTDIR)$(configdir)/session.d
|
||||
$(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services
|
||||
diff --git a/tools/Makefile.am b/tools/Makefile.am
|
||||
index cfd54b8..b6e28f9 100644
|
||||
--- a/tools/Makefile.am
|
||||
+++ b/tools/Makefile.am
|
||||
@@ -74,7 +74,7 @@ CLEANFILES = \
|
||||
|
||||
# create the /var/lib/dbus directory for dbus-uuidgen
|
||||
install-data-local:
|
||||
- $(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/dbus
|
||||
+ :
|
||||
|
||||
installcheck-local:
|
||||
- test -d $(DESTDIR)$(localstatedir)/lib/dbus
|
||||
+ :
|
||||
@@ -1,18 +0,0 @@
|
||||
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
|
||||
index b4ecc96..267984a 100644
|
||||
--- a/dbus/dbus-sysdeps-unix.c
|
||||
+++ b/dbus/dbus-sysdeps-unix.c
|
||||
@@ -1635,6 +1635,13 @@ write_credentials_byte (int server_fd,
|
||||
}
|
||||
}
|
||||
|
||||
+struct ucred
|
||||
+{
|
||||
+ pid_t pid; /* PID of sending process. */
|
||||
+ uid_t uid; /* UID of sending process. */
|
||||
+ gid_t gid; /* GID of sending process. */
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* Reads a single byte which must be nul (an error occurs otherwise),
|
||||
* and reads unix credentials if available. Clears the credentials
|
||||
Reference in New Issue
Block a user