Subject: [bug#58501] [PATCH 1/3] gnu: freedesktop: Add iio-sensor-proxy

From: [email-masked]
Date: Fri, 14 Oct 2022 12:02:44 +0000

From: florhizome <[email-masked]>

---
 gnu/packages/freedesktop.scm | 51 ++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index ab37f04bef..d72b18caf5 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -728,6 +728,57 @@ (define-public elogind
 of a the system to know what users are logged in, and where.")
     (license license:lgpl2.1+)))
 
+
+(define-public iio-sensor-proxy
+ (package
+    (name "iio-sensor-proxy")
+    (version "3.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.freedesktop.org/hadess/iio-sensor-proxy")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1dpcc3i53aw5illfhfkwxy0hsjsnya5iw4iv4al46vgyvcnvjc8z"))))
+    (build-system meson-build-system)
+    (arguments
+     (list
+      #:configure-flags #~(list "-Dsystemdsystemunitdir=false"
+                                (string-append "-Dudevrulesdir="
+                                          #$output
+                                          "/lib/udev"))
+      #:glib-or-gtk? #t
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'fake-pkexec
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                (setenv "PKEXEC_UID" "-1"))))
+         (add-before 'configure 'correct-polkit-dir
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute*
+                   "meson.build"
+                 (("polkit_gobject_dep\\.get_pkgconfig_variable\\('policydir'\\)")
+                  (string-append "'" out "/share/polkit-1/actions'")))))))))
+    (native-inputs
+     (list `(,glib "bin") python umockdev python-dbusmock python-psutil dbus
+              gobject-introspection pkg-config))
+   (inputs
+    (list glib polkit libgudev))
+   (synopsis "Proxies sensor devices (accelerometers, light sensors, compass)
+ to applications through D-Bus ")
+   (description "With a GNOME 3.18 (or newer) based system, orientation changes
+ will automatically be applied when rotating the panel, ambient light will be
+ used to change the screen brightness, and GeoClue will be able to read the compass
+data to show the direction in Maps. Can be used by other DEs, too though.")
+    (home-page "https://gitlab.freedesktop.org/hadess/iio-sensor-proxy")
+    (license license:gpl3)))
+
 (define-public basu
   (package
     (name "basu")

base-commit: 86ec52f66735b122b9035eba56516fd16f3be958
prerequisite-patch-id: 253e1cc8278ab9981294f4e483c7b29a466672d9
prerequisite-patch-id: fb797b9fdd73d1c18cba5dbd5804396d333f13df
prerequisite-patch-id: 6f7fd28e90950c738840d3794ce7cd534f0d9180
-- 
2.38.0