diff options
Diffstat (limited to 'pkgs/development/libraries/dbus/default.nix')
-rw-r--r-- | pkgs/development/libraries/dbus/default.nix | 122 |
1 files changed, 45 insertions, 77 deletions
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix index 4a0f98d262a0..b569fc187e28 100644 --- a/pkgs/development/libraries/dbus/default.nix +++ b/pkgs/development/libraries/dbus/default.nix @@ -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 - ; - - # 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 - ''; + 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"' + ''; + + 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"; - enableParallelBuilding = true; - - doCheck = true; - - installFlags = "sysconfdir=$(out)/etc"; - - } 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 + NIX_CFLAGS_LINK = lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed"; - # 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 . + enableParallelBuilding = true; - inherit libs; + doCheck = true; - 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"; + installFlags = "sysconfdir=$(out)/etc datadir=$(out)/share"; - # 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; - }; - - daemon = tools; + passthru = { + dbus-launch = "${self.lib}/bin/dbus-launch"; + daemon = self.out; + }; - docs = dbus_drv "docs" "doc" { - postInstall = ''rm -r "$out/lib"''; + 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; + }; }; -}; -in attrs.libs // attrs +in self |