[bug#33203] Rime Input Method Engine

Message ID 874ld0stmw.fsf@gmail.com
State Accepted
Headers show
Series [bug#33203] Rime Input Method Engine | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed
cbaines/applying patch fail Apply failed

Commit Message

Meiyo Peng Nov. 1, 2018, 3:29 p.m. UTC
Hi,

I have fixed the non-deterministic issue of rime-data and made some
minor changes to other packages. Please use the patches attached to this
email instead of the previous email.

The previous version of rime-data contains both YAML format schema data
and binary format schema data. Binary schema data are generated from
YAML schema data. They are used to accelerate Rime's startup time. But
this generation process is not reproducible. I contacted Rime's author
on github but still have no feedback, so I removed binary schema data
from rime-data package's output. This will make users first time startup
a little longer, but it's bearable and happens only once.

Patches are attached. You can also view my code on github:
https://github.com/meiyopeng/guix/tree/rime

--
Meiyo Peng

Comments

Ludovic Courtès Nov. 10, 2018, 9:01 p.m. UTC | #1
Meiyo Peng <meiyo.peng@gmail.com> skribis:

> From d550f8b9ab2e16e7a01f42433111dac37b7f2b41 Mon Sep 17 00:00:00 2001
> From: Meiyo Peng <meiyo.peng@gmail.com>
> Date: Mon, 29 Oct 2018 13:20:18 +0800
> Subject: [PATCH 3/6] gnu: ibus: Indent code properly.
>
> * gnu/packages/ibus.scm (ibus, ibus-libpinyin): Indent code properly.

OK!
Ludovic Courtès Nov. 10, 2018, 9:44 p.m. UTC | #2
Meiyo Peng <meiyo.peng@gmail.com> skribis:

> From 64171e63c129c89149dd5248737fa2c32468796f Mon Sep 17 00:00:00 2001
> From: Meiyo Peng <meiyo.peng@gmail.com>
> Date: Mon, 29 Oct 2018 11:29:33 +0800
> Subject: [PATCH 4/6] gnu: Add librime.
>
> * gnu/packages/ibus.scm (librime): New variable.

Applied!
Ludovic Courtès Nov. 10, 2018, 9:47 p.m. UTC | #3
Meiyo Peng <meiyo.peng@gmail.com> skribis:

> From deb0028e5300ef29c5af751e4df22b78e0b6986c Mon Sep 17 00:00:00 2001
> From: Meiyo Peng <meiyo.peng@gmail.com>
> Date: Mon, 29 Oct 2018 11:35:20 +0800
> Subject: [PATCH 5/6] gnu: Add rime-data.
>
> * gnu/packages/ibus.scm (rime-data): New variable.

Applied!
Ludovic Courtès Nov. 10, 2018, 9:51 p.m. UTC | #4
Meiyo Peng <meiyo.peng@gmail.com> skribis:

> From 6f4dff509ac17ce28709959876a9280a172296d4 Mon Sep 17 00:00:00 2001
> From: Meiyo Peng <meiyo.peng@gmail.com>
> Date: Mon, 29 Oct 2018 11:46:03 +0800
> Subject: [PATCH 6/6] gnu: Add ibus-rime.
>
> * gnu/packages/ibus.scm (ibus-rime): New variable.

Applied, thank you!

Ludo’.

Patch

From 6f4dff509ac17ce28709959876a9280a172296d4 Mon Sep 17 00:00:00 2001
From: Meiyo Peng <meiyo.peng@gmail.com>
Date: Mon, 29 Oct 2018 11:46:03 +0800
Subject: [PATCH 6/6] gnu: Add ibus-rime.

* gnu/packages/ibus.scm (ibus-rime): New variable.
---
 gnu/packages/ibus.scm | 59 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scm
index afb760293..8ad1e0985 100644
--- a/gnu/packages/ibus.scm
+++ b/gnu/packages/ibus.scm
@@ -34,6 +34,7 @@ 
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages datastructures)
   #:use-module (gnu packages freedesktop)
@@ -593,3 +594,61 @@  traditional Chinese output.")
     (description "@dfn{rime-data} provides the schema data of Rime Input
 Method Engine.")
     (license lgpl3+)))
+
+(define-public ibus-rime
+  (package
+    (name "ibus-rime")
+    (version "1.3.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/rime/" name
+                           "/archive/" version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0mfbz0vwky7n4wvxrwabnn1i9n9adnql0dd1rx57w1anaslr5amj"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; no tests
+       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-source
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Define RIME_DATA_DIR. It's required but not used by the code.
+             (substitute* "Makefile"
+               (("cmake")
+                (string-append "cmake -DRIME_DATA_DIR="
+                               (assoc-ref inputs "rime-data")
+                               "/share/rime-data")))
+             ;; rime_config.h defines the actual data directory.
+             (substitute* "rime_config.h"
+               (("^#define IBUS_RIME_INSTALL_PREFIX .*$")
+                (string-append "#define IBUS_RIME_INSTALL_PREFIX \""
+                               (assoc-ref outputs "out")
+                               "\"\n"))
+               (("^#define IBUS_RIME_SHARED_DATA_DIR .*$")
+                (string-append "#define IBUS_RIME_SHARED_DATA_DIR \""
+                               (assoc-ref inputs "rime-data")
+                               "/share/rime-data\"\n")))
+             #t))
+         (delete 'configure))))
+    (inputs
+     `(("gdk-pixbuf" ,gdk-pixbuf)
+       ("glib" ,glib)
+       ("ibus" ,ibus)
+       ("libnotify" ,libnotify)
+       ("librime" ,librime)
+       ("rime-data" ,rime-data)))
+    (native-inputs
+     `(("cmake" ,cmake)
+       ("pkg-config" ,pkg-config)))
+    (home-page "https://rime.im/")
+    (synopsis "Rime Input Method Engine for IBus")
+    (description "@dfn{ibus-rime} provides the Rime input method engine for
+IBus.  Rime is a lightweight, extensible input method engine supporting
+various input schemas including glyph-based input methods, romanization-based
+input methods as well as those for Chinese dialects.  It has the ability to
+compose phrases and sentences intelligently and provide very accurate
+traditional Chinese output.")
+    (license gpl3+)))
-- 
2.19.1