diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/dbus | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/dbus')
6 files changed, 321 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/dbus/default.nix b/nixpkgs/pkgs/development/libraries/dbus/default.nix new file mode 100644 index 000000000000..6d85fe1233cf --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/dbus/default.nix @@ -0,0 +1,92 @@ +{ stdenv, lib, fetchurl, pkgconfig, expat, systemd +, libX11 ? null, libICE ? null, libSM ? null, x11Support ? (stdenv.isLinux || stdenv.isDarwin) }: + +assert x11Support -> libX11 != null + && libICE != null + && libSM != null; + +let + version = "1.12.12"; + sha256 = "1y7mxhkw2shd9mi9s62k81lz8npjkrafapr4fyfms7hs04kg4ilm"; + +self = stdenv.mkDerivation { + name = "dbus-${version}"; + inherit version; + + src = fetchurl { + url = "https://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz"; + inherit sha256; + }; + + patches = 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 = [ "out" "dev" "lib" "doc" ]; + + nativeBuildInputs = [ pkgconfig ]; + propagatedBuildInputs = [ expat ]; + 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-system-pid-file=/run/dbus/pid" + "--with-system-socket=/run/dbus/system_bus_socket" + "--with-systemdsystemunitdir=$(out)/etc/systemd/system" + "--with-systemduserunitdir=$(out)/etc/systemd/user" + "--enable-user-session" + "--datadir=/etc" + "--libexecdir=$(out)/libexec" + ] ++ lib.optional (!x11Support) "--without-x"; + + # 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. + # problems building without x11Support so disabled in that case for now + NIX_CFLAGS_COMPILE = lib.optionalString x11Support "-DDBUS_ENABLE_X11_AUTOLAUNCH=1"; + NIX_CFLAGS_LINK = lib.optionalString (!stdenv.isDarwin) "-Wl,--as-needed"; + + enableParallelBuilding = true; + + doCheck = true; + + installFlags = [ "sysconfdir=$(out)/etc" "datadir=$(out)/share" ]; + + postInstall = '' + mkdir -p "$out/share/xml/dbus" + cp doc/*.dtd "$out/share/xml/dbus" + ''; + + # it's executed from $lib by absolute path + postFixup = '' + moveToOutput bin/dbus-launch "$lib" + ln -s "$lib/bin/dbus-launch" "$out/bin/" + ''; + + passthru = { + dbus-launch = "${self.lib}/bin/dbus-launch"; + daemon = self.out; + }; + + 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 self diff --git a/nixpkgs/pkgs/development/libraries/dbus/implement-getgrouplist.patch b/nixpkgs/pkgs/development/libraries/dbus/implement-getgrouplist.patch new file mode 100644 index 000000000000..e3a4a25cb720 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/dbus/implement-getgrouplist.patch @@ -0,0 +1,108 @@ +Compatibility patch for Illumos/Solaris and possibly other platforms. +Implements getgrouplist when not provided by OS. +Without it, only the user's primary group is used in authentication! +--- 1970-01-01 00:00:00.000000000 +0000 ++++ dbus-1.6.8/dbus/getgrouplist.c 2013-02-28 13:10:51.081792722 +0000 +@@ -0,0 +1,89 @@ ++/* $OpenBSD: getgrouplist.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */ ++/* ++ * Copyright (c) 1991, 1993 ++ * The Regents of the University of California. All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++/* OPENBSD ORIGINAL: lib/libc/gen/getgrouplist.c */ ++ ++/* ++ * get credential ++ */ ++#include <sys/types.h> ++#include <string.h> ++#include <unistd.h> ++#include <grp.h> ++ ++int ++getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) ++{ ++ struct group *grp; ++ int i, ngroups; ++ int ret, maxgroups; ++ int bail; ++ ++ ret = 0; ++ ngroups = 0; ++ maxgroups = *grpcnt; ++ ++ /* ++ * install primary group ++ */ ++ if (ngroups >= maxgroups) { ++ *grpcnt = ngroups; ++ return (-1); ++ } ++ groups[ngroups++] = agroup; ++ ++ /* ++ * Scan the group file to find additional groups. ++ */ ++ setgrent(); ++ while ((grp = getgrent())) { ++ if (grp->gr_gid == agroup) ++ continue; ++ for (bail = 0, i = 0; bail == 0 && i < ngroups; i++) ++ if (groups[i] == grp->gr_gid) ++ bail = 1; ++ if (bail) ++ continue; ++ for (i = 0; grp->gr_mem[i]; i++) { ++ if (!strcmp(grp->gr_mem[i], uname)) { ++ if (ngroups >= maxgroups) { ++ ret = -1; ++ goto out; ++ } ++ groups[ngroups++] = grp->gr_gid; ++ break; ++ } ++ } ++ } ++out: ++ endgrent(); ++ *grpcnt = ngroups; ++ return (ret); ++} +--- dbus-1.6.8/dbus/dbus-sysdeps-unix.c.orig 2013-02-28 13:08:52.171215237 +0000 ++++ dbus-1.6.8/dbus/dbus-sysdeps-unix.c 2013-02-28 13:13:52.224615146 +0000 +@@ -21,6 +21,10 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ ++#ifndef HAVE_GETGROUPLIST ++#include "getgrouplist.c" ++#define HAVE_GETGROUPLIST ++#endif + + #include <config.h> + diff --git a/nixpkgs/pkgs/development/libraries/dbus/make-dbus-conf.nix b/nixpkgs/pkgs/development/libraries/dbus/make-dbus-conf.nix new file mode 100644 index 000000000000..b5bf2b230007 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/dbus/make-dbus-conf.nix @@ -0,0 +1,41 @@ +{ runCommand, writeText, libxslt, dbus +, serviceDirectories ? [] +, suidHelper ? "/var/setuid-wrappers/dbus-daemon-launch-helper" +}: + +/* DBus has two configuration parsers -- normal and "trivial", which is used + * for suid helper. Unfortunately the latter doesn't support <include> + * directive. That means that we can't just place our configuration to + * *-local.conf -- it needs to be in the main configuration file. + */ +runCommand "dbus-1" + { + inherit serviceDirectories suidHelper; + preferLocalBuild = true; + XML_CATALOG_FILES = writeText "dbus-catalog.xml" '' + <?xml version="1.0"?> + <!DOCTYPE catalog PUBLIC + "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" + "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"> + + <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> + <rewriteSystem + systemIdStartString="http://www.freedesktop.org/standards/dbus/1.0/" + rewritePrefix="file://${dbus}/share/xml/dbus/"/> + </catalog> + ''; + nativeBuildInputs = [ libxslt.bin ]; + } + '' + mkdir -p $out + + xsltproc --nonet \ + --stringparam serviceDirectories "$serviceDirectories" \ + --stringparam suidHelper "$suidHelper" \ + ${./make-system-conf.xsl} ${dbus}/share/dbus-1/system.conf \ + > $out/system.conf + xsltproc --nonet \ + --stringparam serviceDirectories "$serviceDirectories" \ + ${./make-session-conf.xsl} ${dbus}/share/dbus-1/session.conf \ + > $out/session.conf + '' diff --git a/nixpkgs/pkgs/development/libraries/dbus/make-session-conf.xsl b/nixpkgs/pkgs/development/libraries/dbus/make-session-conf.xsl new file mode 100644 index 000000000000..9544aa13db56 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/dbus/make-session-conf.xsl @@ -0,0 +1,31 @@ +<?xml version="1.0"?> + +<!-- + This script copies the original system.conf from the dbus + distribution, but sets paths from $serviceDirectories parameter + and suid helper from $suidHelper parameter. +--> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:str="http://exslt.org/strings" + extension-element-prefixes="str" + > + + <xsl:output method='xml' encoding="UTF-8" doctype-system="busconfig.dtd" /> + + <xsl:param name="serviceDirectories" /> + + <xsl:template match="/busconfig"> + <busconfig> + <!-- We leave <standard_session_servicedirs/> because it includes XDG dirs and therefore user Nix profile. --> + <xsl:copy-of select="child::node()[name() != 'include' and name() != 'servicedir' and name() != 'includedir']" /> + + <xsl:for-each select="str:tokenize($serviceDirectories)"> + <servicedir><xsl:value-of select="." />/share/dbus-1/services</servicedir> + <includedir><xsl:value-of select="." />/etc/dbus-1/session.d</includedir> + </xsl:for-each> + </busconfig> + </xsl:template> + +</xsl:stylesheet> diff --git a/nixpkgs/pkgs/development/libraries/dbus/make-system-conf.xsl b/nixpkgs/pkgs/development/libraries/dbus/make-system-conf.xsl new file mode 100644 index 000000000000..dd644b4bce7c --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/dbus/make-system-conf.xsl @@ -0,0 +1,35 @@ +<?xml version="1.0"?> + +<!-- + This script copies the original system.conf from the dbus + distribution, but sets paths from $serviceDirectories parameter + and suid helper from $suidHelper parameter. +--> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:str="http://exslt.org/strings" + extension-element-prefixes="str" + > + + <xsl:output method='xml' encoding="UTF-8" doctype-system="busconfig.dtd" /> + + <xsl:param name="serviceDirectories" /> + <xsl:param name="suidHelper" /> + + <xsl:template match="/busconfig"> + <busconfig> + <xsl:copy-of select="child::node()[name() != 'include' and name() != 'standard_system_servicedirs' and name() != 'servicehelper' and name() != 'servicedir' and name() != 'includedir']" /> + + <!-- set suid helper --> + <servicehelper><xsl:value-of select="$suidHelper" /></servicehelper> + + <xsl:for-each select="str:tokenize($serviceDirectories)"> + <servicedir><xsl:value-of select="." />/share/dbus-1/system-services</servicedir> + <includedir><xsl:value-of select="." />/etc/dbus-1/system.d</includedir> + <includedir><xsl:value-of select="." />/share/dbus-1/system.d</includedir> + </xsl:for-each> + </busconfig> + </xsl:template> + +</xsl:stylesheet> diff --git a/nixpkgs/pkgs/development/libraries/dbus/systemd.patch b/nixpkgs/pkgs/development/libraries/dbus/systemd.patch new file mode 100644 index 000000000000..7e6cb1f87d07 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/dbus/systemd.patch @@ -0,0 +1,14 @@ +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 |