Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 146 lines 3.8 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 pkg-config, 6 expat, 7 enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal, 8 systemdMinimal, 9 audit, 10 libapparmor, 11 dbus, 12 docbook_xml_dtd_44, 13 docbook-xsl-nons, 14 xmlto, 15 autoreconfHook, 16 autoconf-archive, 17 x11Support ? (stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin), 18 xorg, 19}: 20 21stdenv.mkDerivation rec { 22 pname = "dbus"; 23 version = "1.14.10"; 24 25 src = fetchurl { 26 url = "https://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.xz"; 27 sha256 = "sha256-uh8h0r2dM52i1KqHgMCd8y/qh5mLc9ok9Jq53x42pQ8="; 28 }; 29 30 patches = lib.optional stdenv.hostPlatform.isSunOS ./implement-getgrouplist.patch; 31 32 postPatch = 33 '' 34 substituteInPlace bus/Makefile.am \ 35 --replace 'install-data-hook:' 'disabled:' \ 36 --replace '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus' ':' 37 substituteInPlace tools/Makefile.am \ 38 --replace 'install-data-local:' 'disabled:' \ 39 --replace 'installcheck-local:' 'disabled:' 40 '' 41 # cleanup of runtime references 42 + '' 43 substituteInPlace ./dbus/dbus-sysdeps-unix.c \ 44 --replace 'DBUS_BINDIR "/dbus-launch"' "\"$lib/bin/dbus-launch\"" 45 substituteInPlace ./tools/dbus-launch.c \ 46 --replace 'DBUS_DAEMONDIR"/dbus-daemon"' '"/run/current-system/sw/bin/dbus-daemon"' 47 ''; 48 49 outputs = [ 50 "out" 51 "dev" 52 "lib" 53 "doc" 54 "man" 55 ]; 56 separateDebugInfo = true; 57 58 strictDeps = true; 59 nativeBuildInputs = [ 60 autoreconfHook 61 autoconf-archive 62 pkg-config 63 docbook_xml_dtd_44 64 docbook-xsl-nons 65 xmlto 66 ]; 67 68 propagatedBuildInputs = [ 69 expat 70 ]; 71 72 buildInputs = 73 lib.optionals x11Support ( 74 with xorg; 75 [ 76 libX11 77 libICE 78 libSM 79 ] 80 ) 81 ++ lib.optional enableSystemd systemdMinimal 82 ++ lib.optionals stdenv.hostPlatform.isLinux [ 83 audit 84 libapparmor 85 ]; 86 # ToDo: optional selinux? 87 88 __darwinAllowLocalNetworking = true; 89 90 configureFlags = 91 [ 92 "--enable-user-session" 93 "--enable-xml-docs" 94 "--libexecdir=${placeholder "out"}/libexec" 95 "--datadir=/etc" 96 "--localstatedir=/var" 97 "--runstatedir=/run" 98 "--sysconfdir=/etc" 99 "--with-session-socket-dir=/tmp" 100 "--with-system-pid-file=/run/dbus/pid" 101 "--with-system-socket=/run/dbus/system_bus_socket" 102 "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system" 103 "--with-systemduserunitdir=${placeholder "out"}/etc/systemd/user" 104 ] 105 ++ lib.optional (!x11Support) "--without-x" 106 ++ lib.optionals stdenv.hostPlatform.isLinux [ 107 "--enable-apparmor" 108 "--enable-libaudit" 109 ] 110 ++ lib.optionals enableSystemd [ "SYSTEMCTL=${systemdMinimal}/bin/systemctl" ]; 111 112 NIX_CFLAGS_LINK = lib.optionalString (!stdenv.hostPlatform.isDarwin) "-Wl,--as-needed"; 113 114 enableParallelBuilding = true; 115 116 doCheck = true; 117 118 makeFlags = [ 119 # Fix paths in XML catalog broken by mismatching build/install datadir. 120 "dtddir=${placeholder "out"}/share/xml/dbus-1" 121 ]; 122 123 installFlags = [ 124 "sysconfdir=${placeholder "out"}/etc" 125 "datadir=${placeholder "out"}/share" 126 ]; 127 128 # it's executed from $lib by absolute path 129 postFixup = '' 130 moveToOutput bin/dbus-launch "$lib" 131 ln -s "$lib/bin/dbus-launch" "$out/bin/" 132 ''; 133 134 passthru = { 135 dbus-launch = "${dbus.lib}/bin/dbus-launch"; 136 }; 137 138 meta = with lib; { 139 description = "Simple interprocess messaging system"; 140 homepage = "https://www.freedesktop.org/wiki/Software/dbus/"; 141 changelog = "https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-${version}/NEWS"; 142 license = licenses.gpl2Plus; # most is also under AFL-2.1 143 teams = [ teams.freedesktop ]; 144 platforms = platforms.unix; 145 }; 146}