Merge pull request #67363 from worldofpeace/dbus-datadir

dbus: don't make datadir /etc, set runstatedir to /run
This commit is contained in:
worldofpeace 2019-08-29 19:46:51 -04:00 committed by GitHub
commit 2f7d0993b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 102 deletions

View File

@ -44,8 +44,10 @@ in
message bus. Specifically, files in the following directories message bus. Specifically, files in the following directories
will be included into their respective DBus configuration paths: will be included into their respective DBus configuration paths:
<filename><replaceable>pkg</replaceable>/etc/dbus-1/system.d</filename> <filename><replaceable>pkg</replaceable>/etc/dbus-1/system.d</filename>
<filename><replaceable>pkg</replaceable>/share/dbus-1/system.d</filename>
<filename><replaceable>pkg</replaceable>/share/dbus-1/system-services</filename> <filename><replaceable>pkg</replaceable>/share/dbus-1/system-services</filename>
<filename><replaceable>pkg</replaceable>/etc/dbus-1/session.d</filename> <filename><replaceable>pkg</replaceable>/etc/dbus-1/session.d</filename>
<filename><replaceable>pkg</replaceable>/share/dbus-1/session.d</filename>
<filename><replaceable>pkg</replaceable>/share/dbus-1/services</filename> <filename><replaceable>pkg</replaceable>/share/dbus-1/services</filename>
''; '';
}; };

View File

@ -1,24 +1,31 @@
{ stdenv, lib, fetchurl, pkgconfig, expat, systemd { stdenv
, libX11 ? null, libICE ? null, libSM ? null, x11Support ? (stdenv.isLinux || stdenv.isDarwin) }: , lib
, fetchurl
, pkgconfig
, expat
, systemd
, libX11 ? null
, libICE ? null
, libSM ? null
, x11Support ? (stdenv.isLinux || stdenv.isDarwin)
, dbus
}:
assert x11Support -> libX11 != null assert
&& libICE != null x11Support ->
&& libSM != null; libX11 != null && libICE != null && libSM != null;
let stdenv.mkDerivation rec {
pname = "dbus";
version = "1.12.16"; version = "1.12.16";
sha256 = "107ckxaff1cv4q6kmfdi2fb1nlsv03312a7kf6lb4biglhpjv8jl";
self = stdenv.mkDerivation {
name = "dbus-${version}";
inherit version;
src = fetchurl { src = fetchurl {
url = "https://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz"; url = "https://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
inherit sha256; sha256 = "107ckxaff1cv4q6kmfdi2fb1nlsv03312a7kf6lb4biglhpjv8jl";
}; };
patches = lib.optional stdenv.isSunOS ./implement-getgrouplist.patch; patches = lib.optional stdenv.isSunOS ./implement-getgrouplist.patch;
postPatch = '' postPatch = ''
substituteInPlace tools/Makefile.in \ substituteInPlace tools/Makefile.in \
--replace 'install-localstatelibDATA:' 'disabled:' \ --replace 'install-localstatelibDATA:' 'disabled:' \
@ -35,23 +42,32 @@ self = stdenv.mkDerivation {
outputs = [ "out" "dev" "lib" "doc" ]; outputs = [ "out" "dev" "lib" "doc" ];
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [
propagatedBuildInputs = [ expat ]; pkgconfig
buildInputs = lib.optional stdenv.isLinux systemd ];
++ lib.optionals x11Support [ libX11 libICE libSM ];
propagatedBuildInputs = [
expat
];
buildInputs = lib.optionals x11Support [
libX11
libICE
libSM
] ++ lib.optional stdenv.isLinux systemd;
# ToDo: optional selinux? # ToDo: optional selinux?
configureFlags = [ configureFlags = [
"--enable-user-session"
"--libexecdir=${placeholder ''out''}/libexec"
"--localstatedir=/var" "--localstatedir=/var"
"--runstatedir=/run"
"--sysconfdir=/etc" "--sysconfdir=/etc"
"--with-session-socket-dir=/tmp" "--with-session-socket-dir=/tmp"
"--with-system-pid-file=/run/dbus/pid" "--with-system-pid-file=/run/dbus/pid"
"--with-system-socket=/run/dbus/system_bus_socket" "--with-system-socket=/run/dbus/system_bus_socket"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system" "--with-systemdsystemunitdir=${placeholder ''out''}/etc/systemd/system"
"--with-systemduserunitdir=$(out)/etc/systemd/user" "--with-systemduserunitdir=${placeholder ''out''}/etc/systemd/user"
"--enable-user-session"
"--datadir=/etc"
"--libexecdir=$(out)/libexec"
] ++ lib.optional (!x11Support) "--without-x"; ] ++ lib.optional (!x11Support) "--without-x";
# Enable X11 autolaunch support in libdbus. This doesn't actually depend on X11 # Enable X11 autolaunch support in libdbus. This doesn't actually depend on X11
@ -64,12 +80,10 @@ self = stdenv.mkDerivation {
doCheck = true; doCheck = true;
installFlags = [ "sysconfdir=$(out)/etc" "datadir=$(out)/share" ]; installFlags = [
"sysconfdir=${placeholder ''out''}/etc"
postInstall = '' "datadir=${placeholder ''out''}/share"
mkdir -p "$out/share/xml/dbus" ];
cp doc/*.dtd "$out/share/xml/dbus"
'';
# it's executed from $lib by absolute path # it's executed from $lib by absolute path
postFixup = '' postFixup = ''
@ -78,8 +92,8 @@ self = stdenv.mkDerivation {
''; '';
passthru = { passthru = {
dbus-launch = "${self.lib}/bin/dbus-launch"; dbus-launch = "${dbus.lib}/bin/dbus-launch";
daemon = self.out; daemon = dbus.out;
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {
@ -88,5 +102,4 @@ self = stdenv.mkDerivation {
license = licenses.gpl2Plus; # most is also under AFL-2.1 license = licenses.gpl2Plus; # most is also under AFL-2.1
platforms = platforms.unix; platforms = platforms.unix;
}; };
}; }
in self

View File

@ -22,7 +22,7 @@ runCommand "dbus-1"
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteSystem <rewriteSystem
systemIdStartString="http://www.freedesktop.org/standards/dbus/1.0/" systemIdStartString="http://www.freedesktop.org/standards/dbus/1.0/"
rewritePrefix="file://${dbus}/share/xml/dbus/"/> rewritePrefix="file://${dbus}/share/xml/dbus-1/"/>
</catalog> </catalog>
''; '';
nativeBuildInputs = [ libxslt.bin ]; nativeBuildInputs = [ libxslt.bin ];

View File

@ -24,6 +24,7 @@
<xsl:for-each select="str:tokenize($serviceDirectories)"> <xsl:for-each select="str:tokenize($serviceDirectories)">
<servicedir><xsl:value-of select="." />/share/dbus-1/services</servicedir> <servicedir><xsl:value-of select="." />/share/dbus-1/services</servicedir>
<includedir><xsl:value-of select="." />/etc/dbus-1/session.d</includedir> <includedir><xsl:value-of select="." />/etc/dbus-1/session.d</includedir>
<includedir><xsl:value-of select="." />/share/dbus-1/session.d</includedir>
</xsl:for-each> </xsl:for-each>
</busconfig> </busconfig>
</xsl:template> </xsl:template>

View File

@ -1,14 +0,0 @@
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