Subject: [bug#51737] [PATCH 2/4] gnu: Add libgbinder.

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

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

diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index 6d8a6801da..4f3e026d1b 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -751,6 +751,59 @@ (define-public glibmm-2.64
       `(("libsigc++" ,libsigc++)
         ("glib" ,glib)))))

+(define-public libgbinder
+  (package
+    (name "libgbinder")
+    (version "1.1.13")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mer-hybris/libgbinder")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "054kghsyyxk7lbsgwis1fczbgjlh0g0x6smwvcczd8dqacfclvpy"))))
+    (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 'fix-pkg-config-in
+           (lambda* _
+             (substitute* "Makefile"
+               (("usr/") ""))
+             (substitute* "libgbinder.pc.in"
+               (("@libdir@") (string-append (assoc-ref %outputs "out") "/lib"))
+               (("/usr/include") (string-append %output "/include")))))
+         (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 `(("bison" ,bison)
+                     ("flex" ,flex)
+                     ("pkg-config" ,pkg-config)))
+    (inputs `(("glib" ,glib)
+              ("libglibutil" ,libglibutil)))
+    (home-page "https://github.com/mer-hybris/libgbinder")
+    (synopsis "GLib-style interface to binder")
+    (description "This package provides GLib-style interface to binder:
+@enumerate
+@item Integration with GLib event loop
+@item Detection of 32 vs 64 bit kernel at runtime
+@item Asynchronous transactions that don't block the event thread
+@item Stable service manager and low-level transation APIs
+@end enumerate")
+    (license license:bsd-3)))
+
 (define-public libglibutil
   (package
     (name "libglibutil")
--
2.33.1