Subject: [bug#61027] [PATCH 2/3] gnu: Add libglnx.

From: Nicolas Graves <[email-masked]>
Date: Mon, 23 Jan 2023 13:21:51 +0100

* gnu/packages/package-management.scm (libglnx): New variable.
---
 gnu/packages/package-management.scm | 48 +++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 708e06dfe7..6210be4d5c 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -1924,6 +1924,54 @@ (define-public libostree
 the boot loader configuration.")
     (license license:lgpl2.0+)))
 
+(define-public libglnx
+  (let ((commit "4e44fd9c174e4196a86fb6d954722feaff612c88")
+        (revision "0"))
+    (package
+      (name "libglnx")
+      (version (git-version "0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://gitlab.gnome.org/GNOME/libglnx.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0b1aqrls3ql2c820plwg0vnxh4xkixvxbkn8mxbyqar7ni8nz0wj"))))
+      (build-system meson-build-system)
+      (arguments
+       (list
+        ;; Using a "release" build is recommended for performance
+        #:build-type "release"
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-before 'configure 'prepare-install
+              (lambda _
+                ;; Install lib.
+                (substitute* "meson.build"
+                  (("^  install : false)")
+                   (string-append
+                    "  install : true)" "\n"
+                    "install_headers("
+                    (string-join
+                     (map (lambda (x) (string-append "'" x "'"))
+                          (delete "config.h" (find-files "." "\\.h$")))
+                     ", ")
+                    ")" )))))
+            (add-after 'install 'install-linglnx-config
+              (lambda _
+                (install-file "libglnx-config.h"
+                              (string-append #$output "/include")))))))
+      (native-inputs (list cmake pkg-config))
+      (propagated-inputs (list glib))
+      (home-page "https://gitlab.gnome.org/GNOME/libglnx.git")
+      (synopsis "libglnx is an extension to glib")
+      (description
+       "libglnx is the successor to libgsystem.  It is used for modules which
+depend on both Glib and Linux.")
+      (license license:lgpl2.1))))
+
 (define-public flatpak
   (package
     (name "flatpak")
-- 
2.39.1