diff options
Diffstat (limited to 'pkgs/development/libraries/dbus/default.nix')
-rw-r--r-- | pkgs/development/libraries/dbus/default.nix | 126 |
1 files changed, 81 insertions, 45 deletions
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix index 5716ac6648a0..d50a0076e62a 100644 --- a/pkgs/development/libraries/dbus/default.nix +++ b/pkgs/development/libraries/dbus/default.nix @@ -1,71 +1,107 @@ -{ 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 ? stdenv.isLinux }: let - version = "1.6.4"; + version = "1.6.12"; # 1.7.* isn't recommended, even for gnome 3.8 + sha256 = "14pfh2ksn4srfry752kf1jy3c61hklcs9fx2xglw2ifhsszplypn"; - src = fetchurl { - url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz"; - sha256 = "1wacqyfkcpayg7f8rvx9awqg275n5pksxq5q7y21lxjx85x6pfjz"; - }; + inherit (stdenv) lib; - patches = [ ./ignore-missing-includedirs.patch ]; + buildInputsX = lib.optionals useX11 [ libX11 libICE libSM ]; - configureFlags = "--localstatedir=/var --sysconfdir=/etc --with-session-socket-dir=/tmp"; + # also other parts than "libs" need this statically linked lib + makeInternalLib = "(cd dbus && make libdbus-internal.la)"; -in rec { + systemdOrEmpty = lib.optional stdenv.isLinux systemd; - libs = stdenv.mkDerivation { - name = "dbus-library-" + version; + # A generic builder for individual parts (subdirs) of D-Bus + dbus_drv = name: subdirs: merge: stdenv.mkDerivation (lib.mergeAttrsByFuncDefaultsClean [{ - nativeBuildInputs = [ pkgconfig ]; + name = "dbus-${name}-${version}"; - buildInputs = [ expat ]; + src = fetchurl { + url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz"; + inherit sha256; + }; - # FIXME: dbus has optional systemd integration when checking - # at_console policies. How to enable this without introducing a - # circular dependency between dbus and systemd? + configureFlags = [ + "--localstatedir=/var" + "--sysconfdir=/etc" + "--with-session-socket-dir=/tmp" + "--with-systemdsystemunitdir=$(out)/lib/systemd" + ]; - inherit src patches configureFlags; + preConfigure = '' + patchShebangs . + substituteInPlace tools/Makefile.am --replace 'install-localstatelibDATA:' 'disabled:' + autoreconf -fi + ''; - preConfigure = - '' - sed -i '/mkinstalldirs.*localstatedir/d' bus/Makefile.in - sed -i '/SUBDIRS/s/ tools//' Makefile.in - ''; + installFlags = "sysconfdir=$(out)/etc"; - # 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"; + doCheck = true; - installFlags = "sysconfdir=$(out)/etc"; - }; + patches = [ ./ignore-missing-includedirs.patch ] + ++ lib.optional (stdenv.isSunOS || stdenv.isLinux/*avoid rebuilds*/) ./implement-getgrouplist.patch + ++ [ ./ucred-dirty-hack.patch ./no-create-dirs.patch ]; - tools = stdenv.mkDerivation { - name = "dbus-tools-" + version; + nativeBuildInputs = [ pkgconfig ]; + propagatedBuildInputs = [ expat ]; + buildInputs = [ autoconf automake libtool ]; # ToDo: optional selinux? + + # 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 + ''; + + } 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"; + } // stdenv.lib.optionalAttrs (systemdOrEmpty != []) { + buildInputs = [ systemd.headers ]; + patches = [ ./systemd.patch ]; # bypass systemd detection + }); - inherit src patches; - configureFlags = "${configureFlags} --with-dbus-daemondir=${daemon}/bin"; +in rec { - nativeBuildInputs = [ pkgconfig ]; + # 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). - buildInputs = [ expat libs ] - ++ stdenv.lib.optionals useX11 [ libX11 libICE libSM ]; + inherit libs; - NIX_LDFLAGS = "-ldbus-1"; + tools = dbus_drv "tools" "tools" { + configureFlags = [ "--with-dbus-daemondir=${daemon}/bin" ]; + buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs daemon dbus_glib ]; + NIX_CFLAGS_LINK = "-Wl,--as-needed -ldbus-1"; - preConfigure = - '' - sed -i 's@$(top_builddir)/dbus/libdbus-1.la@@' tools/Makefile.in - substituteInPlace tools/Makefile.in --replace 'install-localstatelibDATA:' 'disabled:' - ''; + meta.platforms = stdenv.lib.platforms.all; + }; - postConfigure = "cd tools"; + daemon = dbus_drv "daemon" "bus" { + preBuild = makeInternalLib; + buildInputs = systemdOrEmpty; + }; - installFlags = "localstatedir=$TMPDIR/var"; + # 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; + buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs tools daemon dbus_glib python ]; + NIX_CFLAGS_LINK = "-Wl,--as-needed -ldbus-1"; }; - # I'm too lazy to separate daemon and libs now. - daemon = libs; + docs = dbus_drv "docs" "doc" { + postInstall = ''rm -r "$out/lib"''; + }; } |