fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ stdenv, fetchurl, pkgconfig, autoconf, automake, libtool
2, expat, systemd, glib, dbus_glib, python
3, libX11 ? null, libICE ? null, libSM ? null, x11Support ? (stdenv.isLinux || stdenv.isDarwin) }:
4
5assert x11Support -> libX11 != null
6 && libICE != null
7 && libSM != null;
8
9let
10 version = "1.8.20";
11 sha256 = "0fkh3d5r57a659hw9lqnw4v0bc5556vx54fsf7l9c732ci6byksw";
12
13 inherit (stdenv) lib;
14
15 buildInputsX = lib.optionals x11Support [ libX11 libICE libSM ];
16
17 # also other parts than "libs" need this statically linked lib
18 makeInternalLib = "(cd dbus && make libdbus-internal.la)";
19
20 systemdOrEmpty = lib.optional stdenv.isLinux systemd;
21
22 # A generic builder for individual parts (subdirs) of D-Bus
23 dbus_drv = name: subdirs: merge: stdenv.mkDerivation (lib.mergeAttrsByFuncDefaultsClean [{
24
25 name = "dbus-${name}-${version}";
26
27 src = fetchurl {
28 url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
29 inherit sha256;
30 };
31
32 patches = [
33 ./ignore-missing-includedirs.patch
34 ./ucred-dirty-hack.patch
35 ./no-create-dirs.patch
36 ]
37 ++ lib.optional (stdenv.isSunOS || stdenv.isLinux) ./implement-getgrouplist.patch
38 ;
39
40 # build only the specified subdirs
41 postPatch = "sed '/SUBDIRS/s/=.*/=" + subdirs + "/' -i Makefile.am\n"
42 # use already packaged libdbus instead of trying to build it again
43 + lib.optionalString (name != "libs") ''
44 for mfile in */Makefile.am; do
45 sed 's,\$(top_builddir)/dbus/\(libdbus-[0-9]\),${libs}/lib/\1,g' -i "$mfile"
46 done
47 '';
48
49 nativeBuildInputs = [ pkgconfig ];
50 propagatedBuildInputs = [ expat ];
51 buildInputs = [ autoconf automake libtool ]; # ToDo: optional selinux?
52
53 preConfigure = ''
54 patchShebangs .
55 substituteInPlace tools/Makefile.am --replace 'install-localstatelibDATA:' 'disabled:'
56 autoreconf -fi
57 '';
58
59 configureFlags = [
60 "--localstatedir=/var"
61 "--sysconfdir=/etc"
62 "--with-session-socket-dir=/tmp"
63 "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
64 ] ++ lib.optional (!x11Support) "--without-x";
65
66 enableParallelBuilding = true;
67
68 doCheck = true;
69
70 installFlags = "sysconfdir=$(out)/etc";
71
72 } merge ]);
73
74 libs = dbus_drv "libs" "dbus" {
75 # Enable X11 autolaunch support in libdbus. This doesn't actually depend on X11
76 # (it just execs dbus-launch in dbus.tools), contrary to what the configure script demands.
77 NIX_CFLAGS_COMPILE = "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
78 buildInputs = [ systemdOrEmpty ];
79 meta.platforms = stdenv.lib.platforms.all;
80 };
81
82
83 attrs = rec {
84 # If you change much fix indentation
85
86 # This package has been split because most applications only need dbus.lib
87 # which serves as an interface to a *system-wide* daemon,
88 # see e.g. http://en.wikipedia.org/wiki/D-Bus#Architecture .
89
90 inherit libs;
91
92 tools = dbus_drv "tools" "tools bus" {
93 preBuild = makeInternalLib;
94 buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs ];
95 NIX_CFLAGS_LINK =
96 stdenv.lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed "
97 + "-ldbus-1";
98
99 # don't provide another dbus-1.pc (with incorrect include and link dirs),
100 # also remove useless empty dirs
101 postInstall = ''
102 rm "$out"/lib/pkgconfig/dbus-1.pc
103 rmdir --parents --ignore-fail-on-non-empty "$out"/{lib/pkgconfig,share/dbus-1/*}
104 '';
105
106 meta.platforms = with stdenv.lib.platforms; allBut darwin;
107 };
108
109 daemon = tools;
110
111 docs = dbus_drv "docs" "doc" {
112 postInstall = ''rm -r "$out/lib"'';
113 };
114};
115in attrs.libs // attrs
116