Subject: [bug#60013] [PATCH 3/3] gnu: Add clight

From: [email-masked]
Date: Mon, 12 Dec 2022 20:31:21 +0000

From: florhizome <[email-masked]>

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

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 919bcc9400..f7435e69f8 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -137,6 +137,7 @@ (define-module (gnu packages wm)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages polkit)
+  #:use-module (gnu packages popt)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages pulseaudio)
@@ -194,6 +195,61 @@ (define-public bspwm
     (license license:bsd-2)))

+(define-public clight
+  (package
+    (name "clight")
+    (version "4.9")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/FedeDP/clight")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "09hf80kb01xwzr8p87d5r8rw1dq9jqdibyc7k2xc4z5v5j7hlnlv"))))
+    (build-system cmake-build-system)
+    (native-inputs (list pkg-config))
+    (inputs (list clightd
+                  dbus
+                  ddcutil
+                  elogind
+                  gsl
+                  geoclue
+                  libconfig
+                  libmodule
+                  popt
+                  upower))
+    (arguments
+     (list
+      #:tests? #f  ;no rule to make target test
+      #:configure-flags
+      #~(list (string-append "-DBASH_COMPLETIONS_DIR="
+                             #$output "/share/bash-completion/completions")
+              (string-append "-DFISH_COMPLETIONS_DIR="
+                             #$output "/share/fish/completions"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after
+              'patch-source-shebangs 'patch-target-dirs
+            (lambda _
+              (substitute*
+                  "./CMakeLists.txt"
+                (("DESTINATION \\$\\{SESSION_BUS_DIR\\}")
+                 (string-append "DESTINATION " #$output "/share/dbus-1/services"))
+                (("DESTINATION /etc/xdg/autostart")
+                 (string-append "DESTINATION " #$output "/etc/xdg/autostart"))
+                (("DESTINATION /usr/share/*")
+                 (string-append "DESTINATION " #$output "/share/*")))
+              #t)))))
+    (home-page "https://github.com/FedeDP/Clight")
+    (synopsis "User daemon utility to fully manage screens")
+    (description "Clight is a tiny C utility that can turn your webcam
+into a light sensor; moreover it supports a redshift-like gamma
+control, a screen dimmer and dpms settings.
+It is the userspace interface for clightd.")
+    (license license:gpl3)))
+
 (define-public clightd
   (package
     (name "clightd")
-- 
2.38.1