Subject: [PATCH 1/4] gnu: Add libglibutil.

From: phodina <[email-masked]>
Date: Wed, 10 Nov 2021 01:37:39 +0000

* gnu/packages/glib.scm (libglibutil): New variable.

diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index 8ed1e3a944..6d8a6801da 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2019, 2020 Marius Bakke <[email-masked]>
 ;;; Copyright © 2020 Nicolò Balzarotti <[email-masked]>
 ;;; Copyright © 2020 Arthur Margerit <[email-masked]>
+;;; Copyright © 2021 Petr Hodina <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -68,6 +69,7 @@ (define-module (gnu packages glib)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix utils)
@@ -749,6 +751,49 @@ (define-public glibmm-2.64
       `(("libsigc++" ,libsigc++)
         ("glib" ,glib)))))

+(define-public libglibutil
+  (package
+    (name "libglibutil")
+    (version "1.0.55")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://git.sailfishos.org/mer-core/libglibutil")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0zrxccpyfz4jf14zr6fj9b88p340s66lw5cnqkapfa72kl1rnp4q"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
+                          (string-append "DESTDIR=" %output))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'remove-usr-prefix
+           (lambda* _
+             (substitute* "libglibutil.pc.in"
+               (("/usr/include") (string-append %output "/include")))
+             (substitute* "Makefile"
+               (("usr/") ""))))
+         (add-after 'install 'install-dev
+           (lambda* _
+             (invoke "make" "install-dev" (string-append "DESTDIR=" %output))))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (chdir "test")
+               (invoke "make" (string-append "CC=" ,(cc-for-target)))
+               (chdir "..") #t))))))
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("glib" ,glib)))
+    (home-page "https://git.sailfishos.org/mer-core/libglibutil")
+    (synopsis "GLib utilites")
+    (description "This package provides library of glib utilities.")
+    (license license:bsd-3)))
+
 (define-public python2-pygobject-2
   (package
     (name "python2-pygobject")
--
2.33.1