Subject: [bug#39306] [PATCH] gnu: Add xsettingsd.

From: David Wilson <[email-masked]>
Date: Mon, 27 Jan 2020 05:04:40 -0800

* gnu/packages/wm.scm (xsettingsd): New variable.
---
 gnu/packages/wm.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 52d7042806..4fb18e9f67 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -31,6 +31,7 @@
 ;;; Copyright © 2019 Brett Gilio <[email-masked]>
 ;;; Copyright © 2019 Noodles! <[email-masked]>
 ;;; Copyright © 2019 Alexandru-Sergiu Marton <[email-masked]>
+;;; Copyright © 2020 David Wilson <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -59,6 +60,7 @@
   #:use-module (guix build-system meson)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system scons)
   #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
@@ -94,6 +96,7 @@
   #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages suckless)
   #:use-module (gnu packages texinfo)
@@ -1670,3 +1673,63 @@ bar entirely based on XCB.  Provides full UTF-8 support, basic
 formatting, RandR and Xinerama support and EWMH compliance without
 wasting your precious memory.")
       (license license:x11))))
+
+(define-public xsettingsd
+  (package
+    (name "xsettingsd")
+    (version "1.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/derat/xsettingsd.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "05m4jlw0mgwp24cvyklncpziq1prr2lg0cq9c055sh4n9d93d07v"))))
+    (build-system scons-build-system)
+    (inputs
+     `(("libx11" ,libx11)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (arguments
+     `(#:scons ,scons-python2
+       #:scons-flags
+       (list "CC=gcc"
+             (string-append "PREFIX=" %output))
+       #:tests? #f ;; Tests require Google's gtest framework
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'patch-sconstruct
+           (lambda _
+             ;; scons doesn't pick up environment variables automatically
+             ;; so it needs some help to find path variables.
+             (substitute* "SConstruct"
+               (("env = Environment\\(")
+                "env = Environment(
+                         ENV = {
+                           'PATH': os.environ['PATH'],
+                           'CPATH': os.environ['CPATH'],
+                           'LIBRARY_PATH': os.environ['LIBRARY_PATH'],
+                           'PKG_CONFIG_PATH': os.environ['PKG_CONFIG_PATH']
+                         },"))
+             #t))
+         ;; The install task uses gtest to install the binaries.
+         ;; Since we don't have gtest, install binaries manually.
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin")))
+               (mkdir-p bin)
+               (install-file "xsettingsd" bin)
+               (install-file "dump_xsettings" bin)
+               #t))))))
+    (home-page "https://github.com/derat/xsettingsd")
+    (synopsis "Minimal Xorg settings daemon")
+    (description "xsettingsd is a lightweight daemon that provides settings to
+Xorg applications via the XSETTINGS specification.  It is used for defining
+font and theme settings when a complete desktop environment (GNOME, KDE) is
+not running.  With a simple .xsettingsd configuration file one can avoid
+configuring visual settings in different UI toolkits separately.")
+    (license license:bsd-3)))
--
2.24.1