dbus: modularize into libs, daemon, tools, tests and docs
This commit is contained in:
parent
eb2e46aab2
commit
fe4a067aad
@ -1,4 +1,6 @@
|
||||
{ stdenv, fetchurl, pkgconfig, expat, libX11, libICE, libSM, useX11 ? true }:
|
||||
{ stdenv, fetchurl, pkgconfig, autoconf, automake, libtool
|
||||
, expat, systemd, glib, dbus_glib, python
|
||||
, libX11, libICE, libSM, useX11 ? true }:
|
||||
|
||||
let
|
||||
version = "1.6.4";
|
||||
@ -8,64 +10,121 @@ let
|
||||
sha256 = "1wacqyfkcpayg7f8rvx9awqg275n5pksxq5q7y21lxjx85x6pfjz";
|
||||
};
|
||||
|
||||
patches = [ ./ignore-missing-includedirs.patch ];
|
||||
patches = [
|
||||
./ignore-missing-includedirs.patch ./implement-getgrouplist.patch
|
||||
./ucred-dirty-hack.patch ./no-create-dirs.patch
|
||||
];
|
||||
|
||||
configureFlags = "--localstatedir=/var --sysconfdir=/etc --with-session-socket-dir=/tmp";
|
||||
# build only the specified subdirs
|
||||
postPatch = subdirs : "sed '/SUBDIRS/s/=.*/=" + subdirs + "/' -i Makefile.am\n"
|
||||
# use already packaged libdbus instead of trying to build it again
|
||||
+ stdenv.lib.optionalString (subdirs != "dbus") ''
|
||||
for mfile in */Makefile.am; do
|
||||
sed 's,\$(top_builddir)/dbus/\(libdbus-[0-9]\),${libs}/lib/\1,g' -i "$mfile"
|
||||
done
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
buildInputs = [ autoconf automake libtool expat ]; # ToDo: optional selinux?
|
||||
|
||||
buildInputsWithX = buildInputs ++ stdenv.lib.optionals useX11 [ libX11 libICE libSM ];
|
||||
|
||||
preConfigure = ''
|
||||
patchShebangs .
|
||||
substituteInPlace tools/Makefile.am --replace 'install-localstatelibDATA:' 'disabled:'
|
||||
autoreconf -fi
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
"--localstatedir=/var"
|
||||
"--sysconfdir=/etc"
|
||||
"--with-session-socket-dir=/tmp"
|
||||
"--with-systemdsystemunitdir=$(out)/lib/systemd"
|
||||
];
|
||||
|
||||
# also other parts than "libs" need this statically linked lib
|
||||
postConfigure = "(cd dbus && make libdbus-internal.la)";
|
||||
|
||||
doCheck = true;
|
||||
|
||||
installFlags = "sysconfdir=$(out)/etc";
|
||||
|
||||
in rec {
|
||||
|
||||
libs = stdenv.mkDerivation {
|
||||
name = "dbus-library-" + version;
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
inherit src nativeBuildInputs preConfigure configureFlags doCheck installFlags;
|
||||
|
||||
buildInputs = [ expat ];
|
||||
buildInputs = buildInputs ++ [ systemd.headers ];
|
||||
|
||||
# FIXME: dbus has optional systemd integration when checking
|
||||
# at_console policies. How to enable this without introducing a
|
||||
# circular dependency between dbus and systemd?
|
||||
patches = patches ++ [ ./systemd.patch ]; # bypass systemd detection
|
||||
|
||||
inherit src patches configureFlags;
|
||||
|
||||
preConfigure =
|
||||
''
|
||||
sed -i '/mkinstalldirs.*localstatedir/d' bus/Makefile.in
|
||||
sed -i '/SUBDIRS/s/ tools//' Makefile.in
|
||||
'';
|
||||
postPatch = postPatch "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";
|
||||
|
||||
installFlags = "sysconfdir=$(out)/etc";
|
||||
};
|
||||
|
||||
tools = stdenv.mkDerivation {
|
||||
name = "dbus-tools-" + version;
|
||||
|
||||
inherit src patches;
|
||||
inherit src patches nativeBuildInputs preConfigure doCheck installFlags;
|
||||
|
||||
configureFlags = "${configureFlags} --with-dbus-daemondir=${daemon}/bin";
|
||||
configureFlags = configureFlags ++ [ "--with-dbus-daemondir=${daemon}/bin" ];
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = buildInputsWithX ++ [ libs daemon systemd dbus_glib ];
|
||||
|
||||
buildInputs = [ expat libs ]
|
||||
++ stdenv.lib.optionals useX11 [ libX11 libICE libSM ];
|
||||
NIX_CFLAGS_LINK = "-Wl,--as-needed -ldbus-1";
|
||||
|
||||
NIX_LDFLAGS = "-ldbus-1";
|
||||
|
||||
preConfigure =
|
||||
''
|
||||
sed -i 's@$(top_builddir)/dbus/libdbus-1.la@@' tools/Makefile.in
|
||||
substituteInPlace tools/Makefile.in --replace 'install-localstatelibDATA:' 'disabled:'
|
||||
'';
|
||||
|
||||
postConfigure = "cd tools";
|
||||
|
||||
installFlags = "localstatedir=$TMPDIR/var";
|
||||
postPatch = postPatch "tools";
|
||||
};
|
||||
|
||||
# I'm too lazy to separate daemon and libs now.
|
||||
daemon = libs;
|
||||
daemon = stdenv.mkDerivation {
|
||||
name = "dbus-daemon-" + version;
|
||||
|
||||
inherit src patches nativeBuildInputs
|
||||
preConfigure configureFlags postConfigure doCheck installFlags;
|
||||
|
||||
buildInputs = buildInputs ++ [ systemd ];
|
||||
|
||||
postPatch = postPatch "bus";
|
||||
};
|
||||
|
||||
tests = stdenv.mkDerivation {
|
||||
name = "dbus-tests-" + version;
|
||||
|
||||
inherit src patches nativeBuildInputs
|
||||
preConfigure configureFlags postConfigure doCheck installFlags;
|
||||
|
||||
buildInputs = buildInputsWithX ++ [ systemd libs tools daemon dbus_glib python ];
|
||||
|
||||
postPatch = postPatch "test";
|
||||
|
||||
NIX_CFLAGS_LINK = "-Wl,--as-needed -ldbus-1";
|
||||
};
|
||||
|
||||
docs = stdenv.mkDerivation {
|
||||
name = "dbus-docs-" + version;
|
||||
|
||||
inherit src patches nativeBuildInputs
|
||||
preConfigure configureFlags doCheck installFlags;
|
||||
|
||||
buildInputs = buildInputs;
|
||||
|
||||
postPatch = postPatch "doc";
|
||||
|
||||
postInstall = ''rm -r "$out/lib"'';
|
||||
};
|
||||
|
||||
in {
|
||||
inherit libs daemon tools tests docs;
|
||||
|
||||
dbus_libs = libs;
|
||||
dbus_daemon = daemon;
|
||||
dbus_tools = tools;
|
||||
dbus_tests = tests;
|
||||
dbus_docs = docs;
|
||||
}
|
||||
|
108
pkgs/development/libraries/dbus/implement-getgrouplist.patch
Normal file
108
pkgs/development/libraries/dbus/implement-getgrouplist.patch
Normal file
@ -0,0 +1,108 @@
|
||||
Compatibility patch for Illumos/Solaris and possibly other platforms.
|
||||
Implements getgrouplist when not provided by OS.
|
||||
Without it, only the user's primary group is used in authentication!
|
||||
--- 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ dbus-1.6.8/dbus/getgrouplist.c 2013-02-28 13:10:51.081792722 +0000
|
||||
@@ -0,0 +1,89 @@
|
||||
+/* $OpenBSD: getgrouplist.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */
|
||||
+/*
|
||||
+ * Copyright (c) 1991, 1993
|
||||
+ * The Regents of the University of California. All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ * 3. Neither the name of the University nor the names of its contributors
|
||||
+ * may be used to endorse or promote products derived from this software
|
||||
+ * without specific prior written permission.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+ * SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+/* OPENBSD ORIGINAL: lib/libc/gen/getgrouplist.c */
|
||||
+
|
||||
+/*
|
||||
+ * get credential
|
||||
+ */
|
||||
+#include <sys/types.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <grp.h>
|
||||
+
|
||||
+int
|
||||
+getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt)
|
||||
+{
|
||||
+ struct group *grp;
|
||||
+ int i, ngroups;
|
||||
+ int ret, maxgroups;
|
||||
+ int bail;
|
||||
+
|
||||
+ ret = 0;
|
||||
+ ngroups = 0;
|
||||
+ maxgroups = *grpcnt;
|
||||
+
|
||||
+ /*
|
||||
+ * install primary group
|
||||
+ */
|
||||
+ if (ngroups >= maxgroups) {
|
||||
+ *grpcnt = ngroups;
|
||||
+ return (-1);
|
||||
+ }
|
||||
+ groups[ngroups++] = agroup;
|
||||
+
|
||||
+ /*
|
||||
+ * Scan the group file to find additional groups.
|
||||
+ */
|
||||
+ setgrent();
|
||||
+ while ((grp = getgrent())) {
|
||||
+ if (grp->gr_gid == agroup)
|
||||
+ continue;
|
||||
+ for (bail = 0, i = 0; bail == 0 && i < ngroups; i++)
|
||||
+ if (groups[i] == grp->gr_gid)
|
||||
+ bail = 1;
|
||||
+ if (bail)
|
||||
+ continue;
|
||||
+ for (i = 0; grp->gr_mem[i]; i++) {
|
||||
+ if (!strcmp(grp->gr_mem[i], uname)) {
|
||||
+ if (ngroups >= maxgroups) {
|
||||
+ ret = -1;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ groups[ngroups++] = grp->gr_gid;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+out:
|
||||
+ endgrent();
|
||||
+ *grpcnt = ngroups;
|
||||
+ return (ret);
|
||||
+}
|
||||
--- dbus-1.6.8/dbus/dbus-sysdeps-unix.c.orig 2013-02-28 13:08:52.171215237 +0000
|
||||
+++ dbus-1.6.8/dbus/dbus-sysdeps-unix.c 2013-02-28 13:13:52.224615146 +0000
|
||||
@@ -21,6 +21,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
+#ifndef HAVE_GETGROUPLIST
|
||||
+#include "getgrouplist.c"
|
||||
+#define HAVE_GETGROUPLIST
|
||||
+#endif
|
||||
|
||||
#include <config.h>
|
||||
|
26
pkgs/development/libraries/dbus/no-create-dirs.patch
Normal file
26
pkgs/development/libraries/dbus/no-create-dirs.patch
Normal file
@ -0,0 +1,26 @@
|
||||
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
|
||||
+ :
|
14
pkgs/development/libraries/dbus/systemd.patch
Normal file
14
pkgs/development/libraries/dbus/systemd.patch
Normal file
@ -0,0 +1,14 @@
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 24fcc9e..98e0459 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1167,7 +1167,8 @@ else
|
||||
PKG_CHECK_MODULES(SYSTEMD,
|
||||
[libsystemd-login >= 32, libsystemd-daemon >= 32],
|
||||
have_systemd=yes,
|
||||
- have_systemd=no)
|
||||
+ have_systemd=yes)
|
||||
+ AC_MSG_NOTICE([NixOS: do not care whether we found systemd or not])
|
||||
fi
|
||||
|
||||
if test x$have_systemd = xyes; then
|
18
pkgs/development/libraries/dbus/ucred-dirty-hack.patch
Normal file
18
pkgs/development/libraries/dbus/ucred-dirty-hack.patch
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
Loading…
Reference in New Issue
Block a user