Subject: [bug#60767] [PATCH] gnu: Add emacs-liberime.

From: Feng Shu <[email-masked]>
Date: Fri, 13 Jan 2023 08:39:04 +0800

* gnu/packages/emacs-xyz.scm (emacs-liberime): New variable.
---
 gnu/packages/emacs-xyz.scm | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index bd8675f63a..9ebbbca366 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -31362,6 +31362,46 @@ REPL appropriate to the current major mode.")
      "Rime is an Emacs input method built upon Rime input method engine.")
     (license license:gpl3+)))
 
+(define-public emacs-liberime
+  (let ((commit "70ad2e6e1f0ff74fc8b9b5177b9aba645a18e546")
+        (revision "0"))
+    (package
+      (name "emacs-liberime")
+      (version (git-version "v0.0.6" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/merrickluo/liberime")
+               (commit commit)))
+         (sha256
+          (base32
+           "1y9a1khfyz262yarn7rd0hg5vxaz8j80mhad7mh01m6685nfw39b"))
+         (file-name (git-file-name name version))))
+      (build-system emacs-build-system)
+      (arguments
+       (list
+        #:include #~(cons "^src/liberime-core.so$" %default-include)
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'delete-files-and-patch-paths
+              (lambda* (#:key inputs #:allow-other-keys)
+                (delete-file-recursively "emacs-module")
+                (emacs-substitute-variables "liberime.el"
+                  ("liberime-module-file"
+                   (string-append #$output "/src/liberime-core.so"))
+                  ("liberime-shared-data-dir"
+                   (search-input-directory inputs "share/rime-data")))))
+            (add-before 'install 'build-emacs-module
+              (lambda _
+                (invoke "make"))))))
+      (inputs (list librime rime-data))
+      (home-page "https://github.com/merrickluo/liberime")
+      (synopsis "Librime Emacs Lisp Binding")
+      (description
+       "Liberime is an Emacs dynamic module provide librime bindings.")
+      (license license:gpl3+))))
+
 (define-public emacs-bison-mode
   (package
     (name "emacs-bison-mode")
-- 
2.30.2

--